@arcteninc/core 0.0.125 → 0.0.126

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/dist/index.mjs CHANGED
@@ -43,7 +43,7 @@ const $t = zo(
43
43
  size: "default"
44
44
  }
45
45
  }
46
- ), Ne = Qe.forwardRef(({ className: e, variant: t, size: n, asChild: s = !1, ...r }, o) => /* @__PURE__ */ h(
46
+ ), De = Qe.forwardRef(({ className: e, variant: t, size: n, asChild: s = !1, ...r }, o) => /* @__PURE__ */ h(
47
47
  s ? Bo : "button",
48
48
  {
49
49
  ref: o,
@@ -52,7 +52,7 @@ const $t = zo(
52
52
  ...r
53
53
  }
54
54
  ));
55
- Ne.displayName = "Button";
55
+ De.displayName = "Button";
56
56
  const yc = zo(
57
57
  "inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
58
58
  {
@@ -205,7 +205,7 @@ function Cr(e) {
205
205
  const t = de(null);
206
206
  return t.current === null && (t.current = e()), t.current;
207
207
  }
208
- const kr = typeof window < "u", _o = kr ? zl : se, Ns = /* @__PURE__ */ Mt(null);
208
+ const kr = typeof window < "u", _o = kr ? zl : se, Ds = /* @__PURE__ */ Mt(null);
209
209
  function Mr(e, t) {
210
210
  e.indexOf(t) === -1 && e.push(t);
211
211
  }
@@ -232,7 +232,7 @@ function Wo(e) {
232
232
  }
233
233
  const Ko = (e) => /^0[^.\s]+$/u.test(e);
234
234
  // @__NO_SIDE_EFFECTS__
235
- function Nr(e) {
235
+ function Dr(e) {
236
236
  let t;
237
237
  return () => (t === void 0 && (t = e()), t);
238
238
  }
@@ -240,7 +240,7 @@ const Ke = /* @__NO_SIDE_EFFECTS__ */ (e) => e, xc = (e, t) => (n) => t(e(n)), Y
240
240
  const s = t - e;
241
241
  return s === 0 ? 1 : (n - e) / s;
242
242
  };
243
- class Dr {
243
+ class Nr {
244
244
  constructor() {
245
245
  this.subscriptions = [];
246
246
  }
@@ -370,31 +370,31 @@ function ra(e, t) {
370
370
  delta: 0,
371
371
  timestamp: 0,
372
372
  isProcessing: !1
373
- }, o = () => n = !0, i = hs.reduce((v, N) => (v[N] = Mc(o), v), {}), { setup: a, read: l, resolveKeyframes: c, preUpdate: u, update: d, preRender: f, render: m, postRender: w } = i, b = () => {
373
+ }, o = () => n = !0, i = hs.reduce((v, D) => (v[D] = Mc(o), v), {}), { setup: a, read: l, resolveKeyframes: c, preUpdate: u, update: d, preRender: f, render: m, postRender: w } = i, b = () => {
374
374
  const v = mt.useManualTiming ? r.timestamp : performance.now();
375
375
  n = !1, mt.useManualTiming || (r.delta = s ? 1e3 / 60 : Math.max(Math.min(v - r.timestamp, Ec), 1)), r.timestamp = v, r.isProcessing = !0, a.process(r), l.process(r), c.process(r), u.process(r), d.process(r), f.process(r), m.process(r), w.process(r), r.isProcessing = !1, n && t && (s = !1, e(b));
376
376
  }, S = () => {
377
377
  n = !0, s = !0, r.isProcessing || e(b);
378
378
  };
379
- return { schedule: hs.reduce((v, N) => {
380
- const R = i[N];
381
- return v[N] = (L, F = !1, D = !1) => (n || S(), R.schedule(L, F, D)), v;
379
+ return { schedule: hs.reduce((v, D) => {
380
+ const R = i[D];
381
+ return v[D] = (L, F = !1, N = !1) => (n || S(), R.schedule(L, F, N)), v;
382
382
  }, {}), cancel: (v) => {
383
- for (let N = 0; N < hs.length; N++)
384
- i[hs[N]].cancel(v);
383
+ for (let D = 0; D < hs.length; D++)
384
+ i[hs[D]].cancel(v);
385
385
  }, state: r, steps: i };
386
386
  }
387
387
  const { schedule: me, cancel: Ct, state: ke, steps: Os } = /* @__PURE__ */ ra(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Ke, !0);
388
388
  let ys;
389
- function Nc() {
389
+ function Dc() {
390
390
  ys = void 0;
391
391
  }
392
392
  const je = {
393
393
  now: () => (ys === void 0 && je.set(ke.isProcessing || mt.useManualTiming ? ke.timestamp : performance.now()), ys),
394
394
  set: (e) => {
395
- ys = e, queueMicrotask(Nc);
395
+ ys = e, queueMicrotask(Dc);
396
396
  }
397
- }, ia = (e) => (t) => typeof t == "string" && t.startsWith(e), jr = /* @__PURE__ */ ia("--"), Dc = /* @__PURE__ */ ia("var(--"), Or = (e) => Dc(e) ? Rc.test(e.split("/*")[0].trim()) : !1, Rc = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, dn = {
397
+ }, ia = (e) => (t) => typeof t == "string" && t.startsWith(e), jr = /* @__PURE__ */ ia("--"), Nc = /* @__PURE__ */ ia("var(--"), Or = (e) => Nc(e) ? Rc.test(e.split("/*")[0].trim()) : !1, Rc = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, dn = {
398
398
  test: (e) => typeof e == "number",
399
399
  parse: parseFloat,
400
400
  transform: (e) => e
@@ -749,11 +749,11 @@ function ks(e = pe.visualDuration, t = pe.bounce) {
749
749
  else {
750
750
  const R = g * Math.sqrt(b * b - 1);
751
751
  v = (L) => {
752
- const F = Math.exp(-b * g * L), D = Math.min(R * L, 300);
753
- return i - F * ((w + b * g * S) * Math.sinh(D) + R * S * Math.cosh(D)) / R;
752
+ const F = Math.exp(-b * g * L), N = Math.min(R * L, 300);
753
+ return i - F * ((w + b * g * S) * Math.sinh(N) + R * S * Math.cosh(N)) / R;
754
754
  };
755
755
  }
756
- const N = {
756
+ const D = {
757
757
  calculatedDuration: m && d || null,
758
758
  next: (R) => {
759
759
  const L = v(R);
@@ -762,19 +762,19 @@ function ks(e = pe.visualDuration, t = pe.bounce) {
762
762
  else {
763
763
  let F = R === 0 ? w : 0;
764
764
  b < 1 && (F = R === 0 ? /* @__PURE__ */ et(w) : ma(v, R, L));
765
- const D = Math.abs(F) <= s, U = Math.abs(i - L) <= r;
766
- a.done = D && U;
765
+ const N = Math.abs(F) <= s, U = Math.abs(i - L) <= r;
766
+ a.done = N && U;
767
767
  }
768
768
  return a.value = a.done ? i : L, a;
769
769
  },
770
770
  toString: () => {
771
- const R = Math.min(Br(N), Cs), L = fa((F) => N.next(R * F).value, R, 30);
771
+ const R = Math.min(Br(D), Cs), L = fa((F) => D.next(R * F).value, R, 30);
772
772
  return R + "ms " + L;
773
773
  },
774
774
  toTransition: () => {
775
775
  }
776
776
  };
777
- return N;
777
+ return D;
778
778
  }
779
779
  ks.applyToOptions = (e) => {
780
780
  const t = tu(e, 100, ks);
@@ -784,19 +784,19 @@ function sr({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 3
784
784
  const d = e[0], f = {
785
785
  done: !1,
786
786
  value: d
787
- }, m = (D) => a !== void 0 && D < a || l !== void 0 && D > l, w = (D) => a === void 0 ? l : l === void 0 || Math.abs(a - D) < Math.abs(l - D) ? a : l;
787
+ }, m = (N) => a !== void 0 && N < a || l !== void 0 && N > l, w = (N) => a === void 0 ? l : l === void 0 || Math.abs(a - N) < Math.abs(l - N) ? a : l;
788
788
  let b = n * t;
789
789
  const S = d + b, g = i === void 0 ? S : i(S);
790
790
  g !== S && (b = g - d);
791
- const M = (D) => -b * Math.exp(-D / s), v = (D) => g + M(D), N = (D) => {
792
- const U = M(D), k = v(D);
791
+ const M = (N) => -b * Math.exp(-N / s), v = (N) => g + M(N), D = (N) => {
792
+ const U = M(N), k = v(N);
793
793
  f.done = Math.abs(U) <= c, f.value = f.done ? g : k;
794
794
  };
795
795
  let R, L;
796
- const F = (D) => {
797
- m(f.value) && (R = D, L = ks({
796
+ const F = (N) => {
797
+ m(f.value) && (R = N, L = ks({
798
798
  keyframes: [f.value, w(f.value)],
799
- velocity: ma(v, D, f.value),
799
+ velocity: ma(v, N, f.value),
800
800
  // TODO: This should be passing * 1000
801
801
  damping: r,
802
802
  stiffness: o,
@@ -806,9 +806,9 @@ function sr({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 3
806
806
  };
807
807
  return F(0), {
808
808
  calculatedDuration: null,
809
- next: (D) => {
809
+ next: (N) => {
810
810
  let U = !1;
811
- return !L && R === void 0 && (U = !0, N(D), F(D)), R !== void 0 && D >= R ? L.next(D - R) : (!U && N(D), f);
811
+ return !L && R === void 0 && (U = !0, D(N), F(N)), R !== void 0 && N >= R ? L.next(N - R) : (!U && D(N), f);
812
812
  }
813
813
  };
814
814
  }
@@ -953,13 +953,13 @@ class _r extends Ur {
953
953
  this.speed > 0 ? this.startTime = Math.min(this.startTime, t) : this.speed < 0 && (this.startTime = Math.min(t - r / this.speed, this.startTime)), n ? this.currentTime = t : this.updateTime(t);
954
954
  const g = this.currentTime - c * (this.playbackSpeed >= 0 ? 1 : -1), M = this.playbackSpeed >= 0 ? g < 0 : g > r;
955
955
  this.currentTime = Math.max(g, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = r);
956
- let v = this.currentTime, N = s;
956
+ let v = this.currentTime, D = s;
957
957
  if (d) {
958
- const D = Math.min(this.currentTime, r) / a;
959
- let U = Math.floor(D), k = D % 1;
960
- !k && D >= 1 && (k = 1), k === 1 && U--, U = Math.min(U, d + 1), !!(U % 2) && (f === "reverse" ? (k = 1 - k, m && (k -= m / a)) : f === "mirror" && (N = i)), v = ht(0, 1, k) * a;
958
+ const N = Math.min(this.currentTime, r) / a;
959
+ let U = Math.floor(N), k = N % 1;
960
+ !k && N >= 1 && (k = 1), k === 1 && U--, U = Math.min(U, d + 1), !!(U % 2) && (f === "reverse" ? (k = 1 - k, m && (k -= m / a)) : f === "mirror" && (D = i)), v = ht(0, 1, k) * a;
961
961
  }
962
- const R = M ? { done: !1, value: u[0] } : N.next(v);
962
+ const R = M ? { done: !1, value: u[0] } : D.next(v);
963
963
  o && (R.value = o(R.value));
964
964
  let { done: L } = R;
965
965
  !M && l !== null && (L = this.playbackSpeed >= 0 ? this.currentTime >= r : this.currentTime <= 0);
@@ -1203,12 +1203,12 @@ const ku = (e) => e.startsWith("--");
1203
1203
  function Mu(e, t, n) {
1204
1204
  ku(t) ? e.style.setProperty(t, n) : e.style[t] = n;
1205
1205
  }
1206
- const Eu = /* @__PURE__ */ Nr(() => window.ScrollTimeline !== void 0), Nu = {};
1207
- function Du(e, t) {
1208
- const n = /* @__PURE__ */ Nr(e);
1209
- return () => Nu[t] ?? n();
1206
+ const Eu = /* @__PURE__ */ Dr(() => window.ScrollTimeline !== void 0), Du = {};
1207
+ function Nu(e, t) {
1208
+ const n = /* @__PURE__ */ Dr(e);
1209
+ return () => Du[t] ?? n();
1210
1210
  }
1211
- const ba = /* @__PURE__ */ Du(() => {
1211
+ const ba = /* @__PURE__ */ Nu(() => {
1212
1212
  try {
1213
1213
  document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
1214
1214
  } catch {
@@ -1414,7 +1414,7 @@ const Bu = /* @__PURE__ */ new Set([
1414
1414
  "transform"
1415
1415
  // TODO: Could be re-enabled now we have support for linear() easing
1416
1416
  // "background-color"
1417
- ]), zu = /* @__PURE__ */ Nr(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1417
+ ]), zu = /* @__PURE__ */ Dr(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1418
1418
  function Uu(e) {
1419
1419
  const { motionValue: t, name: n, repeatDelay: s, repeatType: r, damping: o, type: i } = e;
1420
1420
  if (!(t?.owner?.current instanceof HTMLElement))
@@ -1571,7 +1571,7 @@ const Zu = /\b([a-z-]*)\(.*?\)/gu, hr = {
1571
1571
  const t = e.match(Zu);
1572
1572
  return t ? t.map(Ju).join(" ") : e;
1573
1573
  }
1574
- }, Ni = {
1574
+ }, Di = {
1575
1575
  ...dn,
1576
1576
  transform: Math.round
1577
1577
  }, Qu = {
@@ -1636,11 +1636,11 @@ const Zu = /\b([a-z-]*)\(.*?\)/gu, hr = {
1636
1636
  backgroundPositionX: Y,
1637
1637
  backgroundPositionY: Y,
1638
1638
  ...Qu,
1639
- zIndex: Ni,
1639
+ zIndex: Di,
1640
1640
  // SVG
1641
1641
  fillOpacity: _n,
1642
1642
  strokeOpacity: _n,
1643
- numOctaves: Ni
1643
+ numOctaves: Di
1644
1644
  }, ed = {
1645
1645
  ...Kr,
1646
1646
  // Color props
@@ -1740,7 +1740,7 @@ const Ma = (e, t) => t && typeof e == "number" ? t.transform(e) : e;
1740
1740
  function Ea(e) {
1741
1741
  return Wo(e) && "offsetHeight" in e;
1742
1742
  }
1743
- const Di = 30, id = (e) => !isNaN(parseFloat(e));
1743
+ const Ni = 30, id = (e) => !isNaN(parseFloat(e));
1744
1744
  class od {
1745
1745
  /**
1746
1746
  * @param init - The initiating value
@@ -1806,7 +1806,7 @@ class od {
1806
1806
  return process.env.NODE_ENV !== "production" && Rr(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", t);
1807
1807
  }
1808
1808
  on(t, n) {
1809
- this.events[t] || (this.events[t] = new Dr());
1809
+ this.events[t] || (this.events[t] = new Nr());
1810
1810
  const s = this.events[t].add(n);
1811
1811
  return t === "change" ? () => {
1812
1812
  s(), me.read(() => {
@@ -1886,9 +1886,9 @@ class od {
1886
1886
  */
1887
1887
  getVelocity() {
1888
1888
  const t = je.now();
1889
- if (!this.canTrackVelocity || this.prevFrameValue === void 0 || t - this.updatedAt > Di)
1889
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || t - this.updatedAt > Ni)
1890
1890
  return 0;
1891
- const n = Math.min(this.updatedAt - this.prevUpdatedAt, Di);
1891
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, Ni);
1892
1892
  return qo(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1893
1893
  }
1894
1894
  /**
@@ -1947,7 +1947,7 @@ const { schedule: qr } = /* @__PURE__ */ ra(queueMicrotask, !1), Ze = {
1947
1947
  x: !1,
1948
1948
  y: !1
1949
1949
  };
1950
- function Na() {
1950
+ function Da() {
1951
1951
  return Ze.x || Ze.y;
1952
1952
  }
1953
1953
  function ad(e) {
@@ -1957,7 +1957,7 @@ function ad(e) {
1957
1957
  Ze.x = Ze.y = !1;
1958
1958
  });
1959
1959
  }
1960
- function Da(e, t) {
1960
+ function Na(e, t) {
1961
1961
  const n = rd(e), s = new AbortController(), r = {
1962
1962
  passive: !0,
1963
1963
  ...t,
@@ -1966,10 +1966,10 @@ function Da(e, t) {
1966
1966
  return [n, r, () => s.abort()];
1967
1967
  }
1968
1968
  function Ri(e) {
1969
- return !(e.pointerType === "touch" || Na());
1969
+ return !(e.pointerType === "touch" || Da());
1970
1970
  }
1971
1971
  function ld(e, t, n = {}) {
1972
- const [s, r, o] = Da(e, n), i = (a) => {
1972
+ const [s, r, o] = Na(e, n), i = (a) => {
1973
1973
  if (!Ri(a))
1974
1974
  return;
1975
1975
  const { target: l } = a, c = t(l, a);
@@ -2019,10 +2019,10 @@ const dd = (e, t) => {
2019
2019
  n.addEventListener("keydown", s, t), n.addEventListener("blur", () => n.removeEventListener("keydown", s), t);
2020
2020
  };
2021
2021
  function Ii(e) {
2022
- return Gr(e) && !Na();
2022
+ return Gr(e) && !Da();
2023
2023
  }
2024
2024
  function hd(e, t, n = {}) {
2025
- const [s, r, o] = Da(e, n), i = (a) => {
2025
+ const [s, r, o] = Na(e, n), i = (a) => {
2026
2026
  const l = a.currentTarget;
2027
2027
  if (!Ii(a))
2028
2028
  return;
@@ -2143,13 +2143,13 @@ const xd = ({ children: e, initial: t, isPresent: n, onExitComplete: s, custom:
2143
2143
  c.forEach((m, w) => c.set(w, !1));
2144
2144
  }, [n]), Qe.useEffect(() => {
2145
2145
  !n && !c.size && s && s();
2146
- }, [n]), i === "popLayout" && (e = h(vd, { isPresent: n, anchorX: a, root: l, children: e })), h(Ns.Provider, { value: f, children: e });
2146
+ }, [n]), i === "popLayout" && (e = h(vd, { isPresent: n, anchorX: a, root: l, children: e })), h(Ds.Provider, { value: f, children: e });
2147
2147
  };
2148
2148
  function wd() {
2149
2149
  return /* @__PURE__ */ new Map();
2150
2150
  }
2151
2151
  function Ia(e = !0) {
2152
- const t = Ce(Ns);
2152
+ const t = Ce(Ds);
2153
2153
  if (t === null)
2154
2154
  return [!0, null];
2155
2155
  const { isPresent: n, onExitComplete: s, register: r } = t, o = Sr();
@@ -2176,19 +2176,19 @@ const Td = ({ children: e, custom: t, initial: n = !0, onExitComplete: s, presen
2176
2176
  f.includes(F) ? b.delete(F) : b.get(F) !== !0 && b.set(F, !1);
2177
2177
  }
2178
2178
  }, [M, f.length, f.join("-")]);
2179
- const N = [];
2179
+ const D = [];
2180
2180
  if (d !== S) {
2181
2181
  let L = [...d];
2182
2182
  for (let F = 0; F < M.length; F++) {
2183
- const D = M[F], U = ms(D);
2184
- f.includes(U) || (L.splice(F, 0, D), N.push(D));
2183
+ const N = M[F], U = ms(N);
2184
+ f.includes(U) || (L.splice(F, 0, N), D.push(N));
2185
2185
  }
2186
- return o === "wait" && N.length && (L = N), v(Oi(L)), g(d), null;
2186
+ return o === "wait" && D.length && (L = D), v(Oi(L)), g(d), null;
2187
2187
  }
2188
2188
  process.env.NODE_ENV !== "production" && o === "wait" && M.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
2189
2189
  const { forceRender: R } = Ce(Ar);
2190
2190
  return h(Zt, { children: M.map((L) => {
2191
- const F = ms(L), D = i && !c ? !1 : d === M || f.includes(F), U = () => {
2191
+ const F = ms(L), N = i && !c ? !1 : d === M || f.includes(F), U = () => {
2192
2192
  if (b.has(F))
2193
2193
  b.set(F, !0);
2194
2194
  else
@@ -2198,7 +2198,7 @@ const Td = ({ children: e, custom: t, initial: n = !0, onExitComplete: s, presen
2198
2198
  E || (k = !1);
2199
2199
  }), k && (R?.(), v(w.current), i && u?.(), s && s());
2200
2200
  };
2201
- return h(xd, { isPresent: D, initial: !m.current || n ? void 0 : !1, custom: t, presenceAffectsLayout: r, mode: o, root: l, onExitComplete: D ? void 0 : U, anchorX: a, children: L }, F);
2201
+ return h(xd, { isPresent: N, initial: !m.current || n ? void 0 : !1, custom: t, presenceAffectsLayout: r, mode: o, root: l, onExitComplete: N ? void 0 : U, anchorX: a, children: L }, F);
2202
2202
  }) });
2203
2203
  }, Hr = Mt({ strict: !1 }), $i = {
2204
2204
  animation: [
@@ -2296,7 +2296,7 @@ function Cd(e, t, n) {
2296
2296
  e.draggable && r.startsWith("onDrag")) && (s[r] = e[r]);
2297
2297
  return s;
2298
2298
  }
2299
- const Ds = /* @__PURE__ */ Mt({});
2299
+ const Ns = /* @__PURE__ */ Mt({});
2300
2300
  function Rs(e) {
2301
2301
  return e !== null && typeof e == "object" && typeof e.start == "function";
2302
2302
  }
@@ -2329,7 +2329,7 @@ function kd(e, t) {
2329
2329
  return e.inherit !== !1 ? t : {};
2330
2330
  }
2331
2331
  function Md(e) {
2332
- const { initial: t, animate: n } = kd(e, Ce(Ds));
2332
+ const { initial: t, animate: n } = kd(e, Ce(Ns));
2333
2333
  return te(() => ({ initial: t, animate: n }), [Li(t), Li(n)]);
2334
2334
  }
2335
2335
  function Li(e) {
@@ -2343,15 +2343,15 @@ function Ed(e) {
2343
2343
  function $a(e, { layout: t, layoutId: n }) {
2344
2344
  return fn.has(e) || e.startsWith("origin") || (t || n !== void 0) && (!!Kn[e] || e === "opacity");
2345
2345
  }
2346
- const Nd = {
2346
+ const Dd = {
2347
2347
  x: "translateX",
2348
2348
  y: "translateY",
2349
2349
  z: "translateZ",
2350
2350
  transformPerspective: "perspective"
2351
- }, Dd = hn.length;
2351
+ }, Nd = hn.length;
2352
2352
  function Rd(e, t, n) {
2353
2353
  let s = "", r = !0;
2354
- for (let o = 0; o < Dd; o++) {
2354
+ for (let o = 0; o < Nd; o++) {
2355
2355
  const i = hn[o], a = e[i];
2356
2356
  if (a === void 0)
2357
2357
  continue;
@@ -2360,7 +2360,7 @@ function Rd(e, t, n) {
2360
2360
  const c = Ma(a, Kr[i]);
2361
2361
  if (!l) {
2362
2362
  r = !1;
2363
- const u = Nd[i] || i;
2363
+ const u = Dd[i] || i;
2364
2364
  s += `${u}(${c}) `;
2365
2365
  }
2366
2366
  n && (t[i] = c);
@@ -2562,8 +2562,8 @@ function _d(e, t, n, s) {
2562
2562
  for (const M in g) {
2563
2563
  let v = g[M];
2564
2564
  if (Array.isArray(v)) {
2565
- const N = u ? v.length - 1 : 0;
2566
- v = v[N];
2565
+ const D = u ? v.length - 1 : 0;
2566
+ v = v[D];
2567
2567
  }
2568
2568
  v !== null && (r[M] = v);
2569
2569
  }
@@ -2575,7 +2575,7 @@ function _d(e, t, n, s) {
2575
2575
  return r;
2576
2576
  }
2577
2577
  const Ua = (e) => (t, n) => {
2578
- const s = Ce(Ds), r = Ce(Ns), o = () => Ud(e, t, s, r);
2578
+ const s = Ce(Ns), r = Ce(Ds), o = () => Ud(e, t, s, r);
2579
2579
  return n ? o() : Cr(o);
2580
2580
  };
2581
2581
  function si(e, t, n) {
@@ -2618,7 +2618,7 @@ function qd(e, t, n) {
2618
2618
  }
2619
2619
  const ri = (e) => e.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Gd = "framerAppearId", Xa = "data-" + ri(Gd), Wa = Mt({});
2620
2620
  function Yd(e, t, n, s, r) {
2621
- const { visualElement: o } = Ce(Ds), i = Ce(Hr), a = Ce(Ns), l = Ce(Yr).reducedMotion, c = de(null);
2621
+ const { visualElement: o } = Ce(Ns), i = Ce(Hr), a = Ce(Ds), l = Ce(Yr).reducedMotion, c = de(null);
2622
2622
  s = s || i.renderer, !c.current && s && (c.current = s(e, {
2623
2623
  visualState: t,
2624
2624
  parent: o,
@@ -2682,7 +2682,7 @@ function xs(e, { forwardMotionProps: t = !1 } = {}, n, s) {
2682
2682
  const w = Qd(u);
2683
2683
  c = w.MeasureLayout, f.visualElement = Yd(e, m, u, s, w.ProjectionNode);
2684
2684
  }
2685
- return C(Ds.Provider, { value: f, children: [c && f.visualElement ? h(c, { visualElement: f.visualElement, ...u }) : null, zd(e, a, qd(m, f.visualElement, l), m, d, t)] });
2685
+ return C(Ns.Provider, { value: f, children: [c && f.visualElement ? h(c, { visualElement: f.visualElement, ...u }) : null, zd(e, a, qd(m, f.visualElement, l), m, d, t)] });
2686
2686
  }
2687
2687
  o.displayName = `motion.${typeof e == "string" ? e : `create(${e.displayName ?? e.name ?? ""})`}`;
2688
2688
  const i = Wl(o);
@@ -3047,7 +3047,7 @@ class lh {
3047
3047
  return r !== void 0 && !Ee(r) ? r : this.initialValues[t] !== void 0 && s === void 0 ? void 0 : this.baseTarget[t];
3048
3048
  }
3049
3049
  on(t, n) {
3050
- return this.events[t] || (this.events[t] = new Dr()), this.events[t].add(n);
3050
+ return this.events[t] || (this.events[t] = new Nr()), this.events[t].add(n);
3051
3051
  }
3052
3052
  notify(t, ...n) {
3053
3053
  this.events[t] && this.events[t].notify(...n);
@@ -3370,12 +3370,12 @@ function ol(e) {
3370
3370
  }
3371
3371
  return t;
3372
3372
  }
3373
- const Eh = [...Jr].reverse(), Nh = Jr.length;
3374
- function Dh(e) {
3373
+ const Eh = [...Jr].reverse(), Dh = Jr.length;
3374
+ function Nh(e) {
3375
3375
  return (t) => Promise.all(t.map(({ animation: n, options: s }) => kh(e, n, s)));
3376
3376
  }
3377
3377
  function Rh(e) {
3378
- let t = Dh(e), n = Gi(), s = !0;
3378
+ let t = Nh(e), n = Gi(), s = !0;
3379
3379
  const r = (l) => (c, u) => {
3380
3380
  const d = an(e, u, l === "exit" ? e.presenceContext?.custom : void 0);
3381
3381
  if (d) {
@@ -3390,19 +3390,19 @@ function Rh(e) {
3390
3390
  function i(l) {
3391
3391
  const { props: c } = e, u = ol(e.parent) || {}, d = [], f = /* @__PURE__ */ new Set();
3392
3392
  let m = {}, w = 1 / 0;
3393
- for (let S = 0; S < Nh; S++) {
3394
- const g = Eh[S], M = n[g], v = c[g] !== void 0 ? c[g] : u[g], N = Wn(v), R = g === l ? M.isActive : null;
3393
+ for (let S = 0; S < Dh; S++) {
3394
+ const g = Eh[S], M = n[g], v = c[g] !== void 0 ? c[g] : u[g], D = Wn(v), R = g === l ? M.isActive : null;
3395
3395
  R === !1 && (w = S);
3396
- let L = v === u[g] && v !== c[g] && N;
3396
+ let L = v === u[g] && v !== c[g] && D;
3397
3397
  if (L && s && e.manuallyAnimateOnMount && (L = !1), M.protectedKeys = { ...m }, // If it isn't active and hasn't *just* been set as inactive
3398
3398
  !M.isActive && R === null || // If we didn't and don't have any defined prop for this animation type
3399
3399
  !v && !M.prevProp || // Or if the prop doesn't define an animation
3400
3400
  Rs(v) || typeof v == "boolean")
3401
3401
  continue;
3402
3402
  const F = Vh(M.prevProp, v);
3403
- let D = F || // If we're making this variant active, we want to always make it active
3404
- g === l && M.isActive && !L && N || // If we removed a higher-priority variant (i is in reverse order)
3405
- S > w && N, U = !1;
3403
+ let N = F || // If we're making this variant active, we want to always make it active
3404
+ g === l && M.isActive && !L && D || // If we removed a higher-priority variant (i is in reverse order)
3405
+ S > w && D, U = !1;
3406
3406
  const k = Array.isArray(v) ? v : [v];
3407
3407
  let E = k.reduce(r(g), {});
3408
3408
  R === !1 && (E = {});
@@ -3410,7 +3410,7 @@ function Rh(e) {
3410
3410
  ...j,
3411
3411
  ...E
3412
3412
  }, G = (W) => {
3413
- D = !0, f.has(W) && (U = !0, f.delete(W)), M.needsAnimating[W] = !0;
3413
+ N = !0, f.has(W) && (U = !0, f.delete(W)), M.needsAnimating[W] = !0;
3414
3414
  const le = e.getValue(W);
3415
3415
  le && (le.liveStyle = !1);
3416
3416
  };
@@ -3421,9 +3421,9 @@ function Rh(e) {
3421
3421
  let Ae = !1;
3422
3422
  yr(le) && yr(Pe) ? Ae = !il(le, Pe) : Ae = le !== Pe, Ae ? le != null ? G(W) : f.add(W) : le !== void 0 && f.has(W) ? G(W) : M.protectedKeys[W] = !0;
3423
3423
  }
3424
- M.prevProp = v, M.prevResolvedValues = E, M.isActive && (m = { ...m, ...E }), s && e.blockInitialAnimation && (D = !1);
3424
+ M.prevProp = v, M.prevResolvedValues = E, M.isActive && (m = { ...m, ...E }), s && e.blockInitialAnimation && (N = !1);
3425
3425
  const H = L && F;
3426
- D && (!H || U) && d.push(...k.map((W) => {
3426
+ N && (!H || U) && d.push(...k.map((W) => {
3427
3427
  const le = { type: g };
3428
3428
  if (typeof W == "string" && s && !H && e.manuallyAnimateOnMount && e.parent) {
3429
3429
  const { parent: Pe } = e, Ae = an(Pe, W);
@@ -3751,8 +3751,8 @@ class ef {
3751
3751
  if (rt.test(M)) {
3752
3752
  const { projection: v } = this.visualElement;
3753
3753
  if (v && v.layout) {
3754
- const N = v.layout.layoutBox[g];
3755
- N && (M = Re(N) * (parseFloat(M) / 100));
3754
+ const D = v.layout.layoutBox[g];
3755
+ D && (M = Re(D) * (parseFloat(M) / 100));
3756
3756
  }
3757
3757
  }
3758
3758
  this.originPoint[g] = M;
@@ -4294,14 +4294,14 @@ function vl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
4294
4294
  this.id = Sf++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
4295
4295
  this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
4296
4296
  }, this.updateProjection = () => {
4297
- this.projectionUpdateScheduled = !1, this.nodes.forEach(Cf), this.nodes.forEach(Nf), this.nodes.forEach(Df), this.nodes.forEach(kf);
4297
+ this.projectionUpdateScheduled = !1, this.nodes.forEach(Cf), this.nodes.forEach(Df), this.nodes.forEach(Nf), this.nodes.forEach(kf);
4298
4298
  }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = i, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0;
4299
4299
  for (let l = 0; l < this.path.length; l++)
4300
4300
  this.path[l].shouldResetTransform = !0;
4301
4301
  this.root === this && (this.nodes = new uf());
4302
4302
  }
4303
4303
  addEventListener(i, a) {
4304
- return this.eventHandlers.has(i) || this.eventHandlers.set(i, new Dr()), this.eventHandlers.get(i).add(a);
4304
+ return this.eventHandlers.has(i) || this.eventHandlers.set(i, new Nr()), this.eventHandlers.get(i).add(a);
4305
4305
  }
4306
4306
  notifyListeners(i, ...a) {
4307
4307
  const l = this.eventHandlers.get(i);
@@ -4593,8 +4593,8 @@ function vl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
4593
4593
  const f = ve(), m = l ? l.source : void 0, w = this.layout ? this.layout.source : void 0, b = m !== w, S = this.getStack(), g = !S || S.members.length <= 1, M = !!(b && !g && this.options.crossfade === !0 && !this.path.some(jf));
4594
4594
  this.animationProgress = 0;
4595
4595
  let v;
4596
- this.mixTargetDelta = (N) => {
4597
- const R = N / 1e3;
4596
+ this.mixTargetDelta = (D) => {
4597
+ const R = D / 1e3;
4598
4598
  So(d.x, i.x, R), So(d.y, i.y, R), this.setTargetDelta(d), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Fn(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), If(this.relativeTarget, this.relativeTargetOrigin, f, R), v && vf(this.relativeTarget, v) && (this.isProjectionDirty = !1), v || (v = ve()), _e(v, this.relativeTarget)), b && (this.animationValues = u, ff(u, c, this.latestValues, R, M, g)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = R;
4599
4599
  }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
4600
4600
  }
@@ -4717,8 +4717,8 @@ function vl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
4717
4717
  const { correct: b, applyTo: S, isCSSVariable: g } = Kn[w], M = d === "none" ? u[w] : b(u[w], c);
4718
4718
  if (S) {
4719
4719
  const v = S.length;
4720
- for (let N = 0; N < v; N++)
4721
- i[S[N]] = M;
4720
+ for (let D = 0; D < v; D++)
4721
+ i[S[D]] = M;
4722
4722
  } else
4723
4723
  g ? this.options.visualElement.renderState.vars[w] = M : i[w] = M;
4724
4724
  }
@@ -4801,10 +4801,10 @@ function Ef(e) {
4801
4801
  function To(e) {
4802
4802
  e.finishAnimation(), e.targetDelta = e.relativeTarget = e.target = void 0, e.isProjectionDirty = !0;
4803
4803
  }
4804
- function Nf(e) {
4804
+ function Df(e) {
4805
4805
  e.resolveTargetDelta();
4806
4806
  }
4807
- function Df(e) {
4807
+ function Nf(e) {
4808
4808
  e.calcProjection();
4809
4809
  }
4810
4810
  function Rf(e) {
@@ -5041,12 +5041,10 @@ function sm(e, t, n, s) {
5041
5041
  return null;
5042
5042
  }
5043
5043
  function Sl(e, t) {
5044
- if (e.length === 0)
5045
- return [];
5046
5044
  let n, s;
5047
5045
  if (!t)
5048
5046
  throw new Error(
5049
- `❌ toolMetadata is required when tools are provided!
5047
+ `❌ toolMetadata is required!
5050
5048
 
5051
5049
  Please:
5052
5050
  1. Run "arcten-extract-types ." before build (add to package.json scripts)
@@ -5055,8 +5053,6 @@ Please:
5055
5053
  3. Pass it to useAgent/ArctenAgent:
5056
5054
  useAgent({ tools: [...], toolMetadata: toolMetadata })
5057
5055
  (Pass the full object for better minification support, or toolMetadata.functions for backward compatibility)
5058
-
5059
- Note: If you're loading tools from the dashboard (no tools prop), toolMetadata is not required.
5060
5056
  `
5061
5057
  );
5062
5058
  if ("functions" in t && typeof t.functions == "object") {
@@ -5103,7 +5099,7 @@ function rm({
5103
5099
  ] }),
5104
5100
  /* @__PURE__ */ C("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
5105
5101
  /* @__PURE__ */ C(
5106
- Ne,
5102
+ De,
5107
5103
  {
5108
5104
  size: "sm",
5109
5105
  variant: "ghost",
@@ -5116,7 +5112,7 @@ function rm({
5116
5112
  }
5117
5113
  ),
5118
5114
  /* @__PURE__ */ h(
5119
- Ne,
5115
+ De,
5120
5116
  {
5121
5117
  size: "sm",
5122
5118
  variant: "ghost",
@@ -5351,13 +5347,13 @@ const um = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5351
5347
  Al.displayName = "Reasoning";
5352
5348
  Cl.displayName = "ReasoningTrigger";
5353
5349
  kl.displayName = "ReasoningContent";
5354
- function No(e) {
5350
+ function Do(e) {
5355
5351
  return `https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=16`;
5356
5352
  }
5357
5353
  function ym({ sources: e, citationNumber: t, className: n }) {
5358
5354
  const s = e.find((o) => o.number === t);
5359
5355
  if (!s) return null;
5360
- const r = No(s.domain);
5356
+ const r = Do(s.domain);
5361
5357
  return /* @__PURE__ */ C(Tt, { children: [
5362
5358
  /* @__PURE__ */ h(St, { asChild: !0, children: /* @__PURE__ */ C(
5363
5359
  "button",
@@ -5419,7 +5415,7 @@ function ym({ sources: e, citationNumber: t, className: n }) {
5419
5415
  /* @__PURE__ */ h(
5420
5416
  "img",
5421
5417
  {
5422
- src: No(o.domain),
5418
+ src: Do(o.domain),
5423
5419
  alt: "",
5424
5420
  className: "w-4 h-4 flex-shrink-0",
5425
5421
  onError: (a) => {
@@ -5458,16 +5454,16 @@ function bm({
5458
5454
  }
5459
5455
  const S = c.current;
5460
5456
  let g, M = !1;
5461
- const v = /* @__PURE__ */ new WeakSet(), N = () => {
5457
+ const v = /* @__PURE__ */ new WeakSet(), D = () => {
5462
5458
  if (!c.current || M) return;
5463
5459
  M = !0;
5464
- const L = c.current, F = /\[(\d+)\]/g, D = document.createTreeWalker(
5460
+ const L = c.current, F = /\[(\d+)\]/g, N = document.createTreeWalker(
5465
5461
  L,
5466
5462
  NodeFilter.SHOW_TEXT,
5467
5463
  null
5468
5464
  ), U = [];
5469
5465
  let k;
5470
- for (; k = D.nextNode(); )
5466
+ for (; k = N.nextNode(); )
5471
5467
  if (k.nodeType === Node.TEXT_NODE && !v.has(k)) {
5472
5468
  const j = k, B = j.textContent || "";
5473
5469
  let G = j.parentElement, H = !1;
@@ -5509,13 +5505,13 @@ function bm({
5509
5505
  return [...G, ...H];
5510
5506
  }), M = !1;
5511
5507
  }, R = new MutationObserver(() => {
5512
- clearTimeout(g), g = setTimeout(N, 100);
5508
+ clearTimeout(g), g = setTimeout(D, 100);
5513
5509
  });
5514
5510
  return R.observe(S, {
5515
5511
  childList: !0,
5516
5512
  subtree: !0,
5517
5513
  characterData: !0
5518
- }), g = setTimeout(N, 200), () => {
5514
+ }), g = setTimeout(D, 200), () => {
5519
5515
  R.disconnect(), clearTimeout(g);
5520
5516
  };
5521
5517
  }, [e, t, n, a]);
@@ -5535,7 +5531,7 @@ function bm({
5535
5531
  /* @__PURE__ */ h("div", { className: "flex flex-wrap gap-2", children: s && s.length > 0 ? (
5536
5532
  // Use grouped citations if available - show as buttons with favicon + title
5537
5533
  s.map((S, g) => {
5538
- const M = S.title || S.baseUrl, v = w(S.url), N = m(v);
5534
+ const M = S.title || S.baseUrl, v = w(S.url), D = m(v);
5539
5535
  return /* @__PURE__ */ C(
5540
5536
  "a",
5541
5537
  {
@@ -5555,7 +5551,7 @@ function bm({
5555
5551
  /* @__PURE__ */ h(
5556
5552
  "img",
5557
5553
  {
5558
- src: N,
5554
+ src: D,
5559
5555
  alt: "",
5560
5556
  className: "w-3.5 h-3.5 shrink-0",
5561
5557
  onError: (R) => {
@@ -5596,8 +5592,8 @@ function bm({
5596
5592
  src: v,
5597
5593
  alt: "",
5598
5594
  className: "w-3.5 h-3.5 shrink-0",
5599
- onError: (N) => {
5600
- const R = N.target;
5595
+ onError: (D) => {
5596
+ const R = D.target;
5601
5597
  R.style.display = "none";
5602
5598
  }
5603
5599
  }
@@ -5614,10 +5610,10 @@ function bm({
5614
5610
  /* @__PURE__ */ h("div", { ref: c, children: /* @__PURE__ */ h(o, { children: e }) }),
5615
5611
  a && u.filter(({ element: S }) => S.isConnected).map(({ element: S, citationNum: g }, M) => {
5616
5612
  if (!t.find((R) => R.number === g)) return null;
5617
- const N = Array.from(
5613
+ const D = Array.from(
5618
5614
  new Map(
5619
5615
  t.map((R) => {
5620
- const L = R.url.replace(/\/+$/, ""), F = s?.find((D) => D.url.replace(/\/+$/, "") === L);
5616
+ const L = R.url.replace(/\/+$/, ""), F = s?.find((N) => N.url.replace(/\/+$/, "") === L);
5621
5617
  return [L, {
5622
5618
  number: R.number,
5623
5619
  url: R.url,
@@ -5631,7 +5627,7 @@ function bm({
5631
5627
  /* @__PURE__ */ h(
5632
5628
  ym,
5633
5629
  {
5634
- sources: N,
5630
+ sources: D,
5635
5631
  citationNumber: g
5636
5632
  },
5637
5633
  `citation-${g}-${S}`
@@ -5817,7 +5813,7 @@ function wm({
5817
5813
  ] }) }),
5818
5814
  /* @__PURE__ */ C(yn, { children: [
5819
5815
  /* @__PURE__ */ h(
5820
- Ne,
5816
+ De,
5821
5817
  {
5822
5818
  type: "button",
5823
5819
  variant: "ghost",
@@ -5829,7 +5825,7 @@ function wm({
5829
5825
  }
5830
5826
  ),
5831
5827
  /* @__PURE__ */ h(
5832
- Ne,
5828
+ De,
5833
5829
  {
5834
5830
  type: "submit",
5835
5831
  disabled: !o.trim() || c,
@@ -5885,7 +5881,7 @@ function Tm({
5885
5881
  ] }),
5886
5882
  /* @__PURE__ */ C(yn, { children: [
5887
5883
  /* @__PURE__ */ h(
5888
- Ne,
5884
+ De,
5889
5885
  {
5890
5886
  type: "button",
5891
5887
  variant: "ghost",
@@ -5897,7 +5893,7 @@ function Tm({
5897
5893
  }
5898
5894
  ),
5899
5895
  /* @__PURE__ */ h(
5900
- Ne,
5896
+ De,
5901
5897
  {
5902
5898
  type: "submit",
5903
5899
  disabled: !o.trim() || !a || c,
@@ -5959,7 +5955,7 @@ function Sm({
5959
5955
  ] }),
5960
5956
  /* @__PURE__ */ C(yn, { children: [
5961
5957
  /* @__PURE__ */ h(
5962
- Ne,
5958
+ De,
5963
5959
  {
5964
5960
  type: "button",
5965
5961
  variant: "ghost",
@@ -5971,7 +5967,7 @@ function Sm({
5971
5967
  }
5972
5968
  ),
5973
5969
  /* @__PURE__ */ h(
5974
- Ne,
5970
+ De,
5975
5971
  {
5976
5972
  type: "submit",
5977
5973
  disabled: !o.trim() || !a || c,
@@ -6032,7 +6028,7 @@ function Pm({
6032
6028
  ] }),
6033
6029
  /* @__PURE__ */ C(yn, { children: [
6034
6030
  /* @__PURE__ */ h(
6035
- Ne,
6031
+ De,
6036
6032
  {
6037
6033
  type: "button",
6038
6034
  variant: "ghost",
@@ -6044,7 +6040,7 @@ function Pm({
6044
6040
  }
6045
6041
  ),
6046
6042
  /* @__PURE__ */ h(
6047
- Ne,
6043
+ De,
6048
6044
  {
6049
6045
  type: "submit",
6050
6046
  disabled: i.length !== r || l,
@@ -6093,7 +6089,7 @@ function Js({
6093
6089
  ) }),
6094
6090
  /* @__PURE__ */ C(yn, { children: [
6095
6091
  /* @__PURE__ */ h(
6096
- Ne,
6092
+ De,
6097
6093
  {
6098
6094
  type: "button",
6099
6095
  variant: "ghost",
@@ -6105,7 +6101,7 @@ function Js({
6105
6101
  }
6106
6102
  ),
6107
6103
  /* @__PURE__ */ h(
6108
- Ne,
6104
+ De,
6109
6105
  {
6110
6106
  type: "submit",
6111
6107
  disabled: !i.trim() || l,
@@ -6146,7 +6142,7 @@ function Am({
6146
6142
  break;
6147
6143
  }
6148
6144
  !G && j.validation && B.trim() && (G = j.validation(B)), l((H) => ({ ...H, [k]: B })), u((H) => ({ ...H, [k]: G || "" }));
6149
- }, N = () => {
6145
+ }, D = () => {
6150
6146
  const k = {};
6151
6147
  let E = !0;
6152
6148
  return s.forEach((j) => {
@@ -6171,7 +6167,7 @@ function Am({
6171
6167
  G && (k[j.name] = G, E = !1);
6172
6168
  }), u(k), E;
6173
6169
  }, R = async (k) => {
6174
- if (k.preventDefault(), !!N()) {
6170
+ if (k.preventDefault(), !!D()) {
6175
6171
  w(!0);
6176
6172
  try {
6177
6173
  const E = {};
@@ -6190,7 +6186,7 @@ function Am({
6190
6186
  ...E,
6191
6187
  [k]: !E[k]
6192
6188
  }));
6193
- }, D = (k) => {
6189
+ }, N = (k) => {
6194
6190
  switch (k.type) {
6195
6191
  case "password":
6196
6192
  return d[k.name] ? "text" : "password";
@@ -6238,7 +6234,7 @@ function Am({
6238
6234
  /* @__PURE__ */ h(
6239
6235
  xn,
6240
6236
  {
6241
- type: D(k),
6237
+ type: N(k),
6242
6238
  value: a[k.name] || "",
6243
6239
  onChange: (E) => v(k.name, E.target.value, k),
6244
6240
  placeholder: U(k),
@@ -6266,7 +6262,7 @@ function Am({
6266
6262
  ] }, k.name)) }),
6267
6263
  /* @__PURE__ */ C(yn, { children: [
6268
6264
  /* @__PURE__ */ h(
6269
- Ne,
6265
+ De,
6270
6266
  {
6271
6267
  type: "button",
6272
6268
  variant: "ghost",
@@ -6276,7 +6272,7 @@ function Am({
6276
6272
  }
6277
6273
  ),
6278
6274
  /* @__PURE__ */ h(
6279
- Ne,
6275
+ De,
6280
6276
  {
6281
6277
  type: "submit",
6282
6278
  disabled: m,
@@ -6398,13 +6394,13 @@ function Em(e) {
6398
6394
  return n;
6399
6395
  }
6400
6396
  }
6401
- function Do(e) {
6397
+ function No(e) {
6402
6398
  let t = e.replace(/_+$/gm, "");
6403
6399
  const n = /(?:^|\n)(?:#+\s*)?(?:References|References:)(?:\*\*)?\s*\n?([\s\S]*?)(?=\n\n|\n#|$)/i, s = t.match(n), r = /* @__PURE__ */ new Map(), o = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
6404
6400
  if (s && s[1]) {
6405
- const D = s[1], U = /\[(\d+)\]\s*(https?:\/\/[^\s\)]+)/g;
6401
+ const N = s[1], U = /\[(\d+)\]\s*(https?:\/\/[^\s\)]+)/g;
6406
6402
  let k;
6407
- for (; (k = U.exec(D)) !== null; )
6403
+ for (; (k = U.exec(N)) !== null; )
6408
6404
  if (k[1] && k[2]) {
6409
6405
  const E = parseInt(k[1], 10), j = k[2].replace(/[.,;:!?]+$/, ""), B = j.replace(/\/+$/, "");
6410
6406
  if (a.has(B) || a.set(B, j), i.has(B) || i.set(B, []), i.get(B).push(E), !l.has(B))
@@ -6433,10 +6429,10 @@ function Do(e) {
6433
6429
  for (; (b = w.exec(d)) !== null; )
6434
6430
  b.index > m && f.push({ type: "text", content: d.slice(m, b.index), start: m, end: b.index }), f.push({ type: "code", content: b[0], start: b.index, end: b.index + b[0].length }), m = b.index + b[0].length;
6435
6431
  m < d.length && f.push({ type: "text", content: d.slice(m), start: m, end: d.length });
6436
- const S = f.map((D) => {
6437
- if (D.type === "code")
6438
- return D.content;
6439
- let U = D.content;
6432
+ const S = f.map((N) => {
6433
+ if (N.type === "code")
6434
+ return N.content;
6435
+ let U = N.content;
6440
6436
  return U = U.replace(/\[(\d+)\]\((https?:\/\/[^\)]+)\)/g, (E, j, B) => {
6441
6437
  const G = parseInt(j, 10), H = B.replace(/\/+$/, ""), ue = c.get(G) || G;
6442
6438
  return l.has(H) || (l.set(H, ue), r.has(ue) || (r.set(ue, B), o.push({ number: ue, url: B }))), `[${ue}]`;
@@ -6445,8 +6441,8 @@ function Do(e) {
6445
6441
  return `[${c.get(B) || B}]`;
6446
6442
  }), U;
6447
6443
  }), g = [];
6448
- for (const [D, U] of l.entries()) {
6449
- const k = a.get(D) || D, { baseUrl: E, anchor: j } = Mm(k), B = Em(k);
6444
+ for (const [N, U] of l.entries()) {
6445
+ const k = a.get(N) || N, { baseUrl: E, anchor: j } = Mm(k), B = Em(k);
6450
6446
  g.push({
6451
6447
  url: k,
6452
6448
  baseUrl: E,
@@ -6456,31 +6452,31 @@ function Do(e) {
6456
6452
  title: B
6457
6453
  });
6458
6454
  }
6459
- g.sort((D, U) => (D.numbers[0] || 0) - (U.numbers[0] || 0));
6455
+ g.sort((N, U) => (N.numbers[0] || 0) - (U.numbers[0] || 0));
6460
6456
  const M = /* @__PURE__ */ new Map();
6461
6457
  let v = 1;
6462
- for (const D of g) {
6463
- const U = D.numbers[0];
6464
- M.set(U, v), D.numbers = [v], v++;
6465
- }
6466
- const N = /* @__PURE__ */ new Map();
6467
- for (const [D, U] of r.entries()) {
6468
- const k = M.get(D);
6469
- k && N.set(k, U);
6470
- }
6471
- const R = o.map((D) => {
6472
- const U = M.get(D.number);
6473
- return U ? { number: U, url: D.url } : D;
6474
- }).filter((D) => M.has(D.number)), L = Array.from(M.entries()).sort((D, U) => U[0] - D[0]);
6458
+ for (const N of g) {
6459
+ const U = N.numbers[0];
6460
+ M.set(U, v), N.numbers = [v], v++;
6461
+ }
6462
+ const D = /* @__PURE__ */ new Map();
6463
+ for (const [N, U] of r.entries()) {
6464
+ const k = M.get(N);
6465
+ k && D.set(k, U);
6466
+ }
6467
+ const R = o.map((N) => {
6468
+ const U = M.get(N.number);
6469
+ return U ? { number: U, url: N.url } : N;
6470
+ }).filter((N) => M.has(N.number)), L = Array.from(M.entries()).sort((N, U) => U[0] - N[0]);
6475
6471
  let F = S.join("");
6476
- for (const [D, U] of L) {
6477
- const k = new RegExp(`\\[${D}\\](?!\\d)`, "g");
6472
+ for (const [N, U] of L) {
6473
+ const k = new RegExp(`\\[${N}\\](?!\\d)`, "g");
6478
6474
  F = F.replace(k, `[${U}]`);
6479
6475
  }
6480
6476
  return {
6481
6477
  processedText: F,
6482
- citations: R.sort((D, U) => D.number - U.number),
6483
- citationMap: N,
6478
+ citations: R.sort((N, U) => N.number - U.number),
6479
+ citationMap: D,
6484
6480
  groupedCitations: g,
6485
6481
  referencesText: u
6486
6482
  };
@@ -6515,7 +6511,7 @@ function Zs(e) {
6515
6511
  }
6516
6512
  return e && typeof e == "object" && !Array.isArray(e) ? Bn(e) : {};
6517
6513
  }
6518
- function Nm({
6514
+ function Dm({
6519
6515
  theme: e = "auto",
6520
6516
  layout: t = "sidebar",
6521
6517
  model: n = "auto",
@@ -6537,11 +6533,11 @@ function Nm({
6537
6533
  apiBaseUrl: g = "https://api.arcten.com",
6538
6534
  user: M,
6539
6535
  state: v,
6540
- onStateChange: N,
6536
+ onStateChange: D,
6541
6537
  allowStateEdits: R = !0,
6542
6538
  sources: L,
6543
6539
  ragConfig: F,
6544
- showCitations: D = !0,
6540
+ showCitations: N = !0,
6545
6541
  sensitiveParams: U,
6546
6542
  autoDetectSensitive: k = !1
6547
6543
  }) {
@@ -6555,7 +6551,7 @@ function Nm({
6555
6551
  // Can be extended later if needed
6556
6552
  } : { enabled: !1 }, [L, F]), [B, G] = $(null), H = de(null), [ue, W] = $(null), [le, Pe] = $(null), Ae = de(null), ie = v !== void 0, [it, pt] = $({}), Ve = de({});
6557
6553
  ie && v ? Ve.current = v : ie || (Ve.current = it);
6558
- const [tt, Xt] = $(!1), [li, ot] = $(null), at = de(!1), [qe, wn] = $(c), [Ge, Wt] = $(i), [Kt, Qn] = $(600), [Tn, Nt] = $(!1), [ae, he] = $(!1), [Fe, nt] = $(!1), [fe, Sn] = $({ x: 100, y: 100 }), [es, qt] = $(!1), [Pn, Dt] = $({ x: 0, y: 0 }), [Gt, An] = $(!1), lt = de(null), Ye = de(null), [Yt, Cn] = $(""), [ts, Is] = $(null), [kn, ns] = $("Thinking..."), [He, Ie] = $(/* @__PURE__ */ new Set()), [Ht, ct] = $(""), [Oe, ss] = $([]), rs = de(/* @__PURE__ */ new Map()), gt = de(!1), Mn = de(""), [En, Nn] = $(!1), [Be, is] = $([]), [ze, Rt] = $(() => typeof window < "u" ? crypto.randomUUID() : null), [yt, bt] = $(!1), [os, Je] = $(!1), [ci, Jt] = $([]), as = Me(async (p, A = 3) => {
6554
+ const [tt, Xt] = $(!1), [li, ot] = $(null), at = de(!1), [qe, wn] = $(c), [Ge, Wt] = $(i), [Kt, Qn] = $(600), [Tn, Dt] = $(!1), [ae, he] = $(!1), [Fe, nt] = $(!1), [fe, Sn] = $({ x: 100, y: 100 }), [es, qt] = $(!1), [Pn, Nt] = $({ x: 0, y: 0 }), [Gt, An] = $(!1), lt = de(null), Ye = de(null), [Yt, Cn] = $(""), [ts, Is] = $(null), [kn, ns] = $("Thinking..."), [He, Ie] = $(/* @__PURE__ */ new Set()), [Ht, ct] = $(""), [Oe, ss] = $([]), rs = de(/* @__PURE__ */ new Map()), gt = de(!1), Mn = de(""), [En, Dn] = $(!1), [Be, is] = $([]), [ze, Rt] = $(() => typeof window < "u" ? crypto.randomUUID() : null), [yt, bt] = $(!1), [os, Je] = $(!1), [ci, Jt] = $([]), as = Me(async (p, A = 3) => {
6559
6555
  if (!ze || !H.current)
6560
6556
  return;
6561
6557
  const V = async () => {
@@ -6595,13 +6591,13 @@ function Nm({
6595
6591
  return Ve.current;
6596
6592
  }, []), Vt = te(() => async function(A) {
6597
6593
  const V = { ...Ve.current, ...A };
6598
- Ve.current = V, ie || pt(V), N && N(V);
6594
+ Ve.current = V, ie || pt(V), D && D(V);
6599
6595
  try {
6600
6596
  await as(A);
6601
6597
  } catch (z) {
6602
6598
  throw z;
6603
6599
  }
6604
- }, [as, N, ie]);
6600
+ }, [as, D, ie]);
6605
6601
  se(() => {
6606
6602
  ie && v && (Ve.current = v);
6607
6603
  }, [ie, v]);
@@ -7070,7 +7066,7 @@ function Nm({
7070
7066
  const p = crypto.randomUUID();
7071
7067
  Rt(p), ds([]), Jt([]), bt(!1);
7072
7068
  const A = ie ? v || {} : {};
7073
- Ve.current = A, ie || pt(A), N && N(A), at.current = !1;
7069
+ Ve.current = A, ie || pt(A), D && D(A), at.current = !1;
7074
7070
  }
7075
7071
  async function It(p) {
7076
7072
  if (B)
@@ -7085,7 +7081,7 @@ function Nm({
7085
7081
  console.error("Failed to delete conversation:", A);
7086
7082
  }
7087
7083
  }
7088
- async function Dn(p) {
7084
+ async function Nn(p) {
7089
7085
  Rt(p.chatId), bt(!1), Je(!0);
7090
7086
  try {
7091
7087
  const A = await fetch(`${g}/conversations/${p.chatId}/messages`, {
@@ -7219,7 +7215,7 @@ function Nm({
7219
7215
  if (z.status === 404 || z.status >= 500) {
7220
7216
  console.warn(`[ArctenAgent] Convex API endpoint not available (${z.status}), using empty state`);
7221
7217
  const X = ie ? v || {} : {};
7222
- Ve.current = X, ie || pt(X), N && N(X), at.current = !0, Xt(!1);
7218
+ Ve.current = X, ie || pt(X), D && D(X), at.current = !0, Xt(!1);
7223
7219
  return;
7224
7220
  }
7225
7221
  const re = await z.text().catch(() => "Unknown error");
@@ -7227,19 +7223,19 @@ function Nm({
7227
7223
  }
7228
7224
  const _ = (await z.json())?.value || {}, ne = !at.current;
7229
7225
  let Q;
7230
- ne ? (Q = { ...ie ? v || {} : {}, ..._ }, at.current = !0) : Q = _, Ve.current = Q, ie || pt(Q), N && N(Q);
7226
+ ne ? (Q = { ...ie ? v || {} : {}, ..._ }, at.current = !0) : Q = _, Ve.current = Q, ie || pt(Q), D && D(Q);
7231
7227
  } catch (A) {
7232
7228
  A instanceof TypeError && A.message.includes("fetch") ? console.warn("[ArctenAgent] Network error fetching state (likely Convex endpoint not available), using fallback state:", A) : console.error("[ArctenAgent] Failed to fetch state:", A);
7233
7229
  const z = A instanceof Error ? A : new Error(String(A));
7234
7230
  if (ot(z), !at.current) {
7235
7231
  const O = ie ? v || {} : {};
7236
- Ve.current = O, ie || pt(O), N && N(O), at.current = !0;
7232
+ Ve.current = O, ie || pt(O), D && D(O), at.current = !0;
7237
7233
  }
7238
7234
  } finally {
7239
7235
  Xt(!1);
7240
7236
  }
7241
7237
  })();
7242
- }, [ze, g, ie, v, N]), se(() => {
7238
+ }, [ze, g, ie, v, D]), se(() => {
7243
7239
  qe && Ye.current && Ye.current.focus();
7244
7240
  }, [qe, $e]);
7245
7241
  function Rl() {
@@ -7283,14 +7279,14 @@ function Nm({
7283
7279
  }
7284
7280
  }
7285
7281
  function A() {
7286
- Nt(!1), localStorage.setItem("arcten-sidebar-width", Ge.toString()), localStorage.setItem("arcten-sidebar-height", Kt.toString());
7282
+ Dt(!1), localStorage.setItem("arcten-sidebar-width", Ge.toString()), localStorage.setItem("arcten-sidebar-height", Kt.toString());
7287
7283
  }
7288
7284
  return window.addEventListener("mousemove", p), window.addEventListener("mouseup", A), () => {
7289
7285
  window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", A);
7290
7286
  };
7291
7287
  }, [Tn, Ge, Kt, ae, fe, a, l]);
7292
7288
  function Ol(p) {
7293
- p.preventDefault(), Nt(!0);
7289
+ p.preventDefault(), Dt(!0);
7294
7290
  }
7295
7291
  function $l() {
7296
7292
  he(!0), nt(!1), localStorage.setItem("arcten-sidebar-detached", "true"), localStorage.setItem("arcten-sidebar-minimized", "false");
@@ -7302,7 +7298,7 @@ function Nm({
7302
7298
  nt(!Fe), localStorage.setItem("arcten-sidebar-minimized", JSON.stringify(!Fe));
7303
7299
  }
7304
7300
  function Fl(p) {
7305
- ae && (qt(!0), Dt({
7301
+ ae && (qt(!0), Nt({
7306
7302
  x: p.clientX - fe.x,
7307
7303
  y: p.clientY - fe.y
7308
7304
  }));
@@ -7373,7 +7369,7 @@ function Nm({
7373
7369
  {
7374
7370
  className: "absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize",
7375
7371
  onMouseDown: (p) => {
7376
- p.preventDefault(), Nt(!0);
7372
+ p.preventDefault(), Dt(!0);
7377
7373
  }
7378
7374
  }
7379
7375
  ),
@@ -7382,7 +7378,7 @@ function Nm({
7382
7378
  {
7383
7379
  className: "absolute bottom-0 left-4 right-4 h-3 cursor-move hover:bg-blue-500/20 group",
7384
7380
  onMouseDown: (p) => {
7385
- p.preventDefault(), p.stopPropagation(), qt(!0), Dt({
7381
+ p.preventDefault(), p.stopPropagation(), qt(!0), Nt({
7386
7382
  x: p.clientX - fe.x,
7387
7383
  y: p.clientY - fe.y
7388
7384
  });
@@ -7395,7 +7391,7 @@ function Nm({
7395
7391
  {
7396
7392
  className: "absolute top-0 right-0 bottom-0 w-1 cursor-ew-resize hover:bg-blue-500/40",
7397
7393
  onMouseDown: (p) => {
7398
- p.preventDefault(), Nt(!0);
7394
+ p.preventDefault(), Dt(!0);
7399
7395
  }
7400
7396
  }
7401
7397
  )
@@ -7466,7 +7462,7 @@ function Nm({
7466
7462
  /* @__PURE__ */ C("div", { className: "flex items-center justify-between px-3 py-1", children: [
7467
7463
  /* @__PURE__ */ h("h3", { className: "text-xs font-semibold text-muted-foreground", children: "Recent chats" }),
7468
7464
  /* @__PURE__ */ h(
7469
- Ne,
7465
+ De,
7470
7466
  {
7471
7467
  variant: "ghost",
7472
7468
  className: "h-auto px-2 py-1 text-xs text-muted-foreground hover:text-foreground",
@@ -7483,7 +7479,7 @@ function Nm({
7483
7479
  {
7484
7480
  type: "button",
7485
7481
  className: oe($t({ variant: "ghost" }), "w-full justify-between h-auto py-1 px-3 font-normal active:scale-[0.99]"),
7486
- onClick: () => Dn(p),
7482
+ onClick: () => Nn(p),
7487
7483
  children: [
7488
7484
  /* @__PURE__ */ h("span", { className: "text-xs truncate", children: p.title }),
7489
7485
  /* @__PURE__ */ h("div", { className: "ml-2 flex items-center", children: /* @__PURE__ */ h("span", { className: "text-xs text-muted-foreground group-hover:hidden", children: ce(p.updatedAt) }) })
@@ -7542,7 +7538,7 @@ function Nm({
7542
7538
  {
7543
7539
  variant: "secondary",
7544
7540
  className: "cursor-pointer text-xs px-2 py-1 hover:bg-stone-200 dark:hover:bg-stone-700 transition-colors",
7545
- onClick: () => Nn(!0),
7541
+ onClick: () => Dn(!0),
7546
7542
  children: [
7547
7543
  "+",
7548
7544
  Oe.length - 10,
@@ -7567,7 +7563,7 @@ function Nm({
7567
7563
  {
7568
7564
  variant: "secondary",
7569
7565
  className: "cursor-pointer text-xs px-2 py-1 hover:bg-stone-200 dark:hover:bg-stone-700 transition-colors",
7570
- onClick: () => Nn(!1),
7566
+ onClick: () => Dn(!1),
7571
7567
  children: "Show less"
7572
7568
  }
7573
7569
  )
@@ -7584,11 +7580,11 @@ function Nm({
7584
7580
  if (p.role === "assistant") {
7585
7581
  const X = z.filter((ye) => ye.type === "text" && ye.text), J = [], q = [];
7586
7582
  X.forEach((ye) => {
7587
- const { citations: xt, citationMap: De, groupedCitations: Ue, referencesText: wt } = Do(ye.text);
7588
- O.push(...xt), J.push(De), Ue && q.push(...Ue), wt && (Q = wt);
7583
+ const { citations: xt, citationMap: Ne, groupedCitations: Ue, referencesText: wt } = No(ye.text);
7584
+ O.push(...xt), J.push(Ne), Ue && q.push(...Ue), wt && (Q = wt);
7589
7585
  }), J.forEach((ye) => {
7590
- ye.forEach((xt, De) => {
7591
- _.has(De) || _.set(De, xt);
7586
+ ye.forEach((xt, Ne) => {
7587
+ _.has(Ne) || _.set(Ne, xt);
7592
7588
  });
7593
7589
  }), ne = Array.from(
7594
7590
  new Map(q.map((ye) => [ye.url, ye])).values()
@@ -7613,11 +7609,11 @@ function Nm({
7613
7609
  }
7614
7610
  ) : /* @__PURE__ */ h("div", { className: "space-y-2", children: z.map((X, J) => {
7615
7611
  if (X.type?.startsWith("tool-")) {
7616
- const q = X.type?.replace("tool-", "") || "", Te = K.find((De) => De.name === q), ye = X.state === "input-available", xt = X.state === "output-available";
7612
+ const q = X.type?.replace("tool-", "") || "", Te = K.find((Ne) => Ne.name === q), ye = X.state === "input-available", xt = X.state === "output-available";
7617
7613
  if (ye && be.has(q), ye) {
7618
7614
  if (be.has(q))
7619
7615
  return null;
7620
- const De = Zs(X.input);
7616
+ const Ne = Zs(X.input);
7621
7617
  return /* @__PURE__ */ h(
7622
7618
  gs,
7623
7619
  {
@@ -7629,7 +7625,7 @@ function Nm({
7629
7625
  {
7630
7626
  toolName: q,
7631
7627
  description: Te?.description || "",
7632
- args: De,
7628
+ args: Ne,
7633
7629
  onApprove: async () => {
7634
7630
  if (He.has(X.toolCallId))
7635
7631
  return;
@@ -7637,7 +7633,7 @@ function Nm({
7637
7633
  const Ue = Z.get(q);
7638
7634
  if (Ue)
7639
7635
  try {
7640
- const wt = await Ue(...Object.values(De));
7636
+ const wt = await Ue(...Object.values(Ne));
7641
7637
  jt({
7642
7638
  toolCallId: X.toolCallId,
7643
7639
  tool: q,
@@ -7664,13 +7660,13 @@ function Nm({
7664
7660
  `${X.toolCallId}-${J}`
7665
7661
  );
7666
7662
  } else if (xt) {
7667
- const De = X.output === "User denied tool execution", Ue = Zs(X.input);
7663
+ const Ne = X.output === "User denied tool execution", Ue = Zs(X.input);
7668
7664
  return /* @__PURE__ */ h(
7669
7665
  im,
7670
7666
  {
7671
7667
  toolName: q,
7672
7668
  args: Ue,
7673
- isDenied: De,
7669
+ isDenied: Ne,
7674
7670
  isSafe: be.has(q)
7675
7671
  },
7676
7672
  `${X.toolCallId}-${J}`
@@ -7679,19 +7675,19 @@ function Nm({
7679
7675
  return null;
7680
7676
  }
7681
7677
  if (X.type === "text" && X.text && ts) {
7682
- const { processedText: q } = Do(X.text), De = !z.slice(J + 1).some((Ue) => Ue.type === "text" && Ue.text) && re && _.size > 0;
7678
+ const { processedText: q } = No(X.text), Ne = !z.slice(J + 1).some((Ue) => Ue.type === "text" && Ue.text) && re && _.size > 0;
7683
7679
  return /* @__PURE__ */ h(
7684
7680
  bm,
7685
7681
  {
7686
7682
  text: q,
7687
7683
  citations: O,
7688
7684
  citationMap: _,
7689
- groupedCitations: De ? ne : void 0,
7690
- referencesText: De ? Q : void 0,
7685
+ groupedCitations: Ne ? ne : void 0,
7686
+ referencesText: Ne ? Q : void 0,
7691
7687
  ResponseComponent: ts,
7692
7688
  className: "text-sm prose prose-sm dark:prose-invert max-w-none",
7693
- showCitations: D,
7694
- showReferences: De
7689
+ showCitations: N,
7690
+ showReferences: Ne
7695
7691
  },
7696
7692
  `${p.id}-${J}`
7697
7693
  );
@@ -7827,9 +7823,9 @@ function Nm({
7827
7823
  ) }) : /* @__PURE__ */ h("div", { className: "fixed right-0 top-0 h-screen w-96 flex items-center justify-center p-4 bg-stone-50 dark:bg-stone-900 border-l border-border", children: /* @__PURE__ */ h("div", { className: "p-4 text-muted-foreground text-sm", children: "Loading..." }) }) : null;
7828
7824
  }
7829
7825
  function ap(e) {
7830
- return /* @__PURE__ */ h(km, { children: /* @__PURE__ */ h(Nm, { ...e }) });
7826
+ return /* @__PURE__ */ h(km, { children: /* @__PURE__ */ h(Dm, { ...e }) });
7831
7827
  }
7832
- const Dm = {
7828
+ const Nm = {
7833
7829
  password: [
7834
7830
  /^password$/i,
7835
7831
  /^pwd$/i,
@@ -7886,7 +7882,7 @@ const Dm = {
7886
7882
  // Fallback type
7887
7883
  };
7888
7884
  function jn(e) {
7889
- for (const [t, n] of Object.entries(Dm))
7885
+ for (const [t, n] of Object.entries(Nm))
7890
7886
  if (t !== "text") {
7891
7887
  for (const s of n)
7892
7888
  if (s.test(e))
@@ -8085,11 +8081,11 @@ function Wm(e, t, n) {
8085
8081
  function Tr(e) {
8086
8082
  return e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : Array.isArray(e) ? e.length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !0;
8087
8083
  }
8088
- function Nl(e, t = "") {
8084
+ function Dl(e, t = "") {
8089
8085
  const n = {};
8090
8086
  return e && typeof e == "object" ? Object.entries(e).forEach(([s, r]) => {
8091
8087
  const o = t ? `${t}.${s}` : s;
8092
- n[o] = Tr(r), r && typeof r == "object" && Object.assign(n, Nl(r, o));
8088
+ n[o] = Tr(r), r && typeof r == "object" && Object.assign(n, Dl(r, o));
8093
8089
  }) : t && (n[t] = Tr(e)), n;
8094
8090
  }
8095
8091
  function Km(e) {
@@ -8128,7 +8124,7 @@ function qm(e) {
8128
8124
  }
8129
8125
  return t;
8130
8126
  }
8131
- function Dl(e, t, n) {
8127
+ function Nl(e, t, n) {
8132
8128
  const s = n.placeholder, r = {
8133
8129
  tool: e,
8134
8130
  redacted: !0,
@@ -8136,14 +8132,14 @@ function Dl(e, t, n) {
8136
8132
  placeholder: s
8137
8133
  };
8138
8134
  if (n.strategy === "full") {
8139
- n.includeFieldStatus && typeof t == "object" && t !== null && (r.fieldStatus = Nl(t)), r.redactedFields = ["*"];
8135
+ n.includeFieldStatus && typeof t == "object" && t !== null && (r.fieldStatus = Dl(t)), r.redactedFields = ["*"];
8140
8136
  let l = {};
8141
8137
  return n.preserve.length > 0 && t && typeof t == "object" && n.preserve.forEach((c) => {
8142
8138
  c in t && (l[c] = t[c]);
8143
8139
  }), l[Ts] = r, l;
8144
8140
  }
8145
8141
  if (n.fields.includes("*"))
8146
- return Dl(e, t, {
8142
+ return Nl(e, t, {
8147
8143
  ...n,
8148
8144
  strategy: "full",
8149
8145
  fields: []
@@ -8186,24 +8182,24 @@ function lp({
8186
8182
  conversationId: g,
8187
8183
  state: M,
8188
8184
  onStateChange: v,
8189
- allowStateEdits: N = !0,
8185
+ allowStateEdits: D = !0,
8190
8186
  onToolCall: R,
8191
8187
  onFinish: L,
8192
8188
  sources: F,
8193
- ragConfig: D,
8189
+ ragConfig: N,
8194
8190
  ragFilters: U,
8195
8191
  // Deprecated: use ragConfig or sources instead
8196
8192
  secureInputHandler: k
8197
8193
  // Optional: custom secure input handler for React-less usage
8198
8194
  } = {}) {
8199
- const E = te(() => D !== void 0 ? D : U ? { enabled: !0, filters: U } : F && F.length > 0 ? {
8195
+ const E = te(() => N !== void 0 ? N : U ? { enabled: !0, filters: U } : F && F.length > 0 ? {
8200
8196
  enabled: !0,
8201
8197
  organizationId: F[0],
8202
8198
  // Use first source as default
8203
8199
  autoExecute: !0,
8204
8200
  // Default to auto-execute when sources are provided
8205
8201
  filters: void 0
8206
- } : { enabled: !1 }, [F, D, U]), j = te(() => {
8202
+ } : { enabled: !1 }, [F, N, U]), j = te(() => {
8207
8203
  const y = {};
8208
8204
  if (l)
8209
8205
  for (const [x, T] of Object.entries(l))
@@ -8239,7 +8235,7 @@ function lp({
8239
8235
  const T = B[y];
8240
8236
  if (!T) return x;
8241
8237
  try {
8242
- return Dl(y, x, T);
8238
+ return Nl(y, x, T);
8243
8239
  } catch (P) {
8244
8240
  return console.error(`[useAgent] Failed to redact output for ${y}:`, P), {
8245
8241
  value: Ss,
@@ -8254,9 +8250,9 @@ function lp({
8254
8250
  [B]
8255
8251
  ), [H, ue] = $(n || null), W = de(n || null), [le, Pe] = $(null), [Ae, ie] = $(null), it = de(null), [pt, Ve] = $([]), [tt, Xt] = $(
8256
8252
  g || (typeof window < "u" ? crypto.randomUUID() : null)
8257
- ), [li, ot] = $(!1), [at, qe] = $(/* @__PURE__ */ new Set()), [wn, Ge] = $(/* @__PURE__ */ new Map()), [Wt, Kt] = $(/* @__PURE__ */ new Map()), [Qn, Tn] = $(/* @__PURE__ */ new Map()), [Nt, ae] = $(/* @__PURE__ */ new Map()), he = M !== void 0, [Fe, nt] = $({}), fe = de({}), Sn = he ? M || {} : Fe;
8253
+ ), [li, ot] = $(!1), [at, qe] = $(/* @__PURE__ */ new Set()), [wn, Ge] = $(/* @__PURE__ */ new Map()), [Wt, Kt] = $(/* @__PURE__ */ new Map()), [Qn, Tn] = $(/* @__PURE__ */ new Map()), [Dt, ae] = $(/* @__PURE__ */ new Map()), he = M !== void 0, [Fe, nt] = $({}), fe = de({}), Sn = he ? M || {} : Fe;
8258
8254
  he && M ? fe.current = M : he || (fe.current = Fe);
8259
- const [es, qt] = $(!1), [Pn, Dt] = $(null), Gt = de(!1), An = Me(async (y, x = 3) => {
8255
+ const [es, qt] = $(!1), [Pn, Nt] = $(null), Gt = de(!1), An = Me(async (y, x = 3) => {
8260
8256
  if (!tt || !W.current)
8261
8257
  return;
8262
8258
  const T = async () => {
@@ -8283,12 +8279,12 @@ function lp({
8283
8279
  };
8284
8280
  for (let P = 0; P < x; P++)
8285
8281
  try {
8286
- await T(), Dt(null);
8282
+ await T(), Nt(null);
8287
8283
  return;
8288
8284
  } catch (I) {
8289
8285
  if (P === x - 1) {
8290
8286
  const Z = I instanceof Error ? I : new Error(String(I));
8291
- throw Dt(Z), console.error("Failed to sync state to Convex after retries:", I), Z;
8287
+ throw Nt(Z), console.error("Failed to sync state to Convex after retries:", I), Z;
8292
8288
  }
8293
8289
  await new Promise((Z) => setTimeout(Z, Math.pow(2, P) * 100));
8294
8290
  }
@@ -8324,7 +8320,7 @@ function lp({
8324
8320
  }), [k]), Is = Me((y, x) => {
8325
8321
  if (k)
8326
8322
  return;
8327
- const T = Nt.get(y);
8323
+ const T = Dt.get(y);
8328
8324
  T && (T(x), Tn((P) => {
8329
8325
  const I = new Map(P);
8330
8326
  return I.delete(y), I;
@@ -8332,7 +8328,7 @@ function lp({
8332
8328
  const I = new Map(P);
8333
8329
  return I.delete(y), I;
8334
8330
  }));
8335
- }, [Nt, k]), kn = Me((y, x) => {
8331
+ }, [Dt, k]), kn = Me((y, x) => {
8336
8332
  const T = j[y] || {}, P = Object.keys(T).length > 0;
8337
8333
  if (u) {
8338
8334
  const I = Object.keys(x).filter((K) => jn(K) !== null);
@@ -8503,10 +8499,10 @@ function lp({
8503
8499
  ...i,
8504
8500
  lt
8505
8501
  ];
8506
- return (!he || N) && y.push(Ye), E?.enabled && (He && y.push(He), Ie && y.push(Ie)), y;
8507
- }, [o, i, lt, Ye, He, Ie, E, he, N]), ct = te(() => Sl(Ht, a), [Ht, a]), Oe = te(() => {
8502
+ return (!he || D) && y.push(Ye), E?.enabled && (He && y.push(He), Ie && y.push(Ie)), y;
8503
+ }, [o, i, lt, Ye, He, Ie, E, he, D]), ct = te(() => Sl(Ht, a), [Ht, a]), Oe = te(() => {
8508
8504
  const y = /* @__PURE__ */ new Map(), x = new Map(ct.map((T) => [T.name, T]));
8509
- return y.set("getState", lt), (!he || N) && y.set("setState", Ye), E?.enabled && (He && y.set("searchDocs", He), Ie && y.set("fetchDocContent", Ie)), Ht.forEach((T) => {
8505
+ return y.set("getState", lt), (!he || D) && y.set("setState", Ye), E?.enabled && (He && y.set("searchDocs", He), Ie && y.set("fetchDocContent", Ie)), Ht.forEach((T) => {
8510
8506
  if (T === lt || T === Ye || T === He || T === Ie)
8511
8507
  return;
8512
8508
  const P = T[dt];
@@ -8520,7 +8516,7 @@ function lp({
8520
8516
  const I = ct.find((K) => K.name === T.name);
8521
8517
  I && y.set(I.name, T);
8522
8518
  }), y;
8523
- }, [Ht, ct, lt, Ye, He, Ie, E, he, N]), ss = te(() => new Set(ct.map((y) => y.name)), [ct]), rs = te(() => {
8519
+ }, [Ht, ct, lt, Ye, He, Ie, E, he, D]), ss = te(() => new Set(ct.map((y) => y.name)), [ct]), rs = te(() => {
8524
8520
  const y = [
8525
8521
  {
8526
8522
  name: "getState",
@@ -8532,7 +8528,7 @@ function lp({
8532
8528
  }
8533
8529
  }
8534
8530
  ];
8535
- (!he || N) && y.push({
8531
+ (!he || D) && y.push({
8536
8532
  name: "setState",
8537
8533
  description: "Update the agent state. Store IDs, workflow state, checklists, context, and other data that must persist across conversations. Merges with existing state.",
8538
8534
  jsonSchema: {
@@ -8598,7 +8594,7 @@ function lp({
8598
8594
  }
8599
8595
  }
8600
8596
  ), [...ct, ...y, ...x];
8601
- }, [ct, E, he, N]), gt = te(() => rs.filter((y) => y.name === "getState" ? !0 : y.name === "setState" ? !he || N : E?.enabled && (y.name === "searchDocs" || y.name === "fetchDocContent") ? !0 : ss.has(y.name)), [rs, ss, he, N, E]), Mn = te(() => {
8597
+ }, [ct, E, he, D]), gt = te(() => rs.filter((y) => y.name === "getState" ? !0 : y.name === "setState" ? !he || D : E?.enabled && (y.name === "searchDocs" || y.name === "fetchDocContent") ? !0 : ss.has(y.name)), [rs, ss, he, D, E]), Mn = te(() => {
8602
8598
  const y = /* @__PURE__ */ new Set();
8603
8599
  return y.add("getState"), y.add("setState"), E?.enabled && E.autoExecute !== !1 && (y.add("searchDocs"), y.add("fetchDocContent")), i.forEach((x) => {
8604
8600
  for (const [T, P] of Oe.entries())
@@ -8672,13 +8668,13 @@ function lp({
8672
8668
  } catch (P) {
8673
8669
  throw console.error("[useAgent] Fetch error:", P), P;
8674
8670
  }
8675
- }, Nn = `${e}/chat`;
8676
- console.log("[useAgent] Chat API URL:", Nn);
8671
+ }, Dn = `${e}/chat`;
8672
+ console.log("[useAgent] Chat API URL:", Dn);
8677
8673
  const { messages: Be, sendMessage: is, status: ze, error: Rt, stop: yt, addToolResult: bt, setMessages: os } = $o({
8678
8674
  id: tt || void 0,
8679
8675
  messages: S,
8680
8676
  transport: new Fo({
8681
- api: Nn,
8677
+ api: Dn,
8682
8678
  fetch: En,
8683
8679
  headers: () => {
8684
8680
  const y = {};
@@ -8745,16 +8741,16 @@ function lp({
8745
8741
  Je(T, P, "User cancelled secure input");
8746
8742
  return;
8747
8743
  }
8748
- const It = { ...we, ...st }, Dn = Oe.get(T);
8749
- if (!Dn)
8744
+ const It = { ...we, ...st }, Nn = Oe.get(T);
8745
+ if (!Nn)
8750
8746
  throw new Error(`Tool ${T} not found`);
8751
8747
  let Rn;
8752
8748
  const $e = gt.find((ls) => ls.name === T);
8753
8749
  if ($e && $e.jsonSchema?.properties) {
8754
8750
  const Le = Object.keys($e.jsonSchema.properties).map((cs) => It[cs]);
8755
- Rn = await Dn(...Le);
8751
+ Rn = await Nn(...Le);
8756
8752
  } else
8757
- Rn = await Dn(...Object.values(It));
8753
+ Rn = await Nn(...Object.values(It));
8758
8754
  Je(T, P, Rn);
8759
8755
  } catch (ee) {
8760
8756
  console.error(`[useAgent] Error executing tool with secure input ${T}:`, ee), Je(T, P, `Error: ${ee}`);
@@ -8824,7 +8820,7 @@ function lp({
8824
8820
  }, [JSON.stringify(r), H, e]), se(() => {
8825
8821
  if (!tt || !W.current) return;
8826
8822
  (async () => {
8827
- qt(!0), Dt(null);
8823
+ qt(!0), Nt(null);
8828
8824
  try {
8829
8825
  const x = await fetch(`${e.replace("/chat", "")}/convex/api/query`, {
8830
8826
  method: "POST",
@@ -8847,7 +8843,7 @@ function lp({
8847
8843
  } catch (x) {
8848
8844
  console.error("Failed to fetch state:", x);
8849
8845
  const T = x instanceof Error ? x : new Error(String(x));
8850
- Dt(T), Gt.current || (fe.current = {}, he ? v && v({}) : (nt({}), v && v({})), Gt.current = !0);
8846
+ Nt(T), Gt.current || (fe.current = {}, he ? v && v({}) : (nt({}), v && v({})), Gt.current = !0);
8851
8847
  } finally {
8852
8848
  qt(!1);
8853
8849
  }