@arcteninc/core 0.0.162 → 0.0.163

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
@@ -1,14 +1,14 @@
1
- import { jsx as h, jsxs as C, Fragment as Gt } from "react/jsx-runtime";
1
+ import { jsx as h, jsxs as S, Fragment as qt } from "react/jsx-runtime";
2
2
  import * as qe from "react";
3
- import { useState as O, useMemo as ee, useEffect as re, useRef as pe, useCallback as ke, useImperativeHandle as Al, createContext as St, useLayoutEffect as kl, useId as wr, useContext as Se, useInsertionEffect as ko, Children as El, isValidElement as Ml, Fragment as Eo, createElement as Nl, forwardRef as Dl, Component as Rl, memo as _n, Suspense as Vl, lazy as Il } from "react";
3
+ import { useState as O, useMemo as ee, useEffect as re, useRef as pe, useCallback as ke, useImperativeHandle as Al, createContext as St, useLayoutEffect as kl, useId as wr, useContext as Se, useInsertionEffect as ko, Children as El, isValidElement as Ml, Fragment as Eo, createElement as Nl, forwardRef as Dl, Component as Vl, memo as zn, Suspense as Rl, lazy as Il } from "react";
4
4
  import { Check as Mo, X as ys, ChevronDown as Ol, ChevronRight as Ll, Zap as jl, BrainIcon as $l, ChevronDownIcon as Fl, XIcon as Bl, EyeOff as No, Eye as Do, Mail as Ul, Phone as zl, Shield as _l, Lock as Xl, AlertCircle as Wl, Plus as Kl, Dock as ql, PictureInPicture2 as Gl, Maximize2 as Yl, Minimize2 as Hl, Square as Jl, ArrowRight as Zl, BotMessageSquare as Ql } from "lucide-react";
5
5
  import { useChat as ec } from "@ai-sdk/react";
6
6
  import { DefaultChatTransport as tc, lastAssistantMessageIsCompleteWithToolCalls as nc } from "ai";
7
- import { Slot as Ro } from "@radix-ui/react-slot";
8
- import { cva as Vo } from "class-variance-authority";
7
+ import { Slot as Vo } from "@radix-ui/react-slot";
8
+ import { cva as Ro } from "class-variance-authority";
9
9
  import { clsx as sc } from "clsx";
10
10
  import { twMerge as rc } from "tailwind-merge";
11
- import * as tn from "@radix-ui/react-tooltip";
11
+ import * as en from "@radix-ui/react-tooltip";
12
12
  import { useControllableState as ai } from "@radix-ui/react-use-controllable-state";
13
13
  import * as Tr from "@radix-ui/react-collapsible";
14
14
  import { createPortal as ic } from "react-dom";
@@ -121,7 +121,7 @@ const ac = {
121
121
  text: []
122
122
  // Fallback type
123
123
  };
124
- function Mn(e) {
124
+ function En(e) {
125
125
  for (const [t, n] of Object.entries(ac))
126
126
  if (t !== "text") {
127
127
  for (const s of n)
@@ -183,7 +183,7 @@ function uc(e, t, n, s = {}) {
183
183
  }
184
184
  const c = dc(s[i]), u = {
185
185
  name: i,
186
- type: hc(l || Mn(i) || "text"),
186
+ type: hc(l || En(i) || "text"),
187
187
  label: Oo(i),
188
188
  placeholder: fc(i, l),
189
189
  required: !0,
@@ -240,20 +240,20 @@ function pc(e, t) {
240
240
  const n = e.toLowerCase();
241
241
  return t <= 2 ? `Please provide the required information to ${n}.` : `Please fill out the form below to ${n}. Required fields are marked with *.`;
242
242
  }
243
- function Dn(e) {
243
+ function Nn(e) {
244
244
  if (typeof e == "string")
245
245
  try {
246
246
  const t = JSON.parse(e);
247
- return Dn(t);
247
+ return Nn(t);
248
248
  } catch {
249
249
  return e;
250
250
  }
251
251
  if (Array.isArray(e))
252
- return e.map(Dn);
252
+ return e.map(Nn);
253
253
  if (e && typeof e == "object") {
254
254
  const t = {};
255
255
  for (const [n, s] of Object.entries(e))
256
- t[n] = Dn(s);
256
+ t[n] = Nn(s);
257
257
  return t;
258
258
  }
259
259
  return e;
@@ -271,12 +271,12 @@ function yc(e) {
271
271
  try {
272
272
  const t = JSON.parse(e);
273
273
  if (t && typeof t == "object" && !Array.isArray(t))
274
- return Dn(t);
274
+ return Nn(t);
275
275
  } catch {
276
276
  }
277
277
  return {};
278
278
  }
279
- return e && typeof e == "object" && !Array.isArray(e) ? Dn(e) : {};
279
+ return e && typeof e == "object" && !Array.isArray(e) ? Nn(e) : {};
280
280
  }
281
281
  const us = "__secureOutput", ds = "[hidden for privacy]";
282
282
  function bc(e, t) {
@@ -447,17 +447,17 @@ function Cc({
447
447
  autoFormGeneration: f = !1,
448
448
  formMode: m = "auto",
449
449
  // NOTE: systemPrompt is deprecated; prompts are managed server-side per project/agent.
450
- systemPrompt: w = "",
450
+ systemPrompt: x = "",
451
451
  agentId: v,
452
- agentName: T,
453
- projectId: b,
452
+ agentName: w,
453
+ projectId: y,
454
454
  enableRemoteConfig: M,
455
455
  remoteConfigUrl: E,
456
456
  initialMessages: F = [],
457
- conversationId: R,
457
+ conversationId: V,
458
458
  state: L,
459
459
  onStateChange: D,
460
- allowStateEdits: A = !0,
460
+ allowStateEdits: C = !0,
461
461
  onToolCall: j,
462
462
  onFinish: k,
463
463
  sources: N,
@@ -467,78 +467,78 @@ function Cc({
467
467
  secureInputHandler: U
468
468
  // Optional: custom secure input handler for React-less usage
469
469
  } = {}) {
470
- const W = e.replace(/\/+$/, ""), [H, G] = O(null), [ae, xe] = O(!1), [He, Ct] = O(null), ot = ee(() => {
471
- const p = N || [], g = H?.config?.sources || [];
470
+ const W = e.replace(/\/+$/, ""), [Y, G] = O(null), [ae, xe] = O(!1), [He, Ct] = O(null), ot = ee(() => {
471
+ const p = N || [], g = Y?.config?.sources || [];
472
472
  return [.../* @__PURE__ */ new Set([...p, ...g])];
473
- }, [N, H]), Y = ee(() => B !== void 0 ? B : I ? { enabled: !0, filters: I } : ot && ot.length > 0 ? {
473
+ }, [N, Y]), H = ee(() => B !== void 0 ? B : I ? { enabled: !0, filters: I } : ot && ot.length > 0 ? {
474
474
  enabled: !0,
475
475
  organizationId: ot[0],
476
476
  // Use first source as default
477
477
  autoExecute: !0,
478
478
  filters: void 0
479
- } : { enabled: !1 }, [ot, B, I]), Bt = ee(() => M === !1 ? !1 : !!b, [b, M]);
479
+ } : { enabled: !1 }, [ot, B, I]), Bt = ee(() => M === !1 ? !1 : !!y, [y, M]);
480
480
  re(() => {
481
- if (!Bt || !le.current)
481
+ if (!Bt || !ce.current)
482
482
  return;
483
483
  (async () => {
484
484
  xe(!0), Ct(null);
485
485
  try {
486
- const y = `${E || W.replace("/chat", "").replace(/\/$/, "")}/convex/api/query`, x = await fetch(y, {
486
+ const b = `${E || W.replace("/chat", "").replace(/\/$/, "")}/convex/api/query`, A = await fetch(b, {
487
487
  method: "POST",
488
488
  headers: {
489
489
  "Content-Type": "application/json",
490
- Authorization: `Bearer ${le.current}`
490
+ Authorization: `Bearer ${ce.current}`
491
491
  },
492
492
  body: JSON.stringify({
493
493
  path: "agents:getConfigForClient",
494
- args: { projectId: b, agentName: T, agentId: v },
494
+ args: { projectId: y, agentName: w, agentId: v },
495
495
  format: "json"
496
496
  })
497
497
  });
498
- if (!x.ok) {
499
- if (x.status === 404) {
498
+ if (!A.ok) {
499
+ if (A.status === 404) {
500
500
  console.warn("[useAgent] Remote config endpoint not found (404), using local tools only"), G(null);
501
501
  return;
502
502
  }
503
- const V = await x.text().catch(() => "Unknown error");
504
- throw new Error(`Failed to fetch remote config: ${x.status} ${V}`);
503
+ const R = await A.text().catch(() => "Unknown error");
504
+ throw new Error(`Failed to fetch remote config: ${A.status} ${R}`);
505
505
  }
506
- const P = await x.json();
506
+ const P = await A.json();
507
507
  G(P?.value || null), console.log("[useAgent] Remote config loaded successfully:", P?.value);
508
508
  } catch (g) {
509
509
  console.error("[useAgent] Failed to fetch remote config:", g);
510
- const y = g instanceof Error ? g : new Error(String(g));
511
- Ct(y), G(null);
510
+ const b = g instanceof Error ? g : new Error(String(g));
511
+ Ct(b), G(null);
512
512
  } finally {
513
513
  xe(!1);
514
514
  }
515
515
  })();
516
- }, [Bt, b, T, v, W, E]);
517
- const Ve = ee(() => {
516
+ }, [Bt, y, w, v, W, E]);
517
+ const Re = ee(() => {
518
518
  const p = {};
519
519
  if (c)
520
- for (const [g, y] of Object.entries(c))
521
- if (p[g] = {}, Array.isArray(y))
522
- for (const x of y) {
523
- const P = Mn(x);
524
- p[g][x] = P || "text";
520
+ for (const [g, b] of Object.entries(c))
521
+ if (p[g] = {}, Array.isArray(b))
522
+ for (const A of b) {
523
+ const P = En(A);
524
+ p[g][A] = P || "text";
525
525
  }
526
526
  else
527
- for (const [x, P] of Object.entries(y))
528
- p[g][x] = P;
527
+ for (const [A, P] of Object.entries(b))
528
+ p[g][A] = P;
529
529
  if (l) {
530
- for (const [g, y] of Object.entries(l))
531
- if (y && typeof y == "object" && "sensitiveParams" in y) {
530
+ for (const [g, b] of Object.entries(l))
531
+ if (b && typeof b == "object" && "sensitiveParams" in b) {
532
532
  p[g] || (p[g] = {});
533
- const x = y.sensitiveParams;
534
- if (Array.isArray(x))
535
- for (const P of x) {
536
- const V = Mn(P);
537
- p[g][P] = V || "text";
533
+ const A = b.sensitiveParams;
534
+ if (Array.isArray(A))
535
+ for (const P of A) {
536
+ const R = En(P);
537
+ p[g][P] = R || "text";
538
538
  }
539
- else if (x && typeof x == "object")
540
- for (const [P, V] of Object.entries(x))
541
- p[g][P] = V;
539
+ else if (A && typeof A == "object")
540
+ for (const [P, R] of Object.entries(A))
541
+ p[g][P] = R;
542
542
  }
543
543
  }
544
544
  return p;
@@ -547,35 +547,35 @@ function Cc({
547
547
  [u]
548
548
  ), Ne = ke(
549
549
  (p, g) => {
550
- const y = At[p];
551
- if (!y) return g;
550
+ const b = At[p];
551
+ if (!b) return g;
552
552
  try {
553
- return jo(p, g, y);
554
- } catch (x) {
555
- return console.error(`[useAgent] Failed to redact output for ${p}:`, x), {
553
+ return jo(p, g, b);
554
+ } catch (A) {
555
+ return console.error(`[useAgent] Failed to redact output for ${p}:`, A), {
556
556
  value: ds,
557
557
  [us]: {
558
558
  tool: p,
559
559
  redacted: !0,
560
- error: String(x)
560
+ error: String(A)
561
561
  }
562
562
  };
563
563
  }
564
564
  },
565
565
  [At]
566
- ), [_e, yn] = O(n || null), le = pe(n || null), [bn, kt] = O(null), [vn, Gn] = O(null), Xe = pe(null), [Et, Mt] = O([]), [Oe, xn] = O(
567
- R || (typeof window < "u" ? crypto.randomUUID() : null)
568
- ), [ks, Ut] = O(!1), wn = pe(/* @__PURE__ */ new Set()), [zt, at] = O(/* @__PURE__ */ new Map()), [Es, Yn] = O(/* @__PURE__ */ new Map()), [lt, Hn] = O(/* @__PURE__ */ new Map()), [Jn, _t] = O(/* @__PURE__ */ new Map()), de = L !== void 0, [Xt, mt] = O({}), we = pe({}), Tn = de ? L || {} : Xt;
566
+ ), [_e, gn] = O(n || null), ce = pe(n || null), [yn, kt] = O(null), [bn, qn] = O(null), Xe = pe(null), [Et, Mt] = O([]), [Oe, vn] = O(
567
+ V || (typeof window < "u" ? crypto.randomUUID() : null)
568
+ ), [ks, Ut] = O(!1), xn = pe(/* @__PURE__ */ new Set()), [zt, at] = O(/* @__PURE__ */ new Map()), [Es, Gn] = O(/* @__PURE__ */ new Map()), [lt, Yn] = O(/* @__PURE__ */ new Map()), [Hn, _t] = O(/* @__PURE__ */ new Map()), de = L !== void 0, [Xt, mt] = O({}), we = pe({}), wn = de ? L || {} : Xt;
569
569
  de && L ? we.current = L : de || (we.current = Xt);
570
- const [Je, $e] = O(!1), [Sn, Ze] = O(null), Nt = pe(!1), Zn = ke(async (p, g = 3) => {
571
- if (!Oe || !le.current)
570
+ const [Je, $e] = O(!1), [Tn, Ze] = O(null), Nt = pe(!1), Jn = ke(async (p, g = 3) => {
571
+ if (!Oe || !ce.current)
572
572
  return;
573
- const y = async () => {
574
- const P = `${W.replace("/chat", "").replace(/\/$/, "")}/convex/api/mutation`, V = await fetch(P, {
573
+ const b = async () => {
574
+ const P = `${W.replace("/chat", "").replace(/\/$/, "")}/convex/api/mutation`, R = await fetch(P, {
575
575
  method: "POST",
576
576
  headers: {
577
577
  "Content-Type": "application/json",
578
- Authorization: `Bearer ${le.current}`
578
+ Authorization: `Bearer ${ce.current}`
579
579
  },
580
580
  body: JSON.stringify({
581
581
  path: "conversations:mergeStateByChatId",
@@ -583,90 +583,90 @@ function Cc({
583
583
  format: "json"
584
584
  })
585
585
  });
586
- if (!V.ok) {
587
- if (V.status === 404) {
586
+ if (!R.ok) {
587
+ if (R.status === 404) {
588
588
  console.warn("[useAgent] Convex API endpoint not available (404), state changes will not be persisted");
589
589
  return;
590
590
  }
591
- const $ = await V.text().catch(() => "Unknown error");
592
- throw new Error(`Failed to sync conversation state: ${V.status} ${$}`);
591
+ const $ = await R.text().catch(() => "Unknown error");
592
+ throw new Error(`Failed to sync conversation state: ${R.status} ${$}`);
593
593
  }
594
594
  };
595
- for (let x = 0; x < g; x++)
595
+ for (let A = 0; A < g; A++)
596
596
  try {
597
- await y(), Ze(null);
597
+ await b(), Ze(null);
598
598
  return;
599
599
  } catch (P) {
600
- if (x === g - 1) {
600
+ if (A === g - 1) {
601
601
  const $ = P instanceof Error ? P : new Error(String(P));
602
602
  throw Ze($), console.error("Failed to sync state to Convex after retries:", P), $;
603
603
  }
604
- await new Promise(($) => setTimeout($, Math.pow(2, x) * 100));
604
+ await new Promise(($) => setTimeout($, Math.pow(2, A) * 100));
605
605
  }
606
- }, [Oe, W, le]), De = ee(() => function() {
606
+ }, [Oe, W, ce]), De = ee(() => function() {
607
607
  return we.current;
608
608
  }, []), pt = ee(() => async function(g) {
609
- const y = { ...we.current, ...g };
610
- we.current = y, de || mt(y), D && D(y);
609
+ const b = { ...we.current, ...g };
610
+ we.current = b, de || mt(b), D && D(b);
611
611
  try {
612
- await Zn(g);
613
- } catch (x) {
614
- throw x;
612
+ await Jn(g);
613
+ } catch (A) {
614
+ throw A;
615
615
  }
616
- }, [Zn, D, de]);
616
+ }, [Jn, D, de]);
617
617
  re(() => {
618
618
  de && L && (we.current = L);
619
619
  }, [de, L]);
620
620
  const Le = ke((p) => U ? U.showSecureModal(p) : new Promise((g) => {
621
- at((y) => new Map(y).set(p.id, p)), Yn((y) => new Map(y).set(p.id, g));
622
- }), [U]), Qn = ke((p, g) => {
621
+ at((b) => new Map(b).set(p.id, p)), Gn((b) => new Map(b).set(p.id, g));
622
+ }), [U]), Zn = ke((p, g) => {
623
623
  if (U)
624
624
  return;
625
- const y = Es.get(p);
626
- y && (y(g), at((x) => {
627
- const P = new Map(x);
625
+ const b = Es.get(p);
626
+ b && (b(g), at((A) => {
627
+ const P = new Map(A);
628
628
  return P.delete(p), P;
629
- }), Yn((x) => {
630
- const P = new Map(x);
629
+ }), Gn((A) => {
630
+ const P = new Map(A);
631
631
  return P.delete(p), P;
632
632
  }));
633
633
  }, [Es, U]), Wt = ke((p) => U ? U.showSecureForm(p) : new Promise((g) => {
634
- Hn((y) => new Map(y).set(p.id, p)), _t((y) => new Map(y).set(p.id, g));
634
+ Yn((b) => new Map(b).set(p.id, p)), _t((b) => new Map(b).set(p.id, g));
635
635
  }), [U]), ct = ke((p, g) => {
636
636
  if (U)
637
637
  return;
638
- const y = Jn.get(p);
639
- y && (y(g), Hn((x) => {
640
- const P = new Map(x);
638
+ const b = Hn.get(p);
639
+ b && (b(g), Yn((A) => {
640
+ const P = new Map(A);
641
641
  return P.delete(p), P;
642
- }), _t((x) => {
643
- const P = new Map(x);
642
+ }), _t((A) => {
643
+ const P = new Map(A);
644
644
  return P.delete(p), P;
645
645
  }));
646
- }, [Jn, U]), es = ke((p, g) => {
647
- const y = Ve[p] || {}, x = Object.keys(y).length > 0;
646
+ }, [Hn, U]), Qn = ke((p, g) => {
647
+ const b = Re[p] || {}, A = Object.keys(b).length > 0;
648
648
  if (d) {
649
- const P = Object.keys(g).filter((V) => Mn(V) !== null);
650
- return x || P.length > 0;
649
+ const P = Object.keys(g).filter((R) => En(R) !== null);
650
+ return A || P.length > 0;
651
651
  }
652
- return x;
653
- }, [Ve, d]), ts = ke((p, g) => {
654
- const x = { ...Ve[p] || {} };
652
+ return A;
653
+ }, [Re, d]), es = ke((p, g) => {
654
+ const A = { ...Re[p] || {} };
655
655
  if (d) {
656
- for (const V of Object.keys(g))
657
- if (!(V in x)) {
658
- const $ = Mn(V);
659
- $ && (x[V] = $);
656
+ for (const R of Object.keys(g))
657
+ if (!(R in A)) {
658
+ const $ = En(R);
659
+ $ && (A[R] = $);
660
660
  }
661
661
  }
662
- const P = Object.entries(x).filter(
663
- ([V]) => Object.prototype.hasOwnProperty.call(g, V)
662
+ const P = Object.entries(A).filter(
663
+ ([R]) => Object.prototype.hasOwnProperty.call(g, R)
664
664
  );
665
- return P.length > 0 ? Object.fromEntries(P) : x;
666
- }, [Ve, d]), Qe = ee(() => Y?.enabled ? async function(g, y = 20, x) {
665
+ return P.length > 0 ? Object.fromEntries(P) : A;
666
+ }, [Re, d]), Qe = ee(() => H?.enabled ? async function(g, b = 20, A) {
667
667
  const P = {
668
- ...Y.filters,
669
- ...x
668
+ ...H.filters,
669
+ ...A
670
670
  };
671
671
  if (N && N.length > 1) {
672
672
  const $ = N.map(
@@ -674,23 +674,23 @@ function Cc({
674
674
  method: "POST",
675
675
  headers: {
676
676
  "Content-Type": "application/json",
677
- ...le.current ? { Authorization: `Bearer ${le.current}` } : {}
677
+ ...ce.current ? { Authorization: `Bearer ${ce.current}` } : {}
678
678
  },
679
679
  body: JSON.stringify({
680
680
  q: g,
681
- k: Math.min(y, 100),
681
+ k: Math.min(b, 100),
682
682
  organizationId: q,
683
683
  ...Object.keys(P).length > 0 ? { filters: P } : {}
684
684
  })
685
685
  }).then((oe) => oe.ok ? oe.json() : null)
686
- ), ce = await Promise.all($), te = [];
687
- for (const q of ce)
686
+ ), le = await Promise.all($), te = [];
687
+ for (const q of le)
688
688
  q?.candidates && te.push(...q.candidates);
689
689
  te.sort((q, oe) => {
690
690
  const rt = q.scores?.rerank || q.scores?.dense || 0;
691
691
  return (oe.scores?.rerank || oe.scores?.dense || 0) - rt;
692
692
  });
693
- const Te = te.slice(0, y).map((q, oe) => {
693
+ const Te = te.slice(0, b).map((q, oe) => {
694
694
  const rt = q.citation || q.url;
695
695
  return {
696
696
  rank: oe + 1,
@@ -716,20 +716,20 @@ function Cc({
716
716
  summary: `Found ${te.length} relevant results across ${N.length} source(s) for "${g}". Top result: ${Te[0]?.title || "N/A"}`
717
717
  };
718
718
  }
719
- const V = Y.organizationId && Y.organizationId !== "default" ? Y.organizationId : N && N.length > 0 ? N[0] : void 0;
719
+ const R = H.organizationId && H.organizationId !== "default" ? H.organizationId : N && N.length > 0 ? N[0] : void 0;
720
720
  try {
721
721
  const $ = {
722
722
  q: g,
723
- k: Math.min(y, 100)
723
+ k: Math.min(b, 100)
724
724
  };
725
- V && ($.organizationId = V), Object.keys(P).length > 0 && ($.filters = P);
726
- const ce = {
725
+ R && ($.organizationId = R), Object.keys(P).length > 0 && ($.filters = P);
726
+ const le = {
727
727
  "Content-Type": "application/json"
728
728
  };
729
- le.current && (ce.Authorization = `Bearer ${le.current}`);
729
+ ce.current && (le.Authorization = `Bearer ${ce.current}`);
730
730
  const te = await fetch(`${W}/search`, {
731
731
  method: "POST",
732
- headers: ce,
732
+ headers: le,
733
733
  body: JSON.stringify($)
734
734
  });
735
735
  if (!te.ok) {
@@ -740,13 +740,13 @@ function Cc({
740
740
  };
741
741
  }
742
742
  const Te = await te.json(), q = Te.candidates.map((oe, rt) => {
743
- const kn = oe.citation || oe.url;
743
+ const An = oe.citation || oe.url;
744
744
  return {
745
745
  rank: rt + 1,
746
746
  doc_id: oe.doc_id,
747
747
  block_id: oe.block_id,
748
748
  url: oe.url,
749
- citation: kn,
749
+ citation: An,
750
750
  title: oe.title || "Untitled",
751
751
  snippet: oe.snippet,
752
752
  score: oe.scores?.rerank || oe.scores?.dense || 0,
@@ -770,30 +770,30 @@ function Cc({
770
770
  error: $ instanceof Error ? $.message : "Unknown error occurred"
771
771
  };
772
772
  }
773
- } : null, [Y, W, le]), et = ee(() => Y?.enabled ? async function(g, y) {
774
- const x = Y.organizationId && Y.organizationId !== "default" ? Y.organizationId : N && N.length > 0 ? N[0] : void 0;
773
+ } : null, [H, W, ce]), et = ee(() => H?.enabled ? async function(g, b) {
774
+ const A = H.organizationId && H.organizationId !== "default" ? H.organizationId : N && N.length > 0 ? N[0] : void 0;
775
775
  try {
776
776
  const P = {
777
777
  "Content-Type": "application/json"
778
778
  };
779
- le.current && (P.Authorization = `Bearer ${le.current}`);
780
- const V = await fetch(`${W}/fetch`, {
779
+ ce.current && (P.Authorization = `Bearer ${ce.current}`);
780
+ const R = await fetch(`${W}/fetch`, {
781
781
  method: "POST",
782
782
  headers: P,
783
783
  body: JSON.stringify({
784
784
  doc_id: g,
785
- block_ids: y,
786
- ...x ? { organizationId: x } : {}
785
+ block_ids: b,
786
+ ...A ? { organizationId: A } : {}
787
787
  })
788
788
  });
789
- if (!V.ok) {
790
- const ce = await V.text();
789
+ if (!R.ok) {
790
+ const le = await R.text();
791
791
  return {
792
792
  success: !1,
793
- error: `Fetch failed: ${V.status} ${ce}`
793
+ error: `Fetch failed: ${R.status} ${le}`
794
794
  };
795
795
  }
796
- const $ = await V.json();
796
+ const $ = await R.json();
797
797
  return {
798
798
  success: !0,
799
799
  blocks: $.blocks || [],
@@ -808,39 +808,39 @@ function Cc({
808
808
  error: P instanceof Error ? P.message : "Unknown error occurred"
809
809
  };
810
810
  }
811
- } : null, [Y, W, le]), Pn = ee(() => {
812
- if (H && H.config?.tools) {
813
- const p = bc(H.config.tools, o);
811
+ } : null, [H, W, ce]), Sn = ee(() => {
812
+ if (Y && Y.config?.tools) {
813
+ const p = bc(Y.config.tools, o);
814
814
  return console.log("[useAgent] Merged remote config:", {
815
- remoteToolCount: H.config.tools.length,
815
+ remoteToolCount: Y.config.tools.length,
816
816
  localToolCount: o.length,
817
817
  mergedToolCount: p.length
818
818
  }), p;
819
819
  }
820
820
  return o;
821
- }, [H, o]), We = H?.enableStateTools ?? !0, tt = H?.enableRagTools ?? Y?.enabled ?? !1, ns = ee(() => {
821
+ }, [Y, o]), We = Y?.enableStateTools ?? !0, tt = Y?.enableRagTools ?? H?.enabled ?? !1, ts = ee(() => {
822
822
  const p = [
823
- ...Pn,
823
+ ...Sn,
824
824
  ...i
825
825
  ];
826
- return We && (p.push(De), (!de || A) && p.push(pt)), tt && (Qe && p.push(Qe), et && p.push(et)), p;
827
- }, [Pn, i, De, pt, Qe, et, We, tt, de, A]), ss = ee(() => [...Pn, ...i], [Pn, i]), ut = ee(() => Io(ss, l), [ss, l]), Dt = ee(() => {
828
- const p = /* @__PURE__ */ new Map(), g = new Map(ut.map((y) => [y.name, y]));
829
- return p.set("getState", De), (!de || A) && p.set("setState", pt), Y?.enabled && (Qe && p.set("searchDocs", Qe), et && p.set("fetchDocContent", et)), ns.forEach((y) => {
830
- if (y === De || y === pt || y === Qe || y === et)
826
+ return We && (p.push(De), (!de || C) && p.push(pt)), tt && (Qe && p.push(Qe), et && p.push(et)), p;
827
+ }, [Sn, i, De, pt, Qe, et, We, tt, de, C]), ns = ee(() => [...Sn, ...i], [Sn, i]), ut = ee(() => Io(ns, l), [ns, l]), Dt = ee(() => {
828
+ const p = /* @__PURE__ */ new Map(), g = new Map(ut.map((b) => [b.name, b]));
829
+ return p.set("getState", De), (!de || C) && p.set("setState", pt), H?.enabled && (Qe && p.set("searchDocs", Qe), et && p.set("fetchDocContent", et)), ts.forEach((b) => {
830
+ if (b === De || b === pt || b === Qe || b === et)
831
831
  return;
832
- const x = y[Ge];
833
- if (x) {
834
- const V = g.get(x);
835
- if (V) {
836
- p.set(V.name, y);
832
+ const A = b[Ge];
833
+ if (A) {
834
+ const R = g.get(A);
835
+ if (R) {
836
+ p.set(R.name, b);
837
837
  return;
838
838
  }
839
839
  }
840
- const P = ut.find((V) => V.name === y.name);
841
- P && p.set(P.name, y);
840
+ const P = ut.find((R) => R.name === b.name);
841
+ P && p.set(P.name, b);
842
842
  }), p;
843
- }, [ns, ut, De, pt, Qe, et, Y, de, A]), rs = ee(() => new Set(ut.map((p) => p.name)), [ut]), Cn = ee(() => {
843
+ }, [ts, ut, De, pt, Qe, et, H, de, C]), ss = ee(() => new Set(ut.map((p) => p.name)), [ut]), Pn = ee(() => {
844
844
  const p = [];
845
845
  We && (p.push({
846
846
  name: "getState",
@@ -850,7 +850,7 @@ function Cc({
850
850
  properties: {},
851
851
  required: []
852
852
  }
853
- }), (!de || A) && p.push({
853
+ }), (!de || C) && p.push({
854
854
  name: "setState",
855
855
  description: "Update the agent state. Store IDs, workflow state, checklists, context, and other data that must persist across conversations. Merges with existing state.",
856
856
  jsonSchema: {
@@ -916,43 +916,43 @@ function Cc({
916
916
  }
917
917
  }
918
918
  );
919
- const y = [];
920
- return H?.config?.workflows && H.config.workflows.forEach((x) => {
921
- const P = {}, V = [];
922
- x.parameters && x.parameters.forEach(($) => {
919
+ const b = [];
920
+ return Y?.config?.workflows && Y.config.workflows.forEach((A) => {
921
+ const P = {}, R = [];
922
+ A.parameters && A.parameters.forEach(($) => {
923
923
  P[$.name] = {
924
924
  type: $.type || "string",
925
925
  description: $.description
926
- }, $.required && V.push($.name);
927
- }), y.push({
928
- name: `workflow_${x.name.replace(/\s+/g, "_").toLowerCase()}`,
929
- description: x.description || `Execute the "${x.name}" workflow. ${x.contentPlaintext?.slice(0, 200) || ""}`,
926
+ }, $.required && R.push($.name);
927
+ }), b.push({
928
+ name: `workflow_${A.name.replace(/\s+/g, "_").toLowerCase()}`,
929
+ description: A.description || `Execute the "${A.name}" workflow. ${A.contentPlaintext?.slice(0, 200) || ""}`,
930
930
  jsonSchema: {
931
931
  type: "object",
932
932
  properties: P,
933
- required: V
933
+ required: R
934
934
  },
935
935
  // Store workflow metadata for execution
936
- _workflow: x
936
+ _workflow: A
937
937
  });
938
- }), [...ut, ...p, ...g, ...y];
939
- }, [ut, We, tt, de, A, H]), gt = ee(() => Cn.filter((p) => p.name === "getState" ? We : p.name === "setState" ? We && (!de || A) : p.name === "searchDocs" || p.name === "fetchDocContent" ? tt : p.name.startsWith("workflow_") ? !0 : rs.has(p.name)), [Cn, rs, We, tt, de, A]), Kt = ee(() => {
938
+ }), [...ut, ...p, ...g, ...b];
939
+ }, [ut, We, tt, de, C, Y]), gt = ee(() => Pn.filter((p) => p.name === "getState" ? We : p.name === "setState" ? We && (!de || C) : p.name === "searchDocs" || p.name === "fetchDocContent" ? tt : p.name.startsWith("workflow_") ? !0 : ss.has(p.name)), [Pn, ss, We, tt, de, C]), Kt = ee(() => {
940
940
  const p = /* @__PURE__ */ new Set();
941
- return We && (p.add("getState"), p.add("setState")), tt && Y?.autoExecute !== !1 && (p.add("searchDocs"), p.add("fetchDocContent")), H?.config?.tools ? H.config.tools.forEach((g) => {
941
+ return We && (p.add("getState"), p.add("setState")), tt && H?.autoExecute !== !1 && (p.add("searchDocs"), p.add("fetchDocContent")), Y?.config?.tools ? Y.config.tools.forEach((g) => {
942
942
  g.isEnabled && !g.requiresApproval && p.add(g.name);
943
943
  }) : (i.forEach((g) => {
944
- for (const [y, x] of Dt.entries())
945
- if (x === g) {
946
- p.add(y);
944
+ for (const [b, A] of Dt.entries())
945
+ if (A === g) {
946
+ p.add(b);
947
947
  break;
948
948
  }
949
949
  }), a && Array.isArray(a) && a.forEach((g) => {
950
950
  typeof g == "string" && p.add(g);
951
- })), H?.config?.workflows && H.config.workflows.forEach((g) => {
952
- const y = `workflow_${g.name.replace(/\s+/g, "_").toLowerCase()}`;
953
- g.requiresApproval || p.add(y);
951
+ })), Y?.config?.workflows && Y.config.workflows.forEach((g) => {
952
+ const b = `workflow_${g.name.replace(/\s+/g, "_").toLowerCase()}`;
953
+ g.requiresApproval || p.add(b);
954
954
  }), p;
955
- }, [H, i, a, Dt, We, tt, Y]);
955
+ }, [Y, i, a, Dt, We, tt, H]);
956
956
  re(() => s || n ? void 0 : ((async () => {
957
957
  try {
958
958
  const g = await fetch(t, {
@@ -966,18 +966,18 @@ function Cc({
966
966
  });
967
967
  if (!g.ok)
968
968
  throw new Error("Failed to fetch token");
969
- const y = await g.json();
970
- yn(y.clientToken), le.current = y.clientToken, Gn(y.expiresAt), kt(null);
969
+ const b = await g.json();
970
+ gn(b.clientToken), ce.current = b.clientToken, qn(b.expiresAt), kt(null);
971
971
  } catch (g) {
972
972
  console.error("[useAgent] Token fetch failed:", g), kt(g instanceof Error ? g.message : "Failed to fetch token");
973
973
  }
974
974
  })(), () => {
975
975
  Xe.current && clearTimeout(Xe.current);
976
976
  }), [t, JSON.stringify(r), s, n]), re(() => {
977
- if (!vn || s || n)
977
+ if (!bn || s || n)
978
978
  return;
979
979
  Xe.current && clearTimeout(Xe.current);
980
- const p = Math.floor(Date.now() / 1e3), g = vn - p, x = Math.max(0, g - 5);
980
+ const p = Math.floor(Date.now() / 1e3), g = bn - p, A = Math.max(0, g - 5);
981
981
  return Xe.current = setTimeout(async () => {
982
982
  try {
983
983
  const P = await fetch(t, {
@@ -991,79 +991,57 @@ function Cc({
991
991
  });
992
992
  if (!P.ok)
993
993
  throw new Error("Failed to refresh token");
994
- const V = await P.json();
995
- yn(V.clientToken), le.current = V.clientToken, Gn(V.expiresAt), kt(null);
994
+ const R = await P.json();
995
+ gn(R.clientToken), ce.current = R.clientToken, qn(R.expiresAt), kt(null);
996
996
  } catch (P) {
997
997
  console.error("[useAgent] Token refresh failed:", P), kt(P instanceof Error ? P.message : "Failed to refresh token");
998
998
  }
999
- }, x * 1e3), () => {
999
+ }, A * 1e3), () => {
1000
1000
  Xe.current && clearTimeout(Xe.current);
1001
1001
  };
1002
- }, [vn, t, JSON.stringify(r), s, n]);
1002
+ }, [bn, t, JSON.stringify(r), s, n]);
1003
1003
  const Ms = async (p, g = {}) => {
1004
- const y = g.headers ? new Headers(g.headers) : new Headers();
1005
- y.delete("user-agent"), y.delete("User-Agent"), console.log("[customFetch] ===== REQUEST ====="), console.log("[customFetch] URL:", p), console.log("[customFetch] Stack trace:", new Error().stack), console.log("[useAgent] Making request to:", p), console.log("[useAgent] Method:", g.method || "GET"), console.log("[useAgent] Has Authorization header:", y.has("Authorization")), console.log("[useAgent] Client token available:", !!le.current);
1006
- try {
1007
- const x = await fetch(p, {
1008
- ...g,
1009
- headers: y
1010
- });
1011
- if (!x.ok) {
1012
- console.error("[useAgent] Request failed:", x.status, x.statusText);
1013
- const P = await x.text().catch(() => "Unable to read error response");
1014
- console.error("[useAgent] Error response:", P);
1015
- }
1016
- return x;
1017
- } catch (x) {
1018
- throw console.error("[useAgent] Fetch error:", x), x;
1019
- }
1020
- }, qt = pe(null), An = `${W}/chat`;
1021
- console.log("[useAgent] Chat API URL:", An);
1022
- const { messages: nt, sendMessage: S, status: X, error: _, stop: Q, addToolResult: J, setMessages: Z } = ec({
1004
+ const b = g.headers ? new Headers(g.headers) : new Headers();
1005
+ return b.delete("user-agent"), b.delete("User-Agent"), fetch(p, { ...g, headers: b });
1006
+ }, Cn = pe(null), rs = `${W}/chat`, { messages: nt, sendMessage: T, status: X, error: _, stop: Q, addToolResult: J, setMessages: Z } = ec({
1023
1007
  id: Oe || void 0,
1024
1008
  messages: F,
1025
1009
  transport: new tc({
1026
- api: An,
1010
+ api: rs,
1027
1011
  fetch: Ms,
1028
1012
  headers: () => {
1029
1013
  const p = {};
1030
- return le.current ? (p.Authorization = `Bearer ${le.current}`, console.log("[useAgent] Adding Authorization header with token")) : console.warn("[useAgent] No client token available - request may fail"), p;
1014
+ return ce.current && (p.Authorization = `Bearer ${ce.current}`), p;
1031
1015
  },
1032
- body: () => {
1033
- console.log("[ArctenAgent] body() agentName =", T);
1034
- const p = gt.map((x) => ({
1035
- name: x.name,
1036
- description: x.description,
1037
- inputSchema: x.jsonSchema
1038
- // JSON Schema format from build-time
1039
- })), g = p.filter((x) => x.name === "getState" || x.name === "setState").map((x) => x.name), y = p.filter((x) => x.name === "searchDocs" || x.name === "fetchDocContent").map((x) => x.name);
1040
- return g.length > 0 && console.log("[useAgent] State tools included in tools list sent to AI SDK:", g), y.length > 0 ? console.log("[useAgent] RAG tools included in tools list sent to AI SDK:", y) : Y?.enabled && console.warn("[useAgent] RAG is enabled but no RAG tools found in tools list!"), {
1041
- tools: p,
1042
- ...v && { agentId: v },
1043
- ...T && { agentName: T },
1044
- state: we.current,
1045
- // Always include current state
1046
- ...I && { ragFilters: I }
1047
- };
1048
- }
1016
+ body: () => ({
1017
+ tools: gt.map((g) => ({
1018
+ name: g.name,
1019
+ description: g.description,
1020
+ inputSchema: g.jsonSchema
1021
+ })),
1022
+ ...v && { agentId: v },
1023
+ ...w && { agentName: w },
1024
+ state: we.current,
1025
+ ...I && { ragFilters: I }
1026
+ })
1049
1027
  }),
1050
1028
  sendAutomaticallyWhen: (p) => {
1051
- const g = p.messages, y = g[g.length - 1];
1052
- if (console.log("[sendAutomaticallyWhen] ===== CALLED ====="), console.log("[sendAutomaticallyWhen] lastMessage role:", y?.role), console.log("[sendAutomaticallyWhen] message count:", g.length), y?.role !== "assistant")
1053
- return console.log("[sendAutomaticallyWhen] BLOCKED: not assistant"), !1;
1029
+ const g = p.messages;
1030
+ if (g[g.length - 1]?.role !== "assistant")
1031
+ return !1;
1054
1032
  const P = [...g].reverse().find(($) => $.role === "user")?.id;
1055
- if (console.log("[sendAutomaticallyWhen] lastUserMessageId:", P), console.log("[sendAutomaticallyWhen] ref.current:", qt.current), P && qt.current === P)
1056
- return console.log("[sendAutomaticallyWhen] BLOCKED: already auto-sent for this user message"), !1;
1057
- const V = nc(p);
1058
- return console.log("[sendAutomaticallyWhen] shouldAutoSend (from SDK helper):", V), V && P && (console.log("[sendAutomaticallyWhen] SETTING ref to:", P), qt.current = P), console.log("[sendAutomaticallyWhen] RETURNING:", V), V;
1059
- }
1060
- }), je = S, ie = ke((p) => (qt.current = null, je(p)), [je]), he = ke(
1061
- (p, g, y) => {
1062
- const x = Ne(p, y);
1033
+ if (P && Cn.current === P)
1034
+ return !1;
1035
+ const R = nc(p);
1036
+ return R && P && (Cn.current = P), R;
1037
+ }
1038
+ }), je = T, ie = ke((p) => (Cn.current = null, je(p)), [je]), he = ke(
1039
+ (p, g, b) => {
1040
+ const A = Ne(p, b);
1063
1041
  J({
1064
1042
  toolCallId: g,
1065
1043
  tool: p,
1066
- output: x
1044
+ output: A
1067
1045
  });
1068
1046
  },
1069
1047
  [J, Ne]
@@ -1072,57 +1050,57 @@ function Cc({
1072
1050
  nt.forEach((p) => {
1073
1051
  p.role === "assistant" && p.parts.forEach((g) => {
1074
1052
  if (!g.type?.startsWith("tool-") || g.state !== "input-available") return;
1075
- const y = g.type.replace("tool-", ""), x = g.toolCallId;
1076
- if (wn.current.has(x)) return;
1077
- wn.current.add(x);
1053
+ const b = g.type.replace("tool-", ""), A = g.toolCallId;
1054
+ if (xn.current.has(A)) return;
1055
+ xn.current.add(A);
1078
1056
  const P = yc(g.input);
1079
- if (es(y, P)) {
1080
- const V = ts(y, P), $ = Object.entries(V).filter(
1057
+ if (Qn(b, P)) {
1058
+ const R = es(b, P), $ = Object.entries(R).filter(
1081
1059
  ([q]) => P[q] !== void 0
1082
- ), ce = $.length > 0 ? Object.fromEntries($) : V, te = Object.keys(P), Te = gc(P, ce);
1060
+ ), le = $.length > 0 ? Object.fromEntries($) : R, te = Object.keys(P), Te = gc(P, le);
1083
1061
  (async () => {
1084
1062
  try {
1085
1063
  const q = uc(
1086
- y,
1064
+ b,
1087
1065
  te,
1088
- ce,
1066
+ le,
1089
1067
  P
1090
1068
  ), oe = {
1091
- id: `${x}-form`,
1092
- toolName: y,
1093
- toolCallId: x,
1069
+ id: `${A}-form`,
1070
+ toolName: b,
1071
+ toolCallId: A,
1094
1072
  title: q.title,
1095
1073
  description: q.description,
1096
1074
  fields: q.fields
1097
1075
  }, rt = await Wt(oe);
1098
1076
  if (rt === null) {
1099
- he(y, x, "User cancelled secure input");
1077
+ he(b, A, "User cancelled secure input");
1100
1078
  return;
1101
1079
  }
1102
- const kn = { ...Te, ...rt }, Ns = Dt.get(y);
1080
+ const An = { ...Te, ...rt }, Ns = Dt.get(b);
1103
1081
  if (!Ns)
1104
- throw new Error(`Tool ${y} not found`);
1082
+ throw new Error(`Tool ${b} not found`);
1105
1083
  let Ds;
1106
- const Rs = gt.find((oi) => oi.name === y);
1107
- if (Rs && Rs.jsonSchema?.properties) {
1108
- const Pl = Object.keys(Rs.jsonSchema.properties).map((Cl) => kn[Cl]);
1084
+ const Vs = gt.find((oi) => oi.name === b);
1085
+ if (Vs && Vs.jsonSchema?.properties) {
1086
+ const Pl = Object.keys(Vs.jsonSchema.properties).map((Cl) => An[Cl]);
1109
1087
  Ds = await Ns(...Pl);
1110
1088
  } else
1111
- Ds = await Ns(...Object.values(kn));
1112
- he(y, x, Ds);
1089
+ Ds = await Ns(...Object.values(An));
1090
+ he(b, A, Ds);
1113
1091
  } catch (q) {
1114
- console.error(`[useAgent] Error executing tool with secure input ${y}:`, q), he(y, x, `Error: ${q}`);
1092
+ console.error(`[useAgent] Error executing tool with secure input ${b}:`, q), he(b, A, `Error: ${q}`);
1115
1093
  }
1116
1094
  })();
1117
1095
  return;
1118
1096
  }
1119
- if (y.startsWith("workflow_") && Kt.has(y)) {
1097
+ if (b.startsWith("workflow_") && Kt.has(b)) {
1120
1098
  (async () => {
1121
1099
  try {
1122
- const $ = gt.find((te) => te.name === y)?._workflow;
1100
+ const $ = gt.find((te) => te.name === b)?._workflow;
1123
1101
  if (!$)
1124
- throw new Error(`Workflow metadata not found for ${y}`);
1125
- let ce;
1102
+ throw new Error(`Workflow metadata not found for ${b}`);
1103
+ let le;
1126
1104
  if ($.webhook?.url) {
1127
1105
  let te = P;
1128
1106
  if ($.webhook.bodyTemplate) {
@@ -1140,57 +1118,57 @@ function Cc({
1140
1118
  body: JSON.stringify(te)
1141
1119
  });
1142
1120
  if (Te.ok)
1143
- ce = { success: !0, data: await Te.json().catch(() => ({ success: !0 })) };
1121
+ le = { success: !0, data: await Te.json().catch(() => ({ success: !0 })) };
1144
1122
  else {
1145
1123
  const q = await Te.text();
1146
- ce = { success: !1, error: `Webhook failed: ${Te.status} ${q}` };
1124
+ le = { success: !1, error: `Webhook failed: ${Te.status} ${q}` };
1147
1125
  }
1148
1126
  } else
1149
- ce = {
1127
+ le = {
1150
1128
  success: !0,
1151
1129
  message: `Workflow "${$.name}" acknowledged. Follow the workflow instructions to proceed.`,
1152
1130
  instructions: $.contentPlaintext
1153
1131
  };
1154
- he(y, x, ce);
1155
- } catch (V) {
1156
- console.error(`[useAgent] Error executing workflow ${y}:`, V), he(y, x, `Error: ${V}`);
1132
+ he(b, A, le);
1133
+ } catch (R) {
1134
+ console.error(`[useAgent] Error executing workflow ${b}:`, R), he(b, A, `Error: ${R}`);
1157
1135
  }
1158
1136
  })();
1159
1137
  return;
1160
1138
  }
1161
- if (Kt.has(y) && !es(y, P)) {
1162
- const V = Dt.get(y);
1163
- V ? (async () => {
1139
+ if (Kt.has(b) && !Qn(b, P)) {
1140
+ const R = Dt.get(b);
1141
+ R ? (async () => {
1164
1142
  try {
1165
- const $ = gt.find((te) => te.name === y);
1166
- let ce;
1143
+ const $ = gt.find((te) => te.name === b);
1144
+ let le;
1167
1145
  if ($ && $.jsonSchema?.properties) {
1168
1146
  const Te = Object.keys($.jsonSchema.properties).map((q) => P[q]);
1169
- ce = await V(...Te);
1170
- } else if (y === "getState")
1171
- ce = V();
1172
- else if (y === "setState") {
1147
+ le = await R(...Te);
1148
+ } else if (b === "getState")
1149
+ le = R();
1150
+ else if (b === "setState") {
1173
1151
  const te = P.updates || P;
1174
- ce = await V(te);
1152
+ le = await R(te);
1175
1153
  } else
1176
- ce = await V(...Object.values(P));
1177
- he(y, x, ce);
1154
+ le = await R(...Object.values(P));
1155
+ he(b, A, le);
1178
1156
  } catch ($) {
1179
- console.error(`[useAgent] Error executing tool ${y}:`, $), he(y, x, `Error: ${$}`);
1157
+ console.error(`[useAgent] Error executing tool ${b}:`, $), he(b, A, `Error: ${$}`);
1180
1158
  }
1181
- })() : console.warn(`[useAgent] Tool ${y} not found in toolsMap`);
1182
- } else y.startsWith("workflow_") && j ? j({ toolCall: {
1183
- toolCallId: x,
1184
- toolName: y,
1159
+ })() : console.warn(`[useAgent] Tool ${b} not found in toolsMap`);
1160
+ } else b.startsWith("workflow_") && j ? j({ toolCall: {
1161
+ toolCallId: A,
1162
+ toolName: b,
1185
1163
  args: P
1186
1164
  } }) : j && j({ toolCall: {
1187
- toolCallId: x,
1188
- toolName: y,
1165
+ toolCallId: A,
1166
+ toolName: b,
1189
1167
  args: P
1190
1168
  } });
1191
1169
  });
1192
1170
  });
1193
- }, [nt, Kt, Dt, j, he, pt, gt, es, ts, Le]), re(() => {
1171
+ }, [nt, Kt, Dt, j, he, pt, gt, Qn, es, Le]), re(() => {
1194
1172
  if (X === "ready" && nt.length > 0 && k) {
1195
1173
  const p = nt[nt.length - 1];
1196
1174
  p && p.role === "assistant" && k({
@@ -1222,7 +1200,7 @@ function Cc({
1222
1200
  re(() => {
1223
1201
  r?.id && _e && K();
1224
1202
  }, [JSON.stringify(r), _e, W]), re(() => {
1225
- if (!Oe || !le.current) return;
1203
+ if (!Oe || !ce.current) return;
1226
1204
  (async () => {
1227
1205
  $e(!0), Ze(null);
1228
1206
  try {
@@ -1230,7 +1208,7 @@ function Cc({
1230
1208
  method: "POST",
1231
1209
  headers: {
1232
1210
  "Content-Type": "application/json",
1233
- Authorization: `Bearer ${le.current}`
1211
+ Authorization: `Bearer ${ce.current}`
1234
1212
  },
1235
1213
  body: JSON.stringify({
1236
1214
  path: "conversations:getStateByChatId",
@@ -1242,29 +1220,29 @@ function Cc({
1242
1220
  const P = await g.text().catch(() => "Unknown error");
1243
1221
  throw new Error(`Failed to fetch conversation state: ${g.status} ${P}`);
1244
1222
  }
1245
- const x = (await g.json())?.value || {};
1246
- we.current = x, de || mt(x), D && D(x), Nt.current = !0;
1223
+ const A = (await g.json())?.value || {};
1224
+ we.current = A, de || mt(A), D && D(A), Nt.current = !0;
1247
1225
  } catch (g) {
1248
1226
  console.error("Failed to fetch state:", g);
1249
- const y = g instanceof Error ? g : new Error(String(g));
1250
- Ze(y), Nt.current || (we.current = {}, de ? D && D({}) : (mt({}), D && D({})), Nt.current = !0);
1227
+ const b = g instanceof Error ? g : new Error(String(g));
1228
+ Ze(b), Nt.current || (we.current = {}, de ? D && D({}) : (mt({}), D && D({})), Nt.current = !0);
1251
1229
  } finally {
1252
1230
  $e(!1);
1253
1231
  }
1254
1232
  })();
1255
1233
  }, [Oe, W, de, D]);
1256
1234
  async function ye(p) {
1257
- xn(p), Ut(!0);
1235
+ vn(p), Ut(!0);
1258
1236
  try {
1259
1237
  const g = await fetch(`${W}/conversations/${p}/messages`, {
1260
1238
  headers: {
1261
- Authorization: `Bearer ${le.current}`
1239
+ Authorization: `Bearer ${ce.current}`
1262
1240
  }
1263
1241
  });
1264
1242
  if (!g.ok)
1265
1243
  throw new Error(`Failed to fetch messages: ${g.statusText}`);
1266
- const x = (await g.json()).messages || [];
1267
- Z(x);
1244
+ const A = (await g.json()).messages || [];
1245
+ Z(A);
1268
1246
  } catch (g) {
1269
1247
  console.error("Failed to load conversation messages:", g);
1270
1248
  } finally {
@@ -1286,33 +1264,33 @@ function Cc({
1286
1264
  }
1287
1265
  function Ae() {
1288
1266
  const p = crypto.randomUUID();
1289
- xn(p), Z([]), wn.current = /* @__PURE__ */ new Set(), we.current = {}, de ? D && D({}) : (mt({}), D && D({})), Nt.current = !1;
1267
+ vn(p), Z([]), xn.current = /* @__PURE__ */ new Set(), we.current = {}, de ? D && D({}) : (mt({}), D && D({})), Nt.current = !1;
1290
1268
  }
1291
1269
  function fe(p) {
1292
- const g = p.tool || "unknown-tool", y = Ne(g, p.output);
1270
+ const g = p.tool || "unknown-tool", b = Ne(g, p.output);
1293
1271
  J({
1294
1272
  toolCallId: p.toolCallId,
1295
1273
  tool: g,
1296
- output: y
1274
+ output: b
1297
1275
  });
1298
1276
  }
1299
- async function st(p, g, y) {
1277
+ async function st(p, g, b) {
1300
1278
  if (!g.startsWith("workflow_"))
1301
1279
  throw new Error(`${g} is not a workflow tool`);
1302
1280
  try {
1303
1281
  const P = gt.find(($) => $.name === g)?._workflow;
1304
1282
  if (!P)
1305
1283
  throw new Error(`Workflow metadata not found for ${g}`);
1306
- let V;
1284
+ let R;
1307
1285
  if (P.webhook?.url) {
1308
- let $ = y;
1286
+ let $ = b;
1309
1287
  if (P.webhook.bodyTemplate) {
1310
1288
  let te = P.webhook.bodyTemplate;
1311
- Object.entries(y).forEach(([Te, q]) => {
1289
+ Object.entries(b).forEach(([Te, q]) => {
1312
1290
  te = te.replace(new RegExp(`\\{\\{${Te}\\}\\}`, "g"), String(q));
1313
1291
  }), $ = JSON.parse(te);
1314
1292
  }
1315
- const ce = await fetch(P.webhook.url, {
1293
+ const le = await fetch(P.webhook.url, {
1316
1294
  method: P.webhook.method || "POST",
1317
1295
  headers: {
1318
1296
  "Content-Type": "application/json",
@@ -1320,31 +1298,31 @@ function Cc({
1320
1298
  },
1321
1299
  body: JSON.stringify($)
1322
1300
  });
1323
- if (ce.ok)
1324
- V = { success: !0, data: await ce.json().catch(() => ({ success: !0 })) };
1301
+ if (le.ok)
1302
+ R = { success: !0, data: await le.json().catch(() => ({ success: !0 })) };
1325
1303
  else {
1326
- const te = await ce.text();
1327
- V = { success: !1, error: `Webhook failed: ${ce.status} ${te}` };
1304
+ const te = await le.text();
1305
+ R = { success: !1, error: `Webhook failed: ${le.status} ${te}` };
1328
1306
  }
1329
1307
  } else
1330
- V = {
1308
+ R = {
1331
1309
  success: !0,
1332
1310
  message: `Workflow "${P.name}" acknowledged. Follow the workflow instructions to proceed.`,
1333
1311
  instructions: P.contentPlaintext
1334
1312
  };
1335
- return fe({ toolCallId: p, tool: g, output: V }), V;
1336
- } catch (x) {
1337
- const P = { success: !1, error: String(x) };
1338
- throw fe({ toolCallId: p, tool: g, output: P }), x;
1313
+ return fe({ toolCallId: p, tool: g, output: R }), R;
1314
+ } catch (A) {
1315
+ const P = { success: !1, error: String(A) };
1316
+ throw fe({ toolCallId: p, tool: g, output: P }), A;
1339
1317
  }
1340
1318
  }
1341
1319
  async function Pe(p) {
1342
1320
  const g = { ...we.current, ...p };
1343
1321
  we.current = g, de || mt(g), D && D(g);
1344
1322
  try {
1345
- await Zn(p);
1346
- } catch (y) {
1347
- throw y;
1323
+ await Jn(p);
1324
+ } catch (b) {
1325
+ throw b;
1348
1326
  }
1349
1327
  }
1350
1328
  return {
@@ -1364,16 +1342,16 @@ function Cc({
1364
1342
  startNewConversation: Ae,
1365
1343
  isLoadingConversations: ks,
1366
1344
  clientToken: _e,
1367
- tokenError: bn,
1345
+ tokenError: yn,
1368
1346
  // State management
1369
- state: Tn,
1347
+ state: wn,
1370
1348
  // Read-only, reactive (uses useState for reactivity)
1371
1349
  setState: Pe,
1372
1350
  isStateLoading: Je,
1373
- stateError: Sn,
1351
+ stateError: Tn,
1374
1352
  // Secure input management
1375
1353
  pendingSecureInputs: Array.from(zt.values()),
1376
- completeSecureInput: Qn,
1354
+ completeSecureInput: Zn,
1377
1355
  // Secure form management
1378
1356
  pendingSecureForms: Array.from(lt.values()),
1379
1357
  completeSecureForm: ct,
@@ -1384,7 +1362,7 @@ function Cc({
1384
1362
  function se(...e) {
1385
1363
  return rc(sc(e));
1386
1364
  }
1387
- const Vt = Vo(
1365
+ const Rt = Ro(
1388
1366
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-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 active:scale-95",
1389
1367
  {
1390
1368
  variants: {
@@ -1411,16 +1389,16 @@ const Vt = Vo(
1411
1389
  }
1412
1390
  }
1413
1391
  ), Me = qe.forwardRef(({ className: e, variant: t, size: n, asChild: s = !1, ...r }, o) => /* @__PURE__ */ h(
1414
- s ? Ro : "button",
1392
+ s ? Vo : "button",
1415
1393
  {
1416
1394
  ref: o,
1417
1395
  "data-slot": "button",
1418
- className: se(Vt({ variant: t, size: n, className: e })),
1396
+ className: se(Rt({ variant: t, size: n, className: e })),
1419
1397
  ...r
1420
1398
  }
1421
1399
  ));
1422
1400
  Me.displayName = "Button";
1423
- const Ac = Vo(
1401
+ const Ac = Ro(
1424
1402
  "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",
1425
1403
  {
1426
1404
  variants: {
@@ -1436,14 +1414,14 @@ const Ac = Vo(
1436
1414
  }
1437
1415
  }
1438
1416
  );
1439
- function Vs({
1417
+ function Rs({
1440
1418
  className: e,
1441
1419
  variant: t,
1442
1420
  asChild: n = !1,
1443
1421
  ...s
1444
1422
  }) {
1445
1423
  return /* @__PURE__ */ h(
1446
- n ? Ro : "span",
1424
+ n ? Vo : "span",
1447
1425
  {
1448
1426
  "data-slot": "badge",
1449
1427
  className: se(Ac({ variant: t }), e),
@@ -1511,7 +1489,7 @@ function Ec({
1511
1489
  ...t
1512
1490
  }) {
1513
1491
  return /* @__PURE__ */ h(
1514
- tn.Provider,
1492
+ en.Provider,
1515
1493
  {
1516
1494
  "data-slot": "tooltip-provider",
1517
1495
  delayDuration: e,
@@ -1522,12 +1500,12 @@ function Ec({
1522
1500
  function yt({
1523
1501
  ...e
1524
1502
  }) {
1525
- return /* @__PURE__ */ h(Ec, { children: /* @__PURE__ */ h(tn.Root, { "data-slot": "tooltip", ...e }) });
1503
+ return /* @__PURE__ */ h(Ec, { children: /* @__PURE__ */ h(en.Root, { "data-slot": "tooltip", ...e }) });
1526
1504
  }
1527
1505
  function bt({
1528
1506
  ...e
1529
1507
  }) {
1530
- return /* @__PURE__ */ h(tn.Trigger, { "data-slot": "tooltip-trigger", ...e });
1508
+ return /* @__PURE__ */ h(en.Trigger, { "data-slot": "tooltip-trigger", ...e });
1531
1509
  }
1532
1510
  function vt({
1533
1511
  className: e,
@@ -1535,8 +1513,8 @@ function vt({
1535
1513
  children: n,
1536
1514
  ...s
1537
1515
  }) {
1538
- return /* @__PURE__ */ h(tn.Portal, { children: /* @__PURE__ */ C(
1539
- tn.Content,
1516
+ return /* @__PURE__ */ h(en.Portal, { children: /* @__PURE__ */ S(
1517
+ en.Content,
1540
1518
  {
1541
1519
  "data-slot": "tooltip-content",
1542
1520
  sideOffset: t,
@@ -1547,7 +1525,7 @@ function vt({
1547
1525
  ...s,
1548
1526
  children: [
1549
1527
  n,
1550
- /* @__PURE__ */ h(tn.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
1528
+ /* @__PURE__ */ h(en.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
1551
1529
  ]
1552
1530
  }
1553
1531
  ) });
@@ -1584,10 +1562,10 @@ const dt = (e, t, n) => n > t ? t : n < e ? e : n;
1584
1562
  function Zs(e, t) {
1585
1563
  return t ? `${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}` : e;
1586
1564
  }
1587
- let on = () => {
1565
+ let rn = () => {
1588
1566
  }, ht = () => {
1589
1567
  };
1590
- process.env.NODE_ENV !== "production" && (on = (e, t, n) => {
1568
+ process.env.NODE_ENV !== "production" && (rn = (e, t, n) => {
1591
1569
  !e && typeof console < "u" && console.warn(Zs(t, n));
1592
1570
  }, ht = (e, t, n) => {
1593
1571
  if (!e)
@@ -1603,7 +1581,7 @@ function Er(e) {
1603
1581
  let t;
1604
1582
  return () => (t === void 0 && (t = e()), t);
1605
1583
  }
1606
- const ze = /* @__NO_SIDE_EFFECTS__ */ (e) => e, Mc = (e, t) => (n) => t(e(n)), Xn = (...e) => e.reduce(Mc), jn = /* @__NO_SIDE_EFFECTS__ */ (e, t, n) => {
1584
+ const ze = /* @__NO_SIDE_EFFECTS__ */ (e) => e, Mc = (e, t) => (n) => t(e(n)), _n = (...e) => e.reduce(Mc), Ln = /* @__NO_SIDE_EFFECTS__ */ (e, t, n) => {
1607
1585
  const s = t - e;
1608
1586
  return s === 0 ? 1 : (n - e) / s;
1609
1587
  };
@@ -1641,25 +1619,25 @@ function Nr(e, t, n) {
1641
1619
  e || ci.has(t) || (console.warn(Zs(t, n)), ci.add(t));
1642
1620
  }
1643
1621
  const Xo = (e, t, n) => (((1 - 3 * n + 3 * t) * e + (3 * n - 6 * t)) * e + 3 * t) * e, Nc = 1e-7, Dc = 12;
1644
- function Rc(e, t, n, s, r) {
1622
+ function Vc(e, t, n, s, r) {
1645
1623
  let o, i, a = 0;
1646
1624
  do
1647
1625
  i = t + (n - t) / 2, o = Xo(i, s, r) - e, o > 0 ? n = i : t = i;
1648
1626
  while (Math.abs(o) > Nc && ++a < Dc);
1649
1627
  return i;
1650
1628
  }
1651
- function Wn(e, t, n, s) {
1629
+ function Xn(e, t, n, s) {
1652
1630
  if (e === t && n === s)
1653
1631
  return ze;
1654
- const r = (o) => Rc(o, 0, 1, e, n);
1632
+ const r = (o) => Vc(o, 0, 1, e, n);
1655
1633
  return (o) => o === 0 || o === 1 ? o : Xo(r(o), t, s);
1656
1634
  }
1657
- const Wo = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, Ko = (e) => (t) => 1 - e(1 - t), qo = /* @__PURE__ */ Wn(0.33, 1.53, 0.69, 0.99), Dr = /* @__PURE__ */ Ko(qo), Go = /* @__PURE__ */ Wo(Dr), Yo = (e) => (e *= 2) < 1 ? 0.5 * Dr(e) : 0.5 * (2 - Math.pow(2, -10 * (e - 1))), Rr = (e) => 1 - Math.sin(Math.acos(e)), Ho = Ko(Rr), Jo = Wo(Rr), Vc = /* @__PURE__ */ Wn(0.42, 0, 1, 1), Ic = /* @__PURE__ */ Wn(0, 0, 0.58, 1), Zo = /* @__PURE__ */ Wn(0.42, 0, 0.58, 1), Oc = (e) => Array.isArray(e) && typeof e[0] != "number", Qo = (e) => Array.isArray(e) && typeof e[0] == "number", ui = {
1635
+ const Wo = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, Ko = (e) => (t) => 1 - e(1 - t), qo = /* @__PURE__ */ Xn(0.33, 1.53, 0.69, 0.99), Dr = /* @__PURE__ */ Ko(qo), Go = /* @__PURE__ */ Wo(Dr), Yo = (e) => (e *= 2) < 1 ? 0.5 * Dr(e) : 0.5 * (2 - Math.pow(2, -10 * (e - 1))), Vr = (e) => 1 - Math.sin(Math.acos(e)), Ho = Ko(Vr), Jo = Wo(Vr), Rc = /* @__PURE__ */ Xn(0.42, 0, 1, 1), Ic = /* @__PURE__ */ Xn(0, 0, 0.58, 1), Zo = /* @__PURE__ */ Xn(0.42, 0, 0.58, 1), Oc = (e) => Array.isArray(e) && typeof e[0] != "number", Qo = (e) => Array.isArray(e) && typeof e[0] == "number", ui = {
1658
1636
  linear: ze,
1659
- easeIn: Vc,
1637
+ easeIn: Rc,
1660
1638
  easeInOut: Zo,
1661
1639
  easeOut: Ic,
1662
- circIn: Rr,
1640
+ circIn: Vr,
1663
1641
  circInOut: Jo,
1664
1642
  circOut: Ho,
1665
1643
  backIn: Dr,
@@ -1670,7 +1648,7 @@ const Wo = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, Ko
1670
1648
  if (Qo(e)) {
1671
1649
  ht(e.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
1672
1650
  const [t, n, s, r] = e;
1673
- return Wn(t, n, s, r);
1651
+ return Xn(t, n, s, r);
1674
1652
  } else if (Lc(e))
1675
1653
  return ht(ui[e] !== void 0, `Invalid easing type '${e}'`, "invalid-easing-type"), ui[e];
1676
1654
  return e;
@@ -1708,8 +1686,8 @@ function jc(e, t) {
1708
1686
  * Schedule a process to run on the next frame.
1709
1687
  */
1710
1688
  schedule: (u, d = !1, f = !1) => {
1711
- const w = f && r ? n : s;
1712
- return d && i.add(u), w.has(u) || w.add(u), u;
1689
+ const x = f && r ? n : s;
1690
+ return d && i.add(u), x.has(u) || x.add(u), u;
1713
1691
  },
1714
1692
  /**
1715
1693
  * Cancel the provided callback from running on the next frame.
@@ -1737,15 +1715,15 @@ function ea(e, t) {
1737
1715
  delta: 0,
1738
1716
  timestamp: 0,
1739
1717
  isProcessing: !1
1740
- }, o = () => n = !0, i = is.reduce((E, F) => (E[F] = jc(o), E), {}), { setup: a, read: l, resolveKeyframes: c, preUpdate: u, update: d, preRender: f, render: m, postRender: w } = i, v = () => {
1718
+ }, o = () => n = !0, i = is.reduce((E, F) => (E[F] = jc(o), E), {}), { setup: a, read: l, resolveKeyframes: c, preUpdate: u, update: d, preRender: f, render: m, postRender: x } = i, v = () => {
1741
1719
  const E = ft.useManualTiming ? r.timestamp : performance.now();
1742
- n = !1, ft.useManualTiming || (r.delta = s ? 1e3 / 60 : Math.max(Math.min(E - r.timestamp, $c), 1)), r.timestamp = E, 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(v));
1743
- }, T = () => {
1720
+ n = !1, ft.useManualTiming || (r.delta = s ? 1e3 / 60 : Math.max(Math.min(E - r.timestamp, $c), 1)), r.timestamp = E, r.isProcessing = !0, a.process(r), l.process(r), c.process(r), u.process(r), d.process(r), f.process(r), m.process(r), x.process(r), r.isProcessing = !1, n && t && (s = !1, e(v));
1721
+ }, w = () => {
1744
1722
  n = !0, s = !0, r.isProcessing || e(v);
1745
1723
  };
1746
1724
  return { schedule: is.reduce((E, F) => {
1747
- const R = i[F];
1748
- return E[F] = (L, D = !1, A = !1) => (n || T(), R.schedule(L, D, A)), E;
1725
+ const V = i[F];
1726
+ return E[F] = (L, D = !1, C = !1) => (n || w(), V.schedule(L, D, C)), E;
1749
1727
  }, {}), cancel: (E) => {
1750
1728
  for (let F = 0; F < is.length; F++)
1751
1729
  i[is[F]].cancel(E);
@@ -1761,17 +1739,17 @@ const Ie = {
1761
1739
  set: (e) => {
1762
1740
  hs = e, queueMicrotask(Fc);
1763
1741
  }
1764
- }, ta = (e) => (t) => typeof t == "string" && t.startsWith(e), Vr = /* @__PURE__ */ ta("--"), Bc = /* @__PURE__ */ ta("var(--"), Ir = (e) => Bc(e) ? Uc.test(e.split("/*")[0].trim()) : !1, Uc = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, an = {
1742
+ }, ta = (e) => (t) => typeof t == "string" && t.startsWith(e), Rr = /* @__PURE__ */ ta("--"), Bc = /* @__PURE__ */ ta("var(--"), Ir = (e) => Bc(e) ? Uc.test(e.split("/*")[0].trim()) : !1, Uc = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, on = {
1765
1743
  test: (e) => typeof e == "number",
1766
1744
  parse: parseFloat,
1767
1745
  transform: (e) => e
1768
- }, $n = {
1769
- ...an,
1746
+ }, jn = {
1747
+ ...on,
1770
1748
  transform: (e) => dt(0, 1, e)
1771
1749
  }, os = {
1772
- ...an,
1750
+ ...on,
1773
1751
  default: 1
1774
- }, Rn = (e) => Math.round(e * 1e5) / 1e5, Or = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
1752
+ }, Dn = (e) => Math.round(e * 1e5) / 1e5, Or = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
1775
1753
  function zc(e) {
1776
1754
  return e == null;
1777
1755
  }
@@ -1786,12 +1764,12 @@ const _c = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s
1786
1764
  alpha: a !== void 0 ? parseFloat(a) : 1
1787
1765
  };
1788
1766
  }, Xc = (e) => dt(0, 255, e), Os = {
1789
- ...an,
1767
+ ...on,
1790
1768
  transform: (e) => Math.round(Xc(e))
1791
1769
  }, Ot = {
1792
1770
  test: /* @__PURE__ */ Lr("rgb", "red"),
1793
1771
  parse: /* @__PURE__ */ na("red", "green", "blue"),
1794
- transform: ({ red: e, green: t, blue: n, alpha: s = 1 }) => "rgba(" + Os.transform(e) + ", " + Os.transform(t) + ", " + Os.transform(n) + ", " + Rn($n.transform(s)) + ")"
1772
+ transform: ({ red: e, green: t, blue: n, alpha: s = 1 }) => "rgba(" + Os.transform(e) + ", " + Os.transform(t) + ", " + Os.transform(n) + ", " + Dn(jn.transform(s)) + ")"
1795
1773
  };
1796
1774
  function Wc(e) {
1797
1775
  let t = "", n = "", s = "", r = "";
@@ -1806,22 +1784,22 @@ const Qs = {
1806
1784
  test: /* @__PURE__ */ Lr("#"),
1807
1785
  parse: Wc,
1808
1786
  transform: Ot.transform
1809
- }, Kn = /* @__NO_SIDE_EFFECTS__ */ (e) => ({
1787
+ }, Wn = /* @__NO_SIDE_EFFECTS__ */ (e) => ({
1810
1788
  test: (t) => typeof t == "string" && t.endsWith(e) && t.split(" ").length === 1,
1811
1789
  parse: parseFloat,
1812
1790
  transform: (t) => `${t}${e}`
1813
- }), xt = /* @__PURE__ */ Kn("deg"), it = /* @__PURE__ */ Kn("%"), z = /* @__PURE__ */ Kn("px"), Kc = /* @__PURE__ */ Kn("vh"), qc = /* @__PURE__ */ Kn("vw"), hi = {
1791
+ }), xt = /* @__PURE__ */ Wn("deg"), it = /* @__PURE__ */ Wn("%"), z = /* @__PURE__ */ Wn("px"), Kc = /* @__PURE__ */ Wn("vh"), qc = /* @__PURE__ */ Wn("vw"), hi = {
1814
1792
  ...it,
1815
1793
  parse: (e) => it.parse(e) / 100,
1816
1794
  transform: (e) => it.transform(e * 100)
1817
- }, Yt = {
1795
+ }, Gt = {
1818
1796
  test: /* @__PURE__ */ Lr("hsl", "hue"),
1819
1797
  parse: /* @__PURE__ */ na("hue", "saturation", "lightness"),
1820
- transform: ({ hue: e, saturation: t, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(e) + ", " + it.transform(Rn(t)) + ", " + it.transform(Rn(n)) + ", " + Rn($n.transform(s)) + ")"
1798
+ transform: ({ hue: e, saturation: t, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(e) + ", " + it.transform(Dn(t)) + ", " + it.transform(Dn(n)) + ", " + Dn(jn.transform(s)) + ")"
1821
1799
  }, ve = {
1822
- test: (e) => Ot.test(e) || Qs.test(e) || Yt.test(e),
1823
- parse: (e) => Ot.test(e) ? Ot.parse(e) : Yt.test(e) ? Yt.parse(e) : Qs.parse(e),
1824
- transform: (e) => typeof e == "string" ? e : e.hasOwnProperty("red") ? Ot.transform(e) : Yt.transform(e),
1800
+ test: (e) => Ot.test(e) || Qs.test(e) || Gt.test(e),
1801
+ parse: (e) => Ot.test(e) ? Ot.parse(e) : Gt.test(e) ? Gt.parse(e) : Qs.parse(e),
1802
+ transform: (e) => typeof e == "string" ? e : e.hasOwnProperty("red") ? Ot.transform(e) : Gt.transform(e),
1825
1803
  getAnimatableNone: (e) => {
1826
1804
  const t = ve.parse(e);
1827
1805
  return t.alpha = 0, ve.transform(t);
@@ -1831,7 +1809,7 @@ function Yc(e) {
1831
1809
  return isNaN(e) && typeof e == "string" && (e.match(Or)?.length || 0) + (e.match(Gc)?.length || 0) > 0;
1832
1810
  }
1833
1811
  const sa = "number", ra = "color", Hc = "var", Jc = "var(", fi = "${}", Zc = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
1834
- function Fn(e) {
1812
+ function $n(e) {
1835
1813
  const t = e.toString(), n = [], s = {
1836
1814
  color: [],
1837
1815
  number: [],
@@ -1842,16 +1820,16 @@ function Fn(e) {
1842
1820
  return { values: n, split: a, indexes: s, types: r };
1843
1821
  }
1844
1822
  function ia(e) {
1845
- return Fn(e).values;
1823
+ return $n(e).values;
1846
1824
  }
1847
1825
  function oa(e) {
1848
- const { split: t, types: n } = Fn(e), s = t.length;
1826
+ const { split: t, types: n } = $n(e), s = t.length;
1849
1827
  return (r) => {
1850
1828
  let o = "";
1851
1829
  for (let i = 0; i < s; i++)
1852
1830
  if (o += t[i], r[i] !== void 0) {
1853
1831
  const a = n[i];
1854
- a === sa ? o += Rn(r[i]) : a === ra ? o += ve.transform(r[i]) : o += r[i];
1832
+ a === sa ? o += Dn(r[i]) : a === ra ? o += ve.transform(r[i]) : o += r[i];
1855
1833
  }
1856
1834
  return o;
1857
1835
  };
@@ -1892,13 +1870,13 @@ function bs(e, t) {
1892
1870
  const ge = (e, t, n) => e + (t - e) * n, js = (e, t, n) => {
1893
1871
  const s = e * e, r = n * (t * t - s) + s;
1894
1872
  return r < 0 ? 0 : Math.sqrt(r);
1895
- }, nu = [Qs, Ot, Yt], su = (e) => nu.find((t) => t.test(e));
1873
+ }, nu = [Qs, Ot, Gt], su = (e) => nu.find((t) => t.test(e));
1896
1874
  function mi(e) {
1897
1875
  const t = su(e);
1898
- if (on(!!t, `'${e}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !t)
1876
+ if (rn(!!t, `'${e}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !t)
1899
1877
  return !1;
1900
1878
  let n = t.parse(e);
1901
- return t === Yt && (n = tu(n)), n;
1879
+ return t === Gt && (n = tu(n)), n;
1902
1880
  }
1903
1881
  const pi = (e, t) => {
1904
1882
  const n = mi(e), s = mi(t);
@@ -1943,8 +1921,8 @@ function au(e, t) {
1943
1921
  return n;
1944
1922
  }
1945
1923
  const lu = (e, t) => {
1946
- const n = Tt.createTransformer(t), s = Fn(e), r = Fn(t);
1947
- return s.indexes.var.length === r.indexes.var.length && s.indexes.color.length === r.indexes.color.length && s.indexes.number.length >= r.indexes.number.length ? er.has(e) && !r.values.length || er.has(t) && !s.values.length ? ru(e, t) : Xn(aa(au(s, r), r.values), n) : (on(!0, `Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), bs(e, t));
1924
+ const n = Tt.createTransformer(t), s = $n(e), r = $n(t);
1925
+ return s.indexes.var.length === r.indexes.var.length && s.indexes.color.length === r.indexes.color.length && s.indexes.number.length >= r.indexes.number.length ? er.has(e) && !r.values.length || er.has(t) && !s.values.length ? ru(e, t) : _n(aa(au(s, r), r.values), n) : (rn(!0, `Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), bs(e, t));
1948
1926
  };
1949
1927
  function la(e, t, n) {
1950
1928
  return typeof e == "number" && typeof t == "number" && typeof n == "number" ? ge(e, t, n) : jr(e)(e, t);
@@ -2019,14 +1997,14 @@ const me = {
2019
1997
  }, $s = 1e-3;
2020
1998
  function hu({ duration: e = me.duration, bounce: t = me.bounce, velocity: n = me.velocity, mass: s = me.mass }) {
2021
1999
  let r, o;
2022
- on(e <= /* @__PURE__ */ Ye(me.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
2000
+ rn(e <= /* @__PURE__ */ Ye(me.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
2023
2001
  let i = 1 - t;
2024
2002
  i = dt(me.minDamping, me.maxDamping, i), e = dt(me.minDuration, me.maxDuration, /* @__PURE__ */ Ue(e)), i < 1 ? (r = (c) => {
2025
- const u = c * i, d = u * e, f = u - n, m = tr(c, i), w = Math.exp(-d);
2026
- return $s - f / m * w;
2003
+ const u = c * i, d = u * e, f = u - n, m = tr(c, i), x = Math.exp(-d);
2004
+ return $s - f / m * x;
2027
2005
  }, o = (c) => {
2028
- const d = c * i * e, f = d * n + n, m = Math.pow(i, 2) * Math.pow(c, 2) * e, w = Math.exp(-d), v = tr(Math.pow(c, 2), i);
2029
- return (-r(c) + $s > 0 ? -1 : 1) * ((f - m) * w) / v;
2006
+ const d = c * i * e, f = d * n + n, m = Math.pow(i, 2) * Math.pow(c, 2) * e, x = Math.exp(-d), v = tr(Math.pow(c, 2), i);
2007
+ return (-r(c) + $s > 0 ? -1 : 1) * ((f - m) * x) / v;
2030
2008
  }) : (r = (c) => {
2031
2009
  const u = Math.exp(-c * e), d = (c - n) * e + 1;
2032
2010
  return -$s + u * d;
@@ -2102,41 +2080,41 @@ function xs(e = me.visualDuration, t = me.bounce) {
2102
2080
  const o = n.keyframes[0], i = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: o }, { stiffness: l, damping: c, mass: u, duration: d, velocity: f, isResolvedFromDuration: m } = yu({
2103
2081
  ...n,
2104
2082
  velocity: -/* @__PURE__ */ Ue(n.velocity || 0)
2105
- }), w = f || 0, v = c / (2 * Math.sqrt(l * u)), T = i - o, b = /* @__PURE__ */ Ue(Math.sqrt(l / u)), M = Math.abs(T) < 5;
2083
+ }), x = f || 0, v = c / (2 * Math.sqrt(l * u)), w = i - o, y = /* @__PURE__ */ Ue(Math.sqrt(l / u)), M = Math.abs(w) < 5;
2106
2084
  s || (s = M ? me.restSpeed.granular : me.restSpeed.default), r || (r = M ? me.restDelta.granular : me.restDelta.default);
2107
2085
  let E;
2108
2086
  if (v < 1) {
2109
- const R = tr(b, v);
2087
+ const V = tr(y, v);
2110
2088
  E = (L) => {
2111
- const D = Math.exp(-v * b * L);
2112
- return i - D * ((w + v * b * T) / R * Math.sin(R * L) + T * Math.cos(R * L));
2089
+ const D = Math.exp(-v * y * L);
2090
+ return i - D * ((x + v * y * w) / V * Math.sin(V * L) + w * Math.cos(V * L));
2113
2091
  };
2114
2092
  } else if (v === 1)
2115
- E = (R) => i - Math.exp(-b * R) * (T + (w + b * T) * R);
2093
+ E = (V) => i - Math.exp(-y * V) * (w + (x + y * w) * V);
2116
2094
  else {
2117
- const R = b * Math.sqrt(v * v - 1);
2095
+ const V = y * Math.sqrt(v * v - 1);
2118
2096
  E = (L) => {
2119
- const D = Math.exp(-v * b * L), A = Math.min(R * L, 300);
2120
- return i - D * ((w + v * b * T) * Math.sinh(A) + R * T * Math.cosh(A)) / R;
2097
+ const D = Math.exp(-v * y * L), C = Math.min(V * L, 300);
2098
+ return i - D * ((x + v * y * w) * Math.sinh(C) + V * w * Math.cosh(C)) / V;
2121
2099
  };
2122
2100
  }
2123
2101
  const F = {
2124
2102
  calculatedDuration: m && d || null,
2125
- next: (R) => {
2126
- const L = E(R);
2103
+ next: (V) => {
2104
+ const L = E(V);
2127
2105
  if (m)
2128
- a.done = R >= d;
2106
+ a.done = V >= d;
2129
2107
  else {
2130
- let D = R === 0 ? w : 0;
2131
- v < 1 && (D = R === 0 ? /* @__PURE__ */ Ye(w) : ua(E, R, L));
2132
- const A = Math.abs(D) <= s, j = Math.abs(i - L) <= r;
2133
- a.done = A && j;
2108
+ let D = V === 0 ? x : 0;
2109
+ v < 1 && (D = V === 0 ? /* @__PURE__ */ Ye(x) : ua(E, V, L));
2110
+ const C = Math.abs(D) <= s, j = Math.abs(i - L) <= r;
2111
+ a.done = C && j;
2134
2112
  }
2135
2113
  return a.value = a.done ? i : L, a;
2136
2114
  },
2137
2115
  toString: () => {
2138
- const R = Math.min($r(F), vs), L = ca((D) => F.next(R * D).value, R, 30);
2139
- return R + "ms " + L;
2116
+ const V = Math.min($r(F), vs), L = ca((D) => F.next(V * D).value, V, 30);
2117
+ return V + "ms " + L;
2140
2118
  },
2141
2119
  toTransition: () => {
2142
2120
  }
@@ -2151,19 +2129,19 @@ function nr({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 3
2151
2129
  const d = e[0], f = {
2152
2130
  done: !1,
2153
2131
  value: d
2154
- }, m = (A) => a !== void 0 && A < a || l !== void 0 && A > l, w = (A) => a === void 0 ? l : l === void 0 || Math.abs(a - A) < Math.abs(l - A) ? a : l;
2132
+ }, m = (C) => a !== void 0 && C < a || l !== void 0 && C > l, x = (C) => a === void 0 ? l : l === void 0 || Math.abs(a - C) < Math.abs(l - C) ? a : l;
2155
2133
  let v = n * t;
2156
- const T = d + v, b = i === void 0 ? T : i(T);
2157
- b !== T && (v = b - d);
2158
- const M = (A) => -v * Math.exp(-A / s), E = (A) => b + M(A), F = (A) => {
2159
- const j = M(A), k = E(A);
2160
- f.done = Math.abs(j) <= c, f.value = f.done ? b : k;
2134
+ const w = d + v, y = i === void 0 ? w : i(w);
2135
+ y !== w && (v = y - d);
2136
+ const M = (C) => -v * Math.exp(-C / s), E = (C) => y + M(C), F = (C) => {
2137
+ const j = M(C), k = E(C);
2138
+ f.done = Math.abs(j) <= c, f.value = f.done ? y : k;
2161
2139
  };
2162
- let R, L;
2163
- const D = (A) => {
2164
- m(f.value) && (R = A, L = xs({
2165
- keyframes: [f.value, w(f.value)],
2166
- velocity: ua(E, A, f.value),
2140
+ let V, L;
2141
+ const D = (C) => {
2142
+ m(f.value) && (V = C, L = xs({
2143
+ keyframes: [f.value, x(f.value)],
2144
+ velocity: ua(E, C, f.value),
2167
2145
  // TODO: This should be passing * 1000
2168
2146
  damping: r,
2169
2147
  stiffness: o,
@@ -2173,9 +2151,9 @@ function nr({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 3
2173
2151
  };
2174
2152
  return D(0), {
2175
2153
  calculatedDuration: null,
2176
- next: (A) => {
2154
+ next: (C) => {
2177
2155
  let j = !1;
2178
- return !L && R === void 0 && (j = !0, F(A), D(A)), R !== void 0 && A >= R ? L.next(A - R) : (!j && F(A), f);
2156
+ return !L && V === void 0 && (j = !0, F(C), D(C)), V !== void 0 && C >= V ? L.next(C - V) : (!j && F(C), f);
2179
2157
  }
2180
2158
  };
2181
2159
  }
@@ -2185,7 +2163,7 @@ function bu(e, t, n) {
2185
2163
  let a = r(e[i], e[i + 1]);
2186
2164
  if (t) {
2187
2165
  const l = Array.isArray(t) ? t[i] || ze : t;
2188
- a = Xn(l, a);
2166
+ a = _n(l, a);
2189
2167
  }
2190
2168
  s.push(a);
2191
2169
  }
@@ -2206,7 +2184,7 @@ function vu(e, t, { clamp: n = !0, ease: s, mixer: r } = {}) {
2206
2184
  if (l > 1)
2207
2185
  for (; d < e.length - 2 && !(u < e[d + 1]); d++)
2208
2186
  ;
2209
- const f = /* @__PURE__ */ jn(e[d], e[d + 1], u);
2187
+ const f = /* @__PURE__ */ Ln(e[d], e[d + 1], u);
2210
2188
  return a[d](f);
2211
2189
  };
2212
2190
  return n ? (u) => c(dt(e[0], e[o - 1], u)) : c;
@@ -2214,7 +2192,7 @@ function vu(e, t, { clamp: n = !0, ease: s, mixer: r } = {}) {
2214
2192
  function xu(e, t) {
2215
2193
  const n = e[e.length - 1];
2216
2194
  for (let s = 1; s <= t; s++) {
2217
- const r = /* @__PURE__ */ jn(0, t, s);
2195
+ const r = /* @__PURE__ */ Ln(0, t, s);
2218
2196
  e.push(ge(n, 1, r));
2219
2197
  }
2220
2198
  }
@@ -2228,7 +2206,7 @@ function Tu(e, t) {
2228
2206
  function Su(e, t) {
2229
2207
  return e.map(() => t || Zo).splice(0, e.length - 1);
2230
2208
  }
2231
- function Ht({ duration: e = 300, keyframes: t, times: n, ease: s = "easeInOut" }) {
2209
+ function Yt({ duration: e = 300, keyframes: t, times: n, ease: s = "easeInOut" }) {
2232
2210
  const r = Oc(s) ? s.map(di) : di(s), o = {
2233
2211
  done: !1,
2234
2212
  value: t[0]
@@ -2253,8 +2231,8 @@ function Fr(e, { repeat: t, repeatType: n = "loop" }, s, r = 1) {
2253
2231
  const Cu = {
2254
2232
  decay: nr,
2255
2233
  inertia: nr,
2256
- tween: Ht,
2257
- keyframes: Ht,
2234
+ tween: Yt,
2235
+ keyframes: Yt,
2258
2236
  spring: xs
2259
2237
  };
2260
2238
  function da(e) {
@@ -2295,10 +2273,10 @@ class Ur extends Br {
2295
2273
  initAnimation() {
2296
2274
  const { options: t } = this;
2297
2275
  da(t);
2298
- const { type: n = Ht, repeat: s = 0, repeatDelay: r = 0, repeatType: o, velocity: i = 0 } = t;
2276
+ const { type: n = Yt, repeat: s = 0, repeatDelay: r = 0, repeatType: o, velocity: i = 0 } = t;
2299
2277
  let { keyframes: a } = t;
2300
- const l = n || Ht;
2301
- process.env.NODE_ENV !== "production" && l !== Ht && ht(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`, "spring-two-frames"), l !== Ht && typeof a[0] != "number" && (this.mixKeyframes = Xn(Au, la(a[0], a[1])), a = [0, 100]);
2278
+ const l = n || Yt;
2279
+ process.env.NODE_ENV !== "production" && l !== Yt && ht(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`, "spring-two-frames"), l !== Yt && typeof a[0] != "number" && (this.mixKeyframes = _n(Au, la(a[0], a[1])), a = [0, 100]);
2302
2280
  const c = l({ ...t, keyframes: a });
2303
2281
  o === "mirror" && (this.mirroredGenerator = l({
2304
2282
  ...t,
@@ -2316,22 +2294,22 @@ class Ur extends Br {
2316
2294
  const { generator: s, totalDuration: r, mixKeyframes: o, mirroredGenerator: i, resolvedDuration: a, calculatedDuration: l } = this;
2317
2295
  if (this.startTime === null)
2318
2296
  return s.next(0);
2319
- const { delay: c = 0, keyframes: u, repeat: d, repeatType: f, repeatDelay: m, type: w, onUpdate: v, finalKeyframe: T } = this.options;
2297
+ const { delay: c = 0, keyframes: u, repeat: d, repeatType: f, repeatDelay: m, type: x, onUpdate: v, finalKeyframe: w } = this.options;
2320
2298
  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);
2321
- const b = this.currentTime - c * (this.playbackSpeed >= 0 ? 1 : -1), M = this.playbackSpeed >= 0 ? b < 0 : b > r;
2322
- this.currentTime = Math.max(b, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = r);
2299
+ const y = this.currentTime - c * (this.playbackSpeed >= 0 ? 1 : -1), M = this.playbackSpeed >= 0 ? y < 0 : y > r;
2300
+ this.currentTime = Math.max(y, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = r);
2323
2301
  let E = this.currentTime, F = s;
2324
2302
  if (d) {
2325
- const A = Math.min(this.currentTime, r) / a;
2326
- let j = Math.floor(A), k = A % 1;
2327
- !k && A >= 1 && (k = 1), k === 1 && j--, j = Math.min(j, d + 1), !!(j % 2) && (f === "reverse" ? (k = 1 - k, m && (k -= m / a)) : f === "mirror" && (F = i)), E = dt(0, 1, k) * a;
2303
+ const C = Math.min(this.currentTime, r) / a;
2304
+ let j = Math.floor(C), k = C % 1;
2305
+ !k && C >= 1 && (k = 1), k === 1 && j--, j = Math.min(j, d + 1), !!(j % 2) && (f === "reverse" ? (k = 1 - k, m && (k -= m / a)) : f === "mirror" && (F = i)), E = dt(0, 1, k) * a;
2328
2306
  }
2329
- const R = M ? { done: !1, value: u[0] } : F.next(E);
2330
- o && (R.value = o(R.value));
2331
- let { done: L } = R;
2307
+ const V = M ? { done: !1, value: u[0] } : F.next(E);
2308
+ o && (V.value = o(V.value));
2309
+ let { done: L } = V;
2332
2310
  !M && l !== null && (L = this.playbackSpeed >= 0 ? this.currentTime >= r : this.currentTime <= 0);
2333
2311
  const D = this.holdTime === null && (this.state === "finished" || this.state === "running" && L);
2334
- return D && w !== nr && (R.value = Fr(u, this.options, T, this.speed)), v && v(R.value), D && this.finish(), R;
2312
+ return D && x !== nr && (V.value = Fr(u, this.options, w, this.speed)), v && v(V.value), D && this.finish(), V;
2335
2313
  }
2336
2314
  /**
2337
2315
  * Allows the returned animation to be awaited or promise-chained. Currently
@@ -2459,7 +2437,7 @@ const Nu = (e, t) => {
2459
2437
  function Du(e) {
2460
2438
  return parseFloat(e.trim());
2461
2439
  }
2462
- const ln = [
2440
+ const an = [
2463
2441
  "transformPerspective",
2464
2442
  "x",
2465
2443
  "y",
@@ -2477,10 +2455,10 @@ const ln = [
2477
2455
  "skew",
2478
2456
  "skewX",
2479
2457
  "skewY"
2480
- ], cn = new Set(ln), xi = (e) => e === an || e === z, Ru = /* @__PURE__ */ new Set(["x", "y", "z"]), Vu = ln.filter((e) => !Ru.has(e));
2458
+ ], ln = new Set(an), xi = (e) => e === on || e === z, Vu = /* @__PURE__ */ new Set(["x", "y", "z"]), Ru = an.filter((e) => !Vu.has(e));
2481
2459
  function Iu(e) {
2482
2460
  const t = [];
2483
- return Vu.forEach((n) => {
2461
+ return Ru.forEach((n) => {
2484
2462
  const s = e.getValue(n);
2485
2463
  s !== void 0 && (t.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
2486
2464
  }), t;
@@ -2582,20 +2560,20 @@ const ma = /* @__PURE__ */ Bu(() => {
2582
2560
  return !1;
2583
2561
  }
2584
2562
  return !0;
2585
- }, "linearEasing"), Nn = ([e, t, n, s]) => `cubic-bezier(${e}, ${t}, ${n}, ${s})`, wi = {
2563
+ }, "linearEasing"), Mn = ([e, t, n, s]) => `cubic-bezier(${e}, ${t}, ${n}, ${s})`, wi = {
2586
2564
  linear: "linear",
2587
2565
  ease: "ease",
2588
2566
  easeIn: "ease-in",
2589
2567
  easeOut: "ease-out",
2590
2568
  easeInOut: "ease-in-out",
2591
- circIn: /* @__PURE__ */ Nn([0, 0.65, 0.55, 1]),
2592
- circOut: /* @__PURE__ */ Nn([0.55, 0, 1, 0.45]),
2593
- backIn: /* @__PURE__ */ Nn([0.31, 0.01, 0.66, -0.59]),
2594
- backOut: /* @__PURE__ */ Nn([0.33, 1.53, 0.69, 0.99])
2569
+ circIn: /* @__PURE__ */ Mn([0, 0.65, 0.55, 1]),
2570
+ circOut: /* @__PURE__ */ Mn([0.55, 0, 1, 0.45]),
2571
+ backIn: /* @__PURE__ */ Mn([0.31, 0.01, 0.66, -0.59]),
2572
+ backOut: /* @__PURE__ */ Mn([0.33, 1.53, 0.69, 0.99])
2595
2573
  };
2596
2574
  function pa(e, t) {
2597
2575
  if (e)
2598
- return typeof e == "function" ? ma() ? ca(e, t) : "ease-out" : Qo(e) ? Nn(e) : Array.isArray(e) ? e.map((n) => pa(n, t) || wi.easeOut) : wi[e];
2576
+ return typeof e == "function" ? ma() ? ca(e, t) : "ease-out" : Qo(e) ? Mn(e) : Array.isArray(e) ? e.map((n) => pa(n, t) || wi.easeOut) : wi[e];
2599
2577
  }
2600
2578
  function Uu(e, t, n, { delay: s = 0, duration: r = 300, repeat: o = 0, repeatType: i = "loop", ease: a = "easeOut", times: l } = {}, c = void 0) {
2601
2579
  const u = {
@@ -2769,7 +2747,7 @@ function Gu(e, t, n, s) {
2769
2747
  if (t === "display" || t === "visibility")
2770
2748
  return !0;
2771
2749
  const o = e[e.length - 1], i = Si(r, t), a = Si(o, t);
2772
- return on(i === a, `You are trying to animate ${t} from "${r}" to "${o}". "${i ? o : r}" is not an animatable value.`, "value-not-animatable"), !i || !a ? !1 : qu(e) || (n === "spring" || ga(n)) && s;
2750
+ return rn(i === a, `You are trying to animate ${t} from "${r}" to "${o}". "${i ? o : r}" is not an animatable value.`, "value-not-animatable"), !i || !a ? !1 : qu(e) || (n === "spring" || ga(n)) && s;
2773
2751
  }
2774
2752
  function ur(e) {
2775
2753
  e.duration = 0, e.type = "keyframes";
@@ -2811,7 +2789,7 @@ class Qu extends Br {
2811
2789
  element: u,
2812
2790
  ...d
2813
2791
  }, m = u?.KeyframeResolver || zr;
2814
- this.keyframeResolver = new m(a, (w, v, T) => this.onKeyframesResolved(w, v, f, !T), l, c, u), this.keyframeResolver?.scheduleResolve();
2792
+ this.keyframeResolver = new m(a, (x, v, w) => this.onKeyframesResolved(x, v, f, !w), l, c, u), this.keyframeResolver?.scheduleResolve();
2815
2793
  }
2816
2794
  onKeyframesResolved(t, n, s, r) {
2817
2795
  this.keyframeResolver = void 0;
@@ -2912,11 +2890,11 @@ const va = /* @__PURE__ */ new Set([
2912
2890
  "left",
2913
2891
  "right",
2914
2892
  "bottom",
2915
- ...ln
2893
+ ...an
2916
2894
  ]), sd = {
2917
2895
  test: (e) => e === "auto",
2918
2896
  parse: (e) => e
2919
- }, xa = (e) => (t) => t.test(e), wa = [an, z, it, xt, qc, Kc, sd], Pi = (e) => wa.find(xa(e));
2897
+ }, xa = (e) => (t) => t.test(e), wa = [on, z, it, xt, qc, Kc, sd], Pi = (e) => wa.find(xa(e));
2920
2898
  function rd(e) {
2921
2899
  return typeof e == "number" ? e === 0 : e !== null ? e === "none" || e === "0" || zo(e) : !0;
2922
2900
  }
@@ -2939,7 +2917,7 @@ const ad = /\b([a-z-]*)\(.*?\)/gu, dr = {
2939
2917
  return t ? t.map(od).join(" ") : e;
2940
2918
  }
2941
2919
  }, Ci = {
2942
- ...an,
2920
+ ...on,
2943
2921
  transform: Math.round
2944
2922
  }, ld = {
2945
2923
  rotate: xt,
@@ -2962,7 +2940,7 @@ const ad = /\b([a-z-]*)\(.*?\)/gu, dr = {
2962
2940
  z,
2963
2941
  perspective: z,
2964
2942
  transformPerspective: z,
2965
- opacity: $n,
2943
+ opacity: jn,
2966
2944
  originX: hi,
2967
2945
  originY: hi,
2968
2946
  originZ: z
@@ -3005,8 +2983,8 @@ const ad = /\b([a-z-]*)\(.*?\)/gu, dr = {
3005
2983
  ...ld,
3006
2984
  zIndex: Ci,
3007
2985
  // SVG
3008
- fillOpacity: $n,
3009
- strokeOpacity: $n,
2986
+ fillOpacity: jn,
2987
+ strokeOpacity: jn,
3010
2988
  numOctaves: Ci
3011
2989
  }, cd = {
3012
2990
  ...Xr,
@@ -3034,7 +3012,7 @@ function dd(e, t, n) {
3034
3012
  let s = 0, r;
3035
3013
  for (; s < e.length && !r; ) {
3036
3014
  const o = e[s];
3037
- typeof o == "string" && !ud.has(o) && Fn(o).values.length && (r = e[s]), s++;
3015
+ typeof o == "string" && !ud.has(o) && $n(o).values.length && (r = e[s]), s++;
3038
3016
  }
3039
3017
  if (r && n)
3040
3018
  for (const o of t)
@@ -3307,7 +3285,7 @@ class pd {
3307
3285
  this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
3308
3286
  }
3309
3287
  }
3310
- function sn(e, t) {
3288
+ function nn(e, t) {
3311
3289
  return new pd(e, t);
3312
3290
  }
3313
3291
  const { schedule: Wr } = /* @__PURE__ */ ea(queueMicrotask, !1), Ke = {
@@ -3394,8 +3372,8 @@ function wd(e, t, n = {}) {
3394
3372
  if (!Mi(a))
3395
3373
  return;
3396
3374
  fs.add(l);
3397
- const c = t(l, a), u = (m, w) => {
3398
- window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", f), fs.has(l) && fs.delete(l), Mi(m) && typeof c == "function" && c(m, { success: w });
3375
+ const c = t(l, a), u = (m, x) => {
3376
+ window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", f), fs.has(l) && fs.delete(l), Mi(m) && typeof c == "function" && c(m, { success: x });
3399
3377
  }, d = (m) => {
3400
3378
  u(m, l === window || l === document || n.useGlobalTarget || Ea(l, m.target));
3401
3379
  }, f = (m) => {
@@ -3472,21 +3450,21 @@ function Ed({ children: e, isPresent: t, anchorX: n, root: s }) {
3472
3450
  const { width: c, height: u, top: d, left: f, right: m } = i.current;
3473
3451
  if (t || !o.current || !c || !u)
3474
3452
  return;
3475
- const w = n === "left" ? `left: ${f}` : `right: ${m}`;
3453
+ const x = n === "left" ? `left: ${f}` : `right: ${m}`;
3476
3454
  o.current.dataset.motionPopId = r;
3477
3455
  const v = document.createElement("style");
3478
3456
  a && (v.nonce = a);
3479
- const T = s ?? document.head;
3480
- return T.appendChild(v), v.sheet && v.sheet.insertRule(`
3457
+ const w = s ?? document.head;
3458
+ return w.appendChild(v), v.sheet && v.sheet.insertRule(`
3481
3459
  [data-motion-pop-id="${r}"] {
3482
3460
  position: absolute !important;
3483
3461
  width: ${c}px !important;
3484
3462
  height: ${u}px !important;
3485
- ${w}px !important;
3463
+ ${x}px !important;
3486
3464
  top: ${d}px !important;
3487
3465
  }
3488
3466
  `), () => {
3489
- T.contains(v) && T.removeChild(v);
3467
+ w.contains(v) && w.removeChild(v);
3490
3468
  };
3491
3469
  }, [t]), h(kd, { isPresent: t, childRef: o, sizeRef: i, children: qe.cloneElement(e, { ref: l }) });
3492
3470
  }
@@ -3499,15 +3477,15 @@ const Md = ({ children: e, initial: t, isPresent: n, onExitComplete: s, custom:
3499
3477
  custom: r,
3500
3478
  onExitComplete: (m) => {
3501
3479
  c.set(m, !0);
3502
- for (const w of c.values())
3503
- if (!w)
3480
+ for (const x of c.values())
3481
+ if (!x)
3504
3482
  return;
3505
3483
  s && s();
3506
3484
  },
3507
3485
  register: (m) => (c.set(m, !1), () => c.delete(m))
3508
3486
  }), [n, c, s]);
3509
3487
  return o && d && (f = { ...f }), ee(() => {
3510
- c.forEach((m, w) => c.set(w, !1));
3488
+ c.forEach((m, x) => c.set(x, !1));
3511
3489
  }, [n]), qe.useEffect(() => {
3512
3490
  !n && !c.size && s && s();
3513
3491
  }, [n]), i === "popLayout" && (e = h(Ed, { isPresent: n, anchorX: a, root: l, children: e })), h(Ss.Provider, { value: f, children: e });
@@ -3535,27 +3513,27 @@ function Di(e) {
3535
3513
  }), t;
3536
3514
  }
3537
3515
  const Dd = ({ children: e, custom: t, initial: n = !0, onExitComplete: s, presenceAffectsLayout: r = !0, mode: o = "sync", propagate: i = !1, anchorX: a = "left", root: l }) => {
3538
- const [c, u] = Na(i), d = ee(() => Di(e), [e]), f = i && !c ? [] : d.map(as), m = pe(!0), w = pe(d), v = Pr(() => /* @__PURE__ */ new Map()), [T, b] = O(d), [M, E] = O(d);
3516
+ const [c, u] = Na(i), d = ee(() => Di(e), [e]), f = i && !c ? [] : d.map(as), m = pe(!0), x = pe(d), v = Pr(() => /* @__PURE__ */ new Map()), [w, y] = O(d), [M, E] = O(d);
3539
3517
  Fo(() => {
3540
- m.current = !1, w.current = d;
3518
+ m.current = !1, x.current = d;
3541
3519
  for (let L = 0; L < M.length; L++) {
3542
3520
  const D = as(M[L]);
3543
3521
  f.includes(D) ? v.delete(D) : v.get(D) !== !0 && v.set(D, !1);
3544
3522
  }
3545
3523
  }, [M, f.length, f.join("-")]);
3546
3524
  const F = [];
3547
- if (d !== T) {
3525
+ if (d !== w) {
3548
3526
  let L = [...d];
3549
3527
  for (let D = 0; D < M.length; D++) {
3550
- const A = M[D], j = as(A);
3551
- f.includes(j) || (L.splice(D, 0, A), F.push(A));
3528
+ const C = M[D], j = as(C);
3529
+ f.includes(j) || (L.splice(D, 0, C), F.push(C));
3552
3530
  }
3553
- return o === "wait" && F.length && (L = F), E(Di(L)), b(d), null;
3531
+ return o === "wait" && F.length && (L = F), E(Di(L)), y(d), null;
3554
3532
  }
3555
3533
  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.`);
3556
- const { forceRender: R } = Se(Sr);
3557
- return h(Gt, { children: M.map((L) => {
3558
- const D = as(L), A = i && !c ? !1 : d === M || f.includes(D), j = () => {
3534
+ const { forceRender: V } = Se(Sr);
3535
+ return h(qt, { children: M.map((L) => {
3536
+ const D = as(L), C = i && !c ? !1 : d === M || f.includes(D), j = () => {
3559
3537
  if (v.has(D))
3560
3538
  v.set(D, !0);
3561
3539
  else
@@ -3563,11 +3541,11 @@ const Dd = ({ children: e, custom: t, initial: n = !0, onExitComplete: s, presen
3563
3541
  let k = !0;
3564
3542
  v.forEach((N) => {
3565
3543
  N || (k = !1);
3566
- }), k && (R?.(), E(w.current), i && u?.(), s && s());
3544
+ }), k && (V?.(), E(x.current), i && u?.(), s && s());
3567
3545
  };
3568
- return h(Md, { isPresent: A, initial: !m.current || n ? void 0 : !1, custom: t, presenceAffectsLayout: r, mode: o, root: l, onExitComplete: A ? void 0 : j, anchorX: a, children: L }, D);
3546
+ return h(Md, { isPresent: C, initial: !m.current || n ? void 0 : !1, custom: t, presenceAffectsLayout: r, mode: o, root: l, onExitComplete: C ? void 0 : j, anchorX: a, children: L }, D);
3569
3547
  }) });
3570
- }, Gr = St({ strict: !1 }), Ri = {
3548
+ }, Gr = St({ strict: !1 }), Vi = {
3571
3549
  animation: [
3572
3550
  "animate",
3573
3551
  "variants",
@@ -3586,19 +3564,19 @@ const Dd = ({ children: e, custom: t, initial: n = !0, onExitComplete: s, presen
3586
3564
  pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
3587
3565
  inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
3588
3566
  layout: ["layout", "layoutId"]
3589
- }, rn = {};
3590
- for (const e in Ri)
3591
- rn[e] = {
3592
- isEnabled: (t) => Ri[e].some((n) => !!t[n])
3567
+ }, sn = {};
3568
+ for (const e in Vi)
3569
+ sn[e] = {
3570
+ isEnabled: (t) => Vi[e].some((n) => !!t[n])
3593
3571
  };
3594
3572
  function hr(e) {
3595
3573
  for (const t in e)
3596
- rn[t] = {
3597
- ...rn[t],
3574
+ sn[t] = {
3575
+ ...sn[t],
3598
3576
  ...e[t]
3599
3577
  };
3600
3578
  }
3601
- function Rd({ children: e, features: t, strict: n = !1 }) {
3579
+ function Vd({ children: e, features: t, strict: n = !1 }) {
3602
3580
  const [, s] = O(!Bs(t)), r = pe(void 0);
3603
3581
  if (!Bs(t)) {
3604
3582
  const { renderer: o, ...i } = t;
@@ -3613,7 +3591,7 @@ function Rd({ children: e, features: t, strict: n = !1 }) {
3613
3591
  function Bs(e) {
3614
3592
  return typeof e == "function";
3615
3593
  }
3616
- const Vd = /* @__PURE__ */ new Set([
3594
+ const Rd = /* @__PURE__ */ new Set([
3617
3595
  "animate",
3618
3596
  "exit",
3619
3597
  "variants",
@@ -3646,7 +3624,7 @@ const Vd = /* @__PURE__ */ new Set([
3646
3624
  "viewport"
3647
3625
  ]);
3648
3626
  function ws(e) {
3649
- return e.startsWith("while") || e.startsWith("drag") && e !== "draggable" || e.startsWith("layout") || e.startsWith("onTap") || e.startsWith("onPan") || e.startsWith("onLayout") || Vd.has(e);
3627
+ return e.startsWith("while") || e.startsWith("drag") && e !== "draggable" || e.startsWith("layout") || e.startsWith("onTap") || e.startsWith("onPan") || e.startsWith("onLayout") || Rd.has(e);
3650
3628
  }
3651
3629
  let Da = (e) => !ws(e);
3652
3630
  function Id(e) {
@@ -3667,7 +3645,7 @@ const Ps = /* @__PURE__ */ St({});
3667
3645
  function Cs(e) {
3668
3646
  return e !== null && typeof e == "object" && typeof e.start == "function";
3669
3647
  }
3670
- function Bn(e) {
3648
+ function Fn(e) {
3671
3649
  return typeof e == "string" || Array.isArray(e);
3672
3650
  }
3673
3651
  const Yr = [
@@ -3680,46 +3658,46 @@ const Yr = [
3680
3658
  "exit"
3681
3659
  ], Hr = ["initial", ...Yr];
3682
3660
  function As(e) {
3683
- return Cs(e.animate) || Hr.some((t) => Bn(e[t]));
3661
+ return Cs(e.animate) || Hr.some((t) => Fn(e[t]));
3684
3662
  }
3685
- function Ra(e) {
3663
+ function Va(e) {
3686
3664
  return !!(As(e) || e.variants);
3687
3665
  }
3688
3666
  function Ld(e, t) {
3689
3667
  if (As(e)) {
3690
3668
  const { initial: n, animate: s } = e;
3691
3669
  return {
3692
- initial: n === !1 || Bn(n) ? n : void 0,
3693
- animate: Bn(s) ? s : void 0
3670
+ initial: n === !1 || Fn(n) ? n : void 0,
3671
+ animate: Fn(s) ? s : void 0
3694
3672
  };
3695
3673
  }
3696
3674
  return e.inherit !== !1 ? t : {};
3697
3675
  }
3698
3676
  function jd(e) {
3699
3677
  const { initial: t, animate: n } = Ld(e, Se(Ps));
3700
- return ee(() => ({ initial: t, animate: n }), [Vi(t), Vi(n)]);
3678
+ return ee(() => ({ initial: t, animate: n }), [Ri(t), Ri(n)]);
3701
3679
  }
3702
- function Vi(e) {
3680
+ function Ri(e) {
3703
3681
  return Array.isArray(e) ? e.join(" ") : e;
3704
3682
  }
3705
- const Un = {};
3683
+ const Bn = {};
3706
3684
  function $d(e) {
3707
3685
  for (const t in e)
3708
- Un[t] = e[t], Vr(t) && (Un[t].isCSSVariable = !0);
3686
+ Bn[t] = e[t], Rr(t) && (Bn[t].isCSSVariable = !0);
3709
3687
  }
3710
- function Va(e, { layout: t, layoutId: n }) {
3711
- return cn.has(e) || e.startsWith("origin") || (t || n !== void 0) && (!!Un[e] || e === "opacity");
3688
+ function Ra(e, { layout: t, layoutId: n }) {
3689
+ return ln.has(e) || e.startsWith("origin") || (t || n !== void 0) && (!!Bn[e] || e === "opacity");
3712
3690
  }
3713
3691
  const Fd = {
3714
3692
  x: "translateX",
3715
3693
  y: "translateY",
3716
3694
  z: "translateZ",
3717
3695
  transformPerspective: "perspective"
3718
- }, Bd = ln.length;
3696
+ }, Bd = an.length;
3719
3697
  function Ud(e, t, n) {
3720
3698
  let s = "", r = !0;
3721
3699
  for (let o = 0; o < Bd; o++) {
3722
- const i = ln[o], a = e[i];
3700
+ const i = an[o], a = e[i];
3723
3701
  if (a === void 0)
3724
3702
  continue;
3725
3703
  let l = !0;
@@ -3740,10 +3718,10 @@ function Jr(e, t, n) {
3740
3718
  let i = !1, a = !1;
3741
3719
  for (const l in t) {
3742
3720
  const c = t[l];
3743
- if (cn.has(l)) {
3721
+ if (ln.has(l)) {
3744
3722
  i = !0;
3745
3723
  continue;
3746
- } else if (Vr(l)) {
3724
+ } else if (Rr(l)) {
3747
3725
  r[l] = c;
3748
3726
  continue;
3749
3727
  } else {
@@ -3764,7 +3742,7 @@ const Zr = () => ({
3764
3742
  });
3765
3743
  function Ia(e, t, n) {
3766
3744
  for (const s in t)
3767
- !Ee(t[s]) && !Va(s, n) && (e[s] = t[s]);
3745
+ !Ee(t[s]) && !Ra(s, n) && (e[s] = t[s]);
3768
3746
  }
3769
3747
  function zd({ transformTemplate: e }, t) {
3770
3748
  return ee(() => {
@@ -3915,7 +3893,7 @@ function Zd(e, t, n, s) {
3915
3893
  for (const f in o)
3916
3894
  r[f] = ms(o[f]);
3917
3895
  let { initial: i, animate: a } = e;
3918
- const l = As(e), c = Ra(e);
3896
+ const l = As(e), c = Va(e);
3919
3897
  t && c && !l && e.inherit !== !1 && (i === void 0 && (i = t.initial), a === void 0 && (a = t.animate));
3920
3898
  let u = n ? n.initial === !1 : !1;
3921
3899
  u = u || i === !1;
@@ -3923,11 +3901,11 @@ function Zd(e, t, n, s) {
3923
3901
  if (d && typeof d != "boolean" && !Cs(d)) {
3924
3902
  const f = Array.isArray(d) ? d : [d];
3925
3903
  for (let m = 0; m < f.length; m++) {
3926
- const w = ei(e, f[m]);
3927
- if (w) {
3928
- const { transitionEnd: v, transition: T, ...b } = w;
3929
- for (const M in b) {
3930
- let E = b[M];
3904
+ const x = ei(e, f[m]);
3905
+ if (x) {
3906
+ const { transitionEnd: v, transition: w, ...y } = x;
3907
+ for (const M in y) {
3908
+ let E = y[M];
3931
3909
  if (Array.isArray(E)) {
3932
3910
  const F = u ? E.length - 1 : 0;
3933
3911
  E = E[F];
@@ -3948,7 +3926,7 @@ const $a = (e) => (t, n) => {
3948
3926
  function ti(e, t, n) {
3949
3927
  const { style: s } = e, r = {};
3950
3928
  for (const o in s)
3951
- (Ee(s[o]) || t.style && Ee(t.style[o]) || Va(o, e) || n?.getValue(o)?.liveStyle !== void 0) && (r[o] = s[o]);
3929
+ (Ee(s[o]) || t.style && Ee(t.style[o]) || Ra(o, e) || n?.getValue(o)?.liveStyle !== void 0) && (r[o] = s[o]);
3952
3930
  return r;
3953
3931
  }
3954
3932
  const Qd = /* @__PURE__ */ $a({
@@ -3959,7 +3937,7 @@ function Fa(e, t, n) {
3959
3937
  const s = ti(e, t, n);
3960
3938
  for (const r in e)
3961
3939
  if (Ee(e[r]) || Ee(t[r])) {
3962
- const o = ln.indexOf(r) !== -1 ? "attr" + r.charAt(0).toUpperCase() + r.substring(1) : r;
3940
+ const o = an.indexOf(r) !== -1 ? "attr" + r.charAt(0).toUpperCase() + r.substring(1) : r;
3963
3941
  s[o] = e[r];
3964
3942
  }
3965
3943
  return s;
@@ -3968,13 +3946,13 @@ const eh = /* @__PURE__ */ $a({
3968
3946
  scrapeMotionValuesFromProps: Fa,
3969
3947
  createRenderState: La
3970
3948
  }), th = Symbol.for("motionComponentSymbol");
3971
- function Jt(e) {
3949
+ function Ht(e) {
3972
3950
  return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "current");
3973
3951
  }
3974
3952
  function nh(e, t, n) {
3975
3953
  return ke(
3976
3954
  (s) => {
3977
- s && e.onMount && e.onMount(s), t && (s ? t.mount(s) : t.unmount()), n && (typeof n == "function" ? n(s) : Jt(n) && (n.current = s));
3955
+ s && e.onMount && e.onMount(s), t && (s ? t.mount(s) : t.unmount()), n && (typeof n == "function" ? n(s) : Ht(n) && (n.current = s));
3978
3956
  },
3979
3957
  /**
3980
3958
  * Include externalRef in dependencies to ensure the callback updates
@@ -4000,13 +3978,13 @@ function rh(e, t, n, s, r) {
4000
3978
  ko(() => {
4001
3979
  u && f.current && u.update(n, a);
4002
3980
  });
4003
- const m = n[Ba], w = pe(!!m && !window.MotionHandoffIsComplete?.(m) && window.MotionHasOptimisedAnimation?.(m));
3981
+ const m = n[Ba], x = pe(!!m && !window.MotionHandoffIsComplete?.(m) && window.MotionHasOptimisedAnimation?.(m));
4004
3982
  return Fo(() => {
4005
- u && (f.current = !0, window.MotionIsMounted = !0, u.updateFeatures(), u.scheduleRenderMicrotask(), w.current && u.animationState && u.animationState.animateChanges());
3983
+ u && (f.current = !0, window.MotionIsMounted = !0, u.updateFeatures(), u.scheduleRenderMicrotask(), x.current && u.animationState && u.animationState.animateChanges());
4006
3984
  }), re(() => {
4007
- u && (!w.current && u.animationState && u.animationState.animateChanges(), w.current && (queueMicrotask(() => {
3985
+ u && (!x.current && u.animationState && u.animationState.animateChanges(), x.current && (queueMicrotask(() => {
4008
3986
  window.MotionHandoffMarkAsComplete?.(m);
4009
- }), w.current = !1), u.enteringChildren = void 0);
3987
+ }), x.current = !1), u.enteringChildren = void 0);
4010
3988
  }), u;
4011
3989
  }
4012
3990
  function ih(e, t, n, s) {
@@ -4014,7 +3992,7 @@ function ih(e, t, n, s) {
4014
3992
  e.projection = new n(e.latestValues, t["data-framer-portal-id"] ? void 0 : za(e.parent)), e.projection.setOptions({
4015
3993
  layoutId: r,
4016
3994
  layout: o,
4017
- alwaysMeasureLayout: !!i || a && Jt(a),
3995
+ alwaysMeasureLayout: !!i || a && Ht(a),
4018
3996
  visualElement: e,
4019
3997
  /**
4020
3998
  * TODO: Update options in an effect. This could be tricky as it'll be too late
@@ -4046,10 +4024,10 @@ function ps(e, { forwardMotionProps: t = !1 } = {}, n, s) {
4046
4024
  }, { isStatic: d } = u, f = jd(a), m = r(a, d);
4047
4025
  if (!d && Cr) {
4048
4026
  ah(u, n);
4049
- const w = lh(u);
4050
- c = w.MeasureLayout, f.visualElement = rh(e, m, u, s, w.ProjectionNode);
4027
+ const x = lh(u);
4028
+ c = x.MeasureLayout, f.visualElement = rh(e, m, u, s, x.ProjectionNode);
4051
4029
  }
4052
- return C(Ps.Provider, { value: f, children: [c && f.visualElement ? h(c, { visualElement: f.visualElement, ...u }) : null, Hd(e, a, nh(m, f.visualElement, l), m, d, t)] });
4030
+ return S(Ps.Provider, { value: f, children: [c && f.visualElement ? h(c, { visualElement: f.visualElement, ...u }) : null, Hd(e, a, nh(m, f.visualElement, l), m, d, t)] });
4053
4031
  }
4054
4032
  o.displayName = `motion.${typeof e == "string" ? e : `create(${e.displayName ?? e.name ?? ""})`}`;
4055
4033
  const i = Dl(o);
@@ -4063,11 +4041,11 @@ function ah(e, t) {
4063
4041
  const n = Se(Gr).strict;
4064
4042
  if (process.env.NODE_ENV !== "production" && t && n) {
4065
4043
  const s = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
4066
- e.ignoreStrict ? on(!1, s, "lazy-strict-mode") : ht(!1, s, "lazy-strict-mode");
4044
+ e.ignoreStrict ? rn(!1, s, "lazy-strict-mode") : ht(!1, s, "lazy-strict-mode");
4067
4045
  }
4068
4046
  }
4069
4047
  function lh(e) {
4070
- const { drag: t, layout: n } = rn;
4048
+ const { drag: t, layout: n } = sn;
4071
4049
  if (!t && !n)
4072
4050
  return {};
4073
4051
  const s = { ...t, ...n };
@@ -4147,21 +4125,21 @@ function hh(e, t, n, s = !1) {
4147
4125
  for (let a = 0; a < r; a++) {
4148
4126
  o = n[a], i = o.projectionDelta;
4149
4127
  const { visualElement: l } = o.options;
4150
- l && l.props.style && l.props.style.display === "contents" || (s && o.options.layoutScroll && o.scroll && o !== o.root && Qt(e, {
4128
+ l && l.props.style && l.props.style.display === "contents" || (s && o.options.layoutScroll && o.scroll && o !== o.root && Zt(e, {
4151
4129
  x: -o.scroll.offset.x,
4152
4130
  y: -o.scroll.offset.y
4153
- }), i && (t.x *= i.x.scale, t.y *= i.y.scale, Wa(e, i)), s && It(o.latestValues) && Qt(e, o.latestValues));
4131
+ }), i && (t.x *= i.x.scale, t.y *= i.y.scale, Wa(e, i)), s && It(o.latestValues) && Zt(e, o.latestValues));
4154
4132
  }
4155
4133
  t.x < $i && t.x > ji && (t.x = 1), t.y < $i && t.y > ji && (t.y = 1);
4156
4134
  }
4157
- function Zt(e, t) {
4135
+ function Jt(e, t) {
4158
4136
  e.min = e.min + t, e.max = e.max + t;
4159
4137
  }
4160
4138
  function Fi(e, t, n, s, r = 0.5) {
4161
4139
  const o = ge(e.min, e.max, r);
4162
4140
  mr(e, t, n, o, s);
4163
4141
  }
4164
- function Qt(e, t) {
4142
+ function Zt(e, t) {
4165
4143
  Fi(e.x, t.x, t.scaleX, t.scale, t.originX), Fi(e.y, t.y, t.scaleY, t.scale, t.originY);
4166
4144
  }
4167
4145
  function Ka(e, t) {
@@ -4169,14 +4147,14 @@ function Ka(e, t) {
4169
4147
  }
4170
4148
  function fh(e, t, n) {
4171
4149
  const s = Ka(e, n), { scroll: r } = t;
4172
- return r && (Zt(s.x, r.offset.x), Zt(s.y, r.offset.y)), s;
4150
+ return r && (Jt(s.x, r.offset.x), Jt(s.y, r.offset.y)), s;
4173
4151
  }
4174
4152
  const Bi = () => ({
4175
4153
  translate: 0,
4176
4154
  scale: 1,
4177
4155
  origin: 0,
4178
4156
  originPoint: 0
4179
- }), en = () => ({
4157
+ }), Qt = () => ({
4180
4158
  x: Bi(),
4181
4159
  y: Bi()
4182
4160
  }), Ui = () => ({ min: 0, max: 0 }), be = () => ({
@@ -4198,14 +4176,14 @@ function gh(e, t, n) {
4198
4176
  if (Ee(r))
4199
4177
  e.addValue(s, r);
4200
4178
  else if (Ee(o))
4201
- e.addValue(s, sn(r, { owner: e }));
4179
+ e.addValue(s, nn(r, { owner: e }));
4202
4180
  else if (o !== r)
4203
4181
  if (e.hasValue(s)) {
4204
4182
  const i = e.getValue(s);
4205
4183
  i.liveStyle === !0 ? i.jump(r) : i.hasAnimated || i.set(r);
4206
4184
  } else {
4207
4185
  const i = e.getStaticValue(s);
4208
- e.addValue(s, sn(i !== void 0 ? i : r, { owner: e }));
4186
+ e.addValue(s, nn(i !== void 0 ? i : r, { owner: e }));
4209
4187
  }
4210
4188
  }
4211
4189
  for (const s in n)
@@ -4240,7 +4218,7 @@ class yh {
4240
4218
  this.renderScheduledAt < f && (this.renderScheduledAt = f, ue.render(this.render, !1, !0));
4241
4219
  };
4242
4220
  const { latestValues: l, renderState: c } = i;
4243
- this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = c, this.parent = t, this.props = n, this.presenceContext = s, this.depth = t ? t.depth + 1 : 0, this.reducedMotionConfig = r, this.options = a, this.blockInitialAnimation = !!o, this.isControllingVariants = As(n), this.isVariantNode = Ra(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(t && t.current);
4221
+ this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = c, this.parent = t, this.props = n, this.presenceContext = s, this.depth = t ? t.depth + 1 : 0, this.reducedMotionConfig = r, this.options = a, this.blockInitialAnimation = !!o, this.isControllingVariants = As(n), this.isVariantNode = Va(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(t && t.current);
4244
4222
  const { willChange: u, ...d } = this.scrapeMotionValuesFromProps(n, {}, this);
4245
4223
  for (const f in d) {
4246
4224
  const m = d[f];
@@ -4268,7 +4246,7 @@ class yh {
4268
4246
  }
4269
4247
  bindToMotionValue(t, n) {
4270
4248
  this.valueSubscriptions.has(t) && this.valueSubscriptions.get(t)();
4271
- const s = cn.has(t);
4249
+ const s = ln.has(t);
4272
4250
  s && this.onBindTransform && this.onBindTransform();
4273
4251
  const r = n.on("change", (i) => {
4274
4252
  this.latestValues[t] = i, this.props.onUpdate && ue.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
@@ -4283,8 +4261,8 @@ class yh {
4283
4261
  }
4284
4262
  updateFeatures() {
4285
4263
  let t = "animation";
4286
- for (t in rn) {
4287
- const n = rn[t];
4264
+ for (t in sn) {
4265
+ const n = sn[t];
4288
4266
  if (!n)
4289
4267
  continue;
4290
4268
  const { isEnabled: s, Feature: r } = n;
@@ -4379,7 +4357,7 @@ class yh {
4379
4357
  if (this.props.values && this.props.values[t])
4380
4358
  return this.props.values[t];
4381
4359
  let s = this.values.get(t);
4382
- return s === void 0 && n !== void 0 && (s = sn(n === null ? void 0 : n, { owner: this }), this.addValue(t, s)), s;
4360
+ return s === void 0 && n !== void 0 && (s = nn(n === null ? void 0 : n, { owner: this }), this.addValue(t, s)), s;
4383
4361
  }
4384
4362
  /**
4385
4363
  * If we're trying to animate to a previously unencountered value,
@@ -4461,10 +4439,10 @@ class vh extends Ga {
4461
4439
  super(...arguments), this.type = "html", this.renderInstance = Ya;
4462
4440
  }
4463
4441
  readValueFromInstance(t, n) {
4464
- if (cn.has(n))
4442
+ if (ln.has(n))
4465
4443
  return this.projection?.isProjecting ? ir(n) : Nu(t, n);
4466
4444
  {
4467
- const s = bh(t), r = (Vr(n) ? s.getPropertyValue(n) : s[n]) || 0;
4445
+ const s = bh(t), r = (Rr(n) ? s.getPropertyValue(n) : s[n]) || 0;
4468
4446
  return typeof r == "string" ? r.trim() : r;
4469
4447
  }
4470
4448
  }
@@ -4516,7 +4494,7 @@ class wh extends Ga {
4516
4494
  return t[n];
4517
4495
  }
4518
4496
  readValueFromInstance(t, n) {
4519
- if (cn.has(n)) {
4497
+ if (ln.has(n)) {
4520
4498
  const s = Ta(n);
4521
4499
  return s && s.default || 0;
4522
4500
  }
@@ -4538,19 +4516,19 @@ class wh extends Ga {
4538
4516
  const Ja = (e, t) => Qr(e) ? new wh(t) : new vh(t, {
4539
4517
  allowProjection: e !== Eo
4540
4518
  });
4541
- function nn(e, t, n) {
4519
+ function tn(e, t, n) {
4542
4520
  const s = e.getProps();
4543
4521
  return ei(s, t, n !== void 0 ? n : s.custom, e);
4544
4522
  }
4545
4523
  const gr = (e) => Array.isArray(e);
4546
4524
  function Th(e, t, n) {
4547
- e.hasValue(t) ? e.getValue(t).set(n) : e.addValue(t, sn(n));
4525
+ e.hasValue(t) ? e.getValue(t).set(n) : e.addValue(t, nn(n));
4548
4526
  }
4549
4527
  function Sh(e) {
4550
4528
  return gr(e) ? e[e.length - 1] || 0 : e;
4551
4529
  }
4552
4530
  function Ph(e, t) {
4553
- const n = nn(e, t);
4531
+ const n = tn(e, t);
4554
4532
  let { transitionEnd: s = {}, transition: r = {}, ...o } = n || {};
4555
4533
  o = { ...o, ...s };
4556
4534
  for (const i in o) {
@@ -4595,8 +4573,8 @@ const Eh = {
4595
4573
  type: "keyframes",
4596
4574
  ease: [0.25, 0.1, 0.35, 1],
4597
4575
  duration: 0.3
4598
- }, Rh = (e, { keyframes: t }) => t.length > 2 ? Nh : cn.has(e) ? e.startsWith("scale") ? Mh(t[1]) : Eh : Dh;
4599
- function Vh({ when: e, delay: t, delayChildren: n, staggerChildren: s, staggerDirection: r, repeat: o, repeatType: i, repeatDelay: a, from: l, elapsed: c, ...u }) {
4576
+ }, Vh = (e, { keyframes: t }) => t.length > 2 ? Nh : ln.has(e) ? e.startsWith("scale") ? Mh(t[1]) : Eh : Dh;
4577
+ function Rh({ when: e, delay: t, delayChildren: n, staggerChildren: s, staggerDirection: r, repeat: o, repeatType: i, repeatDelay: a, from: l, elapsed: c, ...u }) {
4600
4578
  return !!Object.keys(u).length;
4601
4579
  }
4602
4580
  const si = (e, t, n, s = {}, r, o) => (i) => {
@@ -4619,7 +4597,7 @@ const si = (e, t, n, s = {}, r, o) => (i) => {
4619
4597
  motionValue: t,
4620
4598
  element: o ? void 0 : r
4621
4599
  };
4622
- Vh(a) || Object.assign(u, Rh(e, u)), u.duration && (u.duration = /* @__PURE__ */ Ye(u.duration)), u.repeatDelay && (u.repeatDelay = /* @__PURE__ */ Ye(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
4600
+ Rh(a) || Object.assign(u, Vh(e, u)), u.duration && (u.duration = /* @__PURE__ */ Ye(u.duration)), u.repeatDelay && (u.repeatDelay = /* @__PURE__ */ Ye(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
4623
4601
  let d = !1;
4624
4602
  if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (ur(u), u.delay === 0 && (d = !0)), (ft.instantAnimations || ft.skipAnimations) && (d = !0, ur(u), u.delay = 0), u.allowFlatten = !a.type && !a.ease, d && !o && t.get() !== void 0) {
4625
4603
  const f = kh(u.keyframes, a);
@@ -4647,20 +4625,20 @@ function Qa(e, t, { delay: n = 0, transitionOverride: s, type: r } = {}) {
4647
4625
  const m = {
4648
4626
  delay: n,
4649
4627
  ..._r(o || {}, u)
4650
- }, w = d.get();
4651
- if (w !== void 0 && !d.isAnimating && !Array.isArray(f) && f === w && !m.velocity)
4628
+ }, x = d.get();
4629
+ if (x !== void 0 && !d.isAnimating && !Array.isArray(f) && f === x && !m.velocity)
4652
4630
  continue;
4653
4631
  let v = !1;
4654
4632
  if (window.MotionHandoffAnimation) {
4655
- const b = Za(e);
4656
- if (b) {
4657
- const M = window.MotionHandoffAnimation(b, u, ue);
4633
+ const y = Za(e);
4634
+ if (y) {
4635
+ const M = window.MotionHandoffAnimation(y, u, ue);
4658
4636
  M !== null && (m.startTime = M, v = !0);
4659
4637
  }
4660
4638
  }
4661
4639
  yr(e, u), d.start(si(u, d, f, e.shouldReduceMotion && va.has(u) ? { type: !1 } : m, e, v));
4662
- const T = d.animation;
4663
- T && l.push(T);
4640
+ const w = d.animation;
4641
+ w && l.push(w);
4664
4642
  }
4665
4643
  return i && Promise.all(l).then(() => {
4666
4644
  ue.update(() => {
@@ -4673,7 +4651,7 @@ function el(e, t, n, s = 0, r = 1) {
4673
4651
  return typeof n == "function" ? n(o, i) : r === 1 ? o * s : a - o * s;
4674
4652
  }
4675
4653
  function br(e, t, n = {}) {
4676
- const s = nn(e, t, n.type === "exit" ? e.presenceContext?.custom : void 0);
4654
+ const s = tn(e, t, n.type === "exit" ? e.presenceContext?.custom : void 0);
4677
4655
  let { transition: r = e.getDefaultTransition() || {} } = s || {};
4678
4656
  n.transitionOverride && (r = n.transitionOverride);
4679
4657
  const o = s ? () => Promise.all(Qa(e, s, n)) : () => Promise.resolve(), i = e.variantChildren && e.variantChildren.size ? (l = 0) => {
@@ -4704,7 +4682,7 @@ function Lh(e, t, n = {}) {
4704
4682
  } else if (typeof t == "string")
4705
4683
  s = br(e, t, n);
4706
4684
  else {
4707
- const r = typeof t == "function" ? nn(e, t, n.custom) : t;
4685
+ const r = typeof t == "function" ? tn(e, t, n.custom) : t;
4708
4686
  s = Promise.all(Qa(e, r, n));
4709
4687
  }
4710
4688
  return s.then(() => {
@@ -4733,7 +4711,7 @@ function nl(e) {
4733
4711
  const t = {};
4734
4712
  for (let n = 0; n < jh; n++) {
4735
4713
  const s = Hr[n], r = e.props[s];
4736
- (Bn(r) || r === !1) && (t[s] = r);
4714
+ (Fn(r) || r === !1) && (t[s] = r);
4737
4715
  }
4738
4716
  return t;
4739
4717
  }
@@ -4744,10 +4722,10 @@ function Bh(e) {
4744
4722
  function Uh(e) {
4745
4723
  let t = Bh(e), n = _i(), s = !0;
4746
4724
  const r = (l) => (c, u) => {
4747
- const d = nn(e, u, l === "exit" ? e.presenceContext?.custom : void 0);
4725
+ const d = tn(e, u, l === "exit" ? e.presenceContext?.custom : void 0);
4748
4726
  if (d) {
4749
- const { transition: f, transitionEnd: m, ...w } = d;
4750
- c = { ...c, ...w, ...m };
4727
+ const { transition: f, transitionEnd: m, ...x } = d;
4728
+ c = { ...c, ...x, ...m };
4751
4729
  }
4752
4730
  return c;
4753
4731
  };
@@ -4756,28 +4734,28 @@ function Uh(e) {
4756
4734
  }
4757
4735
  function i(l) {
4758
4736
  const { props: c } = e, u = nl(e.parent) || {}, d = [], f = /* @__PURE__ */ new Set();
4759
- let m = {}, w = 1 / 0;
4760
- for (let T = 0; T < Fh; T++) {
4761
- const b = $h[T], M = n[b], E = c[b] !== void 0 ? c[b] : u[b], F = Bn(E), R = b === l ? M.isActive : null;
4762
- R === !1 && (w = T);
4763
- let L = E === u[b] && E !== c[b] && F;
4737
+ let m = {}, x = 1 / 0;
4738
+ for (let w = 0; w < Fh; w++) {
4739
+ const y = $h[w], M = n[y], E = c[y] !== void 0 ? c[y] : u[y], F = Fn(E), V = y === l ? M.isActive : null;
4740
+ V === !1 && (x = w);
4741
+ let L = E === u[y] && E !== c[y] && F;
4764
4742
  if (L && s && e.manuallyAnimateOnMount && (L = !1), M.protectedKeys = { ...m }, // If it isn't active and hasn't *just* been set as inactive
4765
- !M.isActive && R === null || // If we didn't and don't have any defined prop for this animation type
4743
+ !M.isActive && V === null || // If we didn't and don't have any defined prop for this animation type
4766
4744
  !E && !M.prevProp || // Or if the prop doesn't define an animation
4767
4745
  Cs(E) || typeof E == "boolean")
4768
4746
  continue;
4769
4747
  const D = zh(M.prevProp, E);
4770
- let A = D || // If we're making this variant active, we want to always make it active
4771
- b === l && M.isActive && !L && F || // If we removed a higher-priority variant (i is in reverse order)
4772
- T > w && F, j = !1;
4748
+ let C = D || // If we're making this variant active, we want to always make it active
4749
+ y === l && M.isActive && !L && F || // If we removed a higher-priority variant (i is in reverse order)
4750
+ w > x && F, j = !1;
4773
4751
  const k = Array.isArray(E) ? E : [E];
4774
- let N = k.reduce(r(b), {});
4775
- R === !1 && (N = {});
4752
+ let N = k.reduce(r(y), {});
4753
+ V === !1 && (N = {});
4776
4754
  const { prevResolvedValues: B = {} } = M, I = {
4777
4755
  ...B,
4778
4756
  ...N
4779
4757
  }, U = (G) => {
4780
- A = !0, f.has(G) && (j = !0, f.delete(G)), M.needsAnimating[G] = !0;
4758
+ C = !0, f.has(G) && (j = !0, f.delete(G)), M.needsAnimating[G] = !0;
4781
4759
  const ae = e.getValue(G);
4782
4760
  ae && (ae.liveStyle = !1);
4783
4761
  };
@@ -4788,12 +4766,12 @@ function Uh(e) {
4788
4766
  let He = !1;
4789
4767
  gr(ae) && gr(xe) ? He = !tl(ae, xe) : He = ae !== xe, He ? ae != null ? U(G) : f.add(G) : ae !== void 0 && f.has(G) ? U(G) : M.protectedKeys[G] = !0;
4790
4768
  }
4791
- M.prevProp = E, M.prevResolvedValues = N, M.isActive && (m = { ...m, ...N }), s && e.blockInitialAnimation && (A = !1);
4769
+ M.prevProp = E, M.prevResolvedValues = N, M.isActive && (m = { ...m, ...N }), s && e.blockInitialAnimation && (C = !1);
4792
4770
  const W = L && D;
4793
- A && (!W || j) && d.push(...k.map((G) => {
4794
- const ae = { type: b };
4771
+ C && (!W || j) && d.push(...k.map((G) => {
4772
+ const ae = { type: y };
4795
4773
  if (typeof G == "string" && s && !W && e.manuallyAnimateOnMount && e.parent) {
4796
- const { parent: xe } = e, He = nn(xe, G);
4774
+ const { parent: xe } = e, He = tn(xe, G);
4797
4775
  if (xe.enteringChildren && He) {
4798
4776
  const { delayChildren: Ct } = He.transition || {};
4799
4777
  ae.delay = el(xe.enteringChildren, e, Ct);
@@ -4806,15 +4784,15 @@ function Uh(e) {
4806
4784
  }));
4807
4785
  }
4808
4786
  if (f.size) {
4809
- const T = {};
4787
+ const w = {};
4810
4788
  if (typeof c.initial != "boolean") {
4811
- const b = nn(e, Array.isArray(c.initial) ? c.initial[0] : c.initial);
4812
- b && b.transition && (T.transition = b.transition);
4789
+ const y = tn(e, Array.isArray(c.initial) ? c.initial[0] : c.initial);
4790
+ y && y.transition && (w.transition = y.transition);
4813
4791
  }
4814
- f.forEach((b) => {
4815
- const M = e.getBaseTarget(b), E = e.getValue(b);
4816
- E && (E.liveStyle = !0), T[b] = M ?? null;
4817
- }), d.push({ animation: T });
4792
+ f.forEach((y) => {
4793
+ const M = e.getBaseTarget(y), E = e.getValue(y);
4794
+ E && (E.liveStyle = !0), w[y] = M ?? null;
4795
+ }), d.push({ animation: w });
4818
4796
  }
4819
4797
  let v = !!d.length;
4820
4798
  return s && (c.initial === !1 || c.initial === c.animate) && !e.manuallyAnimateOnMount && (v = !1), s = !1, v ? t(d) : Promise.resolve();
@@ -4841,7 +4819,7 @@ function Uh(e) {
4841
4819
  function zh(e, t) {
4842
4820
  return typeof t == "string" ? t !== e : Array.isArray(t) ? !tl(t, e) : !1;
4843
4821
  }
4844
- function Rt(e = !1) {
4822
+ function Vt(e = !1) {
4845
4823
  return {
4846
4824
  isActive: e,
4847
4825
  protectedKeys: {},
@@ -4851,13 +4829,13 @@ function Rt(e = !1) {
4851
4829
  }
4852
4830
  function _i() {
4853
4831
  return {
4854
- animate: Rt(!0),
4855
- whileInView: Rt(),
4856
- whileHover: Rt(),
4857
- whileTap: Rt(),
4858
- whileDrag: Rt(),
4859
- whileFocus: Rt(),
4860
- exit: Rt()
4832
+ animate: Vt(!0),
4833
+ whileInView: Vt(),
4834
+ whileHover: Vt(),
4835
+ whileTap: Vt(),
4836
+ whileDrag: Vt(),
4837
+ whileFocus: Vt(),
4838
+ exit: Vt()
4861
4839
  };
4862
4840
  }
4863
4841
  class Pt {
@@ -4925,10 +4903,10 @@ const sl = {
4925
4903
  Feature: Wh
4926
4904
  }
4927
4905
  };
4928
- function zn(e, t, n, s = { passive: !0 }) {
4906
+ function Un(e, t, n, s = { passive: !0 }) {
4929
4907
  return e.addEventListener(t, n, s), () => e.removeEventListener(t, n);
4930
4908
  }
4931
- function qn(e) {
4909
+ function Kn(e) {
4932
4910
  return {
4933
4911
  point: {
4934
4912
  x: e.pageX,
@@ -4936,33 +4914,33 @@ function qn(e) {
4936
4914
  }
4937
4915
  };
4938
4916
  }
4939
- const Kh = (e) => (t) => Kr(t) && e(t, qn(t));
4917
+ const Kh = (e) => (t) => Kr(t) && e(t, Kn(t));
4940
4918
  function Vn(e, t, n, s) {
4941
- return zn(e, t, Kh(n), s);
4919
+ return Un(e, t, Kh(n), s);
4942
4920
  }
4943
4921
  const rl = 1e-4, qh = 1 - rl, Gh = 1 + rl, il = 0.01, Yh = 0 - il, Hh = 0 + il;
4944
- function Re(e) {
4922
+ function Ve(e) {
4945
4923
  return e.max - e.min;
4946
4924
  }
4947
4925
  function Jh(e, t, n) {
4948
4926
  return Math.abs(e - t) <= n;
4949
4927
  }
4950
4928
  function Xi(e, t, n, s = 0.5) {
4951
- e.origin = s, e.originPoint = ge(t.min, t.max, e.origin), e.scale = Re(n) / Re(t), e.translate = ge(n.min, n.max, e.origin) - e.originPoint, (e.scale >= qh && e.scale <= Gh || isNaN(e.scale)) && (e.scale = 1), (e.translate >= Yh && e.translate <= Hh || isNaN(e.translate)) && (e.translate = 0);
4929
+ e.origin = s, e.originPoint = ge(t.min, t.max, e.origin), e.scale = Ve(n) / Ve(t), e.translate = ge(n.min, n.max, e.origin) - e.originPoint, (e.scale >= qh && e.scale <= Gh || isNaN(e.scale)) && (e.scale = 1), (e.translate >= Yh && e.translate <= Hh || isNaN(e.translate)) && (e.translate = 0);
4952
4930
  }
4953
- function In(e, t, n, s) {
4931
+ function Rn(e, t, n, s) {
4954
4932
  Xi(e.x, t.x, n.x, s ? s.originX : void 0), Xi(e.y, t.y, n.y, s ? s.originY : void 0);
4955
4933
  }
4956
4934
  function Wi(e, t, n) {
4957
- e.min = n.min + t.min, e.max = e.min + Re(t);
4935
+ e.min = n.min + t.min, e.max = e.min + Ve(t);
4958
4936
  }
4959
4937
  function Zh(e, t, n) {
4960
4938
  Wi(e.x, t.x, n.x), Wi(e.y, t.y, n.y);
4961
4939
  }
4962
4940
  function Ki(e, t, n) {
4963
- e.min = t.min - n.min, e.max = e.min + Re(t);
4941
+ e.min = t.min - n.min, e.max = e.min + Ve(t);
4964
4942
  }
4965
- function On(e, t, n) {
4943
+ function In(e, t, n) {
4966
4944
  Ki(e.x, t.x, n.x), Ki(e.y, t.y, n.y);
4967
4945
  }
4968
4946
  function Be(e) {
@@ -4978,29 +4956,29 @@ class al {
4978
4956
  if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => {
4979
4957
  if (!(this.lastMoveEvent && this.lastMoveEventInfo))
4980
4958
  return;
4981
- const f = _s(this.lastMoveEventInfo, this.history), m = this.startEvent !== null, w = Qh(f.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
4982
- if (!m && !w)
4959
+ const f = _s(this.lastMoveEventInfo, this.history), m = this.startEvent !== null, x = Qh(f.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
4960
+ if (!m && !x)
4983
4961
  return;
4984
- const { point: v } = f, { timestamp: T } = Ce;
4985
- this.history.push({ ...v, timestamp: T });
4986
- const { onStart: b, onMove: M } = this.handlers;
4987
- m || (b && b(this.lastMoveEvent, f), this.startEvent = this.lastMoveEvent), M && M(this.lastMoveEvent, f);
4962
+ const { point: v } = f, { timestamp: w } = Ce;
4963
+ this.history.push({ ...v, timestamp: w });
4964
+ const { onStart: y, onMove: M } = this.handlers;
4965
+ m || (y && y(this.lastMoveEvent, f), this.startEvent = this.lastMoveEvent), M && M(this.lastMoveEvent, f);
4988
4966
  }, this.handlePointerMove = (f, m) => {
4989
4967
  this.lastMoveEvent = f, this.lastMoveEventInfo = zs(m, this.transformPagePoint), ue.update(this.updatePoint, !0);
4990
4968
  }, this.handlePointerUp = (f, m) => {
4991
4969
  this.end();
4992
- const { onEnd: w, onSessionEnd: v, resumeAnimation: T } = this.handlers;
4993
- if (this.dragSnapToOrigin && T && T(), !(this.lastMoveEvent && this.lastMoveEventInfo))
4970
+ const { onEnd: x, onSessionEnd: v, resumeAnimation: w } = this.handlers;
4971
+ if (this.dragSnapToOrigin && w && w(), !(this.lastMoveEvent && this.lastMoveEventInfo))
4994
4972
  return;
4995
- const b = _s(f.type === "pointercancel" ? this.lastMoveEventInfo : zs(m, this.transformPagePoint), this.history);
4996
- this.startEvent && w && w(f, b), v && v(f, b);
4973
+ const y = _s(f.type === "pointercancel" ? this.lastMoveEventInfo : zs(m, this.transformPagePoint), this.history);
4974
+ this.startEvent && x && x(f, y), v && v(f, y);
4997
4975
  }, !Kr(t))
4998
4976
  return;
4999
4977
  this.dragSnapToOrigin = o, this.handlers = n, this.transformPagePoint = s, this.distanceThreshold = i, this.contextWindow = r || window;
5000
- const a = qn(t), l = zs(a, this.transformPagePoint), { point: c } = l, { timestamp: u } = Ce;
4978
+ const a = Kn(t), l = zs(a, this.transformPagePoint), { point: c } = l, { timestamp: u } = Ce;
5001
4979
  this.history = [{ ...c, timestamp: u }];
5002
4980
  const { onSessionStart: d } = n;
5003
- d && d(t, _s(l, this.history)), this.removeListeners = Xn(Vn(this.contextWindow, "pointermove", this.handlePointerMove), Vn(this.contextWindow, "pointerup", this.handlePointerUp), Vn(this.contextWindow, "pointercancel", this.handlePointerUp));
4981
+ d && d(t, _s(l, this.history)), this.removeListeners = _n(Vn(this.contextWindow, "pointermove", this.handlePointerMove), Vn(this.contextWindow, "pointerup", this.handlePointerUp), Vn(this.contextWindow, "pointercancel", this.handlePointerUp));
5004
4982
  }
5005
4983
  updateHandlers(t) {
5006
4984
  this.handlers = t;
@@ -5074,8 +5052,8 @@ function rf(e, t) {
5074
5052
  }
5075
5053
  function of(e, t) {
5076
5054
  let n = 0.5;
5077
- const s = Re(e), r = Re(t);
5078
- return r > s ? n = /* @__PURE__ */ jn(t.min, t.max - s, e.min) : s > r && (n = /* @__PURE__ */ jn(e.min, e.max - r, t.min)), dt(0, 1, n);
5055
+ const s = Ve(e), r = Ve(t);
5056
+ return r > s ? n = /* @__PURE__ */ Ln(t.min, t.max - s, e.min) : s > r && (n = /* @__PURE__ */ Ln(e.min, e.max - r, t.min)), dt(0, 1, n);
5079
5057
  }
5080
5058
  function af(e, t) {
5081
5059
  const n = {};
@@ -5108,35 +5086,35 @@ class uf {
5108
5086
  return;
5109
5087
  const o = (d) => {
5110
5088
  const { dragSnapToOrigin: f } = this.getProps();
5111
- f ? this.pauseAnimation() : this.stopAnimation(), n && this.snapToCursor(qn(d).point);
5089
+ f ? this.pauseAnimation() : this.stopAnimation(), n && this.snapToCursor(Kn(d).point);
5112
5090
  }, i = (d, f) => {
5113
- const { drag: m, dragPropagation: w, onDragStart: v } = this.getProps();
5114
- if (m && !w && (this.openDragLock && this.openDragLock(), this.openDragLock = gd(m), !this.openDragLock))
5091
+ const { drag: m, dragPropagation: x, onDragStart: v } = this.getProps();
5092
+ if (m && !x && (this.openDragLock && this.openDragLock(), this.openDragLock = gd(m), !this.openDragLock))
5115
5093
  return;
5116
- this.latestPointerEvent = d, this.latestPanInfo = f, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Be((b) => {
5117
- let M = this.getAxisMotionValue(b).get() || 0;
5094
+ this.latestPointerEvent = d, this.latestPanInfo = f, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), Be((y) => {
5095
+ let M = this.getAxisMotionValue(y).get() || 0;
5118
5096
  if (it.test(M)) {
5119
5097
  const { projection: E } = this.visualElement;
5120
5098
  if (E && E.layout) {
5121
- const F = E.layout.layoutBox[b];
5122
- F && (M = Re(F) * (parseFloat(M) / 100));
5099
+ const F = E.layout.layoutBox[y];
5100
+ F && (M = Ve(F) * (parseFloat(M) / 100));
5123
5101
  }
5124
5102
  }
5125
- this.originPoint[b] = M;
5103
+ this.originPoint[y] = M;
5126
5104
  }), v && ue.postRender(() => v(d, f)), yr(this.visualElement, "transform");
5127
- const { animationState: T } = this.visualElement;
5128
- T && T.setActive("whileDrag", !0);
5105
+ const { animationState: w } = this.visualElement;
5106
+ w && w.setActive("whileDrag", !0);
5129
5107
  }, a = (d, f) => {
5130
5108
  this.latestPointerEvent = d, this.latestPanInfo = f;
5131
- const { dragPropagation: m, dragDirectionLock: w, onDirectionLock: v, onDrag: T } = this.getProps();
5109
+ const { dragPropagation: m, dragDirectionLock: x, onDirectionLock: v, onDrag: w } = this.getProps();
5132
5110
  if (!m && !this.openDragLock)
5133
5111
  return;
5134
- const { offset: b } = f;
5135
- if (w && this.currentDirection === null) {
5136
- this.currentDirection = df(b), this.currentDirection !== null && v && v(this.currentDirection);
5112
+ const { offset: y } = f;
5113
+ if (x && this.currentDirection === null) {
5114
+ this.currentDirection = df(y), this.currentDirection !== null && v && v(this.currentDirection);
5137
5115
  return;
5138
5116
  }
5139
- this.updateAxis("x", f.point, b), this.updateAxis("y", f.point, b), this.visualElement.render(), T && T(d, f);
5117
+ this.updateAxis("x", f.point, y), this.updateAxis("y", f.point, y), this.visualElement.render(), w && w(d, f);
5140
5118
  }, l = (d, f) => {
5141
5119
  this.latestPointerEvent = d, this.latestPanInfo = f, this.stop(d, f), this.latestPointerEvent = null, this.latestPanInfo = null;
5142
5120
  }, c = () => Be((d) => this.getAnimationState(d) === "paused" && this.getAxisMotionValue(d).animation?.play()), { dragSnapToOrigin: u } = this.getProps();
@@ -5185,13 +5163,13 @@ class uf {
5185
5163
  }
5186
5164
  resolveConstraints() {
5187
5165
  const { dragConstraints: t, dragElastic: n } = this.getProps(), s = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, r = this.constraints;
5188
- t && Jt(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && s ? this.constraints = sf(s.layoutBox, t) : this.constraints = !1, this.elastic = lf(n), r !== this.constraints && s && this.constraints && !this.hasMutatedConstraints && Be((o) => {
5166
+ t && Ht(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && s ? this.constraints = sf(s.layoutBox, t) : this.constraints = !1, this.elastic = lf(n), r !== this.constraints && s && this.constraints && !this.hasMutatedConstraints && Be((o) => {
5189
5167
  this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = af(s.layoutBox[o], this.constraints[o]));
5190
5168
  });
5191
5169
  }
5192
5170
  resolveRefConstraints() {
5193
5171
  const { dragConstraints: t, onMeasureDragConstraints: n } = this.getProps();
5194
- if (!t || !Jt(t))
5172
+ if (!t || !Ht(t))
5195
5173
  return !1;
5196
5174
  const s = t.current;
5197
5175
  ht(s !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
@@ -5212,7 +5190,7 @@ class uf {
5212
5190
  return;
5213
5191
  let d = l && l[u] || {};
5214
5192
  i && (d = { min: 0, max: 0 });
5215
- const f = r ? 200 : 1e6, m = r ? 40 : 1e7, w = {
5193
+ const f = r ? 200 : 1e6, m = r ? 40 : 1e7, x = {
5216
5194
  type: "inertia",
5217
5195
  velocity: s ? t[u] : 0,
5218
5196
  bounceStiffness: f,
@@ -5223,7 +5201,7 @@ class uf {
5223
5201
  ...o,
5224
5202
  ...d
5225
5203
  };
5226
- return this.startAxisValueAnimation(u, w);
5204
+ return this.startAxisValueAnimation(u, x);
5227
5205
  });
5228
5206
  return Promise.all(c).then(a);
5229
5207
  }
@@ -5271,7 +5249,7 @@ class uf {
5271
5249
  if (!this.visualElement.current)
5272
5250
  return;
5273
5251
  const { drag: t, dragConstraints: n } = this.getProps(), { projection: s } = this.visualElement;
5274
- if (!Jt(n) || !s || !this.constraints)
5252
+ if (!Ht(n) || !s || !this.constraints)
5275
5253
  return;
5276
5254
  this.stopAnimation();
5277
5255
  const r = { x: 0, y: 0 };
@@ -5299,10 +5277,10 @@ class uf {
5299
5277
  c && u && this.start(l);
5300
5278
  }), s = () => {
5301
5279
  const { dragConstraints: l } = this.getProps();
5302
- Jt(l) && l.current && (this.constraints = this.resolveRefConstraints());
5280
+ Ht(l) && l.current && (this.constraints = this.resolveRefConstraints());
5303
5281
  }, { projection: r } = this.visualElement, o = r.addEventListener("measure", s);
5304
5282
  r && !r.layout && (r.root && r.root.updateScroll(), r.updateLayout()), ue.read(s);
5305
- const i = zn(window, "resize", () => this.scalePositionWithinConstraints()), a = r.addEventListener("didUpdate", ({ delta: l, hasLayoutChanged: c }) => {
5283
+ const i = Un(window, "resize", () => this.scalePositionWithinConstraints()), a = r.addEventListener("didUpdate", ({ delta: l, hasLayoutChanged: c }) => {
5306
5284
  this.isDragging && c && (Be((u) => {
5307
5285
  const d = this.getAxisMotionValue(u);
5308
5286
  d && (this.originPoint[u] += l[u].translate, d.set(d.get() + l[u].translate));
@@ -5393,7 +5371,7 @@ const gs = {
5393
5371
  function eo(e, t) {
5394
5372
  return t.max === t.min ? 0 : e / (t.max - t.min) * 100;
5395
5373
  }
5396
- const En = {
5374
+ const kn = {
5397
5375
  correct: (e, t) => {
5398
5376
  if (!t.target)
5399
5377
  return e;
@@ -5417,7 +5395,7 @@ const En = {
5417
5395
  }
5418
5396
  };
5419
5397
  let Xs = !1;
5420
- class pf extends Rl {
5398
+ class pf extends Vl {
5421
5399
  /**
5422
5400
  * This only mounts projection nodes for components that
5423
5401
  * need measuring, we might want to do it for all components
@@ -5463,7 +5441,7 @@ function cl(e) {
5463
5441
  }
5464
5442
  const gf = {
5465
5443
  borderRadius: {
5466
- ...En,
5444
+ ...kn,
5467
5445
  applyTo: [
5468
5446
  "borderTopLeftRadius",
5469
5447
  "borderTopRightRadius",
@@ -5471,14 +5449,14 @@ const gf = {
5471
5449
  "borderBottomRightRadius"
5472
5450
  ]
5473
5451
  },
5474
- borderTopLeftRadius: En,
5475
- borderTopRightRadius: En,
5476
- borderBottomLeftRadius: En,
5477
- borderBottomRightRadius: En,
5452
+ borderTopLeftRadius: kn,
5453
+ borderTopRightRadius: kn,
5454
+ borderBottomLeftRadius: kn,
5455
+ borderBottomRightRadius: kn,
5478
5456
  boxShadow: mf
5479
5457
  };
5480
5458
  function yf(e, t, n) {
5481
- const s = Ee(e) ? e : sn(e);
5459
+ const s = Ee(e) ? e : nn(e);
5482
5460
  return s.start(si("", s, t, n)), s.animation;
5483
5461
  }
5484
5462
  const bf = (e, t) => e.depth - t.depth;
@@ -5520,7 +5498,7 @@ function so(e, t) {
5520
5498
  }
5521
5499
  const Sf = /* @__PURE__ */ dl(0, 0.5, Ho), Pf = /* @__PURE__ */ dl(0.5, 0.95, ze);
5522
5500
  function dl(e, t, n) {
5523
- return (s) => s < e ? 0 : s > t ? 1 : n(/* @__PURE__ */ jn(e, t, s));
5501
+ return (s) => s < e ? 0 : s > t ? 1 : n(/* @__PURE__ */ Ln(e, t, s));
5524
5502
  }
5525
5503
  function ro(e, t) {
5526
5504
  e.min = t.min, e.max = t.max;
@@ -5566,7 +5544,7 @@ function fl(e, t) {
5566
5544
  return ho(e.x, t.x) && ho(e.y, t.y);
5567
5545
  }
5568
5546
  function fo(e) {
5569
- return Re(e.x) / Re(e.y);
5547
+ return Ve(e.x) / Ve(e.y);
5570
5548
  }
5571
5549
  function mo(e, t) {
5572
5550
  return e.translate === t.translate && e.scale === t.scale && e.originPoint === t.originPoint;
@@ -5629,14 +5607,14 @@ function Nf(e, t, n) {
5629
5607
  let s = "";
5630
5608
  const r = e.x.translate / t.x, o = e.y.translate / t.y, i = n?.z || 0;
5631
5609
  if ((r || o || i) && (s = `translate3d(${r}px, ${o}px, ${i}px) `), (t.x !== 1 || t.y !== 1) && (s += `scale(${1 / t.x}, ${1 / t.y}) `), n) {
5632
- const { transformPerspective: c, rotate: u, rotateX: d, rotateY: f, skewX: m, skewY: w } = n;
5633
- c && (s = `perspective(${c}px) ${s}`), u && (s += `rotate(${u}deg) `), d && (s += `rotateX(${d}deg) `), f && (s += `rotateY(${f}deg) `), m && (s += `skewX(${m}deg) `), w && (s += `skewY(${w}deg) `);
5610
+ const { transformPerspective: c, rotate: u, rotateX: d, rotateY: f, skewX: m, skewY: x } = n;
5611
+ c && (s = `perspective(${c}px) ${s}`), u && (s += `rotate(${u}deg) `), d && (s += `rotateX(${d}deg) `), f && (s += `rotateY(${f}deg) `), m && (s += `skewX(${m}deg) `), x && (s += `skewY(${x}deg) `);
5634
5612
  }
5635
5613
  const a = e.x.scale * t.x, l = e.y.scale * t.y;
5636
5614
  return (a !== 1 || l !== 1) && (s += `scale(${a}, ${l})`), s || "none";
5637
5615
  }
5638
5616
  const Ws = ["", "X", "Y", "Z"], Df = 1e3;
5639
- let Rf = 0;
5617
+ let Vf = 0;
5640
5618
  function Ks(e, t, n, s) {
5641
5619
  const { latestValues: r } = t;
5642
5620
  r[e] && (n[e] = r[e], t.setStaticValue(e, 0), s && (s[e] = 0));
@@ -5658,7 +5636,7 @@ function ml(e) {
5658
5636
  function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, checkIsScrollRoot: s, resetTransform: r }) {
5659
5637
  return class {
5660
5638
  constructor(i = {}, a = t?.()) {
5661
- this.id = Rf++, 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 = () => {
5639
+ this.id = Vf++, 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 = () => {
5662
5640
  this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
5663
5641
  }, this.updateProjection = () => {
5664
5642
  this.projectionUpdateScheduled = !1, this.nodes.forEach(Of), this.nodes.forEach(Ff), this.nodes.forEach(Bf), this.nodes.forEach(Lf);
@@ -5700,13 +5678,13 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5700
5678
  this.target = void 0, this.relativeTarget = void 0;
5701
5679
  return;
5702
5680
  }
5703
- const w = this.options.transition || c.getDefaultTransition() || Wf, { onLayoutAnimationStart: v, onLayoutAnimationComplete: T } = c.getProps(), b = !this.targetLayout || !fl(this.targetLayout, m), M = !d && f;
5704
- if (this.options.layoutRoot || this.resumeFrom || M || d && (b || !this.currentAnimation)) {
5681
+ const x = this.options.transition || c.getDefaultTransition() || Wf, { onLayoutAnimationStart: v, onLayoutAnimationComplete: w } = c.getProps(), y = !this.targetLayout || !fl(this.targetLayout, m), M = !d && f;
5682
+ if (this.options.layoutRoot || this.resumeFrom || M || d && (y || !this.currentAnimation)) {
5705
5683
  this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
5706
5684
  const E = {
5707
- ..._r(w, "layout"),
5685
+ ..._r(x, "layout"),
5708
5686
  onPlay: v,
5709
- onComplete: T
5687
+ onComplete: w
5710
5688
  };
5711
5689
  (c.shouldReduceMotion || this.options.layoutRoot) && (E.delay = 0, E.type = !1), this.startAnimation(E), this.setAnimationOrigin(u, M);
5712
5690
  } else
@@ -5767,7 +5745,7 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5767
5745
  this.nodes.forEach(go);
5768
5746
  return;
5769
5747
  }
5770
- this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach($f), this.nodes.forEach(Vf), this.nodes.forEach(If)) : this.nodes.forEach(go), this.clearAllSnapshots();
5748
+ this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach($f), this.nodes.forEach(Rf), this.nodes.forEach(If)) : this.nodes.forEach(go), this.clearAllSnapshots();
5771
5749
  const a = Ie.now();
5772
5750
  Ce.delta = dt(0, 1e3 / 60, a - Ce.timestamp), Ce.timestamp = a, Ce.isProcessing = !0, Is.update.process(Ce), Is.preRender.process(Ce), Is.render.process(Ce), Ce.isProcessing = !1;
5773
5751
  }
@@ -5789,7 +5767,7 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5789
5767
  * Update measurements
5790
5768
  */
5791
5769
  updateSnapshot() {
5792
- this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !Re(this.snapshot.measuredBox.x) && !Re(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
5770
+ this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !Ve(this.snapshot.measuredBox.x) && !Ve(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
5793
5771
  }
5794
5772
  updateLayout() {
5795
5773
  if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
@@ -5839,7 +5817,7 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5839
5817
  const a = i.measureViewportBox();
5840
5818
  if (!(this.scroll?.wasRoot || this.path.some(qf))) {
5841
5819
  const { scroll: c } = this.root;
5842
- c && (Zt(a.x, c.offset.x), Zt(a.y, c.offset.y));
5820
+ c && (Jt(a.x, c.offset.x), Jt(a.y, c.offset.y));
5843
5821
  }
5844
5822
  return a;
5845
5823
  }
@@ -5849,7 +5827,7 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5849
5827
  return a;
5850
5828
  for (let l = 0; l < this.path.length; l++) {
5851
5829
  const c = this.path[l], { scroll: u, options: d } = c;
5852
- c !== this.root && u && d.layoutScroll && (u.wasRoot && Fe(a, i), Zt(a.x, u.offset.x), Zt(a.y, u.offset.y));
5830
+ c !== this.root && u && d.layoutScroll && (u.wasRoot && Fe(a, i), Jt(a.x, u.offset.x), Jt(a.y, u.offset.y));
5853
5831
  }
5854
5832
  return a;
5855
5833
  }
@@ -5858,12 +5836,12 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5858
5836
  Fe(l, i);
5859
5837
  for (let c = 0; c < this.path.length; c++) {
5860
5838
  const u = this.path[c];
5861
- !a && u.options.layoutScroll && u.scroll && u !== u.root && Qt(l, {
5839
+ !a && u.options.layoutScroll && u.scroll && u !== u.root && Zt(l, {
5862
5840
  x: -u.scroll.offset.x,
5863
5841
  y: -u.scroll.offset.y
5864
- }), It(u.latestValues) && Qt(l, u.latestValues);
5842
+ }), It(u.latestValues) && Zt(l, u.latestValues);
5865
5843
  }
5866
- return It(this.latestValues) && Qt(l, this.latestValues), l;
5844
+ return It(this.latestValues) && Zt(l, this.latestValues), l;
5867
5845
  }
5868
5846
  removeTransform(i) {
5869
5847
  const a = be();
@@ -5904,12 +5882,12 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5904
5882
  if (!(!this.layout || !(u || d))) {
5905
5883
  if (this.resolvedRelativeTargetAt = Ce.timestamp, !this.targetDelta && !this.relativeTarget) {
5906
5884
  const f = this.getClosestProjectingParent();
5907
- f && f.layout && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = be(), this.relativeTargetOrigin = be(), On(this.relativeTargetOrigin, this.layout.layoutBox, f.layout.layoutBox), Fe(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
5885
+ f && f.layout && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = be(), this.relativeTargetOrigin = be(), In(this.relativeTargetOrigin, this.layout.layoutBox, f.layout.layoutBox), Fe(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
5908
5886
  }
5909
5887
  if (!(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = be(), this.targetWithTransforms = be()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Zh(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : Fe(this.target, this.layout.layoutBox), Wa(this.target, this.targetDelta)) : Fe(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget)) {
5910
5888
  this.attemptToResolveRelativeTarget = !1;
5911
5889
  const f = this.getClosestProjectingParent();
5912
- f && !!f.resumingFrom == !!this.resumingFrom && !f.options.layoutScroll && f.target && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = be(), this.relativeTargetOrigin = be(), On(this.relativeTargetOrigin, this.target, f.target), Fe(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
5890
+ f && !!f.resumingFrom == !!this.resumingFrom && !f.options.layoutScroll && f.target && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = be(), this.relativeTargetOrigin = be(), In(this.relativeTargetOrigin, this.target, f.target), Fe(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
5913
5891
  }
5914
5892
  }
5915
5893
  }
@@ -5936,7 +5914,7 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5936
5914
  this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
5937
5915
  return;
5938
5916
  }
5939
- !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (io(this.prevProjectionDelta.x, this.projectionDelta.x), io(this.prevProjectionDelta.y, this.projectionDelta.y)), In(this.projectionDelta, this.layoutCorrected, m, this.latestValues), (this.treeScale.x !== d || this.treeScale.y !== f || !mo(this.projectionDelta.x, this.prevProjectionDelta.x) || !mo(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", m));
5917
+ !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (io(this.prevProjectionDelta.x, this.projectionDelta.x), io(this.prevProjectionDelta.y, this.projectionDelta.y)), Rn(this.projectionDelta, this.layoutCorrected, m, this.latestValues), (this.treeScale.x !== d || this.treeScale.y !== f || !mo(this.projectionDelta.x, this.prevProjectionDelta.x) || !mo(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", m));
5940
5918
  }
5941
5919
  hide() {
5942
5920
  this.isVisible = !1;
@@ -5952,22 +5930,22 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5952
5930
  this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
5953
5931
  }
5954
5932
  createProjectionDeltas() {
5955
- this.prevProjectionDelta = en(), this.projectionDelta = en(), this.projectionDeltaWithTransform = en();
5933
+ this.prevProjectionDelta = Qt(), this.projectionDelta = Qt(), this.projectionDeltaWithTransform = Qt();
5956
5934
  }
5957
5935
  setAnimationOrigin(i, a = !1) {
5958
- const l = this.snapshot, c = l ? l.latestValues : {}, u = { ...this.latestValues }, d = en();
5936
+ const l = this.snapshot, c = l ? l.latestValues : {}, u = { ...this.latestValues }, d = Qt();
5959
5937
  (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a;
5960
- const f = be(), m = l ? l.source : void 0, w = this.layout ? this.layout.source : void 0, v = m !== w, T = this.getStack(), b = !T || T.members.length <= 1, M = !!(v && !b && this.options.crossfade === !0 && !this.path.some(Xf));
5938
+ const f = be(), m = l ? l.source : void 0, x = this.layout ? this.layout.source : void 0, v = m !== x, w = this.getStack(), y = !w || w.members.length <= 1, M = !!(v && !y && this.options.crossfade === !0 && !this.path.some(Xf));
5961
5939
  this.animationProgress = 0;
5962
5940
  let E;
5963
5941
  this.mixTargetDelta = (F) => {
5964
- const R = F / 1e3;
5965
- bo(d.x, i.x, R), bo(d.y, i.y, R), this.setTargetDelta(d), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (On(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), _f(this.relativeTarget, this.relativeTargetOrigin, f, R), E && Ef(this.relativeTarget, E) && (this.isProjectionDirty = !1), E || (E = be()), Fe(E, this.relativeTarget)), v && (this.animationValues = u, Tf(u, c, this.latestValues, R, M, b)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = R;
5942
+ const V = F / 1e3;
5943
+ bo(d.x, i.x, V), bo(d.y, i.y, V), this.setTargetDelta(d), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (In(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), _f(this.relativeTarget, this.relativeTargetOrigin, f, V), E && Ef(this.relativeTarget, E) && (this.isProjectionDirty = !1), E || (E = be()), Fe(E, this.relativeTarget)), v && (this.animationValues = u, Tf(u, c, this.latestValues, V, M, y)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = V;
5966
5944
  }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
5967
5945
  }
5968
5946
  startAnimation(i) {
5969
5947
  this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (wt(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = ue.update(() => {
5970
- gs.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = sn(0)), this.currentAnimation = yf(this.motionValue, [0, 1e3], {
5948
+ gs.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = nn(0)), this.currentAnimation = yf(this.motionValue, [0, 1e3], {
5971
5949
  ...i,
5972
5950
  velocity: 0,
5973
5951
  isSync: !0,
@@ -5996,12 +5974,12 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
5996
5974
  if (!(!a || !l || !c)) {
5997
5975
  if (this !== i && this.layout && c && gl(this.options.animationType, this.layout.layoutBox, c.layoutBox)) {
5998
5976
  l = this.target || be();
5999
- const d = Re(this.layout.layoutBox.x);
5977
+ const d = Ve(this.layout.layoutBox.x);
6000
5978
  l.x.min = i.target.x.min, l.x.max = l.x.min + d;
6001
- const f = Re(this.layout.layoutBox.y);
5979
+ const f = Ve(this.layout.layoutBox.y);
6002
5980
  l.y.min = i.target.y.min, l.y.max = l.y.min + f;
6003
5981
  }
6004
- Fe(a, l), Qt(a, u), In(this.projectionDeltaWithTransform, this.layoutCorrected, a, u);
5982
+ Fe(a, l), Zt(a, u), Rn(this.projectionDeltaWithTransform, this.layoutCorrected, a, u);
6005
5983
  }
6006
5984
  }
6007
5985
  registerSharedNode(i, a) {
@@ -6078,16 +6056,16 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
6078
6056
  l && (d = l(u, d)), i.transform = d;
6079
6057
  const { x: f, y: m } = this.projectionDelta;
6080
6058
  i.transformOrigin = `${f.origin * 100}% ${m.origin * 100}% 0`, c.animationValues ? i.opacity = c === this ? u.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : u.opacityExit : i.opacity = c === this ? u.opacity !== void 0 ? u.opacity : "" : u.opacityExit !== void 0 ? u.opacityExit : 0;
6081
- for (const w in Un) {
6082
- if (u[w] === void 0)
6059
+ for (const x in Bn) {
6060
+ if (u[x] === void 0)
6083
6061
  continue;
6084
- const { correct: v, applyTo: T, isCSSVariable: b } = Un[w], M = d === "none" ? u[w] : v(u[w], c);
6085
- if (T) {
6086
- const E = T.length;
6062
+ const { correct: v, applyTo: w, isCSSVariable: y } = Bn[x], M = d === "none" ? u[x] : v(u[x], c);
6063
+ if (w) {
6064
+ const E = w.length;
6087
6065
  for (let F = 0; F < E; F++)
6088
- i[T[F]] = M;
6066
+ i[w[F]] = M;
6089
6067
  } else
6090
- b ? this.options.visualElement.renderState.vars[w] = M : i[w] = M;
6068
+ y ? this.options.visualElement.renderState.vars[x] = M : i[x] = M;
6091
6069
  }
6092
6070
  this.options.layoutId && (i.pointerEvents = c === this ? ms(a?.pointerEvents) || "" : "none");
6093
6071
  }
@@ -6100,7 +6078,7 @@ function pl({ attachResizeListener: e, defaultParent: t, measureScroll: n, check
6100
6078
  }
6101
6079
  };
6102
6080
  }
6103
- function Vf(e) {
6081
+ function Rf(e) {
6104
6082
  e.updateLayout();
6105
6083
  }
6106
6084
  function If(e) {
@@ -6108,16 +6086,16 @@ function If(e) {
6108
6086
  if (e.isLead() && e.layout && t && e.hasListeners("didUpdate")) {
6109
6087
  const { layoutBox: n, measuredBox: s } = e.layout, { animationType: r } = e.options, o = t.source !== e.layout.source;
6110
6088
  r === "size" ? Be((u) => {
6111
- const d = o ? t.measuredBox[u] : t.layoutBox[u], f = Re(d);
6089
+ const d = o ? t.measuredBox[u] : t.layoutBox[u], f = Ve(d);
6112
6090
  d.min = n[u].min, d.max = d.min + f;
6113
6091
  }) : gl(r, t.layoutBox, n) && Be((u) => {
6114
- const d = o ? t.measuredBox[u] : t.layoutBox[u], f = Re(n[u]);
6092
+ const d = o ? t.measuredBox[u] : t.layoutBox[u], f = Ve(n[u]);
6115
6093
  d.max = d.min + f, e.relativeTarget && !e.currentAnimation && (e.isProjectionDirty = !0, e.relativeTarget[u].max = e.relativeTarget[u].min + f);
6116
6094
  });
6117
- const i = en();
6118
- In(i, n, t.layoutBox);
6119
- const a = en();
6120
- o ? In(a, e.applyTransform(s, !0), t.measuredBox) : In(a, n, t.layoutBox);
6095
+ const i = Qt();
6096
+ Rn(i, n, t.layoutBox);
6097
+ const a = Qt();
6098
+ o ? Rn(a, e.applyTransform(s, !0), t.measuredBox) : Rn(a, n, t.layoutBox);
6121
6099
  const l = !hl(i);
6122
6100
  let c = !1;
6123
6101
  if (!e.resumeFrom) {
@@ -6126,9 +6104,9 @@ function If(e) {
6126
6104
  const { snapshot: d, layout: f } = u;
6127
6105
  if (d && f) {
6128
6106
  const m = be();
6129
- On(m, t.layoutBox, d.layoutBox);
6130
- const w = be();
6131
- On(w, n, f.layoutBox), fl(m, w) || (c = !0), u.options.layoutRoot && (e.relativeTarget = w, e.relativeTargetOrigin = m, e.relativeParent = u);
6107
+ In(m, t.layoutBox, d.layoutBox);
6108
+ const x = be();
6109
+ In(x, n, f.layoutBox), fl(m, x) || (c = !0), u.options.layoutRoot && (e.relativeTarget = x, e.relativeTargetOrigin = m, e.relativeParent = u);
6132
6110
  }
6133
6111
  }
6134
6112
  }
@@ -6209,7 +6187,7 @@ function qf(e) {
6209
6187
  return e !== e.root && e.scroll?.wasRoot;
6210
6188
  }
6211
6189
  const Gf = pl({
6212
- attachResizeListener: (e, t) => zn(e, "resize", t),
6190
+ attachResizeListener: (e, t) => Un(e, "resize", t),
6213
6191
  measureScroll: () => ({
6214
6192
  x: document.documentElement.scrollLeft || document.body.scrollLeft,
6215
6193
  y: document.documentElement.scrollTop || document.body.scrollTop
@@ -6247,7 +6225,7 @@ function So(e, t, n) {
6247
6225
  const { props: s } = e;
6248
6226
  e.animationState && s.whileHover && e.animationState.setActive("whileHover", n === "Start");
6249
6227
  const r = "onHover" + n, o = s[r];
6250
- o && ue.postRender(() => o(t, qn(t)));
6228
+ o && ue.postRender(() => o(t, Kn(t)));
6251
6229
  }
6252
6230
  class Hf extends Pt {
6253
6231
  mount() {
@@ -6274,7 +6252,7 @@ class Jf extends Pt {
6274
6252
  !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
6275
6253
  }
6276
6254
  mount() {
6277
- this.unmount = Xn(zn(this.node.current, "focus", () => this.onFocus()), zn(this.node.current, "blur", () => this.onBlur()));
6255
+ this.unmount = _n(Un(this.node.current, "focus", () => this.onFocus()), Un(this.node.current, "blur", () => this.onBlur()));
6278
6256
  }
6279
6257
  unmount() {
6280
6258
  }
@@ -6285,7 +6263,7 @@ function Po(e, t, n) {
6285
6263
  return;
6286
6264
  e.animationState && s.whileTap && e.animationState.setActive("whileTap", n === "Start");
6287
6265
  const r = "onTap" + (n === "End" ? "" : n), o = s[r];
6288
- o && ue.postRender(() => o(t, qn(t)));
6266
+ o && ue.postRender(() => o(t, Kn(t)));
6289
6267
  }
6290
6268
  class Zf extends Pt {
6291
6269
  mount() {
@@ -6392,19 +6370,19 @@ function hm({
6392
6370
  onDeny: r
6393
6371
  }) {
6394
6372
  const o = Object.keys(n).length > 0;
6395
- return /* @__PURE__ */ h("div", { className: "bg-stone-100 dark:bg-stone-800 border border-border rounded-lg px-3 py-2.5 my-1.5", children: /* @__PURE__ */ C("div", { className: "flex items-start gap-2", children: [
6396
- /* @__PURE__ */ C("div", { className: "flex-1 min-w-0", children: [
6373
+ return /* @__PURE__ */ h("div", { className: "bg-stone-100 dark:bg-stone-800 border border-border rounded-lg px-3 py-2.5 my-1.5", children: /* @__PURE__ */ S("div", { className: "flex items-start gap-2", children: [
6374
+ /* @__PURE__ */ S("div", { className: "flex-1 min-w-0", children: [
6397
6375
  /* @__PURE__ */ h("div", { className: "flex items-center gap-1.5 mb-1", children: /* @__PURE__ */ h("span", { className: "text-sm font-medium text-foreground", children: e }) }),
6398
- o && /* @__PURE__ */ h("div", { className: "space-y-0.5 mb-1.5", children: Object.entries(n).map(([i, a]) => /* @__PURE__ */ C("div", { className: "flex items-start gap-1.5 text-xs", children: [
6399
- /* @__PURE__ */ C("span", { className: "text-muted-foreground min-w-[60px]", children: [
6376
+ o && /* @__PURE__ */ h("div", { className: "space-y-0.5 mb-1.5", children: Object.entries(n).map(([i, a]) => /* @__PURE__ */ S("div", { className: "flex items-start gap-1.5 text-xs", children: [
6377
+ /* @__PURE__ */ S("span", { className: "text-muted-foreground min-w-[60px]", children: [
6400
6378
  i,
6401
6379
  ":"
6402
6380
  ] }),
6403
6381
  /* @__PURE__ */ h("span", { className: "font-mono text-foreground", children: typeof a == "string" ? a : JSON.stringify(a) })
6404
6382
  ] }, i)) })
6405
6383
  ] }),
6406
- /* @__PURE__ */ C("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
6407
- /* @__PURE__ */ C(
6384
+ /* @__PURE__ */ S("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
6385
+ /* @__PURE__ */ S(
6408
6386
  Me,
6409
6387
  {
6410
6388
  size: "sm",
@@ -6444,8 +6422,8 @@ function fm({
6444
6422
  const a = Object.fromEntries(
6445
6423
  Object.entries(t).filter(([c]) => !i.includes(c))
6446
6424
  ), l = Object.keys(a).length > 0;
6447
- return /* @__PURE__ */ C("div", { className: "my-1", children: [
6448
- /* @__PURE__ */ C(
6425
+ return /* @__PURE__ */ S("div", { className: "my-1", children: [
6426
+ /* @__PURE__ */ S(
6449
6427
  "button",
6450
6428
  {
6451
6429
  onClick: () => l && o(!r),
@@ -6453,7 +6431,7 @@ function fm({
6453
6431
  children: [
6454
6432
  l && /* @__PURE__ */ h("span", { className: "transition-transform duration-200", children: r ? /* @__PURE__ */ h(Ol, { className: "h-3 w-3" }) : /* @__PURE__ */ h(Ll, { className: "h-3 w-3" }) }),
6455
6433
  n ? /* @__PURE__ */ h(ys, { className: "h-3 w-3" }) : s ? /* @__PURE__ */ h(jl, { className: "h-3 w-3" }) : /* @__PURE__ */ h(Mo, { className: "h-3 w-3" }),
6456
- /* @__PURE__ */ C("span", { className: "font-medium", children: [
6434
+ /* @__PURE__ */ S("span", { className: "font-medium", children: [
6457
6435
  n ? "Denied" : s ? "Auto-executed" : "Executed",
6458
6436
  " ",
6459
6437
  e
@@ -6461,8 +6439,8 @@ function fm({
6461
6439
  ]
6462
6440
  }
6463
6441
  ),
6464
- r && l && /* @__PURE__ */ h("div", { className: "mt-1 ml-6 p-2 bg-stone-50 dark:bg-stone-900 rounded-md border border-border", children: /* @__PURE__ */ h("div", { className: "space-y-0.5", children: Object.entries(a).map(([c, u]) => /* @__PURE__ */ C("div", { className: "flex items-start gap-1.5 text-xs", children: [
6465
- /* @__PURE__ */ C("span", { className: "text-muted-foreground min-w-[60px]", children: [
6442
+ r && l && /* @__PURE__ */ h("div", { className: "mt-1 ml-6 p-2 bg-stone-50 dark:bg-stone-900 rounded-md border border-border", children: /* @__PURE__ */ h("div", { className: "space-y-0.5", children: Object.entries(a).map(([c, u]) => /* @__PURE__ */ S("div", { className: "flex items-start gap-1.5 text-xs", children: [
6443
+ /* @__PURE__ */ S("span", { className: "text-muted-foreground min-w-[60px]", children: [
6466
6444
  c,
6467
6445
  ":"
6468
6446
  ] }),
@@ -6499,8 +6477,8 @@ function gm({
6499
6477
  }
6500
6478
  const ym = Il(
6501
6479
  () => import("streamdown").then((e) => ({ default: e.Streamdown }))
6502
- ), ii = _n(
6503
- ({ className: e, ...t }) => typeof window > "u" ? null : /* @__PURE__ */ h(Vl, { fallback: null, children: /* @__PURE__ */ h(
6480
+ ), ii = zn(
6481
+ ({ className: e, ...t }) => typeof window > "u" ? null : /* @__PURE__ */ h(Rl, { fallback: null, children: /* @__PURE__ */ h(
6504
6482
  ym,
6505
6483
  {
6506
6484
  className: se(
@@ -6551,12 +6529,12 @@ const bm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6551
6529
  children: e
6552
6530
  }
6553
6531
  );
6554
- }, xm = _n(vm), vl = St(null), wm = () => {
6532
+ }, xm = zn(vm), vl = St(null), wm = () => {
6555
6533
  const e = Se(vl);
6556
6534
  if (!e)
6557
6535
  throw new Error("Reasoning components must be used within Reasoning");
6558
6536
  return e;
6559
- }, Tm = 1e3, Sm = 1e3, xl = _n(
6537
+ }, Tm = 1e3, Sm = 1e3, xl = zn(
6560
6538
  ({
6561
6539
  className: e,
6562
6540
  isStreaming: t = !1,
@@ -6574,19 +6552,19 @@ const bm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6574
6552
  }), [u, d] = ai({
6575
6553
  prop: o,
6576
6554
  defaultProp: 0
6577
- }), [f, m] = O(!1), [w, v] = O(null);
6555
+ }), [f, m] = O(!1), [x, v] = O(null);
6578
6556
  re(() => {
6579
- t ? w === null && v(Date.now()) : w !== null && (d(Math.ceil((Date.now() - w) / Sm)), v(null));
6580
- }, [t, w, d]), re(() => {
6557
+ t ? x === null && v(Date.now()) : x !== null && (d(Math.ceil((Date.now() - x) / Sm)), v(null));
6558
+ }, [t, x, d]), re(() => {
6581
6559
  if (s && !t && l && !f) {
6582
- const b = setTimeout(() => {
6560
+ const y = setTimeout(() => {
6583
6561
  c(!1), m(!0);
6584
6562
  }, Tm);
6585
- return () => clearTimeout(b);
6563
+ return () => clearTimeout(y);
6586
6564
  }
6587
6565
  }, [t, l, s, c, f]);
6588
- const T = (b) => {
6589
- c(b);
6566
+ const w = (y) => {
6567
+ c(y);
6590
6568
  };
6591
6569
  return /* @__PURE__ */ h(
6592
6570
  vl.Provider,
@@ -6596,7 +6574,7 @@ const bm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6596
6574
  mm,
6597
6575
  {
6598
6576
  className: se("not-prose mb-4", e),
6599
- onOpenChange: T,
6577
+ onOpenChange: w,
6600
6578
  open: l,
6601
6579
  ...a,
6602
6580
  children: i
@@ -6605,11 +6583,11 @@ const bm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6605
6583
  }
6606
6584
  );
6607
6585
  }
6608
- ), Pm = (e, t) => e || t === 0 ? /* @__PURE__ */ h(xm, { duration: 1, children: "Thinking..." }) : t === void 0 ? /* @__PURE__ */ h("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ C("p", { children: [
6586
+ ), Pm = (e, t) => e || t === 0 ? /* @__PURE__ */ h(xm, { duration: 1, children: "Thinking..." }) : t === void 0 ? /* @__PURE__ */ h("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ S("p", { children: [
6609
6587
  "Thought for ",
6610
6588
  t,
6611
6589
  " seconds"
6612
- ] }), wl = _n(
6590
+ ] }), wl = zn(
6613
6591
  ({ className: e, children: t, ...n }) => {
6614
6592
  const { isStreaming: s, isOpen: r, duration: o } = wm();
6615
6593
  return /* @__PURE__ */ h(
@@ -6620,7 +6598,7 @@ const bm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6620
6598
  e
6621
6599
  ),
6622
6600
  ...n,
6623
- children: t ?? /* @__PURE__ */ C(Gt, { children: [
6601
+ children: t ?? /* @__PURE__ */ S(qt, { children: [
6624
6602
  /* @__PURE__ */ h($l, { className: "size-4" }),
6625
6603
  Pm(s, o),
6626
6604
  /* @__PURE__ */ h(
@@ -6636,7 +6614,7 @@ const bm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6636
6614
  }
6637
6615
  );
6638
6616
  }
6639
- ), Tl = _n(
6617
+ ), Tl = zn(
6640
6618
  ({ className: e, children: t, ...n }) => /* @__PURE__ */ h(
6641
6619
  gm,
6642
6620
  {
@@ -6660,8 +6638,8 @@ function Cm({ sources: e, citationNumber: t, className: n }) {
6660
6638
  const s = e.find((o) => o.number === t);
6661
6639
  if (!s) return null;
6662
6640
  const r = Co(s.domain);
6663
- return /* @__PURE__ */ C(yt, { children: [
6664
- /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ C(
6641
+ return /* @__PURE__ */ S(yt, { children: [
6642
+ /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ S(
6665
6643
  "button",
6666
6644
  {
6667
6645
  className: se(
@@ -6699,14 +6677,14 @@ function Cm({ sources: e, citationNumber: t, className: n }) {
6699
6677
  {
6700
6678
  side: "top",
6701
6679
  className: "bg-stone-800 dark:bg-stone-900 border border-stone-700 dark:border-stone-600 p-3 max-w-sm z-50 rounded-lg shadow-lg",
6702
- children: /* @__PURE__ */ C("div", { className: "space-y-1.5", children: [
6703
- /* @__PURE__ */ C("div", { className: "text-xs font-semibold text-stone-300 dark:text-stone-200 mb-2 pb-2 border-b border-stone-700 dark:border-stone-600", children: [
6680
+ children: /* @__PURE__ */ S("div", { className: "space-y-1.5", children: [
6681
+ /* @__PURE__ */ S("div", { className: "text-xs font-semibold text-stone-300 dark:text-stone-200 mb-2 pb-2 border-b border-stone-700 dark:border-stone-600", children: [
6704
6682
  "Sources • ",
6705
6683
  e.length
6706
6684
  ] }),
6707
6685
  e.map((o) => {
6708
6686
  const i = o.title || o.domain;
6709
- return /* @__PURE__ */ C(
6687
+ return /* @__PURE__ */ S(
6710
6688
  "a",
6711
6689
  {
6712
6690
  href: o.url,
@@ -6758,18 +6736,18 @@ function Am({
6758
6736
  (n.size === 0 || !a) && d([]);
6759
6737
  return;
6760
6738
  }
6761
- const T = c.current;
6762
- let b, M = !1;
6739
+ const w = c.current;
6740
+ let y, M = !1;
6763
6741
  const E = /* @__PURE__ */ new WeakSet(), F = () => {
6764
6742
  if (!c.current || M) return;
6765
6743
  M = !0;
6766
- const L = c.current, D = /\[(\d+)\]/g, A = document.createTreeWalker(
6744
+ const L = c.current, D = /\[(\d+)\]/g, C = document.createTreeWalker(
6767
6745
  L,
6768
6746
  NodeFilter.SHOW_TEXT,
6769
6747
  null
6770
6748
  ), j = [];
6771
6749
  let k;
6772
- for (; k = A.nextNode(); )
6750
+ for (; k = C.nextNode(); )
6773
6751
  if (k.nodeType === Node.TEXT_NODE && !E.has(k)) {
6774
6752
  const B = k, I = B.textContent || "";
6775
6753
  let U = B.parentElement, W = !1;
@@ -6797,51 +6775,51 @@ function Am({
6797
6775
  j.forEach(({ node: B, matches: I }) => {
6798
6776
  E.add(B);
6799
6777
  const U = B.textContent || "", W = document.createDocumentFragment();
6800
- let H = 0;
6778
+ let Y = 0;
6801
6779
  I.forEach((G) => {
6802
6780
  if (!G[1]) return;
6803
- G.index !== void 0 && G.index > H && W.appendChild(document.createTextNode(U.slice(H, G.index)));
6781
+ G.index !== void 0 && G.index > Y && W.appendChild(document.createTextNode(U.slice(Y, G.index)));
6804
6782
  const ae = document.createElement("span");
6805
6783
  ae.className = "inline-flex items-center citation-button-container";
6806
6784
  const xe = parseInt(G[1], 10);
6807
- ae.setAttribute("data-citation", G[1]), W.appendChild(ae), N.push({ element: ae, citationNum: xe }), H = (G.index || 0) + G[0].length;
6808
- }), H < U.length && W.appendChild(document.createTextNode(U.slice(H))), B.parentNode && B.parentNode.replaceChild(W, B);
6785
+ ae.setAttribute("data-citation", G[1]), W.appendChild(ae), N.push({ element: ae, citationNum: xe }), Y = (G.index || 0) + G[0].length;
6786
+ }), Y < U.length && W.appendChild(document.createTextNode(U.slice(Y))), B.parentNode && B.parentNode.replaceChild(W, B);
6809
6787
  }), N.length > 0 && d((B) => {
6810
- const I = new Set(B.map((H) => H.element)), U = B.filter((H) => H.element.isConnected), W = N.filter((H) => !I.has(H.element));
6788
+ const I = new Set(B.map((Y) => Y.element)), U = B.filter((Y) => Y.element.isConnected), W = N.filter((Y) => !I.has(Y.element));
6811
6789
  return [...U, ...W];
6812
6790
  }), M = !1;
6813
- }, R = new MutationObserver(() => {
6814
- clearTimeout(b), b = setTimeout(F, 100);
6791
+ }, V = new MutationObserver(() => {
6792
+ clearTimeout(y), y = setTimeout(F, 100);
6815
6793
  });
6816
- return R.observe(T, {
6794
+ return V.observe(w, {
6817
6795
  childList: !0,
6818
6796
  subtree: !0,
6819
6797
  characterData: !0
6820
- }), b = setTimeout(F, 200), () => {
6821
- R.disconnect(), clearTimeout(b);
6798
+ }), y = setTimeout(F, 200), () => {
6799
+ V.disconnect(), clearTimeout(y);
6822
6800
  };
6823
6801
  }, [e, t, n, a]);
6824
6802
  const f = s && s.length > 0 || n && n.size > 0 || r;
6825
- function m(T) {
6826
- return `https://www.google.com/s2/favicons?domain=${encodeURIComponent(T)}&sz=16`;
6803
+ function m(w) {
6804
+ return `https://www.google.com/s2/favicons?domain=${encodeURIComponent(w)}&sz=16`;
6827
6805
  }
6828
- function w(T) {
6806
+ function x(w) {
6829
6807
  try {
6830
- return new URL(T).hostname.replace(/^www\./, "");
6808
+ return new URL(w).hostname.replace(/^www\./, "");
6831
6809
  } catch {
6832
- return T;
6810
+ return w;
6833
6811
  }
6834
6812
  }
6835
- const v = a && l && f ? /* @__PURE__ */ C("div", { className: "mt-4 pt-4 border-t border-stone-200 dark:border-stone-700", children: [
6813
+ const v = a && l && f ? /* @__PURE__ */ S("div", { className: "mt-4 pt-4 border-t border-stone-200 dark:border-stone-700", children: [
6836
6814
  /* @__PURE__ */ h("div", { className: "text-xs font-semibold text-stone-600 dark:text-stone-400 mb-3", children: "References" }),
6837
6815
  /* @__PURE__ */ h("div", { className: "flex flex-wrap gap-2", children: s && s.length > 0 ? (
6838
6816
  // Use grouped citations if available - show as buttons with favicon + title
6839
- s.map((T, b) => {
6840
- const M = T.title || T.baseUrl, E = w(T.url), F = m(E);
6841
- return /* @__PURE__ */ C(
6817
+ s.map((w, y) => {
6818
+ const M = w.title || w.baseUrl, E = x(w.url), F = m(E);
6819
+ return /* @__PURE__ */ S(
6842
6820
  "a",
6843
6821
  {
6844
- href: T.url,
6822
+ href: w.url,
6845
6823
  target: "_blank",
6846
6824
  rel: "noopener noreferrer",
6847
6825
  className: se(
@@ -6860,8 +6838,8 @@ function Am({
6860
6838
  src: F,
6861
6839
  alt: "",
6862
6840
  className: "w-3.5 h-3.5 shrink-0",
6863
- onError: (R) => {
6864
- const L = R.target;
6841
+ onError: (V) => {
6842
+ const L = V.target;
6865
6843
  L.style.display = "none";
6866
6844
  }
6867
6845
  }
@@ -6869,17 +6847,17 @@ function Am({
6869
6847
  /* @__PURE__ */ h("span", { className: "leading-none", children: M })
6870
6848
  ]
6871
6849
  },
6872
- `group-${b}`
6850
+ `group-${y}`
6873
6851
  );
6874
6852
  })
6875
6853
  ) : (
6876
6854
  // Fallback to original format if no grouped citations
6877
- Array.from(n.entries()).sort(([T], [b]) => T - b).map(([T, b]) => {
6878
- const M = w(b), E = m(M);
6879
- return /* @__PURE__ */ C(
6855
+ Array.from(n.entries()).sort(([w], [y]) => w - y).map(([w, y]) => {
6856
+ const M = x(y), E = m(M);
6857
+ return /* @__PURE__ */ S(
6880
6858
  "a",
6881
6859
  {
6882
- href: b,
6860
+ href: y,
6883
6861
  target: "_blank",
6884
6862
  rel: "noopener noreferrer",
6885
6863
  className: se(
@@ -6899,31 +6877,31 @@ function Am({
6899
6877
  alt: "",
6900
6878
  className: "w-3.5 h-3.5 shrink-0",
6901
6879
  onError: (F) => {
6902
- const R = F.target;
6903
- R.style.display = "none";
6880
+ const V = F.target;
6881
+ V.style.display = "none";
6904
6882
  }
6905
6883
  }
6906
6884
  ),
6907
- /* @__PURE__ */ h("span", { className: "leading-none", children: b })
6885
+ /* @__PURE__ */ h("span", { className: "leading-none", children: y })
6908
6886
  ]
6909
6887
  },
6910
- T
6888
+ w
6911
6889
  );
6912
6890
  })
6913
6891
  ) })
6914
6892
  ] }) : null;
6915
- return /* @__PURE__ */ C("div", { className: i, children: [
6893
+ return /* @__PURE__ */ S("div", { className: i, children: [
6916
6894
  /* @__PURE__ */ h("div", { ref: c, children: /* @__PURE__ */ h(o, { children: e }) }),
6917
- a && u.filter(({ element: T }) => T.isConnected).map(({ element: T, citationNum: b }, M) => {
6918
- if (!t.find((R) => R.number === b)) return null;
6895
+ a && u.filter(({ element: w }) => w.isConnected).map(({ element: w, citationNum: y }, M) => {
6896
+ if (!t.find((V) => V.number === y)) return null;
6919
6897
  const F = Array.from(
6920
6898
  new Map(
6921
- t.map((R) => {
6922
- const L = R.url.replace(/\/+$/, ""), D = s?.find((A) => A.url.replace(/\/+$/, "") === L);
6899
+ t.map((V) => {
6900
+ const L = V.url.replace(/\/+$/, ""), D = s?.find((C) => C.url.replace(/\/+$/, "") === L);
6923
6901
  return [L, {
6924
- number: R.number,
6925
- url: R.url,
6926
- domain: w(R.url),
6902
+ number: V.number,
6903
+ url: V.url,
6904
+ domain: x(V.url),
6927
6905
  title: D?.title
6928
6906
  }];
6929
6907
  })
@@ -6934,18 +6912,18 @@ function Am({
6934
6912
  Cm,
6935
6913
  {
6936
6914
  sources: F,
6937
- citationNumber: b
6915
+ citationNumber: y
6938
6916
  },
6939
- `citation-${b}-${T}`
6917
+ `citation-${y}-${w}`
6940
6918
  ),
6941
- T,
6942
- `citation-${b}-${M}`
6919
+ w,
6920
+ `citation-${y}-${M}`
6943
6921
  );
6944
6922
  }),
6945
6923
  v
6946
6924
  ] });
6947
6925
  }
6948
- function un({
6926
+ function cn({
6949
6927
  ...e
6950
6928
  }) {
6951
6929
  return /* @__PURE__ */ h(Ft.Root, { "data-slot": "dialog", ...e });
@@ -6971,15 +6949,15 @@ function Em({
6971
6949
  }
6972
6950
  );
6973
6951
  }
6974
- function dn({
6952
+ function un({
6975
6953
  className: e,
6976
6954
  children: t,
6977
6955
  showCloseButton: n = !0,
6978
6956
  ...s
6979
6957
  }) {
6980
- return /* @__PURE__ */ C(km, { "data-slot": "dialog-portal", children: [
6958
+ return /* @__PURE__ */ S(km, { "data-slot": "dialog-portal", children: [
6981
6959
  /* @__PURE__ */ h(Em, {}),
6982
- /* @__PURE__ */ C(
6960
+ /* @__PURE__ */ S(
6983
6961
  Ft.Content,
6984
6962
  {
6985
6963
  "data-slot": "dialog-content",
@@ -6990,7 +6968,7 @@ function dn({
6990
6968
  ...s,
6991
6969
  children: [
6992
6970
  t,
6993
- n && /* @__PURE__ */ C(
6971
+ n && /* @__PURE__ */ S(
6994
6972
  Ft.Close,
6995
6973
  {
6996
6974
  "data-slot": "dialog-close",
@@ -7006,7 +6984,7 @@ function dn({
7006
6984
  )
7007
6985
  ] });
7008
6986
  }
7009
- function hn({ className: e, ...t }) {
6987
+ function dn({ className: e, ...t }) {
7010
6988
  return /* @__PURE__ */ h(
7011
6989
  "div",
7012
6990
  {
@@ -7016,7 +6994,7 @@ function hn({ className: e, ...t }) {
7016
6994
  }
7017
6995
  );
7018
6996
  }
7019
- function fn({ className: e, ...t }) {
6997
+ function hn({ className: e, ...t }) {
7020
6998
  return /* @__PURE__ */ h(
7021
6999
  "div",
7022
7000
  {
@@ -7029,7 +7007,7 @@ function fn({ className: e, ...t }) {
7029
7007
  }
7030
7008
  );
7031
7009
  }
7032
- function mn({
7010
+ function fn({
7033
7011
  className: e,
7034
7012
  ...t
7035
7013
  }) {
@@ -7042,7 +7020,7 @@ function mn({
7042
7020
  }
7043
7021
  );
7044
7022
  }
7045
- function pn({
7023
+ function mn({
7046
7024
  className: e,
7047
7025
  ...t
7048
7026
  }) {
@@ -7055,7 +7033,7 @@ function pn({
7055
7033
  }
7056
7034
  );
7057
7035
  }
7058
- function gn({ className: e, type: t, ...n }) {
7036
+ function pn({ className: e, type: t, ...n }) {
7059
7037
  return /* @__PURE__ */ h(
7060
7038
  "input",
7061
7039
  {
@@ -7079,7 +7057,7 @@ function Mm({
7079
7057
  onComplete: r
7080
7058
  }) {
7081
7059
  const [o, i] = O(""), [a, l] = O(!1), [c, u] = O(!1);
7082
- return /* @__PURE__ */ h(un, { open: e, children: /* @__PURE__ */ h(dn, { showCloseButton: !1, children: /* @__PURE__ */ C("form", { onSubmit: async (m) => {
7060
+ return /* @__PURE__ */ h(cn, { open: e, children: /* @__PURE__ */ h(un, { showCloseButton: !1, children: /* @__PURE__ */ S("form", { onSubmit: async (m) => {
7083
7061
  if (m.preventDefault(), !!o.trim()) {
7084
7062
  u(!0);
7085
7063
  try {
@@ -7089,13 +7067,13 @@ function Mm({
7089
7067
  }
7090
7068
  }
7091
7069
  }, children: [
7092
- /* @__PURE__ */ C(hn, { children: [
7093
- /* @__PURE__ */ h(mn, { children: t }),
7094
- /* @__PURE__ */ h(pn, { children: n })
7070
+ /* @__PURE__ */ S(dn, { children: [
7071
+ /* @__PURE__ */ h(fn, { children: t }),
7072
+ /* @__PURE__ */ h(mn, { children: n })
7095
7073
  ] }),
7096
- /* @__PURE__ */ h("div", { className: "py-4", children: /* @__PURE__ */ C("div", { className: "relative", children: [
7074
+ /* @__PURE__ */ h("div", { className: "py-4", children: /* @__PURE__ */ S("div", { className: "relative", children: [
7097
7075
  /* @__PURE__ */ h(
7098
- gn,
7076
+ pn,
7099
7077
  {
7100
7078
  type: a ? "text" : "password",
7101
7079
  value: o,
@@ -7117,7 +7095,7 @@ function Mm({
7117
7095
  }
7118
7096
  )
7119
7097
  ] }) }),
7120
- /* @__PURE__ */ C(fn, { children: [
7098
+ /* @__PURE__ */ S(hn, { children: [
7121
7099
  /* @__PURE__ */ h(
7122
7100
  Me,
7123
7101
  {
@@ -7151,7 +7129,7 @@ function Nm({
7151
7129
  const [o, i] = O(""), [a, l] = O(!0), [c, u] = O(!1), d = (v) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v), f = (v) => {
7152
7130
  i(v), v.trim() ? l(d(v)) : l(!0);
7153
7131
  };
7154
- return /* @__PURE__ */ h(un, { open: e, children: /* @__PURE__ */ h(dn, { showCloseButton: !1, children: /* @__PURE__ */ C("form", { onSubmit: async (v) => {
7132
+ return /* @__PURE__ */ h(cn, { open: e, children: /* @__PURE__ */ h(un, { showCloseButton: !1, children: /* @__PURE__ */ S("form", { onSubmit: async (v) => {
7155
7133
  if (v.preventDefault(), !o.trim() || !d(o)) {
7156
7134
  l(!1);
7157
7135
  return;
@@ -7163,16 +7141,16 @@ function Nm({
7163
7141
  u(!1);
7164
7142
  }
7165
7143
  }, children: [
7166
- /* @__PURE__ */ C(hn, { children: [
7167
- /* @__PURE__ */ C(mn, { className: "flex items-center gap-2", children: [
7144
+ /* @__PURE__ */ S(dn, { children: [
7145
+ /* @__PURE__ */ S(fn, { className: "flex items-center gap-2", children: [
7168
7146
  /* @__PURE__ */ h(Ul, { className: "h-5 w-5" }),
7169
7147
  t
7170
7148
  ] }),
7171
- /* @__PURE__ */ h(pn, { children: n })
7149
+ /* @__PURE__ */ h(mn, { children: n })
7172
7150
  ] }),
7173
- /* @__PURE__ */ C("div", { className: "py-4", children: [
7151
+ /* @__PURE__ */ S("div", { className: "py-4", children: [
7174
7152
  /* @__PURE__ */ h(
7175
- gn,
7153
+ pn,
7176
7154
  {
7177
7155
  type: "email",
7178
7156
  value: o,
@@ -7185,7 +7163,7 @@ function Nm({
7185
7163
  ),
7186
7164
  !a && /* @__PURE__ */ h("p", { className: "text-sm text-red-500 mt-1", children: "Please enter a valid email address" })
7187
7165
  ] }),
7188
- /* @__PURE__ */ C(fn, { children: [
7166
+ /* @__PURE__ */ S(hn, { children: [
7189
7167
  /* @__PURE__ */ h(
7190
7168
  Me,
7191
7169
  {
@@ -7216,40 +7194,40 @@ function Dm({
7216
7194
  placeholder: s = "Enter phone number...",
7217
7195
  onComplete: r
7218
7196
  }) {
7219
- const [o, i] = O(""), [a, l] = O(!0), [c, u] = O(!1), d = (T) => {
7220
- const b = T.replace(/\D/g, "");
7221
- return b.length <= 3 ? b : b.length <= 6 ? `(${b.slice(0, 3)}) ${b.slice(3)}` : `(${b.slice(0, 3)}) ${b.slice(3, 6)}-${b.slice(6, 10)}`;
7222
- }, f = (T) => T.replace(/\D/g, "").length === 10, m = (T) => {
7223
- const b = d(T);
7224
- i(b), b.trim() ? l(f(b)) : l(!0);
7197
+ const [o, i] = O(""), [a, l] = O(!0), [c, u] = O(!1), d = (w) => {
7198
+ const y = w.replace(/\D/g, "");
7199
+ return y.length <= 3 ? y : y.length <= 6 ? `(${y.slice(0, 3)}) ${y.slice(3)}` : `(${y.slice(0, 3)}) ${y.slice(3, 6)}-${y.slice(6, 10)}`;
7200
+ }, f = (w) => w.replace(/\D/g, "").length === 10, m = (w) => {
7201
+ const y = d(w);
7202
+ i(y), y.trim() ? l(f(y)) : l(!0);
7225
7203
  };
7226
- return /* @__PURE__ */ h(un, { open: e, children: /* @__PURE__ */ h(dn, { showCloseButton: !1, children: /* @__PURE__ */ C("form", { onSubmit: async (T) => {
7227
- if (T.preventDefault(), !o.trim() || !f(o)) {
7204
+ return /* @__PURE__ */ h(cn, { open: e, children: /* @__PURE__ */ h(un, { showCloseButton: !1, children: /* @__PURE__ */ S("form", { onSubmit: async (w) => {
7205
+ if (w.preventDefault(), !o.trim() || !f(o)) {
7228
7206
  l(!1);
7229
7207
  return;
7230
7208
  }
7231
7209
  u(!0);
7232
7210
  try {
7233
- const b = o.replace(/\D/g, "");
7234
- r(b);
7211
+ const y = o.replace(/\D/g, "");
7212
+ r(y);
7235
7213
  } finally {
7236
7214
  u(!1);
7237
7215
  }
7238
7216
  }, children: [
7239
- /* @__PURE__ */ C(hn, { children: [
7240
- /* @__PURE__ */ C(mn, { className: "flex items-center gap-2", children: [
7217
+ /* @__PURE__ */ S(dn, { children: [
7218
+ /* @__PURE__ */ S(fn, { className: "flex items-center gap-2", children: [
7241
7219
  /* @__PURE__ */ h(zl, { className: "h-5 w-5" }),
7242
7220
  t
7243
7221
  ] }),
7244
- /* @__PURE__ */ h(pn, { children: n })
7222
+ /* @__PURE__ */ h(mn, { children: n })
7245
7223
  ] }),
7246
- /* @__PURE__ */ C("div", { className: "py-4", children: [
7224
+ /* @__PURE__ */ S("div", { className: "py-4", children: [
7247
7225
  /* @__PURE__ */ h(
7248
- gn,
7226
+ pn,
7249
7227
  {
7250
7228
  type: "tel",
7251
7229
  value: o,
7252
- onChange: (T) => m(T.target.value),
7230
+ onChange: (w) => m(w.target.value),
7253
7231
  placeholder: s,
7254
7232
  className: a ? "" : "border-red-500",
7255
7233
  maxLength: 14,
@@ -7259,7 +7237,7 @@ function Dm({
7259
7237
  ),
7260
7238
  !a && /* @__PURE__ */ h("p", { className: "text-sm text-red-500 mt-1", children: "Please enter a valid 10-digit phone number" })
7261
7239
  ] }),
7262
- /* @__PURE__ */ C(fn, { children: [
7240
+ /* @__PURE__ */ S(hn, { children: [
7263
7241
  /* @__PURE__ */ h(
7264
7242
  Me,
7265
7243
  {
@@ -7283,7 +7261,7 @@ function Dm({
7283
7261
  ] })
7284
7262
  ] }) }) });
7285
7263
  }
7286
- function Rm({
7264
+ function Vm({
7287
7265
  isOpen: e,
7288
7266
  title: t = "PIN Required",
7289
7267
  description: n = "Please enter your PIN",
@@ -7292,10 +7270,10 @@ function Rm({
7292
7270
  onComplete: o
7293
7271
  }) {
7294
7272
  const [i, a] = O(""), [l, c] = O(!1), u = (m) => {
7295
- const w = m.replace(/\D/g, "");
7296
- a(w.slice(0, r));
7273
+ const x = m.replace(/\D/g, "");
7274
+ a(x.slice(0, r));
7297
7275
  };
7298
- return /* @__PURE__ */ h(un, { open: e, children: /* @__PURE__ */ h(dn, { showCloseButton: !1, children: /* @__PURE__ */ C("form", { onSubmit: async (m) => {
7276
+ return /* @__PURE__ */ h(cn, { open: e, children: /* @__PURE__ */ h(un, { showCloseButton: !1, children: /* @__PURE__ */ S("form", { onSubmit: async (m) => {
7299
7277
  if (m.preventDefault(), i.length === r) {
7300
7278
  c(!0);
7301
7279
  try {
@@ -7305,16 +7283,16 @@ function Rm({
7305
7283
  }
7306
7284
  }
7307
7285
  }, children: [
7308
- /* @__PURE__ */ C(hn, { children: [
7309
- /* @__PURE__ */ C(mn, { className: "flex items-center gap-2", children: [
7286
+ /* @__PURE__ */ S(dn, { children: [
7287
+ /* @__PURE__ */ S(fn, { className: "flex items-center gap-2", children: [
7310
7288
  /* @__PURE__ */ h(_l, { className: "h-5 w-5" }),
7311
7289
  t
7312
7290
  ] }),
7313
- /* @__PURE__ */ h(pn, { children: n })
7291
+ /* @__PURE__ */ h(mn, { children: n })
7314
7292
  ] }),
7315
- /* @__PURE__ */ C("div", { className: "py-4", children: [
7293
+ /* @__PURE__ */ S("div", { className: "py-4", children: [
7316
7294
  /* @__PURE__ */ h(
7317
- gn,
7295
+ pn,
7318
7296
  {
7319
7297
  type: "password",
7320
7298
  value: i,
@@ -7326,13 +7304,13 @@ function Rm({
7326
7304
  disabled: l
7327
7305
  }
7328
7306
  ),
7329
- /* @__PURE__ */ C("p", { className: "text-sm text-gray-500 mt-1 text-center", children: [
7307
+ /* @__PURE__ */ S("p", { className: "text-sm text-gray-500 mt-1 text-center", children: [
7330
7308
  "Enter ",
7331
7309
  r,
7332
7310
  "-digit PIN"
7333
7311
  ] })
7334
7312
  ] }),
7335
- /* @__PURE__ */ C(fn, { children: [
7313
+ /* @__PURE__ */ S(hn, { children: [
7336
7314
  /* @__PURE__ */ h(
7337
7315
  Me,
7338
7316
  {
@@ -7365,7 +7343,7 @@ function Ys({
7365
7343
  onComplete: o
7366
7344
  }) {
7367
7345
  const [i, a] = O(""), [l, c] = O(!1);
7368
- return /* @__PURE__ */ h(un, { open: e, children: /* @__PURE__ */ h(dn, { showCloseButton: !1, children: /* @__PURE__ */ C("form", { onSubmit: async (f) => {
7346
+ return /* @__PURE__ */ h(cn, { open: e, children: /* @__PURE__ */ h(un, { showCloseButton: !1, children: /* @__PURE__ */ S("form", { onSubmit: async (f) => {
7369
7347
  if (f.preventDefault(), !!i.trim()) {
7370
7348
  c(!0);
7371
7349
  try {
@@ -7375,15 +7353,15 @@ function Ys({
7375
7353
  }
7376
7354
  }
7377
7355
  }, children: [
7378
- /* @__PURE__ */ C(hn, { children: [
7379
- /* @__PURE__ */ C(mn, { className: "flex items-center gap-2", children: [
7356
+ /* @__PURE__ */ S(dn, { children: [
7357
+ /* @__PURE__ */ S(fn, { className: "flex items-center gap-2", children: [
7380
7358
  /* @__PURE__ */ h(Xl, { className: "h-5 w-5" }),
7381
7359
  t
7382
7360
  ] }),
7383
- /* @__PURE__ */ h(pn, { children: n })
7361
+ /* @__PURE__ */ h(mn, { children: n })
7384
7362
  ] }),
7385
7363
  /* @__PURE__ */ h("div", { className: "py-4", children: /* @__PURE__ */ h(
7386
- gn,
7364
+ pn,
7387
7365
  {
7388
7366
  type: r,
7389
7367
  value: i,
@@ -7393,7 +7371,7 @@ function Ys({
7393
7371
  disabled: l
7394
7372
  }
7395
7373
  ) }),
7396
- /* @__PURE__ */ C(fn, { children: [
7374
+ /* @__PURE__ */ S(hn, { children: [
7397
7375
  /* @__PURE__ */ h(
7398
7376
  Me,
7399
7377
  {
@@ -7417,7 +7395,7 @@ function Ys({
7417
7395
  ] })
7418
7396
  ] }) }) });
7419
7397
  }
7420
- function Vm({
7398
+ function Rm({
7421
7399
  isOpen: e,
7422
7400
  title: t,
7423
7401
  description: n,
@@ -7431,20 +7409,20 @@ function Vm({
7431
7409
  return s.forEach((N) => {
7432
7410
  k[N.name] = N.value || "";
7433
7411
  }), k;
7434
- }), [c, u] = O({}), [d, f] = O({}), [m, w] = O(!1), v = (k) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(k) ? null : "Please enter a valid email address", T = (k) => k.replace(/\D/g, "").length === 10 ? null : "Please enter a valid 10-digit phone number", b = (k, N = 4) => k.length === N ? null : `PIN must be ${N} digits`, M = (k) => {
7412
+ }), [c, u] = O({}), [d, f] = O({}), [m, x] = O(!1), v = (k) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(k) ? null : "Please enter a valid email address", w = (k) => k.replace(/\D/g, "").length === 10 ? null : "Please enter a valid 10-digit phone number", y = (k, N = 4) => k.length === N ? null : `PIN must be ${N} digits`, M = (k) => {
7435
7413
  const N = k.replace(/\D/g, "");
7436
7414
  return N.length <= 3 ? N : N.length <= 6 ? `(${N.slice(0, 3)}) ${N.slice(3)}` : `(${N.slice(0, 3)}) ${N.slice(3, 6)}-${N.slice(6, 10)}`;
7437
7415
  }, E = (k, N, B) => {
7438
7416
  let I = N, U = null;
7439
7417
  switch (B.type) {
7440
7418
  case "phone":
7441
- I = M(N), I.trim() && (U = T(I));
7419
+ I = M(N), I.trim() && (U = w(I));
7442
7420
  break;
7443
7421
  case "email":
7444
7422
  N.trim() && (U = v(N));
7445
7423
  break;
7446
7424
  case "pin":
7447
- I = N.replace(/\D/g, "").slice(0, 6), I.trim() && (U = b(I));
7425
+ I = N.replace(/\D/g, "").slice(0, 6), I.trim() && (U = y(I));
7448
7426
  break;
7449
7427
  }
7450
7428
  !U && B.validation && I.trim() && (U = B.validation(I)), l((W) => ({ ...W, [k]: I })), u((W) => ({ ...W, [k]: U || "" }));
@@ -7462,19 +7440,19 @@ function Vm({
7462
7440
  U = v(I);
7463
7441
  break;
7464
7442
  case "phone":
7465
- U = T(I);
7443
+ U = w(I);
7466
7444
  break;
7467
7445
  case "pin":
7468
- U = b(I);
7446
+ U = y(I);
7469
7447
  break;
7470
7448
  }
7471
7449
  !U && B.validation && (U = B.validation(I));
7472
7450
  }
7473
7451
  U && (k[B.name] = U, N = !1);
7474
7452
  }), u(k), N;
7475
- }, R = async (k) => {
7453
+ }, V = async (k) => {
7476
7454
  if (k.preventDefault(), !!F()) {
7477
- w(!0);
7455
+ x(!0);
7478
7456
  try {
7479
7457
  const N = {};
7480
7458
  s.forEach((B) => {
@@ -7482,7 +7460,7 @@ function Vm({
7482
7460
  I && (B.type === "phone" ? N[B.name] = I.replace(/\D/g, "") : N[B.name] = I);
7483
7461
  }), r(N);
7484
7462
  } finally {
7485
- w(!1);
7463
+ x(!1);
7486
7464
  }
7487
7465
  }
7488
7466
  }, L = () => {
@@ -7492,7 +7470,7 @@ function Vm({
7492
7470
  ...N,
7493
7471
  [k]: !N[k]
7494
7472
  }));
7495
- }, A = (k) => {
7473
+ }, C = (k) => {
7496
7474
  switch (k.type) {
7497
7475
  case "password":
7498
7476
  return d[k.name] ? "text" : "password";
@@ -7526,21 +7504,21 @@ function Vm({
7526
7504
  return `Enter ${k.label.toLowerCase()}...`;
7527
7505
  }
7528
7506
  };
7529
- return /* @__PURE__ */ h(un, { open: e, children: /* @__PURE__ */ h(dn, { showCloseButton: !1, className: "max-w-md", children: /* @__PURE__ */ C("form", { onSubmit: R, children: [
7530
- /* @__PURE__ */ C(hn, { children: [
7531
- /* @__PURE__ */ h(mn, { children: t }),
7532
- n && /* @__PURE__ */ h(pn, { children: n })
7507
+ return /* @__PURE__ */ h(cn, { open: e, children: /* @__PURE__ */ h(un, { showCloseButton: !1, className: "max-w-md", children: /* @__PURE__ */ S("form", { onSubmit: V, children: [
7508
+ /* @__PURE__ */ S(dn, { children: [
7509
+ /* @__PURE__ */ h(fn, { children: t }),
7510
+ n && /* @__PURE__ */ h(mn, { children: n })
7533
7511
  ] }),
7534
- /* @__PURE__ */ h("div", { className: "py-4 space-y-4", children: s.map((k) => /* @__PURE__ */ C("div", { children: [
7535
- /* @__PURE__ */ C("label", { className: "block text-sm font-medium mb-1", children: [
7512
+ /* @__PURE__ */ h("div", { className: "py-4 space-y-4", children: s.map((k) => /* @__PURE__ */ S("div", { children: [
7513
+ /* @__PURE__ */ S("label", { className: "block text-sm font-medium mb-1", children: [
7536
7514
  k.label,
7537
7515
  k.required && /* @__PURE__ */ h("span", { className: "text-red-500 ml-1", children: "*" })
7538
7516
  ] }),
7539
- /* @__PURE__ */ C("div", { className: "relative", children: [
7517
+ /* @__PURE__ */ S("div", { className: "relative", children: [
7540
7518
  /* @__PURE__ */ h(
7541
- gn,
7519
+ pn,
7542
7520
  {
7543
- type: A(k),
7521
+ type: C(k),
7544
7522
  value: a[k.name] || "",
7545
7523
  onChange: (N) => E(k.name, N.target.value, k),
7546
7524
  placeholder: j(k),
@@ -7561,12 +7539,12 @@ function Vm({
7561
7539
  }
7562
7540
  )
7563
7541
  ] }),
7564
- c[k.name] && /* @__PURE__ */ C("div", { className: "flex items-center gap-1 mt-1 text-sm text-red-500", children: [
7542
+ c[k.name] && /* @__PURE__ */ S("div", { className: "flex items-center gap-1 mt-1 text-sm text-red-500", children: [
7565
7543
  /* @__PURE__ */ h(Wl, { className: "h-3 w-3" }),
7566
7544
  c[k.name]
7567
7545
  ] })
7568
7546
  ] }, k.name)) }),
7569
- /* @__PURE__ */ C(fn, { children: [
7547
+ /* @__PURE__ */ S(hn, { children: [
7570
7548
  /* @__PURE__ */ h(
7571
7549
  Me,
7572
7550
  {
@@ -7596,17 +7574,17 @@ function Im() {
7596
7574
  return e;
7597
7575
  }
7598
7576
  function Om({ children: e }) {
7599
- const [t, n] = O(null), [s, r] = O(null), o = pe(null), i = pe(null), a = ke((m) => new Promise((w) => {
7600
- n(m), o.current = w;
7601
- }), []), l = ke((m) => new Promise((w) => {
7602
- r(m), i.current = w;
7577
+ const [t, n] = O(null), [s, r] = O(null), o = pe(null), i = pe(null), a = ke((m) => new Promise((x) => {
7578
+ n(m), o.current = x;
7579
+ }), []), l = ke((m) => new Promise((x) => {
7580
+ r(m), i.current = x;
7603
7581
  }), []), c = ke((m) => {
7604
7582
  o.current && (o.current(m), o.current = null), n(null);
7605
7583
  }, []), u = ke((m) => {
7606
7584
  i.current && (i.current(m), i.current = null), r(null);
7607
7585
  }, []), d = () => {
7608
7586
  if (s) {
7609
- const w = s.fields.map((v) => ({
7587
+ const x = s.fields.map((v) => ({
7610
7588
  name: v.name,
7611
7589
  type: v.type === "text" ? "text" : v.type === "password" ? "password" : v.type === "email" ? "email" : v.type === "phone" ? "phone" : v.type === "pin" ? "pin" : v.type === "ssn" ? "ssn" : v.type === "creditCard" ? "creditCard" : "text",
7612
7590
  label: v.label,
@@ -7616,12 +7594,12 @@ function Om({ children: e }) {
7616
7594
  value: v.value
7617
7595
  }));
7618
7596
  return /* @__PURE__ */ h(
7619
- Vm,
7597
+ Rm,
7620
7598
  {
7621
7599
  isOpen: !0,
7622
7600
  title: s.title,
7623
7601
  description: s.description,
7624
- fields: w,
7602
+ fields: x,
7625
7603
  onComplete: u
7626
7604
  }
7627
7605
  );
@@ -7642,7 +7620,7 @@ function Om({ children: e }) {
7642
7620
  case "phone":
7643
7621
  return /* @__PURE__ */ h(Dm, { ...m });
7644
7622
  case "pin":
7645
- return /* @__PURE__ */ h(Rm, { ...m });
7623
+ return /* @__PURE__ */ h(Vm, { ...m });
7646
7624
  case "ssn":
7647
7625
  return /* @__PURE__ */ h(
7648
7626
  Ys,
@@ -7670,7 +7648,7 @@ function Om({ children: e }) {
7670
7648
  () => ({ showSecureModal: a, showSecureForm: l }),
7671
7649
  [a, l]
7672
7650
  );
7673
- return /* @__PURE__ */ C(Sl.Provider, { value: f, children: [
7651
+ return /* @__PURE__ */ S(Sl.Provider, { value: f, children: [
7674
7652
  e,
7675
7653
  d()
7676
7654
  ] });
@@ -7704,9 +7682,9 @@ function Ao(e) {
7704
7682
  let t = e.replace(/_+$/gm, "");
7705
7683
  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();
7706
7684
  if (s && s[1]) {
7707
- const A = s[1], j = /\[(\d+)\]\s*(https?:\/\/[^\s\)]+)/g;
7685
+ const C = s[1], j = /\[(\d+)\]\s*(https?:\/\/[^\s\)]+)/g;
7708
7686
  let k;
7709
- for (; (k = j.exec(A)) !== null; )
7687
+ for (; (k = j.exec(C)) !== null; )
7710
7688
  if (k[1] && k[2]) {
7711
7689
  const N = parseInt(k[1], 10), B = k[2].replace(/[.,;:!?]+$/, ""), I = B.replace(/\/+$/, "");
7712
7690
  if (a.has(I) || a.set(I, B), i.has(I) || i.set(I, []), i.get(I).push(N), !l.has(I))
@@ -7730,26 +7708,26 @@ function Ao(e) {
7730
7708
  s && s[0] && (u = s[0], d = t.replace(n, ""));
7731
7709
  const f = [];
7732
7710
  let m = 0;
7733
- const w = /```[\s\S]*?```|`[^`]+`/g;
7711
+ const x = /```[\s\S]*?```|`[^`]+`/g;
7734
7712
  let v;
7735
- for (; (v = w.exec(d)) !== null; )
7713
+ for (; (v = x.exec(d)) !== null; )
7736
7714
  v.index > m && f.push({ type: "text", content: d.slice(m, v.index), start: m, end: v.index }), f.push({ type: "code", content: v[0], start: v.index, end: v.index + v[0].length }), m = v.index + v[0].length;
7737
7715
  m < d.length && f.push({ type: "text", content: d.slice(m), start: m, end: d.length });
7738
- const T = f.map((A) => {
7739
- if (A.type === "code")
7740
- return A.content;
7741
- let j = A.content;
7716
+ const w = f.map((C) => {
7717
+ if (C.type === "code")
7718
+ return C.content;
7719
+ let j = C.content;
7742
7720
  return j = j.replace(/\[(\d+)\]\((https?:\/\/[^\)]+)\)/g, (N, B, I) => {
7743
- const U = parseInt(B, 10), W = I.replace(/\/+$/, ""), H = c.get(U) || U;
7744
- return l.has(W) || (l.set(W, H), r.has(H) || (r.set(H, I), o.push({ number: H, url: I }))), `[${H}]`;
7721
+ const U = parseInt(B, 10), W = I.replace(/\/+$/, ""), Y = c.get(U) || U;
7722
+ return l.has(W) || (l.set(W, Y), r.has(Y) || (r.set(Y, I), o.push({ number: Y, url: I }))), `[${Y}]`;
7745
7723
  }), j = j.replace(/\[(\d+)\]/g, (N, B) => {
7746
7724
  const I = parseInt(B, 10);
7747
7725
  return `[${c.get(I) || I}]`;
7748
7726
  }), j;
7749
- }), b = [];
7750
- for (const [A, j] of l.entries()) {
7751
- const k = a.get(A) || A, { baseUrl: N, anchor: B } = Lm(k), I = jm(k);
7752
- b.push({
7727
+ }), y = [];
7728
+ for (const [C, j] of l.entries()) {
7729
+ const k = a.get(C) || C, { baseUrl: N, anchor: B } = Lm(k), I = jm(k);
7730
+ y.push({
7753
7731
  url: k,
7754
7732
  baseUrl: N,
7755
7733
  numbers: [j],
@@ -7758,49 +7736,49 @@ function Ao(e) {
7758
7736
  title: I
7759
7737
  });
7760
7738
  }
7761
- b.sort((A, j) => (A.numbers[0] || 0) - (j.numbers[0] || 0));
7739
+ y.sort((C, j) => (C.numbers[0] || 0) - (j.numbers[0] || 0));
7762
7740
  const M = /* @__PURE__ */ new Map();
7763
7741
  let E = 1;
7764
- for (const A of b) {
7765
- const j = A.numbers[0];
7766
- M.set(j, E), A.numbers = [E], E++;
7742
+ for (const C of y) {
7743
+ const j = C.numbers[0];
7744
+ M.set(j, E), C.numbers = [E], E++;
7767
7745
  }
7768
7746
  const F = /* @__PURE__ */ new Map();
7769
- for (const [A, j] of r.entries()) {
7770
- const k = M.get(A);
7747
+ for (const [C, j] of r.entries()) {
7748
+ const k = M.get(C);
7771
7749
  k && F.set(k, j);
7772
7750
  }
7773
- const R = o.map((A) => {
7774
- const j = M.get(A.number);
7775
- return j ? { number: j, url: A.url } : A;
7776
- }).filter((A) => M.has(A.number)), L = Array.from(M.entries()).sort((A, j) => j[0] - A[0]);
7777
- let D = T.join("");
7778
- for (const [A, j] of L) {
7779
- const k = new RegExp(`\\[${A}\\](?!\\d)`, "g");
7751
+ const V = o.map((C) => {
7752
+ const j = M.get(C.number);
7753
+ return j ? { number: j, url: C.url } : C;
7754
+ }).filter((C) => M.has(C.number)), L = Array.from(M.entries()).sort((C, j) => j[0] - C[0]);
7755
+ let D = w.join("");
7756
+ for (const [C, j] of L) {
7757
+ const k = new RegExp(`\\[${C}\\](?!\\d)`, "g");
7780
7758
  D = D.replace(k, `[${j}]`);
7781
7759
  }
7782
7760
  return {
7783
7761
  processedText: D,
7784
- citations: R.sort((A, j) => A.number - j.number),
7762
+ citations: V.sort((C, j) => C.number - j.number),
7785
7763
  citationMap: F,
7786
- groupedCitations: b,
7764
+ groupedCitations: y,
7787
7765
  referencesText: u
7788
7766
  };
7789
7767
  }
7790
- function Ln(e) {
7768
+ function On(e) {
7791
7769
  if (typeof e == "string")
7792
7770
  try {
7793
7771
  const t = JSON.parse(e);
7794
- return Ln(t);
7772
+ return On(t);
7795
7773
  } catch {
7796
7774
  return e;
7797
7775
  }
7798
7776
  if (Array.isArray(e))
7799
- return e.map(Ln);
7777
+ return e.map(On);
7800
7778
  if (e && typeof e == "object") {
7801
7779
  const t = {};
7802
7780
  for (const [n, s] of Object.entries(e))
7803
- t[n] = Ln(s);
7781
+ t[n] = On(s);
7804
7782
  return t;
7805
7783
  }
7806
7784
  return e;
@@ -7810,12 +7788,12 @@ function Hs(e) {
7810
7788
  try {
7811
7789
  const t = JSON.parse(e);
7812
7790
  if (t && typeof t == "object" && !Array.isArray(t))
7813
- return Ln(t);
7791
+ return On(t);
7814
7792
  } catch {
7815
7793
  }
7816
7794
  return {};
7817
7795
  }
7818
- return e && typeof e == "object" && !Array.isArray(e) ? Ln(e) : {};
7796
+ return e && typeof e == "object" && !Array.isArray(e) ? On(e) : {};
7819
7797
  }
7820
7798
  function $m({
7821
7799
  theme: e = "auto",
@@ -7833,24 +7811,24 @@ function $m({
7833
7811
  safeToolNames: f,
7834
7812
  toolMetadata: m,
7835
7813
  // NOTE: systemPrompt is deprecated; configure prompts in the dashboard/agents UI.
7836
- systemPrompt: w = "",
7814
+ systemPrompt: x = "",
7837
7815
  agentId: v,
7838
- agentName: T,
7839
- tokenEndpoint: b = "/api/arcten/token",
7816
+ agentName: w,
7817
+ tokenEndpoint: y = "/api/arcten/token",
7840
7818
  apiBaseUrl: M = "https://api.arcten.com",
7841
7819
  user: E,
7842
7820
  state: F,
7843
- onStateChange: R,
7821
+ onStateChange: V,
7844
7822
  allowStateEdits: L = !0,
7845
7823
  sources: D,
7846
- ragConfig: A,
7824
+ ragConfig: C,
7847
7825
  showCitations: j = !0,
7848
7826
  sensitiveParams: k,
7849
7827
  autoDetectSensitive: N = !1
7850
7828
  }) {
7851
7829
  const B = M.replace(/\/+$/, ""), { showSecureModal: I } = Im(), U = Cc({
7852
7830
  apiBaseUrl: B,
7853
- tokenEndpoint: b,
7831
+ tokenEndpoint: y,
7854
7832
  user: E,
7855
7833
  tools: u,
7856
7834
  safeTools: d,
@@ -7858,15 +7836,15 @@ function $m({
7858
7836
  sensitiveParams: k,
7859
7837
  autoDetectSensitive: N,
7860
7838
  agentId: v,
7861
- agentName: T,
7839
+ agentName: w,
7862
7840
  state: F,
7863
7841
  // controlled state prop
7864
- onStateChange: R,
7842
+ onStateChange: V,
7865
7843
  allowStateEdits: L,
7866
7844
  sources: D,
7867
- ragConfig: A
7845
+ ragConfig: C
7868
7846
  });
7869
- ee(() => A !== void 0 ? A : D && D.length > 0 ? {
7847
+ ee(() => C !== void 0 ? C : D && D.length > 0 ? {
7870
7848
  enabled: !0,
7871
7849
  organizationId: D[0],
7872
7850
  // Use first source as default
@@ -7874,34 +7852,34 @@ function $m({
7874
7852
  // Default to auto-execute when sources are provided
7875
7853
  filters: void 0
7876
7854
  // Can be extended later if needed
7877
- } : { enabled: !1 }, [D, A]);
7878
- const [W, H] = O(c), [G, ae] = O(i), [xe, He] = O(600), [Ct, ot] = O(!1), [Y, Bt] = O(!1), [Ve, At] = O(!1), [Ne, _e] = O({ x: 100, y: 100 }), [yn, le] = O(!1), [bn, kt] = O({ x: 0, y: 0 }), [vn, Gn] = O(!1), Xe = pe(null), Et = pe(null), [Mt, Oe] = O(""), [xn, ks] = O(null), [Ut, wn] = O("Thinking..."), [zt, at] = O(/* @__PURE__ */ new Set()), [Es, Yn] = O(""), [lt, Hn] = O([]), Jn = pe(/* @__PURE__ */ new Map()), _t = pe(!1), de = pe(""), [Xt, mt] = O(!1), [we, Tn] = O(!1), Je = ee(() => [...u, ...d], [u, d]), $e = ee(() => Io(Je, m), [Je, m]), Sn = ee(() => {
7879
- const S = /* @__PURE__ */ new Map(), X = new Map($e.map((_) => [_.name, _]));
7855
+ } : { enabled: !1 }, [D, C]);
7856
+ const [W, Y] = O(c), [G, ae] = O(i), [xe, He] = O(600), [Ct, ot] = O(!1), [H, Bt] = O(!1), [Re, At] = O(!1), [Ne, _e] = O({ x: 100, y: 100 }), [gn, ce] = O(!1), [yn, kt] = O({ x: 0, y: 0 }), [bn, qn] = O(!1), Xe = pe(null), Et = pe(null), [Mt, Oe] = O(""), [vn, ks] = O(null), [Ut, xn] = O("Thinking..."), [zt, at] = O(/* @__PURE__ */ new Set()), [Es, Gn] = O(""), [lt, Yn] = O([]), Hn = pe(/* @__PURE__ */ new Map()), _t = pe(!1), de = pe(""), [Xt, mt] = O(!1), [we, wn] = O(!1), Je = ee(() => [...u, ...d], [u, d]), $e = ee(() => Io(Je, m), [Je, m]), Tn = ee(() => {
7857
+ const T = /* @__PURE__ */ new Map(), X = new Map($e.map((_) => [_.name, _]));
7880
7858
  return Je.forEach((_) => {
7881
7859
  const Q = _[Ge];
7882
7860
  if (Q) {
7883
7861
  const Z = X.get(Q);
7884
7862
  if (Z) {
7885
- S.set(Z.name, _);
7863
+ T.set(Z.name, _);
7886
7864
  return;
7887
7865
  }
7888
7866
  }
7889
7867
  const J = $e.find((Z) => Z.name === _.name);
7890
- J && S.set(J.name, _);
7891
- }), S;
7868
+ J && T.set(J.name, _);
7869
+ }), T;
7892
7870
  }, [Je, $e]), Ze = ee(() => {
7893
- const S = /* @__PURE__ */ new Set(), X = new Map($e.map((_) => [_.name, _]));
7871
+ const T = /* @__PURE__ */ new Set(), X = new Map($e.map((_) => [_.name, _]));
7894
7872
  return d.forEach((_) => {
7895
7873
  const Q = _[Ge];
7896
7874
  if (Q && X.has(Q))
7897
- S.add(Q);
7875
+ T.add(Q);
7898
7876
  else {
7899
7877
  const J = $e.find((Z) => Z.name === _.name);
7900
- J && S.add(J.name);
7878
+ J && T.add(J.name);
7901
7879
  }
7902
7880
  }), f && Array.isArray(f) && f.forEach((_) => {
7903
- typeof _ == "string" && S.add(_);
7904
- }), S;
7881
+ typeof _ == "string" && T.add(_);
7882
+ }), T;
7905
7883
  }, [d, $e, f]), Nt = [
7906
7884
  "Thinking...",
7907
7885
  "Pondering...",
@@ -7968,8 +7946,8 @@ function $m({
7968
7946
  ];
7969
7947
  re(() => {
7970
7948
  if (typeof window < "u") {
7971
- const S = localStorage.getItem("arcten-sidebar-expanded");
7972
- S && H(JSON.parse(S));
7949
+ const T = localStorage.getItem("arcten-sidebar-expanded");
7950
+ T && Y(JSON.parse(T));
7973
7951
  const X = localStorage.getItem("arcten-sidebar-width");
7974
7952
  X && ae(parseInt(X));
7975
7953
  const _ = localStorage.getItem("arcten-sidebar-height");
@@ -7988,7 +7966,7 @@ function $m({
7988
7966
  _e({ x: he, y: K });
7989
7967
  }
7990
7968
  const Z = localStorage.getItem("arcten-sidebar-minimized");
7991
- Z && At(JSON.parse(Z)), Gn(!0);
7969
+ Z && At(JSON.parse(Z)), qn(!0);
7992
7970
  }
7993
7971
  }, []), ee(() => E, [E?.id]), re(() => {
7994
7972
  (async () => {
@@ -8008,8 +7986,8 @@ function $m({
8008
7986
  if (Q.ok) {
8009
7987
  const J = await Q.json();
8010
7988
  J.tools && J.tools.forEach((Z) => {
8011
- Jn.current.set(Z.name, Z);
8012
- }), Hn(J.tools);
7989
+ Hn.current.set(Z.name, Z);
7990
+ }), Yn(J.tools);
8013
7991
  }
8014
7992
  } catch (_) {
8015
7993
  console.error("Failed to fetch tool descriptions:", _);
@@ -8019,49 +7997,49 @@ function $m({
8019
7997
  }
8020
7998
  })();
8021
7999
  }, [Je, B]), re(() => {
8022
- Promise.resolve().then(() => bm).then((S) => {
8023
- ks(() => S.Response);
8000
+ Promise.resolve().then(() => bm).then((T) => {
8001
+ ks(() => T.Response);
8024
8002
  });
8025
8003
  }, []), re(() => {
8026
- const S = () => {
8027
- Yn(window.location.pathname);
8004
+ const T = () => {
8005
+ Gn(window.location.pathname);
8028
8006
  };
8029
- S(), window.addEventListener("popstate", S);
8030
- const X = setInterval(S, 500);
8007
+ T(), window.addEventListener("popstate", T);
8008
+ const X = setInterval(T, 500);
8031
8009
  return () => {
8032
- window.removeEventListener("popstate", S), clearInterval(X);
8010
+ window.removeEventListener("popstate", T), clearInterval(X);
8033
8011
  };
8034
8012
  }, []);
8035
8013
  const {
8036
- id: Zn,
8014
+ id: Jn,
8037
8015
  messages: De,
8038
8016
  sendMessage: pt,
8039
8017
  status: Le,
8040
- error: Qn,
8018
+ error: Zn,
8041
8019
  stop: Wt,
8042
8020
  addToolOutput: ct,
8043
- setMessages: es,
8044
- clientToken: ts,
8021
+ setMessages: Qn,
8022
+ clientToken: es,
8045
8023
  tokenError: Qe,
8046
8024
  conversations: et,
8047
- isLoadingConversations: Pn,
8025
+ isLoadingConversations: Sn,
8048
8026
  loadConversation: We,
8049
8027
  deleteConversation: tt,
8050
- startNewConversation: ns
8028
+ startNewConversation: ts
8051
8029
  } = U;
8052
8030
  re(() => {
8053
8031
  W && Et.current && Et.current.focus();
8054
8032
  }, [W, De]), re(() => {
8055
- const S = De[De.length - 1];
8056
- if (!S || S.role !== "assistant") return;
8057
- const X = S.parts?.filter((_) => _.type?.startsWith("tool-") && _.state === "input-available" && typeof _.toolCallId == "string" && _.input !== void 0) || [];
8033
+ const T = De[De.length - 1];
8034
+ if (!T || T.role !== "assistant") return;
8035
+ const X = T.parts?.filter((_) => _.type?.startsWith("tool-") && _.state === "input-available" && typeof _.toolCallId == "string" && _.input !== void 0) || [];
8058
8036
  for (const _ of X) {
8059
8037
  const Q = _, J = Q.type?.replace("tool-", "") || "", Z = Q.toolCallId;
8060
8038
  if (Ze.has(J)) {
8061
8039
  if (zt.has(Z)) continue;
8062
8040
  at((ie) => ie.has(Z) ? ie : new Set(ie).add(Z)), (async () => {
8063
8041
  try {
8064
- const ie = Sn.get(J);
8042
+ const ie = Tn.get(J);
8065
8043
  if (!ie) {
8066
8044
  console.warn(`[ArctenAgent] Tool ${J} not found in toolsMap`), ct({
8067
8045
  toolCallId: Z,
@@ -8101,43 +8079,43 @@ function $m({
8101
8079
  })();
8102
8080
  }
8103
8081
  }
8104
- }, [De, Ze, Sn, $e, ct, zt]);
8105
- function ss() {
8106
- H(!0), localStorage.setItem("arcten-sidebar-expanded", "true");
8082
+ }, [De, Ze, Tn, $e, ct, zt]);
8083
+ function ns() {
8084
+ Y(!0), localStorage.setItem("arcten-sidebar-expanded", "true");
8107
8085
  }
8108
8086
  function ut() {
8109
- H(!1), localStorage.setItem("arcten-sidebar-expanded", "false");
8087
+ Y(!1), localStorage.setItem("arcten-sidebar-expanded", "false");
8110
8088
  }
8111
8089
  re(() => {
8112
8090
  }, [W]), re(() => {
8113
8091
  Xe.current && Xe.current.scrollIntoView({ behavior: "smooth" });
8114
8092
  }, [De]), re(() => {
8115
- function S(X) {
8093
+ function T(X) {
8116
8094
  X.key === "Escape" && (Le === "streaming" || Le === "submitted") && (X.preventDefault(), Wt());
8117
8095
  }
8118
- return window.addEventListener("keydown", S), () => window.removeEventListener("keydown", S);
8096
+ return window.addEventListener("keydown", T), () => window.removeEventListener("keydown", T);
8119
8097
  }, [Le, Wt]);
8120
- function Dt(S) {
8121
- const X = Math.floor((Date.now() - S) / 1e3);
8098
+ function Dt(T) {
8099
+ const X = Math.floor((Date.now() - T) / 1e3);
8122
8100
  return X < 60 ? "now" : X < 3600 ? `${Math.floor(X / 60)}m` : X < 86400 ? `${Math.floor(X / 3600)}h` : `${Math.floor(X / 86400)}d`;
8123
8101
  }
8124
- function rs() {
8125
- ns(), Tn(!1);
8102
+ function ss() {
8103
+ ts(), wn(!1);
8126
8104
  }
8127
- function Cn(S) {
8128
- if (S.preventDefault(), !Mt.trim()) return;
8105
+ function Pn(T) {
8106
+ if (T.preventDefault(), !Mt.trim()) return;
8129
8107
  (Le === "streaming" || Le === "submitted") && Wt();
8130
8108
  const X = Nt[Math.floor(Math.random() * Nt.length)] || "Thinking...";
8131
- wn(X), pt({ text: Mt }), Oe("");
8109
+ xn(X), pt({ text: Mt }), Oe("");
8132
8110
  }
8133
- function gt(S) {
8134
- const X = S.target.value;
8111
+ function gt(T) {
8112
+ const X = T.target.value;
8135
8113
  Oe(X);
8136
8114
  }
8137
8115
  re(() => {
8138
8116
  if (!Ct) return;
8139
- function S(_) {
8140
- if (Y) {
8117
+ function T(_) {
8118
+ if (H) {
8141
8119
  const Q = _.clientX - Ne.x, J = _.clientY - Ne.y;
8142
8120
  Q >= a && Q <= l && ae(Q), J >= 400 && J <= 1e3 && He(J);
8143
8121
  } else {
@@ -8148,31 +8126,31 @@ function $m({
8148
8126
  function X() {
8149
8127
  ot(!1), localStorage.setItem("arcten-sidebar-width", G.toString()), localStorage.setItem("arcten-sidebar-height", xe.toString());
8150
8128
  }
8151
- return window.addEventListener("mousemove", S), window.addEventListener("mouseup", X), () => {
8152
- window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", X);
8129
+ return window.addEventListener("mousemove", T), window.addEventListener("mouseup", X), () => {
8130
+ window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", X);
8153
8131
  };
8154
- }, [Ct, G, xe, Y, Ne, a, l]);
8155
- function Kt(S) {
8156
- S.preventDefault(), ot(!0);
8132
+ }, [Ct, G, xe, H, Ne, a, l]);
8133
+ function Kt(T) {
8134
+ T.preventDefault(), ot(!0);
8157
8135
  }
8158
8136
  function Ms() {
8159
8137
  Bt(!0), At(!1), localStorage.setItem("arcten-sidebar-detached", "true"), localStorage.setItem("arcten-sidebar-minimized", "false");
8160
8138
  }
8161
- function qt() {
8139
+ function Cn() {
8162
8140
  Bt(!1), At(!1), localStorage.setItem("arcten-sidebar-detached", "false"), localStorage.setItem("arcten-sidebar-minimized", "false");
8163
8141
  }
8164
- function An() {
8165
- At(!Ve), localStorage.setItem("arcten-sidebar-minimized", JSON.stringify(!Ve));
8142
+ function rs() {
8143
+ At(!Re), localStorage.setItem("arcten-sidebar-minimized", JSON.stringify(!Re));
8166
8144
  }
8167
- function nt(S) {
8168
- Y && (le(!0), kt({
8169
- x: S.clientX - Ne.x,
8170
- y: S.clientY - Ne.y
8145
+ function nt(T) {
8146
+ H && (ce(!0), kt({
8147
+ x: T.clientX - Ne.x,
8148
+ y: T.clientY - Ne.y
8171
8149
  }));
8172
8150
  }
8173
8151
  return re(() => {
8174
- if (!Y) return;
8175
- function S() {
8152
+ if (!H) return;
8153
+ function T() {
8176
8154
  _e((X) => {
8177
8155
  const Q = window.innerWidth - 50, J = window.innerHeight - 50, Z = 50 - G, je = 0, ie = Math.max(Z, Math.min(X.x, Q)), he = Math.max(je, Math.min(X.y, J));
8178
8156
  if (ie !== X.x || he !== X.y) {
@@ -8182,47 +8160,47 @@ function $m({
8182
8160
  return X;
8183
8161
  });
8184
8162
  }
8185
- return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
8186
- }, [Y, G]), re(() => {
8187
- if (!yn) return;
8188
- function S(_) {
8189
- const Q = _.clientX - bn.x, J = _.clientY - bn.y, Z = 50, je = window.innerWidth - Z, ie = window.innerHeight - Z, he = Z - G, K = 0, ye = Math.max(he, Math.min(Q, je)), ne = Math.max(K, Math.min(J, ie));
8163
+ return window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
8164
+ }, [H, G]), re(() => {
8165
+ if (!gn) return;
8166
+ function T(_) {
8167
+ const Q = _.clientX - yn.x, J = _.clientY - yn.y, Z = 50, je = window.innerWidth - Z, ie = window.innerHeight - Z, he = Z - G, K = 0, ye = Math.max(he, Math.min(Q, je)), ne = Math.max(K, Math.min(J, ie));
8190
8168
  _e({ x: ye, y: ne });
8191
8169
  }
8192
8170
  function X() {
8193
- le(!1), localStorage.setItem("arcten-sidebar-position", JSON.stringify(Ne));
8171
+ ce(!1), localStorage.setItem("arcten-sidebar-position", JSON.stringify(Ne));
8194
8172
  }
8195
- return window.addEventListener("mousemove", S), window.addEventListener("mouseup", X), () => {
8196
- window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", X);
8173
+ return window.addEventListener("mousemove", T), window.addEventListener("mouseup", X), () => {
8174
+ window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", X);
8197
8175
  };
8198
- }, [yn, bn, Ne, G]), vn ? Qe ? /* @__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__ */ C("div", { className: "p-4 bg-destructive/10 text-destructive text-sm rounded-lg", children: [
8176
+ }, [gn, yn, Ne, G]), bn ? Qe ? /* @__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__ */ S("div", { className: "p-4 bg-destructive/10 text-destructive text-sm rounded-lg", children: [
8199
8177
  "Authentication error: ",
8200
8178
  Qe
8201
- ] }) }) : ts ? /* @__PURE__ */ h(Rd, { features: cm, children: /* @__PURE__ */ h(
8179
+ ] }) }) : es ? /* @__PURE__ */ h(Vd, { features: cm, children: /* @__PURE__ */ h(
8202
8180
  cs,
8203
8181
  {
8204
8182
  id: "arcten-sidebar",
8205
8183
  "data-theme": e,
8206
8184
  "data-layout": t,
8207
8185
  "data-model": n,
8208
- initial: Y ? { opacity: 0, scale: 0.95, filter: "blur(4px)" } : !1,
8209
- animate: Y ? { opacity: 1, scale: 1, filter: "blur(0px)" } : {},
8186
+ initial: H ? { opacity: 0, scale: 0.95, filter: "blur(4px)" } : !1,
8187
+ animate: H ? { opacity: 1, scale: 1, filter: "blur(0px)" } : {},
8210
8188
  transition: { duration: 0.2, ease: "easeOut" },
8211
8189
  className: `
8212
- ${Y ? "fixed z-50 shadow-xl rounded-xl" : "h-screen flex-shrink-0 relative rounded-l-2xl"}
8190
+ ${H ? "fixed z-50 shadow-xl rounded-xl" : "h-screen flex-shrink-0 relative rounded-l-2xl"}
8213
8191
  ${W ? "bg-stone-50 dark:bg-stone-900" : "bg-stone-100 dark:bg-stone-800 hover:bg-stone-200 dark:hover:bg-stone-700 transition-colors duration-200"}
8214
- ${Y ? "border border-border" : "border-l border-border"}
8192
+ ${H ? "border border-border" : "border-l border-border"}
8215
8193
  ${W ? "" : "w-[30px]"}
8216
8194
  `,
8217
- style: W ? Y ? {
8195
+ style: W ? H ? {
8218
8196
  width: `${G}px`,
8219
- height: Ve ? "auto" : `${xe}px`,
8197
+ height: Re ? "auto" : `${xe}px`,
8220
8198
  left: `${Ne.x}px`,
8221
8199
  top: `${Ne.y}px`
8222
8200
  } : { width: `${G}px` } : void 0,
8223
- onClick: W ? void 0 : ss,
8224
- children: W ? /* @__PURE__ */ C(Gt, { children: [
8225
- !Y && /* @__PURE__ */ h(
8201
+ onClick: W ? void 0 : ns,
8202
+ children: W ? /* @__PURE__ */ S(qt, { children: [
8203
+ !H && /* @__PURE__ */ h(
8226
8204
  "div",
8227
8205
  {
8228
8206
  className: "absolute left-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500/40 hover:w-1 transition-all group",
@@ -8230,13 +8208,13 @@ function $m({
8230
8208
  children: /* @__PURE__ */ h("div", { className: "absolute left-0 top-0 bottom-0 w-3 -translate-x-1" })
8231
8209
  }
8232
8210
  ),
8233
- Y && /* @__PURE__ */ C(Gt, { children: [
8211
+ H && /* @__PURE__ */ S(qt, { children: [
8234
8212
  /* @__PURE__ */ h(
8235
8213
  "div",
8236
8214
  {
8237
8215
  className: "absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize",
8238
- onMouseDown: (S) => {
8239
- S.preventDefault(), ot(!0);
8216
+ onMouseDown: (T) => {
8217
+ T.preventDefault(), ot(!0);
8240
8218
  }
8241
8219
  }
8242
8220
  ),
@@ -8244,10 +8222,10 @@ function $m({
8244
8222
  "div",
8245
8223
  {
8246
8224
  className: "absolute bottom-0 left-4 right-4 h-3 cursor-move hover:bg-blue-500/20 group",
8247
- onMouseDown: (S) => {
8248
- S.preventDefault(), S.stopPropagation(), le(!0), kt({
8249
- x: S.clientX - Ne.x,
8250
- y: S.clientY - Ne.y
8225
+ onMouseDown: (T) => {
8226
+ T.preventDefault(), T.stopPropagation(), ce(!0), kt({
8227
+ x: T.clientX - Ne.x,
8228
+ y: T.clientY - Ne.y
8251
8229
  });
8252
8230
  },
8253
8231
  children: /* @__PURE__ */ h("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-1 rounded-full bg-stone-400/30 group-hover:bg-blue-500/40 transition-colors" })
@@ -8257,76 +8235,76 @@ function $m({
8257
8235
  "div",
8258
8236
  {
8259
8237
  className: "absolute top-0 right-0 bottom-0 w-1 cursor-ew-resize hover:bg-blue-500/40",
8260
- onMouseDown: (S) => {
8261
- S.preventDefault(), ot(!0);
8238
+ onMouseDown: (T) => {
8239
+ T.preventDefault(), ot(!0);
8262
8240
  }
8263
8241
  }
8264
8242
  )
8265
8243
  ] }),
8266
- /* @__PURE__ */ C("div", { className: "flex flex-col h-full", children: [
8267
- /* @__PURE__ */ C(
8244
+ /* @__PURE__ */ S("div", { className: "flex flex-col h-full", children: [
8245
+ /* @__PURE__ */ S(
8268
8246
  "div",
8269
8247
  {
8270
- className: `flex items-center justify-between p-3 border-b border-border ${Y ? "cursor-move" : ""}`,
8271
- onMouseDown: Y ? nt : void 0,
8248
+ className: `flex items-center justify-between p-3 border-b border-border ${H ? "cursor-move" : ""}`,
8249
+ onMouseDown: H ? nt : void 0,
8272
8250
  children: [
8273
8251
  /* @__PURE__ */ h(
8274
8252
  "h2",
8275
8253
  {
8276
- className: `text-base font-semibold ${Y && Ve ? "cursor-pointer" : ""}`,
8277
- onClick: Y && Ve ? (S) => {
8278
- S.stopPropagation(), An();
8254
+ className: `text-base font-semibold ${H && Re ? "cursor-pointer" : ""}`,
8255
+ onClick: H && Re ? (T) => {
8256
+ T.stopPropagation(), rs();
8279
8257
  } : void 0,
8280
8258
  children: r
8281
8259
  }
8282
8260
  ),
8283
- /* @__PURE__ */ C("div", { className: "flex items-center gap-1", onClick: (S) => S.stopPropagation(), children: [
8284
- /* @__PURE__ */ C(yt, { children: [
8261
+ /* @__PURE__ */ S("div", { className: "flex items-center gap-1", onClick: (T) => T.stopPropagation(), children: [
8262
+ /* @__PURE__ */ S(yt, { children: [
8285
8263
  /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ h(
8286
8264
  "button",
8287
8265
  {
8288
8266
  type: "button",
8289
- className: se(Vt({ variant: "ghost", size: "icon" }), "h-8 w-8"),
8290
- onClick: rs,
8267
+ className: se(Rt({ variant: "ghost", size: "icon" }), "h-8 w-8"),
8268
+ onClick: ss,
8291
8269
  "aria-label": "New chat",
8292
8270
  children: /* @__PURE__ */ h(Kl, { className: "h-4 w-4" })
8293
8271
  }
8294
8272
  ) }),
8295
8273
  /* @__PURE__ */ h(vt, { children: "Start a new conversation" })
8296
8274
  ] }),
8297
- /* @__PURE__ */ C(yt, { children: [
8275
+ /* @__PURE__ */ S(yt, { children: [
8298
8276
  /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ h(
8299
8277
  "button",
8300
8278
  {
8301
8279
  type: "button",
8302
- className: se(Vt({ variant: "ghost", size: "icon" }), "h-8 w-8"),
8303
- onClick: Y ? qt : Ms,
8304
- "aria-label": Y ? "Dock sidebar" : "Float sidebar",
8305
- children: Y ? /* @__PURE__ */ h(ql, { className: "h-4 w-4" }) : /* @__PURE__ */ h(Gl, { className: "h-4 w-4" })
8280
+ className: se(Rt({ variant: "ghost", size: "icon" }), "h-8 w-8"),
8281
+ onClick: H ? Cn : Ms,
8282
+ "aria-label": H ? "Dock sidebar" : "Float sidebar",
8283
+ children: H ? /* @__PURE__ */ h(ql, { className: "h-4 w-4" }) : /* @__PURE__ */ h(Gl, { className: "h-4 w-4" })
8306
8284
  }
8307
8285
  ) }),
8308
- /* @__PURE__ */ h(vt, { children: Y ? "Dock to sidebar" : "Undock to floating window" })
8286
+ /* @__PURE__ */ h(vt, { children: H ? "Dock to sidebar" : "Undock to floating window" })
8309
8287
  ] }),
8310
- /* @__PURE__ */ C(yt, { children: [
8288
+ /* @__PURE__ */ S(yt, { children: [
8311
8289
  /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ h(
8312
8290
  "button",
8313
8291
  {
8314
8292
  type: "button",
8315
- className: se(Vt({ variant: "ghost", size: "icon" }), "h-8 w-8"),
8316
- onClick: Y ? An : ut,
8317
- "aria-label": Y ? Ve ? "Maximize" : "Minimize" : "Close sidebar",
8318
- children: Y ? Ve ? /* @__PURE__ */ h(Yl, { className: "h-4 w-4" }) : /* @__PURE__ */ h(Hl, { className: "h-4 w-4" }) : /* @__PURE__ */ h(ys, { className: "h-4 w-4" })
8293
+ className: se(Rt({ variant: "ghost", size: "icon" }), "h-8 w-8"),
8294
+ onClick: H ? rs : ut,
8295
+ "aria-label": H ? Re ? "Maximize" : "Minimize" : "Close sidebar",
8296
+ children: H ? Re ? /* @__PURE__ */ h(Yl, { className: "h-4 w-4" }) : /* @__PURE__ */ h(Hl, { className: "h-4 w-4" }) : /* @__PURE__ */ h(ys, { className: "h-4 w-4" })
8319
8297
  }
8320
8298
  ) }),
8321
- /* @__PURE__ */ h(vt, { children: Y ? Ve ? "Maximize window" : "Minimize to header" : "Close the chat" })
8299
+ /* @__PURE__ */ h(vt, { children: H ? Re ? "Maximize window" : "Minimize to header" : "Close the chat" })
8322
8300
  ] })
8323
8301
  ] })
8324
8302
  ]
8325
8303
  }
8326
8304
  ),
8327
- !Ve && /* @__PURE__ */ C(Gt, { children: [
8328
- E && et.length > 0 && /* @__PURE__ */ C("div", { className: `border-b border-border ${we ? "flex flex-col flex-1" : ""}`, children: [
8329
- /* @__PURE__ */ C("div", { className: "flex items-center justify-between px-3 py-1", children: [
8305
+ !Re && /* @__PURE__ */ S(qt, { children: [
8306
+ E && et.length > 0 && /* @__PURE__ */ S("div", { className: `border-b border-border ${we ? "flex flex-col flex-1" : ""}`, children: [
8307
+ /* @__PURE__ */ S("div", { className: "flex items-center justify-between px-3 py-1", children: [
8330
8308
  /* @__PURE__ */ h("h3", { className: "text-xs font-semibold text-muted-foreground", children: "Recent chats" }),
8331
8309
  /* @__PURE__ */ h(
8332
8310
  Me,
@@ -8334,24 +8312,24 @@ function $m({
8334
8312
  variant: "ghost",
8335
8313
  className: "h-auto px-2 py-1 text-xs text-muted-foreground hover:text-foreground",
8336
8314
  onClick: () => {
8337
- Tn(!we);
8315
+ wn(!we);
8338
8316
  },
8339
8317
  children: we ? "Show less" : "View all"
8340
8318
  }
8341
8319
  )
8342
8320
  ] }),
8343
- /* @__PURE__ */ h("div", { className: `px-2 pb-2 space-y-0.5 ${we ? "flex-1 overflow-y-auto" : ""}`, children: et.slice(0, we ? void 0 : 3).map((S) => /* @__PURE__ */ C("div", { className: "group relative", children: [
8344
- /* @__PURE__ */ C(
8321
+ /* @__PURE__ */ h("div", { className: `px-2 pb-2 space-y-0.5 ${we ? "flex-1 overflow-y-auto" : ""}`, children: et.slice(0, we ? void 0 : 3).map((T) => /* @__PURE__ */ S("div", { className: "group relative", children: [
8322
+ /* @__PURE__ */ S(
8345
8323
  um,
8346
8324
  {
8347
8325
  type: "button",
8348
- className: se(Vt({ variant: "ghost" }), "w-full justify-between h-auto py-1 px-3 font-normal active:scale-[0.99]"),
8326
+ className: se(Rt({ variant: "ghost" }), "w-full justify-between h-auto py-1 px-3 font-normal active:scale-[0.99]"),
8349
8327
  onClick: () => {
8350
- We(S.chatId || S._id), Tn(!1);
8328
+ We(T.chatId || T._id), wn(!1);
8351
8329
  },
8352
8330
  children: [
8353
- /* @__PURE__ */ h("span", { className: "text-xs truncate", children: S.title }),
8354
- /* @__PURE__ */ h("div", { className: "ml-2 flex items-center", children: /* @__PURE__ */ h("span", { className: "text-xs text-muted-foreground group-hover:hidden", children: Dt(S.updatedAt) }) })
8331
+ /* @__PURE__ */ h("span", { className: "text-xs truncate", children: T.title }),
8332
+ /* @__PURE__ */ h("div", { className: "ml-2 flex items-center", children: /* @__PURE__ */ h("span", { className: "text-xs text-muted-foreground group-hover:hidden", children: Dt(T.updatedAt) }) })
8355
8333
  ]
8356
8334
  }
8357
8335
  ),
@@ -8361,49 +8339,49 @@ function $m({
8361
8339
  type: "button",
8362
8340
  className: "absolute right-2 top-1/2 -translate-y-1/2 h-6 w-6 p-0 hidden group-hover:flex items-center justify-center text-muted-foreground hover:text-foreground rounded-md hover:bg-accent transition-colors",
8363
8341
  onClick: (X) => {
8364
- X.stopPropagation(), tt(S._id);
8342
+ X.stopPropagation(), tt(T._id);
8365
8343
  },
8366
8344
  "aria-label": "Delete conversation",
8367
8345
  children: /* @__PURE__ */ h(ys, { className: "h-3 w-3" })
8368
8346
  }
8369
8347
  )
8370
- ] }, S._id)) })
8348
+ ] }, T._id)) })
8371
8349
  ] }),
8372
- /* @__PURE__ */ C("div", { className: "flex-1 flex flex-col overflow-hidden relative", children: [
8373
- /* @__PURE__ */ h("div", { className: "flex-1 overflow-y-auto p-4 space-y-4 scroll-smooth", children: De.length === 0 ? /* @__PURE__ */ C("div", { className: "flex flex-col items-center justify-center h-full", children: [
8350
+ /* @__PURE__ */ S("div", { className: "flex-1 flex flex-col overflow-hidden relative", children: [
8351
+ /* @__PURE__ */ h("div", { className: "flex-1 overflow-y-auto p-4 space-y-4 scroll-smooth", children: De.length === 0 ? /* @__PURE__ */ S("div", { className: "flex flex-col items-center justify-center h-full", children: [
8374
8352
  o && /* @__PURE__ */ h("div", { className: "mb-6", children: o }),
8375
8353
  /* @__PURE__ */ h("h3", { className: "text-lg font-semibold text-center mb-2", children: "How can I help you?" }),
8376
- lt.length > 0 && /* @__PURE__ */ h("div", { className: "mt-4 px-4 max-w-md mx-auto", children: /* @__PURE__ */ C("div", { className: "flex flex-wrap gap-2 justify-center", children: [
8377
- (Xt ? lt : lt.slice(0, 10)).map((S) => /* @__PURE__ */ C(yt, { children: [
8354
+ lt.length > 0 && /* @__PURE__ */ h("div", { className: "mt-4 px-4 max-w-md mx-auto", children: /* @__PURE__ */ S("div", { className: "flex flex-wrap gap-2 justify-center", children: [
8355
+ (Xt ? lt : lt.slice(0, 10)).map((T) => /* @__PURE__ */ S(yt, { children: [
8378
8356
  /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ h(
8379
- Vs,
8357
+ Rs,
8380
8358
  {
8381
8359
  variant: "secondary",
8382
8360
  className: "cursor-pointer text-xs px-2 py-1 hover:bg-stone-200 dark:hover:bg-stone-700 transition-colors",
8383
8361
  onClick: () => {
8384
- Oe(S.sampleUsage), Et.current?.focus();
8362
+ Oe(T.sampleUsage), Et.current?.focus();
8385
8363
  },
8386
- children: S.friendlyName
8364
+ children: T.friendlyName
8387
8365
  }
8388
8366
  ) }),
8389
- /* @__PURE__ */ h(vt, { children: /* @__PURE__ */ C("div", { className: "max-w-xs", children: [
8390
- /* @__PURE__ */ h("p", { className: "font-medium", children: S.description }),
8391
- /* @__PURE__ */ C("p", { className: "text-xs text-muted-foreground mt-2", children: [
8367
+ /* @__PURE__ */ h(vt, { children: /* @__PURE__ */ S("div", { className: "max-w-xs", children: [
8368
+ /* @__PURE__ */ h("p", { className: "font-medium", children: T.description }),
8369
+ /* @__PURE__ */ S("p", { className: "text-xs text-muted-foreground mt-2", children: [
8392
8370
  /* @__PURE__ */ h("span", { className: "font-medium", children: "Example:" }),
8393
8371
  ' "',
8394
- S.sampleUsage,
8372
+ T.sampleUsage,
8395
8373
  '"'
8396
8374
  ] }),
8397
- S.paramCount > 0 && /* @__PURE__ */ C("p", { className: "text-xs text-muted-foreground mt-1", children: [
8375
+ T.paramCount > 0 && /* @__PURE__ */ S("p", { className: "text-xs text-muted-foreground mt-1", children: [
8398
8376
  /* @__PURE__ */ h("span", { className: "font-medium", children: "Parameters:" }),
8399
8377
  " ",
8400
- S.params.join(", ")
8378
+ T.params.join(", ")
8401
8379
  ] })
8402
8380
  ] }) })
8403
- ] }, S.name)),
8404
- lt.length > 10 && !Xt && /* @__PURE__ */ C(yt, { children: [
8405
- /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ C(
8406
- Vs,
8381
+ ] }, T.name)),
8382
+ lt.length > 10 && !Xt && /* @__PURE__ */ S(yt, { children: [
8383
+ /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ S(
8384
+ Rs,
8407
8385
  {
8408
8386
  variant: "secondary",
8409
8387
  className: "cursor-pointer text-xs px-2 py-1 hover:bg-stone-200 dark:hover:bg-stone-700 transition-colors",
@@ -8415,20 +8393,20 @@ function $m({
8415
8393
  ]
8416
8394
  }
8417
8395
  ) }),
8418
- /* @__PURE__ */ h(vt, { children: /* @__PURE__ */ C("div", { className: "max-w-xs", children: [
8396
+ /* @__PURE__ */ h(vt, { children: /* @__PURE__ */ S("div", { className: "max-w-xs", children: [
8419
8397
  /* @__PURE__ */ h("p", { className: "font-medium mb-2", children: "Additional tools:" }),
8420
- /* @__PURE__ */ h("div", { className: "space-y-1 max-h-64 overflow-y-auto pr-2", children: lt.slice(10).map((S) => /* @__PURE__ */ C("div", { children: [
8421
- /* @__PURE__ */ C("span", { className: "font-medium text-xs", children: [
8422
- S.friendlyName,
8398
+ /* @__PURE__ */ h("div", { className: "space-y-1 max-h-64 overflow-y-auto pr-2", children: lt.slice(10).map((T) => /* @__PURE__ */ S("div", { children: [
8399
+ /* @__PURE__ */ S("span", { className: "font-medium text-xs", children: [
8400
+ T.friendlyName,
8423
8401
  ":"
8424
8402
  ] }),
8425
- /* @__PURE__ */ h("span", { className: "text-xs text-muted-foreground ml-1", children: S.description })
8426
- ] }, S.name)) }),
8403
+ /* @__PURE__ */ h("span", { className: "text-xs text-muted-foreground ml-1", children: T.description })
8404
+ ] }, T.name)) }),
8427
8405
  /* @__PURE__ */ h("p", { className: "text-xs text-muted-foreground mt-2 italic", children: "Click to show all tools" })
8428
8406
  ] }) })
8429
8407
  ] }),
8430
8408
  Xt && lt.length > 10 && /* @__PURE__ */ h(
8431
- Vs,
8409
+ Rs,
8432
8410
  {
8433
8411
  variant: "secondary",
8434
8412
  className: "cursor-pointer text-xs px-2 py-1 hover:bg-stone-200 dark:hover:bg-stone-700 transition-colors",
@@ -8437,16 +8415,16 @@ function $m({
8437
8415
  }
8438
8416
  )
8439
8417
  ] }) })
8440
- ] }) : /* @__PURE__ */ C(Gt, { children: [
8441
- De.map((S) => {
8442
- const _ = S.parts.filter((K) => K.type === "text").map((K) => K.text).join("");
8443
- let Q = S.parts;
8444
- S.role === "assistant" && S.parts.some((ye) => ye.timestamp) && (Q = [...S.parts].sort((ye, ne) => {
8418
+ ] }) : /* @__PURE__ */ S(qt, { children: [
8419
+ De.map((T) => {
8420
+ const _ = T.parts.filter((K) => K.type === "text").map((K) => K.text).join("");
8421
+ let Q = T.parts;
8422
+ T.role === "assistant" && T.parts.some((ye) => ye.timestamp) && (Q = [...T.parts].sort((ye, ne) => {
8445
8423
  const Ae = ye.timestamp || 0, fe = ne.timestamp || 0;
8446
8424
  return Ae - fe;
8447
8425
  }));
8448
8426
  let J = [], Z = /* @__PURE__ */ new Map(), je = [], ie, he = !0;
8449
- if (S.role === "assistant") {
8427
+ if (T.role === "assistant") {
8450
8428
  const K = Q.filter((fe) => fe.type === "text" && fe.text), ye = [], ne = [];
8451
8429
  K.forEach((fe) => {
8452
8430
  const { citations: st, citationMap: Pe, groupedCitations: p, referencesText: g } = Ao(fe.text);
@@ -8457,17 +8435,17 @@ function $m({
8457
8435
  });
8458
8436
  }), je = Array.from(
8459
8437
  new Map(ne.map((fe) => [fe.url, fe])).values()
8460
- ).sort((fe, st) => (fe.numbers[0] || 0) - (st.numbers[0] || 0)), he = !(Le === "streaming" && S.id === De.at(-1)?.id);
8438
+ ).sort((fe, st) => (fe.numbers[0] || 0) - (st.numbers[0] || 0)), he = !(Le === "streaming" && T.id === De.at(-1)?.id);
8461
8439
  }
8462
8440
  return /* @__PURE__ */ h(
8463
8441
  "div",
8464
8442
  {
8465
- className: `${S.role === "user" ? "flex justify-end" : "w-full"}`,
8443
+ className: `${T.role === "user" ? "flex justify-end" : "w-full"}`,
8466
8444
  children: /* @__PURE__ */ h(
8467
8445
  "div",
8468
8446
  {
8469
- className: `${S.role === "user" ? "max-w-[85%] text-right" : "w-full"}`,
8470
- children: S.role === "user" ? /* @__PURE__ */ h(
8447
+ className: `${T.role === "user" ? "max-w-[85%] text-right" : "w-full"}`,
8448
+ children: T.role === "user" ? /* @__PURE__ */ h(
8471
8449
  dm,
8472
8450
  {
8473
8451
  initial: { opacity: 0, filter: "blur(4px)" },
@@ -8499,7 +8477,7 @@ function $m({
8499
8477
  if (zt.has(K.toolCallId))
8500
8478
  return;
8501
8479
  at((g) => new Set(g).add(K.toolCallId));
8502
- const p = Sn.get(ne);
8480
+ const p = Tn.get(ne);
8503
8481
  if (p)
8504
8482
  try {
8505
8483
  const g = await p(...Object.values(Pe));
@@ -8543,7 +8521,7 @@ function $m({
8543
8521
  }
8544
8522
  return null;
8545
8523
  }
8546
- if (K.type === "text" && K.text && xn) {
8524
+ if (K.type === "text" && K.text && vn) {
8547
8525
  const { processedText: ne } = Ao(K.text), Pe = !Q.slice(ye + 1).some((p) => p.type === "text" && p.text) && he && Z.size > 0;
8548
8526
  return /* @__PURE__ */ h(
8549
8527
  Am,
@@ -8553,41 +8531,41 @@ function $m({
8553
8531
  citationMap: Z,
8554
8532
  groupedCitations: Pe ? je : void 0,
8555
8533
  referencesText: Pe ? ie : void 0,
8556
- ResponseComponent: xn,
8534
+ ResponseComponent: vn,
8557
8535
  className: "text-sm prose prose-sm dark:prose-invert max-w-none",
8558
8536
  showCitations: j,
8559
8537
  showReferences: Pe
8560
8538
  },
8561
- `${S.id}-${ye}`
8539
+ `${T.id}-${ye}`
8562
8540
  );
8563
8541
  }
8564
- return K.type === "reasoning" && K.text ? /* @__PURE__ */ C(
8542
+ return K.type === "reasoning" && K.text ? /* @__PURE__ */ S(
8565
8543
  xl,
8566
8544
  {
8567
8545
  className: "w-full",
8568
- isStreaming: Le === "streaming" && ye === S.parts.length - 1 && S.id === De.at(-1)?.id,
8546
+ isStreaming: Le === "streaming" && ye === T.parts.length - 1 && T.id === De.at(-1)?.id,
8569
8547
  children: [
8570
8548
  /* @__PURE__ */ h(wl, {}),
8571
8549
  /* @__PURE__ */ h(Tl, { children: K.text })
8572
8550
  ]
8573
8551
  },
8574
- `${S.id}-${ye}`
8552
+ `${T.id}-${ye}`
8575
8553
  ) : null;
8576
8554
  }) })
8577
8555
  }
8578
8556
  )
8579
8557
  },
8580
- S.id
8558
+ T.id
8581
8559
  );
8582
8560
  }),
8583
8561
  /* @__PURE__ */ h("div", { ref: Xe })
8584
8562
  ] }) }),
8585
- Qn && /* @__PURE__ */ C("div", { className: "px-4 py-2 bg-destructive/10 text-destructive text-xs", children: [
8563
+ Zn && /* @__PURE__ */ S("div", { className: "px-4 py-2 bg-destructive/10 text-destructive text-xs", children: [
8586
8564
  "Error: ",
8587
- Qn.message
8565
+ Zn.message
8588
8566
  ] }),
8589
- /* @__PURE__ */ C("div", { className: "p-4 border-t border-border relative overflow-visible", children: [
8590
- /* @__PURE__ */ h(Dd, { mode: "wait", children: (Le === "streaming" || Le === "submitted") && /* @__PURE__ */ C(
8567
+ /* @__PURE__ */ S("div", { className: "p-4 border-t border-border relative overflow-visible", children: [
8568
+ /* @__PURE__ */ h(Dd, { mode: "wait", children: (Le === "streaming" || Le === "submitted") && /* @__PURE__ */ S(
8591
8569
  cs,
8592
8570
  {
8593
8571
  initial: { opacity: 0, filter: "blur(4px)", y: 5 },
@@ -8620,7 +8598,7 @@ function $m({
8620
8598
  ]
8621
8599
  }
8622
8600
  ) }),
8623
- /* @__PURE__ */ C("form", { onSubmit: Cn, className: "relative", children: [
8601
+ /* @__PURE__ */ S("form", { onSubmit: Pn, className: "relative", children: [
8624
8602
  /* @__PURE__ */ h(
8625
8603
  $o,
8626
8604
  {
@@ -8631,36 +8609,36 @@ function $m({
8631
8609
  className: "w-full pr-12 resize-none border border-border rounded-xl px-4 py-3",
8632
8610
  minHeight: 24,
8633
8611
  maxHeight: 200,
8634
- onKeyDown: (S) => {
8635
- S.key === "Enter" && !S.shiftKey && (S.preventDefault(), Cn(S));
8612
+ onKeyDown: (T) => {
8613
+ T.key === "Enter" && !T.shiftKey && (T.preventDefault(), Pn(T));
8636
8614
  }
8637
8615
  }
8638
8616
  ),
8639
- Le === "streaming" || Le === "submitted" ? /* @__PURE__ */ C(yt, { children: [
8617
+ Le === "streaming" || Le === "submitted" ? /* @__PURE__ */ S(yt, { children: [
8640
8618
  /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ h(
8641
8619
  "button",
8642
8620
  {
8643
8621
  type: "button",
8644
- className: se(Vt({ variant: "ghost", size: "icon" }), "absolute top-1/2 -translate-y-1/2 right-2 h-8 w-8"),
8622
+ className: se(Rt({ variant: "ghost", size: "icon" }), "absolute top-1/2 -translate-y-1/2 right-2 h-8 w-8"),
8645
8623
  onClick: Wt,
8646
8624
  children: /* @__PURE__ */ h(Jl, { className: "h-4 w-4" })
8647
8625
  }
8648
8626
  ) }),
8649
- /* @__PURE__ */ C(vt, { children: [
8627
+ /* @__PURE__ */ S(vt, { children: [
8650
8628
  /* @__PURE__ */ h(li, { children: "Escape" }),
8651
8629
  " to stop"
8652
8630
  ] })
8653
- ] }) : /* @__PURE__ */ C(yt, { children: [
8631
+ ] }) : /* @__PURE__ */ S(yt, { children: [
8654
8632
  /* @__PURE__ */ h(bt, { asChild: !0, children: /* @__PURE__ */ h(
8655
8633
  "button",
8656
8634
  {
8657
8635
  type: "submit",
8658
- className: se(Vt({ variant: "ghost", size: "icon" }), "absolute top-1/2 -translate-y-1/2 right-2 h-8 w-8"),
8636
+ className: se(Rt({ variant: "ghost", size: "icon" }), "absolute top-1/2 -translate-y-1/2 right-2 h-8 w-8"),
8659
8637
  disabled: !Mt.trim(),
8660
8638
  children: /* @__PURE__ */ h(Zl, { className: "h-4 w-4" })
8661
8639
  }
8662
8640
  ) }),
8663
- /* @__PURE__ */ C(vt, { children: [
8641
+ /* @__PURE__ */ S(vt, { children: [
8664
8642
  /* @__PURE__ */ h(li, { children: "Enter" }),
8665
8643
  " to send"
8666
8644
  ] })
@@ -8668,7 +8646,7 @@ function $m({
8668
8646
  ] })
8669
8647
  ] })
8670
8648
  ] }),
8671
- /* @__PURE__ */ C(
8649
+ /* @__PURE__ */ S(
8672
8650
  "a",
8673
8651
  {
8674
8652
  href: "https://arcten.com",
@@ -8684,7 +8662,7 @@ function $m({
8684
8662
  )
8685
8663
  ] })
8686
8664
  ] })
8687
- ] }) : /* @__PURE__ */ C("div", { className: "flex flex-col items-center justify-center gap-3 h-full cursor-pointer", children: [
8665
+ ] }) : /* @__PURE__ */ S("div", { className: "flex flex-col items-center justify-center gap-3 h-full cursor-pointer", children: [
8688
8666
  /* @__PURE__ */ h(Ql, { className: "h-5 w-5 text-stone-600 dark:text-stone-400" }),
8689
8667
  /* @__PURE__ */ h("span", { className: "text-xs font-medium text-stone-600 dark:text-stone-400 [writing-mode:vertical-lr]", children: "AI agent" })
8690
8668
  ] })