@factorialco/f0-react 3.2.5 → 3.2.6

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.
@@ -63,15 +63,15 @@ function ni(e, { defaultTransition: t = {}, ...o } = {}, n, s) {
63
63
  }
64
64
  let [v, w, k = {}] = C;
65
65
  k.at !== void 0 && (g = P1(g, k.at, f, u));
66
- let V = 0;
67
- const T = (E, y, L, H = 0, b = 0) => {
68
- const A = si(E), { delay: S = 0, times: R = io(A), type: $ = "keyframes", repeat: _, repeatType: z, repeatDelay: G = 0, ...re } = y;
69
- let { ease: K = t.ease || "easeOut", duration: O } = y;
70
- const Z = typeof S == "function" ? S(H, b) : S, D = A.length, Q = lo($) ? $ : s?.[$];
66
+ let T = 0;
67
+ const H = (R, L, b, A = 0, V = 0) => {
68
+ const y = si(R), { delay: E = 0, times: F = io(y), type: $ = "keyframes", repeat: _, repeatType: z, repeatDelay: G = 0, ...re } = L;
69
+ let { ease: K = t.ease || "easeOut", duration: O } = L;
70
+ const Z = typeof E == "function" ? E(A, V) : E, D = y.length, Q = lo($) ? $ : s?.[$];
71
71
  if (D <= 2 && Q) {
72
72
  let ie = 100;
73
- if (D === 2 && ci(A)) {
74
- const de = A[1] - A[0];
73
+ if (D === 2 && ci(y)) {
74
+ const de = y[1] - y[0];
75
75
  ie = Math.abs(de);
76
76
  }
77
77
  const oe = { ...re };
@@ -81,56 +81,56 @@ function ni(e, { defaultTransition: t = {}, ...o } = {}, n, s) {
81
81
  }
82
82
  O ?? (O = i);
83
83
  const W = g + Z;
84
- R.length === 1 && R[0] === 0 && (R[1] = 1);
85
- const he = R.length - A.length;
86
- if (he > 0 && co(R, he), A.length === 1 && A.unshift(null), _) {
84
+ F.length === 1 && F[0] === 0 && (F[1] = 1);
85
+ const he = F.length - y.length;
86
+ if (he > 0 && co(F, he), y.length === 1 && y.unshift(null), _) {
87
87
  kt(_ < oi, "Repeat count too high, must be less than 20"), O = Ys(O, _);
88
- const ie = [...A], oe = [...R];
88
+ const ie = [...y], oe = [...F];
89
89
  K = Array.isArray(K) ? [...K] : [K];
90
90
  const se = [...K];
91
91
  for (let de = 0; de < _; de++) {
92
- A.push(...ie);
92
+ y.push(...ie);
93
93
  for (let M = 0; M < ie.length; M++)
94
- R.push(oe[M] + (de + 1)), K.push(M === 0 ? "linear" : Jt(se, M - 1));
94
+ F.push(oe[M] + (de + 1)), K.push(M === 0 ? "linear" : Jt(se, M - 1));
95
95
  }
96
- ei(R, _);
96
+ ei(F, _);
97
97
  }
98
98
  const ge = W + O;
99
- Js(L, A, K, R, W, ge), V = Math.max(Z + O, V), m = Math.max(ge, m);
99
+ Js(b, y, K, F, W, ge), T = Math.max(Z + O, T), m = Math.max(ge, m);
100
100
  };
101
101
  if (xt(v)) {
102
- const E = j1(v, d);
103
- T(w, k, D1("default", E));
102
+ const R = j1(v, d);
103
+ H(w, k, D1("default", R));
104
104
  } else {
105
- const E = Qt(v, w, n, l), y = E.length;
106
- for (let L = 0; L < y; L++) {
105
+ const R = Qt(v, w, n, l), L = R.length;
106
+ for (let b = 0; b < L; b++) {
107
107
  w = w, k = k;
108
- const H = E[L], b = j1(H, d);
109
- for (const A in w)
110
- T(w[A], ii(k, A), D1(A, b), L, y);
108
+ const A = R[b], V = j1(A, d);
109
+ for (const y in w)
110
+ H(w[y], ii(k, y), D1(y, V), b, L);
111
111
  }
112
112
  }
113
- f = g, g += V;
113
+ f = g, g += T;
114
114
  }
115
115
  return d.forEach((h, C) => {
116
116
  for (const v in h) {
117
117
  const w = h[v];
118
118
  w.sort(ti);
119
- const k = [], V = [], T = [];
120
- for (let y = 0; y < w.length; y++) {
121
- const { at: L, value: H, easing: b } = w[y];
122
- k.push(H), V.push(uo(0, m, L)), T.push(b || "easeOut");
119
+ const k = [], T = [], H = [];
120
+ for (let L = 0; L < w.length; L++) {
121
+ const { at: b, value: A, easing: V } = w[L];
122
+ k.push(A), T.push(uo(0, m, b)), H.push(V || "easeOut");
123
123
  }
124
- V[0] !== 0 && (V.unshift(0), k.unshift(k[0]), T.unshift(ri)), V[V.length - 1] !== 1 && (V.push(1), k.push(null)), a.has(C) || a.set(C, {
124
+ T[0] !== 0 && (T.unshift(0), k.unshift(k[0]), H.unshift(ri)), T[T.length - 1] !== 1 && (T.push(1), k.push(null)), a.has(C) || a.set(C, {
125
125
  keyframes: {},
126
126
  transition: {}
127
127
  });
128
- const E = a.get(C);
129
- E.keyframes[v] = k, E.transition[v] = {
128
+ const R = a.get(C);
129
+ R.keyframes[v] = k, R.transition[v] = {
130
130
  ...t,
131
131
  duration: m,
132
- ease: T,
133
- times: V,
132
+ ease: H,
133
+ times: T,
134
134
  ...o
135
135
  };
136
136
  }
@@ -7140,19 +7140,19 @@ const Jl = Fe({
7140
7140
  marginX: v,
7141
7141
  marginY: w,
7142
7142
  marginTop: k,
7143
- marginBottom: V,
7144
- marginLeft: T,
7145
- marginRight: E,
7143
+ marginBottom: T,
7144
+ marginLeft: H,
7145
+ marginRight: R,
7146
7146
  // Gap
7147
- gap: y,
7147
+ gap: L,
7148
7148
  // Grid
7149
- columns: L,
7150
- rows: H,
7151
- colSpan: b,
7152
- colStart: A,
7153
- rowSpan: S,
7149
+ columns: b,
7150
+ rows: A,
7151
+ colSpan: V,
7152
+ colStart: y,
7153
+ rowSpan: E,
7154
7154
  // Dimensions
7155
- width: R,
7155
+ width: F,
7156
7156
  height: $,
7157
7157
  minWidth: _,
7158
7158
  minHeight: z,
@@ -7174,8 +7174,8 @@ const Jl = Fe({
7174
7174
  borderRadiusBottomRight: de,
7175
7175
  borderStyle: M,
7176
7176
  // Overflow
7177
- overflow: N,
7178
- overflowX: F,
7177
+ overflow: S,
7178
+ overflowX: N,
7179
7179
  overflowY: j,
7180
7180
  // Divider
7181
7181
  divider: B,
@@ -7224,16 +7224,16 @@ const Jl = Fe({
7224
7224
  marginX: v,
7225
7225
  marginY: w,
7226
7226
  marginTop: k,
7227
- marginBottom: V,
7228
- marginLeft: T,
7229
- marginRight: E,
7230
- gap: y,
7231
- columns: L,
7232
- rows: H,
7233
- colSpan: b,
7234
- colStart: A,
7235
- rowSpan: S,
7236
- width: R,
7227
+ marginBottom: T,
7228
+ marginLeft: H,
7229
+ marginRight: R,
7230
+ gap: L,
7231
+ columns: b,
7232
+ rows: A,
7233
+ colSpan: V,
7234
+ colStart: y,
7235
+ rowSpan: E,
7236
+ width: F,
7237
7237
  height: $,
7238
7238
  minWidth: _,
7239
7239
  minHeight: z,
@@ -7252,8 +7252,8 @@ const Jl = Fe({
7252
7252
  borderRadiusBottomLeft: se,
7253
7253
  borderRadiusBottomRight: de,
7254
7254
  borderStyle: M,
7255
- overflow: N,
7256
- overflowX: F,
7255
+ overflow: S,
7256
+ overflowX: N,
7257
7257
  overflowY: j,
7258
7258
  divider: B,
7259
7259
  dividerColor: U,
@@ -7405,40 +7405,47 @@ function Z1({
7405
7405
  stack: a = "none",
7406
7406
  fullWidthOnStack: d = !1,
7407
7407
  reverseOnStack: l = !1,
7408
- className: u
7408
+ canOverflow: u = !0,
7409
+ className: f
7409
7410
  }) {
7410
- const f = I(null), { width: g = 0 } = ss({
7411
- ref: f,
7411
+ const g = I(null), { width: m = 0 } = ss({
7412
+ ref: g,
7412
7413
  box: "border-box"
7413
- }), m = a === "sm" || a === "md" ? c1[a] : c1.md, h = It(`(min-width: ${m}px)`, {
7414
+ }), h = a === "sm" || a === "md" ? c1[a] : c1.md, C = It(`(min-width: ${h}px)`, {
7414
7415
  initializeWithValue: !1
7415
- }), C = a === "none" ? !0 : a === "container-md" ? g >= c1["container-md"] : h, v = typeof n == "string" ? n : n.base, w = typeof n == "string" ? n : n.md, k = C ? w : v, V = Array.isArray(
7416
+ }), v = a === "none" ? !0 : a === "container-md" ? m >= c1["container-md"] : C, w = typeof n == "string" ? n : n.base, k = typeof n == "string" ? n : n.md, T = v ? k : w, H = Array.isArray(
7416
7417
  t
7417
- ) ? t : [], T = t != null && !Array.isArray(t) ? t : void 0, E = {
7418
+ ) ? t : [], R = t != null && !Array.isArray(t) ? t : void 0, L = {
7418
7419
  primaryAction: e,
7419
- secondaryItems: V,
7420
- secondaryLink: T,
7420
+ secondaryItems: H,
7421
+ secondaryLink: R,
7421
7422
  otherActions: o,
7422
- size: k,
7423
+ size: T,
7423
7424
  gap: s,
7424
- align: i
7425
+ align: i,
7426
+ canOverflow: u
7425
7427
  };
7426
7428
  return /* @__PURE__ */ r(
7427
7429
  "div",
7428
7430
  {
7429
- ref: f,
7431
+ ref: g,
7430
7432
  role: "group",
7431
7433
  className: x(
7432
- C ? "flex w-full items-center" : t2({
7434
+ v ? (
7435
+ // Keep the pinned trailing items (splits, divider, primary) at their
7436
+ // natural width; only the first child — the flex-1 cluster — shrinks,
7437
+ // so the title truncates against it rather than squeezing the buttons.
7438
+ "flex w-full items-center [&>*:not(:first-child)]:shrink-0"
7439
+ ) : t2({
7433
7440
  align: i,
7434
7441
  stack: a,
7435
7442
  fullWidthOnStack: d,
7436
7443
  reverseOnStack: l
7437
7444
  }),
7438
- u
7445
+ f
7439
7446
  ),
7440
7447
  style: { gap: s },
7441
- children: C ? /* @__PURE__ */ r(n2, { ...E }, "row") : /* @__PURE__ */ r(o2, { ...E }, "stacked")
7448
+ children: v ? /* @__PURE__ */ r(n2, { ...L }, "row") : /* @__PURE__ */ r(o2, { ...L }, "stacked")
7442
7449
  }
7443
7450
  );
7444
7451
  }
@@ -7468,86 +7475,90 @@ function n2({
7468
7475
  otherActions: n,
7469
7476
  size: s,
7470
7477
  gap: i,
7471
- align: a
7478
+ align: a,
7479
+ canOverflow: d
7472
7480
  }) {
7473
- const d = ee(
7481
+ const l = ee(
7474
7482
  () => t.filter(r2),
7475
7483
  [t]
7476
7484
  ), {
7477
- containerRef: l,
7478
- measurementContainerRef: u,
7479
- customOverflowIndicatorRef: f,
7480
- visibleItems: g,
7481
- overflowItems: m,
7482
- isInitialized: h
7483
- } = is(d, i);
7485
+ containerRef: u,
7486
+ measurementContainerRef: f,
7487
+ customOverflowIndicatorRef: g,
7488
+ visibleItems: m,
7489
+ overflowItems: h,
7490
+ isInitialized: C
7491
+ } = is(l, i);
7484
7492
  X(() => {
7485
- u.current?.setAttribute("inert", "");
7486
- }, [u]);
7487
- const C = h ? g : d, v = h ? m : [], w = new Set(C.map((b) => b.id)), k = e ? yr(e, s) : null, V = t.filter(qe), T = t[t.length - 1], E = T != null && g1(T) && (V.length > 0 || k != null), y = [];
7488
- t.forEach((b, A) => {
7489
- if (!qe(b)) {
7490
- if (g1(b)) {
7491
- y.push({ kind: "sep", key: `sep-${A}` });
7493
+ f.current?.setAttribute("inert", "");
7494
+ }, [f]);
7495
+ const v = d && C ? m : l, w = d ? C ? h : [] : [], k = new Set(v.map((y) => y.id)), T = e ? yr(e, s) : null, H = t.filter(qe), R = t[t.length - 1], L = R != null && g1(R) && (H.length > 0 || T != null), b = [];
7496
+ t.forEach((y, E) => {
7497
+ if (!qe(y)) {
7498
+ if (g1(y)) {
7499
+ b.push({ kind: "sep", key: `sep-${E}` });
7492
7500
  return;
7493
7501
  }
7494
- w.has(b.id) && y.push({
7502
+ k.has(y.id) && b.push({
7495
7503
  kind: "node",
7496
- node: Xe(b, s, "outline")
7504
+ node: Xe(y, s, "outline")
7497
7505
  });
7498
7506
  }
7499
7507
  });
7500
- const L = y.filter(
7501
- (b, A) => b.kind === "node" || y[A - 1]?.kind === "node" && y[A + 1]?.kind === "node"
7502
- ), H = [
7503
- ...v.map(
7504
- (b) => ({
7505
- label: b.label,
7506
- icon: b.icon,
7507
- onClick: b.onClick,
7508
- href: b.href,
7509
- critical: b.critical
7508
+ const A = b.filter(
7509
+ (y, E) => y.kind === "node" || b[E - 1]?.kind === "node" && b[E + 1]?.kind === "node"
7510
+ ), V = [
7511
+ ...w.map(
7512
+ (y) => ({
7513
+ label: y.label,
7514
+ icon: y.icon,
7515
+ onClick: y.onClick,
7516
+ href: y.href,
7517
+ critical: y.critical
7510
7518
  })
7511
7519
  ),
7512
- ...v.length > 0 && n.length > 0 ? [{ type: "separator" }] : [],
7520
+ ...w.length > 0 && n.length > 0 ? [{ type: "separator" }] : [],
7513
7521
  ...n
7514
7522
  ];
7515
7523
  return /* @__PURE__ */ c(xe, { children: [
7516
7524
  /* @__PURE__ */ c(
7517
7525
  "div",
7518
7526
  {
7519
- ref: l,
7527
+ ref: u,
7520
7528
  className: x(
7521
- "relative flex min-w-0 flex-1 items-center",
7529
+ // `[&>*]:shrink-0` keeps each rendered secondary, separator, link and
7530
+ // the "⋯" trigger at its natural width: the row overflows by shedding
7531
+ // into the menu, never by squeezing a button to nothing.
7532
+ "relative flex min-w-0 flex-1 items-center [&>*]:shrink-0",
7522
7533
  a === "end" && "justify-end"
7523
7534
  ),
7524
7535
  style: { gap: i },
7525
7536
  children: [
7526
- /* @__PURE__ */ r(
7537
+ d && /* @__PURE__ */ r(
7527
7538
  "div",
7528
7539
  {
7529
- ref: u,
7540
+ ref: f,
7530
7541
  "aria-hidden": "true",
7531
7542
  className: "pointer-events-none invisible absolute left-0 top-0 flex items-center whitespace-nowrap",
7532
7543
  style: { gap: i },
7533
- children: d.map(
7534
- (b) => Xe(b, s, "outline")
7544
+ children: l.map(
7545
+ (y) => Xe(y, s, "outline")
7535
7546
  )
7536
7547
  }
7537
7548
  ),
7538
- H.length > 0 && /* @__PURE__ */ r("div", { ref: f, children: /* @__PURE__ */ r(Qe, { items: H, icon: Rt, size: s }) }),
7539
- L.map(
7540
- (b) => b.kind === "sep" ? /* @__PURE__ */ r(_1, {}, b.key) : b.node
7549
+ V.length > 0 && /* @__PURE__ */ r("div", { ref: g, children: /* @__PURE__ */ r(Qe, { items: V, icon: Rt, size: s }) }),
7550
+ A.map(
7551
+ (y) => y.kind === "sep" ? /* @__PURE__ */ r(_1, {}, y.key) : y.node
7541
7552
  ),
7542
7553
  o && Lr(o, s)
7543
7554
  ]
7544
7555
  }
7545
7556
  ),
7546
- V.map(
7547
- (b) => F1(b, s, "outline")
7557
+ H.map(
7558
+ (y) => F1(y, s, "outline")
7548
7559
  ),
7549
- E && /* @__PURE__ */ r(_1, {}),
7550
- k
7560
+ L && /* @__PURE__ */ r(_1, {}),
7561
+ T
7551
7562
  ] });
7552
7563
  }
7553
7564
  function _1() {
@@ -7638,7 +7649,7 @@ function d2({
7638
7649
  hideLabel: w,
7639
7650
  disabled: s.disabled,
7640
7651
  onClick: s.onClick
7641
- } : void 0, V = n ? {
7652
+ } : void 0, T = n ? {
7642
7653
  id: "confirm",
7643
7654
  icon: C1,
7644
7655
  label: n.label ?? "Confirm",
@@ -7649,10 +7660,11 @@ function d2({
7649
7660
  return /* @__PURE__ */ r(
7650
7661
  Z1,
7651
7662
  {
7652
- primaryAction: V,
7663
+ primaryAction: T,
7653
7664
  secondaryActions: k ? [k] : void 0,
7654
7665
  size: l,
7655
- gap: O1
7666
+ gap: O1,
7667
+ canOverflow: !1
7656
7668
  }
7657
7669
  );
7658
7670
  }, v = (
@@ -8198,23 +8210,23 @@ const w2 = ({
8198
8210
  }
8199
8211
  if (s)
8200
8212
  return f(!1), a(C), v(), g.current = setTimeout(() => {
8201
- const y = (d + 1) % Math.max(e.length, 1);
8202
- l(y);
8213
+ const L = (d + 1) % Math.max(e.length, 1);
8214
+ l(L);
8203
8215
  }, 4e3), () => {
8204
8216
  v();
8205
8217
  };
8206
8218
  f(!0), a("");
8207
8219
  let w = 0;
8208
- const k = 50, V = 30, T = 2e3, E = 1e3;
8220
+ const k = 50, T = 30, H = 2e3, R = 1e3;
8209
8221
  return m.current = setInterval(() => {
8210
8222
  w < C.length ? (a(C.slice(0, w + 1)), w++) : (m.current && (clearInterval(m.current), m.current = null), g.current = setTimeout(() => {
8211
8223
  h.current = setInterval(() => {
8212
8224
  w > 0 ? (w--, a(C.slice(0, w))) : (h.current && (clearInterval(h.current), h.current = null), g.current = setTimeout(() => {
8213
- const y = (d + 1) % Math.max(e.length, 1);
8214
- l(y);
8215
- }, E));
8216
- }, V);
8217
- }, T));
8225
+ const L = (d + 1) % Math.max(e.length, 1);
8226
+ l(L);
8227
+ }, R));
8228
+ }, T);
8229
+ }, H));
8218
8230
  }, k), () => {
8219
8231
  v();
8220
8232
  };
@@ -8507,8 +8519,8 @@ function N2(e) {
8507
8519
  X(() => {
8508
8520
  h.current = t.length;
8509
8521
  }, [t]);
8510
- const C = q((T) => {
8511
- i.current && clearTimeout(i.current), s(T), i.current = setTimeout(() => {
8522
+ const C = q((H) => {
8523
+ i.current && clearTimeout(i.current), s(H), i.current = setTimeout(() => {
8512
8524
  s(null), i.current = null;
8513
8525
  }, F2);
8514
8526
  }, []);
@@ -8519,11 +8531,11 @@ function N2(e) {
8519
8531
  []
8520
8532
  );
8521
8533
  const v = q(
8522
- async (T) => {
8523
- if (T.length === 0 || !l) return;
8524
- const E = R2(T, u);
8525
- if (E.length === 0) return;
8526
- if (f !== void 0 && h.current + E.length > f) {
8534
+ async (H) => {
8535
+ if (H.length === 0 || !l) return;
8536
+ const R = R2(H, u);
8537
+ if (R.length === 0) return;
8538
+ if (f !== void 0 && h.current + R.length > f) {
8527
8539
  C(
8528
8540
  d.ai.tooManyFilesError.replace(
8529
8541
  "{{maxFiles}}",
@@ -8532,40 +8544,40 @@ function N2(e) {
8532
8544
  );
8533
8545
  return;
8534
8546
  }
8535
- const y = E.map((b) => ({
8547
+ const L = R.map((V) => ({
8536
8548
  id: crypto.randomUUID(),
8537
- file: b,
8549
+ file: V,
8538
8550
  status: "uploading"
8539
- })), L = y.map((b) => b.id);
8540
- o((b) => [...b, ...y]);
8541
- const H = (b) => o(
8542
- (A) => A.map(
8543
- (S) => L.includes(S.id) ? { ...S, status: "error", errorMessage: b } : S
8551
+ })), b = L.map((V) => V.id);
8552
+ o((V) => [...V, ...L]);
8553
+ const A = (V) => o(
8554
+ (y) => y.map(
8555
+ (E) => b.includes(E.id) ? { ...E, status: "error", errorMessage: V } : E
8544
8556
  )
8545
8557
  );
8546
8558
  try {
8547
- const b = await l(E);
8548
- if (!Array.isArray(b) || b.length !== E.length) {
8549
- H(d.ai.fileUploadError);
8559
+ const V = await l(R);
8560
+ if (!Array.isArray(V) || V.length !== R.length) {
8561
+ A(d.ai.fileUploadError);
8550
8562
  return;
8551
8563
  }
8552
8564
  o(
8553
- (A) => A.map((S) => {
8554
- const R = y.findIndex(($) => $.id === S.id);
8555
- return R === -1 ? S : b[R] ? {
8556
- ...S,
8565
+ (y) => y.map((E) => {
8566
+ const F = L.findIndex(($) => $.id === E.id);
8567
+ return F === -1 ? E : V[F] ? {
8568
+ ...E,
8557
8569
  status: "uploaded",
8558
- uploadedFile: b[R]
8570
+ uploadedFile: V[F]
8559
8571
  } : {
8560
- ...S,
8572
+ ...E,
8561
8573
  status: "error",
8562
8574
  errorMessage: d.ai.fileUploadError
8563
8575
  };
8564
8576
  })
8565
8577
  );
8566
- } catch (b) {
8567
- const A = b instanceof Error && b.message ? b.message : d.ai.fileUploadError;
8568
- H(A);
8578
+ } catch (V) {
8579
+ const y = V instanceof Error && V.message ? V.message : d.ai.fileUploadError;
8580
+ A(y);
8569
8581
  }
8570
8582
  },
8571
8583
  [
@@ -8577,13 +8589,13 @@ function N2(e) {
8577
8589
  C
8578
8590
  ]
8579
8591
  ), w = q(
8580
- async (T) => {
8581
- await v(Array.from(T.target.files ?? [])), T.target.value = "";
8592
+ async (H) => {
8593
+ await v(Array.from(H.target.files ?? [])), H.target.value = "";
8582
8594
  },
8583
8595
  [v]
8584
- ), k = q((T) => {
8585
- o((E) => E.filter((y) => y.id !== T));
8586
- }, []), V = q(() => {
8596
+ ), k = q((H) => {
8597
+ o((R) => R.filter((L) => L.id !== H));
8598
+ }, []), T = q(() => {
8587
8599
  o([]);
8588
8600
  }, []);
8589
8601
  return {
@@ -8596,7 +8608,7 @@ function N2(e) {
8596
8608
  processFiles: v,
8597
8609
  handleFileSelect: w,
8598
8610
  handleRemoveFile: k,
8599
- clearFiles: V,
8611
+ clearFiles: T,
8600
8612
  transientError: n,
8601
8613
  showTransientError: C
8602
8614
  };
@@ -8679,57 +8691,57 @@ function A2({
8679
8691
  searchPersons: n,
8680
8692
  textareaRef: s
8681
8693
  }) {
8682
- const [i, a] = P(!1), [d, l] = P(""), [u, f] = P([]), [g, m] = P(!1), [h, C] = P(0), [v, w] = P([]), k = I(-1), V = I(null), T = I(0), E = I(-1);
8694
+ const [i, a] = P(!1), [d, l] = P(""), [u, f] = P([]), [g, m] = P(!1), [h, C] = P(0), [v, w] = P([]), k = I(-1), T = I(null), H = I(0), R = I(-1);
8683
8695
  X(() => {
8684
8696
  if (!n) {
8685
8697
  a(!1);
8686
8698
  return;
8687
8699
  }
8688
- const R = S2(e, o, v);
8689
- if (!R) {
8690
- a(!1), l(""), f([]), C(0), k.current = -1, E.current = -1;
8700
+ const F = S2(e, o, v);
8701
+ if (!F) {
8702
+ a(!1), l(""), f([]), C(0), k.current = -1, R.current = -1;
8691
8703
  return;
8692
8704
  }
8693
- if (R.atIndex === E.current)
8705
+ if (F.atIndex === R.current)
8694
8706
  return;
8695
- k.current = R.atIndex, l(R.query), a(!0), C(0), m(!0), V.current && clearTimeout(V.current);
8696
- const $ = ++T.current;
8697
- return V.current = setTimeout(() => {
8698
- n(R.query).then((_) => {
8699
- $ === T.current && (f(_), C(0), _.length === 0 && R.query.length > 0 && (E.current = R.atIndex, a(!1)));
8707
+ k.current = F.atIndex, l(F.query), a(!0), C(0), m(!0), T.current && clearTimeout(T.current);
8708
+ const $ = ++H.current;
8709
+ return T.current = setTimeout(() => {
8710
+ n(F.query).then((_) => {
8711
+ $ === H.current && (f(_), C(0), _.length === 0 && F.query.length > 0 && (R.current = F.atIndex, a(!1)));
8700
8712
  }).catch(() => {
8701
- $ === T.current && f([]);
8713
+ $ === H.current && f([]);
8702
8714
  }).finally(() => {
8703
- $ === T.current && m(!1);
8715
+ $ === H.current && m(!1);
8704
8716
  });
8705
8717
  }, H2), () => {
8706
- V.current && clearTimeout(V.current);
8718
+ T.current && clearTimeout(T.current);
8707
8719
  };
8708
8720
  }, [e, o, n, v]);
8709
- const y = q(() => {
8721
+ const L = q(() => {
8710
8722
  a(!1), l(""), f([]), C(0), k.current = -1;
8711
- }, []), L = q(
8712
- (R) => {
8723
+ }, []), b = q(
8724
+ (F) => {
8713
8725
  const $ = k.current;
8714
8726
  if ($ === -1) return;
8715
- const _ = `${R.firstName} ${R.lastName}`.trim(), z = String(R.id), G = e.slice(0, $), re = e.slice(o), K = `@${_} `, O = G + K + re, Z = G.length + K.length;
8716
- t(O), w((D) => [...D.filter((W) => !(W.id === z && W.name === _)), { id: z, name: _ }]), y(), requestAnimationFrame(() => {
8727
+ const _ = `${F.firstName} ${F.lastName}`.trim(), z = String(F.id), G = e.slice(0, $), re = e.slice(o), K = `@${_} `, O = G + K + re, Z = G.length + K.length;
8728
+ t(O), w((D) => [...D.filter((W) => !(W.id === z && W.name === _)), { id: z, name: _ }]), L(), requestAnimationFrame(() => {
8717
8729
  const D = s.current;
8718
8730
  D && (D.focus(), D.setSelectionRange(Z, Z));
8719
8731
  });
8720
8732
  },
8721
- [e, o, t, s, y]
8722
- ), H = q(
8723
- (R) => {
8733
+ [e, o, t, s, L]
8734
+ ), A = q(
8735
+ (F) => {
8724
8736
  if (!i) return !1;
8725
- if (R.key === "Escape")
8726
- return R.preventDefault(), y(), !0;
8737
+ if (F.key === "Escape")
8738
+ return F.preventDefault(), L(), !0;
8727
8739
  if (u.length === 0) return !1;
8728
- switch (R.key) {
8740
+ switch (F.key) {
8729
8741
  case "ArrowDown":
8730
- return R.preventDefault(), C(($) => ($ + 1) % u.length), !0;
8742
+ return F.preventDefault(), C(($) => ($ + 1) % u.length), !0;
8731
8743
  case "ArrowUp":
8732
- return R.preventDefault(), C(
8744
+ return F.preventDefault(), C(
8733
8745
  ($) => ($ + u.length - 1) % u.length
8734
8746
  ), !0;
8735
8747
  case "Tab": {
@@ -8737,21 +8749,21 @@ function A2({
8737
8749
  if ($) {
8738
8750
  const _ = `${$.firstName} ${$.lastName}`.trim();
8739
8751
  if (d.length === 0 || _.toLowerCase().startsWith(d.toLowerCase()))
8740
- return R.preventDefault(), L($), !0;
8752
+ return F.preventDefault(), b($), !0;
8741
8753
  }
8742
8754
  return !1;
8743
8755
  }
8744
8756
  case "Enter":
8745
- return R.preventDefault(), u[h] && L(u[h]), !0;
8757
+ return F.preventDefault(), u[h] && b(u[h]), !0;
8746
8758
  default:
8747
8759
  return !1;
8748
8760
  }
8749
8761
  },
8750
- [i, u, h, d, L, y]
8751
- ), b = q(
8752
- (R) => {
8753
- if (v.length === 0) return R;
8754
- let $ = R;
8762
+ [i, u, h, d, b, L]
8763
+ ), V = q(
8764
+ (F) => {
8765
+ if (v.length === 0) return F;
8766
+ let $ = F;
8755
8767
  const _ = [...v].sort((z, G) => G.name.length - z.name.length);
8756
8768
  for (const z of _) {
8757
8769
  const G = `@${z.name}`, re = `<entity-ref type="person" id="${U1(z.id)}">${U1(z.name)}</entity-ref>`;
@@ -8764,7 +8776,7 @@ function A2({
8764
8776
  );
8765
8777
  X(() => {
8766
8778
  w(
8767
- (R) => R.filter(($) => {
8779
+ (F) => F.filter(($) => {
8768
8780
  const _ = `@${$.name}`, z = e.indexOf(_);
8769
8781
  if (z === -1) return !1;
8770
8782
  const G = e[z + _.length];
@@ -8773,17 +8785,17 @@ function A2({
8773
8785
  })
8774
8786
  );
8775
8787
  }, [e]);
8776
- const A = ee(() => {
8788
+ const y = ee(() => {
8777
8789
  if (!i || k.current === -1) return null;
8778
- const R = s.current;
8779
- if (!R) return null;
8780
- const $ = T2(R, k.current), _ = R.offsetLeft + $.left, G = (R.offsetParent ? R.offsetParent.offsetHeight : 0) - (R.offsetTop + $.top);
8790
+ const F = s.current;
8791
+ if (!F) return null;
8792
+ const $ = T2(F, k.current), _ = F.offsetLeft + $.left, G = (F.offsetParent ? F.offsetParent.offsetHeight : 0) - (F.offsetTop + $.top);
8781
8793
  return { left: _, bottom: G };
8782
- }, [i, e, o, s]), S = ee(() => {
8794
+ }, [i, e, o, s]), E = ee(() => {
8783
8795
  if (!i || u.length === 0) return null;
8784
- const R = u[h];
8785
- if (!R) return null;
8786
- const $ = `${R.firstName} ${R.lastName}`.trim();
8796
+ const F = u[h];
8797
+ if (!F) return null;
8798
+ const $ = `${F.firstName} ${F.lastName}`.trim();
8787
8799
  return d.length === 0 ? $ : $.toLowerCase().startsWith(d.toLowerCase()) ? $.slice(d.length) : null;
8788
8800
  }, [i, u, h, d]);
8789
8801
  return {
@@ -8793,12 +8805,12 @@ function A2({
8793
8805
  isLoading: g,
8794
8806
  selectedIndex: h,
8795
8807
  mentions: v,
8796
- popoverPosition: A,
8797
- inlineCompletion: S,
8798
- handleKeyDown: H,
8799
- selectPerson: L,
8800
- transformMentions: b,
8801
- close: y
8808
+ popoverPosition: y,
8809
+ inlineCompletion: E,
8810
+ handleKeyDown: A,
8811
+ selectPerson: b,
8812
+ transformMentions: V,
8813
+ close: L
8802
8814
  };
8803
8815
  }
8804
8816
  const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>[\s\S]*?<\/entity-ref>)/g).map((t, o) => o % 2 === 1 ? t : t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(B2, "\\$&")).join(""), d9 = ({
@@ -8820,20 +8832,20 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
8820
8832
  disclaimer: v,
8821
8833
  footer: w,
8822
8834
  isWelcomeScreen: k = !1,
8823
- fullscreen: V = !1,
8824
- welcomeScreenSuggestions: T,
8825
- onSuggestionClick: E,
8826
- ref: y
8835
+ fullscreen: T = !1,
8836
+ welcomeScreenSuggestions: H,
8837
+ onSuggestionClick: R,
8838
+ ref: L
8827
8839
  }) => {
8828
- const L = Y(), H = ye(), [b, A] = P(""), [S, R] = P(0), [$, _] = P(!1), [z, G] = P(!1), [re, K] = P(null), O = I(null), Z = I(null), D = I(null), Q = a != null, { tracking: W } = Me(), he = q(
8840
+ const b = Y(), A = ye(), [V, y] = P(""), [E, F] = P(0), [$, _] = P(!1), [z, G] = P(!1), [re, K] = P(null), O = I(null), Z = I(null), D = I(null), Q = a != null, { tracking: W } = Me(), he = q(
8829
8841
  (te, ke) => {
8830
8842
  W?.onWelcomeSuggestionClick?.({
8831
8843
  item: te,
8832
8844
  group: ke,
8833
8845
  prompt: te.prompt || te.title
8834
- }), E?.(te, ke);
8846
+ }), R?.(te, ke);
8835
8847
  },
8836
- [W, E]
8848
+ [W, R]
8837
8849
  ), {
8838
8850
  attachedFiles: ge,
8839
8851
  fileInputRef: ie,
@@ -8841,25 +8853,25 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
8841
8853
  acceptValue: se,
8842
8854
  isAtMaxFiles: de,
8843
8855
  maxFiles: M,
8844
- processFiles: N,
8845
- handleFileSelect: F,
8856
+ processFiles: S,
8857
+ handleFileSelect: N,
8846
8858
  handleRemoveFile: j,
8847
8859
  clearFiles: B,
8848
8860
  transientError: U,
8849
8861
  showTransientError: ae
8850
8862
  } = N2(g), J = A2({
8851
- inputValue: b,
8852
- setInputValue: A,
8853
- cursorPosition: S,
8863
+ inputValue: V,
8864
+ setInputValue: y,
8865
+ cursorPosition: E,
8854
8866
  searchPersons: h,
8855
8867
  textareaRef: Z
8856
8868
  }), we = I(""), Ee = q((te) => {
8857
8869
  const ke = we.current, i1 = ke && !/\s$/.test(ke) ? " " : "", Ue = `${ke}${i1}${te}`;
8858
- A(Ue), R(Ue.length);
8870
+ y(Ue), F(Ue.length);
8859
8871
  }, []), Te = {
8860
- "permission-denied": L.ai.micPermissionDenied,
8861
- "device-error": L.ai.micError,
8862
- "transcription-failed": L.ai.transcriptionError
8872
+ "permission-denied": b.ai.micPermissionDenied,
8873
+ "device-error": b.ai.micError,
8874
+ "transcription-failed": b.ai.transcriptionError
8863
8875
  }, Ce = ms({
8864
8876
  onTranscribe: m,
8865
8877
  onPartial: Ee,
@@ -8868,8 +8880,8 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
8868
8880
  },
8869
8881
  onError: (te) => ae(Te[te])
8870
8882
  }), Je = !!m && Ce.isSupported, e1 = q(() => {
8871
- W?.onDictationStart?.(), we.current = b, Ce.start();
8872
- }, [b, Ce, W]), t1 = q(() => {
8883
+ W?.onDictationStart?.(), we.current = V, Ce.start();
8884
+ }, [V, Ce, W]), t1 = q(() => {
8873
8885
  W?.onDictationCancel?.(), Ce.cancel();
8874
8886
  }, [Ce, W]);
8875
8887
  X(() => {
@@ -8877,16 +8889,16 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
8877
8889
  }, []), X(() => {
8878
8890
  if (C)
8879
8891
  return C((te) => {
8880
- N(te);
8892
+ S(te);
8881
8893
  }), () => {
8882
8894
  C(null);
8883
8895
  };
8884
- }, [C, N]);
8885
- const je = Ce.status === "recording", r1 = je ? L.ai.listening : L.ai.inputPlaceholder, o1 = ge.filter((te) => te.status === "uploaded"), Se = ge.some((te) => te.status === "uploading"), He = ge.some((te) => te.status === "error"), De = b.trim().length > 0;
8896
+ }, [C, S]);
8897
+ const je = Ce.status === "recording", r1 = je ? b.ai.listening : b.ai.inputPlaceholder, o1 = ge.filter((te) => te.status === "uploaded"), Se = ge.some((te) => te.status === "uploading"), He = ge.some((te) => te.status === "error"), De = V.trim().length > 0;
8886
8898
  X(() => {
8887
8899
  if (!(!z || Se)) {
8888
8900
  if (G(!1), He) {
8889
- ae(L.ai.fileUploadBlockedSubmit);
8901
+ ae(b.ai.fileUploadBlockedSubmit);
8890
8902
  return;
8891
8903
  }
8892
8904
  O.current?.requestSubmit();
@@ -8896,7 +8908,7 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
8896
8908
  Se,
8897
8909
  He,
8898
8910
  ae,
8899
- L.ai.fileUploadBlockedSubmit
8911
+ b.ai.fileUploadBlockedSubmit
8900
8912
  ]);
8901
8913
  const n1 = async (te) => {
8902
8914
  if (te.preventDefault(), !Q) {
@@ -8918,7 +8930,7 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
8918
8930
  _(!1);
8919
8931
  }
8920
8932
  }
8921
- const ke = J.transformMentions(b.trim()), i1 = $2(ke), Ue = o1.flatMap(
8933
+ const ke = J.transformMentions(V.trim()), i1 = $2(ke), Ue = o1.flatMap(
8922
8934
  (B1) => B1.uploadedFile ? [B1.uploadedFile] : []
8923
8935
  ), H1 = d, A1 = u;
8924
8936
  H1 && l?.(null), A1 && f?.(null), await e({
@@ -8926,28 +8938,28 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
8926
8938
  files: Ue,
8927
8939
  context: H1,
8928
8940
  quote: A1
8929
- }), A(""), B();
8941
+ }), y(""), B();
8930
8942
  }
8931
8943
  Z.current?.focus();
8932
8944
  }
8933
8945
  }, s1 = (te) => {
8934
8946
  Q || J.handleKeyDown(te) || te.key === "Enter" && !te.shiftKey && (te.preventDefault(), o || O.current?.requestSubmit());
8935
8947
  }, Ze = () => {
8936
- R(Z.current?.selectionStart ?? 0);
8948
+ F(Z.current?.selectionStart ?? 0);
8937
8949
  }, _e = () => {
8938
8950
  D.current && Z.current && (D.current.scrollTop = Z.current.scrollTop);
8939
- }, S1 = re ? re.prompt ?? re.title : null, V1 = je ? [L.ai.listening] : S1 ? [S1] : s ?? [], Kr = V1.length > 1, Qr = ee(() => M2(b, J.mentions, {
8940
- cursorPosition: S,
8951
+ }, S1 = re ? re.prompt ?? re.title : null, V1 = je ? [b.ai.listening] : S1 ? [S1] : s ?? [], Kr = V1.length > 1, Qr = ee(() => M2(V, J.mentions, {
8952
+ cursorPosition: E,
8941
8953
  inlineCompletion: J.inlineCompletion
8942
- }), [b, J.mentions, S, J.inlineCompletion]), Jr = J.mentions.length > 0 || J.inlineCompletion !== null, Oe = k && !!T && T.length > 0 && !!E ? /* @__PURE__ */ r(
8954
+ }), [V, J.mentions, E, J.inlineCompletion]), Jr = J.mentions.length > 0 || J.inlineCompletion !== null, Oe = k && !!H && H.length > 0 && !!R ? /* @__PURE__ */ r(
8943
8955
  y2,
8944
8956
  {
8945
- suggestions: T,
8957
+ suggestions: H,
8946
8958
  onItemClick: he,
8947
8959
  onItemHover: K,
8948
- side: V ? "bottom" : "top"
8960
+ side: T ? "bottom" : "top"
8949
8961
  }
8950
- ) : null, T1 = V && k, { motionProps: eo } = Cs(
8962
+ ) : null, T1 = T && k, { motionProps: eo } = Cs(
8951
8963
  k,
8952
8964
  160,
8953
8965
  0.5
@@ -8955,15 +8967,15 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
8955
8967
  return /* @__PURE__ */ c(
8956
8968
  ne.div,
8957
8969
  {
8958
- ref: y,
8970
+ ref: L,
8959
8971
  className: x(
8960
8972
  "flex flex-col items-center gap-2 px-4 pb-3 pt-2",
8961
8973
  T1 && "min-h-0 flex-1 justify-start -mt-20"
8962
8974
  ),
8963
- ...V ? eo : {},
8975
+ ...T ? eo : {},
8964
8976
  children: [
8965
8977
  /* @__PURE__ */ c("div", { className: "flex w-full max-w-content flex-col gap-2", children: [
8966
- Oe && !V && /* @__PURE__ */ r("div", { children: Oe }),
8978
+ Oe && !T && /* @__PURE__ */ r("div", { children: Oe }),
8967
8979
  /* @__PURE__ */ r(C2, { creditWarning: i, children: /* @__PURE__ */ c(
8968
8980
  ne.form,
8969
8981
  {
@@ -9023,12 +9035,12 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9023
9035
  height: 0,
9024
9036
  opacity: 0,
9025
9037
  transition: {
9026
- duration: H ? 0 : 0.22,
9038
+ duration: A ? 0 : 0.22,
9027
9039
  ease: [0.4, 0, 1, 1]
9028
9040
  }
9029
9041
  },
9030
9042
  transition: {
9031
- duration: H ? 0 : 0.4,
9043
+ duration: A ? 0 : 0.4,
9032
9044
  ease: [0.4, 0, 0.2, 1]
9033
9045
  },
9034
9046
  children: a
@@ -9044,12 +9056,12 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9044
9056
  height: 0,
9045
9057
  opacity: 0,
9046
9058
  transition: {
9047
- duration: H ? 0 : 0.15,
9059
+ duration: A ? 0 : 0.15,
9048
9060
  ease: [0.55, 0, 1, 0.45]
9049
9061
  }
9050
9062
  },
9051
9063
  transition: {
9052
- duration: H ? 0 : 0.4,
9064
+ duration: A ? 0 : 0.4,
9053
9065
  ease: [0.4, 0, 0.2, 1]
9054
9066
  },
9055
9067
  children: [
@@ -9070,7 +9082,7 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9070
9082
  animate: { opacity: 1, y: 0 },
9071
9083
  exit: { opacity: 0, y: -4 },
9072
9084
  transition: {
9073
- duration: H ? 0 : 0.2,
9085
+ duration: A ? 0 : 0.2,
9074
9086
  ease: "easeOut"
9075
9087
  },
9076
9088
  children: /* @__PURE__ */ c(
@@ -9095,7 +9107,7 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9095
9107
  attachedFiles: ge,
9096
9108
  isUploading: Se,
9097
9109
  onRemove: j,
9098
- removeLabel: L.ai.removeFile
9110
+ removeLabel: b.ai.removeFile
9099
9111
  }
9100
9112
  ),
9101
9113
  /* @__PURE__ */ r(
@@ -9103,9 +9115,9 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9103
9115
  {
9104
9116
  textareaRef: Z,
9105
9117
  highlightRef: D,
9106
- inputValue: b,
9118
+ inputValue: V,
9107
9119
  onInputChange: (te, ke) => {
9108
- A(te), R(ke);
9120
+ y(te), F(ke);
9109
9121
  },
9110
9122
  onKeyDown: s1,
9111
9123
  onCursorUpdate: Ze,
@@ -9126,7 +9138,7 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9126
9138
  maxFiles: M,
9127
9139
  acceptValue: se,
9128
9140
  fileInputRef: ie,
9129
- handleFileSelect: F,
9141
+ handleFileSelect: N,
9130
9142
  inProgress: o,
9131
9143
  hasDataToSend: De,
9132
9144
  isPreSending: $ || z,
@@ -9146,8 +9158,8 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9146
9158
  }
9147
9159
  ) })
9148
9160
  ] }),
9149
- Oe && V && /* @__PURE__ */ r("div", { className: "w-full max-w-content", children: Oe }),
9150
- w && k && V && /* @__PURE__ */ r("div", { className: "w-full py-4 mx-auto flex max-w-content justify-center", children: w }),
9161
+ Oe && T && /* @__PURE__ */ r("div", { className: "w-full max-w-content", children: Oe }),
9162
+ w && k && T && /* @__PURE__ */ r("div", { className: "w-full py-4 mx-auto flex max-w-content justify-center", children: w }),
9151
9163
  /* @__PURE__ */ r(Ne, { mode: "wait", initial: !1, children: Q ? /* @__PURE__ */ c(
9152
9164
  ne.div,
9153
9165
  {
@@ -9160,17 +9172,17 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9160
9172
  /* @__PURE__ */ c("span", { children: [
9161
9173
  /* @__PURE__ */ r("kbd", { className: "font-sans", children: "↑↓" }),
9162
9174
  " ",
9163
- L.ai.clarifyingQuestion.navHint.navigate
9175
+ b.ai.clarifyingQuestion.navHint.navigate
9164
9176
  ] }),
9165
9177
  /* @__PURE__ */ c("span", { children: [
9166
9178
  /* @__PURE__ */ r("kbd", { className: "font-sans", children: "Enter" }),
9167
9179
  " ",
9168
- L.ai.clarifyingQuestion.navHint.select
9180
+ b.ai.clarifyingQuestion.navHint.select
9169
9181
  ] }),
9170
9182
  /* @__PURE__ */ c("span", { children: [
9171
9183
  /* @__PURE__ */ r("kbd", { className: "font-sans", children: "Esc" }),
9172
9184
  " ",
9173
- L.ai.clarifyingQuestion.navHint.cancel
9185
+ b.ai.clarifyingQuestion.navHint.cancel
9174
9186
  ] })
9175
9187
  ]
9176
9188
  },
@@ -9183,7 +9195,7 @@ const B2 = /[\\`*_{}[\]()#+\-.!|~>]/g, $2 = (e) => e.split(/(<entity-ref\b[^>]*>
9183
9195
  animate: { opacity: 1 },
9184
9196
  exit: { opacity: 0 },
9185
9197
  transition: {
9186
- duration: H ? 0 : 0.3,
9198
+ duration: A ? 0 : 0.3,
9187
9199
  ease: "easeOut"
9188
9200
  },
9189
9201
  children: [
@@ -10192,24 +10204,24 @@ function Ar({
10192
10204
  h.current = k, X(() => {
10193
10205
  typeof window > "u" || window.innerWidth < h4 || G1.has(e) || (G1.add(e), h.current());
10194
10206
  }, [e]);
10195
- const V = i && a ? Object.entries(i).map(([y, L]) => {
10196
- const H = a[y], b = m?.(y, H, {
10197
- fieldType: L.fieldType,
10198
- customFieldName: L.customFieldName
10207
+ const T = i && a ? Object.entries(i).map(([L, b]) => {
10208
+ const A = a[L], V = m?.(L, A, {
10209
+ fieldType: b.fieldType,
10210
+ customFieldName: b.customFieldName
10199
10211
  });
10200
- if (!b && L.fieldType === "custom" && typeof H == "object" && H !== null)
10212
+ if (!V && b.fieldType === "custom" && typeof A == "object" && A !== null)
10201
10213
  return null;
10202
- const A = b ?? Hr(H, L.fieldType), S = ["richtext", "textarea"];
10214
+ const y = V ?? Hr(A, b.fieldType), E = ["richtext", "textarea"];
10203
10215
  return {
10204
- label: L.label,
10205
- content: A,
10206
- verticalLayout: S.includes(L.fieldType ?? "")
10216
+ label: b.label,
10217
+ content: y,
10218
+ verticalLayout: E.includes(b.fieldType ?? "")
10207
10219
  };
10208
- }).filter((y) => {
10209
- if (!y) return !1;
10210
- const L = Array.isArray(y.content) ? y.content[0] : y.content;
10211
- return !(L?.type === "item" && L.text === "—");
10212
- }) : [], T = V.slice(0, z1), E = V.length > z1;
10220
+ }).filter((L) => {
10221
+ if (!L) return !1;
10222
+ const b = Array.isArray(L.content) ? L.content[0] : L.content;
10223
+ return !(b?.type === "item" && b.text === "—");
10224
+ }) : [], H = T.slice(0, z1), R = T.length > z1;
10213
10225
  return /* @__PURE__ */ r(
10214
10226
  Tr,
10215
10227
  {
@@ -10223,15 +10235,15 @@ function Ar({
10223
10235
  onClose: f,
10224
10236
  showButton: w
10225
10237
  },
10226
- children: T.length > 0 && !w && /* @__PURE__ */ r("div", { className: "-mx-3 flex w-full flex-col overflow-hidden pb-1", children: /* @__PURE__ */ r(
10238
+ children: H.length > 0 && !w && /* @__PURE__ */ r("div", { className: "-mx-3 flex w-full flex-col overflow-hidden pb-1", children: /* @__PURE__ */ r(
10227
10239
  Es,
10228
10240
  {
10229
- details: T.map((y) => ({
10230
- title: y.label,
10231
- content: y.content,
10232
- ...y.verticalLayout && { verticalLayout: !0 }
10241
+ details: H.map((L) => ({
10242
+ title: L.label,
10243
+ content: L.content,
10244
+ ...L.verticalLayout && { verticalLayout: !0 }
10233
10245
  })),
10234
- showSeeMore: E,
10246
+ showSeeMore: R,
10235
10247
  onClickSeeMore: k,
10236
10248
  tableView: !0
10237
10249
  }
@@ -10814,8 +10826,8 @@ function P4({
10814
10826
  const h = q(() => {
10815
10827
  const C = e.current;
10816
10828
  if (!C) return;
10817
- const { scrollTop: v, scrollHeight: w, clientHeight: k } = C, V = w - v - k;
10818
- u(V > k);
10829
+ const { scrollTop: v, scrollHeight: w, clientHeight: k } = C, T = w - v - k;
10830
+ u(T > k);
10819
10831
  }, [e]);
10820
10832
  return X(() => {
10821
10833
  const C = e.current;
@@ -10826,8 +10838,8 @@ function P4({
10826
10838
  requestAnimationFrame(() => {
10827
10839
  const C = e.current, v = n.current;
10828
10840
  if (!C || !v) return;
10829
- const w = C.getBoundingClientRect(), k = v.getBoundingClientRect(), V = C.scrollTop + (k.top - w.top);
10830
- C.scrollTo({ top: V, behavior: "smooth" });
10841
+ const w = C.getBoundingClientRect(), k = v.getBoundingClientRect(), T = C.scrollTop + (k.top - w.top);
10842
+ C.scrollTo({ top: T, behavior: "smooth" });
10831
10843
  });
10832
10844
  }), s === 0 && u(!1), f.current = s;
10833
10845
  }, [s, n, e]), { showScrollBtn: l, turnMinHeight: a, scrollToBottom: m };
@@ -10857,15 +10869,15 @@ const j4 = {
10857
10869
  AssistantMessage: v,
10858
10870
  UserMessage: w,
10859
10871
  onRegenerate: k,
10860
- onCopy: V
10872
+ onCopy: T
10861
10873
  }) => {
10862
- const { modal: T, handleSubmit: E, handleClose: y } = y4(
10874
+ const { modal: H, handleSubmit: R, handleClose: L } = y4(
10863
10875
  f ?? j4
10864
- ), L = Y(), H = v ?? k4, b = w ?? V4, A = ee(() => {
10865
- const D = n ?? L.ai.defaultInitialMessage;
10876
+ ), b = Y(), A = v ?? k4, V = w ?? V4, y = ee(() => {
10877
+ const D = n ?? b.ai.defaultInitialMessage;
10866
10878
  return (Array.isArray(D) ? D : [D]).filter((W) => typeof W == "string" && W.length > 0);
10867
- }, [n, L.ai.defaultInitialMessage]), S = !t && e.length === 0 && A.length > 0, R = I(null), $ = I(null), _ = I(null), z = I(null), G = I(null), { showScrollBtn: re, turnMinHeight: K, scrollToBottom: O } = P4({
10868
- viewportRef: R,
10879
+ }, [n, b.ai.defaultInitialMessage]), E = !t && e.length === 0 && y.length > 0, F = I(null), $ = I(null), _ = I(null), z = I(null), G = I(null), { showScrollBtn: re, turnMinHeight: K, scrollToBottom: O } = P4({
10880
+ viewportRef: F,
10869
10881
  contentRef: $,
10870
10882
  endRef: _,
10871
10883
  lastTurnRef: G,
@@ -10884,37 +10896,37 @@ const j4 = {
10884
10896
  inProgress: D.isInProgress,
10885
10897
  index: se,
10886
10898
  isCurrentMessage: !1,
10887
- AssistantMessage: H,
10888
- UserMessage: b,
10899
+ AssistantMessage: A,
10900
+ UserMessage: V,
10889
10901
  onRegenerate: k,
10890
- onCopy: V,
10902
+ onCopy: T,
10891
10903
  rawData: oe.rawData || {},
10892
10904
  ...he
10893
10905
  };
10894
10906
  return /* @__PURE__ */ r(
10895
- b,
10907
+ V,
10896
10908
  {
10897
10909
  ...de
10898
10910
  },
10899
10911
  `${Q}-u-${se}`
10900
10912
  );
10901
10913
  }, ie = (oe, se) => {
10902
- const de = W && se === D.assistantMessages.length - 1, M = D.userMessages.length + se, N = {
10914
+ const de = W && se === D.assistantMessages.length - 1, M = D.userMessages.length + se, S = {
10903
10915
  message: oe,
10904
10916
  inProgress: D.isInProgress,
10905
10917
  index: M,
10906
10918
  isCurrentMessage: de,
10907
- AssistantMessage: H,
10908
- UserMessage: b,
10919
+ AssistantMessage: A,
10920
+ UserMessage: V,
10909
10921
  onRegenerate: k,
10910
- onCopy: V,
10922
+ onCopy: T,
10911
10923
  rawData: oe.rawData || {},
10912
10924
  ...he
10913
10925
  };
10914
10926
  return /* @__PURE__ */ r(
10915
- H,
10927
+ A,
10916
10928
  {
10917
- ...N,
10929
+ ...S,
10918
10930
  isGenerating: D.isInProgress && de,
10919
10931
  isLoading: D.isInProgress && de && !oe.content
10920
10932
  },
@@ -10940,7 +10952,7 @@ const j4 = {
10940
10952
  R4,
10941
10953
  {
10942
10954
  titles: D.thinking.titles,
10943
- title: L.ai.thoughtsGroupTitle,
10955
+ title: b.ai.thoughtsGroupTitle,
10944
10956
  inProgress: D.thinking.inProgress,
10945
10957
  isWriting: D.thinking.isWriting
10946
10958
  }
@@ -10948,14 +10960,14 @@ const j4 = {
10948
10960
  D.assistantMessages.map(
10949
10961
  (oe, se) => ie(oe, se)
10950
10962
  ),
10951
- D.endIndicator === "thinking" && /* @__PURE__ */ r(u1, { title: L.ai.thinking, status: "executing" }),
10963
+ D.endIndicator === "thinking" && /* @__PURE__ */ r(u1, { title: b.ai.thinking, status: "executing" }),
10952
10964
  D.endIndicator === "activity" && /* @__PURE__ */ r(u1, { status: "writing" }),
10953
10965
  D.feedback && /* @__PURE__ */ r(
10954
10966
  M4,
10955
10967
  {
10956
10968
  content: D.feedback.content,
10957
10969
  targetMessage: D.feedback.targetMessage,
10958
- onCopy: V
10970
+ onCopy: T
10959
10971
  }
10960
10972
  ),
10961
10973
  W && /* @__PURE__ */ r(C4, {})
@@ -10969,7 +10981,7 @@ const j4 = {
10969
10981
  /* @__PURE__ */ r(
10970
10982
  "div",
10971
10983
  {
10972
- ref: R,
10984
+ ref: F,
10973
10985
  className: x(
10974
10986
  "flex-1 overflow-y-scroll",
10975
10987
  "[scrollbar-width:thin] [scrollbar-color:transparent_transparent]",
@@ -10988,15 +11000,15 @@ const j4 = {
10988
11000
  "div",
10989
11001
  {
10990
11002
  className: x(
10991
- S ? "flex flex-1" : "flex flex-col gap-6",
11003
+ E ? "flex flex-1" : "flex flex-col gap-6",
10992
11004
  "w-full max-w-content"
10993
11005
  ),
10994
11006
  children: [
10995
11007
  t && /* @__PURE__ */ r(Z4, {}),
10996
- S && /* @__PURE__ */ r(
11008
+ E && /* @__PURE__ */ r(
10997
11009
  I4,
10998
11010
  {
10999
- messages: A,
11011
+ messages: y,
11000
11012
  onClick: s,
11001
11013
  fullscreen: h
11002
11014
  }
@@ -11020,7 +11032,7 @@ const j4 = {
11020
11032
  fe,
11021
11033
  {
11022
11034
  onClick: () => O(),
11023
- label: L.ai.scrollToBottom,
11035
+ label: b.ai.scrollToBottom,
11024
11036
  variant: "neutral",
11025
11037
  icon: Lt,
11026
11038
  hideLabel: !0
@@ -11033,18 +11045,18 @@ const j4 = {
11033
11045
  )
11034
11046
  }
11035
11047
  ),
11036
- !m && !S && /* @__PURE__ */ c(xe, { children: [
11048
+ !m && !E && /* @__PURE__ */ c(xe, { children: [
11037
11049
  /* @__PURE__ */ r(K1, { position: "top" }, "shadow-top"),
11038
11050
  /* @__PURE__ */ r(K1, { position: "bottom" }, "shadow-bottom")
11039
11051
  ] })
11040
11052
  ] }),
11041
- T.isOpen && /* @__PURE__ */ r(
11053
+ H.isOpen && /* @__PURE__ */ r(
11042
11054
  b4,
11043
11055
  {
11044
- onSubmit: E,
11045
- onClose: y,
11046
- reactionType: T.currentReaction,
11047
- message: T.currentMessage
11056
+ onSubmit: R,
11057
+ onClose: L,
11058
+ reactionType: H.currentReaction,
11059
+ message: H.currentMessage
11048
11060
  }
11049
11061
  )
11050
11062
  ] });
@@ -11241,38 +11253,38 @@ const z4 = ({
11241
11253
  onToggleCustomActive: v,
11242
11254
  onConfirm: w
11243
11255
  }) => {
11244
- const k = ye(), V = (() => {
11256
+ const k = ye(), T = (() => {
11245
11257
  if (e !== "single") return 0;
11246
- const H = o.findIndex((b) => n.includes(b.id));
11247
- return H >= 0 ? H : 0;
11248
- })(), [T, E] = P(V), y = I([]);
11258
+ const A = o.findIndex((V) => n.includes(V.id));
11259
+ return A >= 0 ? A : 0;
11260
+ })(), [H, R] = P(T), L = I([]);
11249
11261
  X(() => {
11250
- g && e === "single" && y.current[T]?.focus();
11262
+ g && e === "single" && L.current[H]?.focus();
11251
11263
  }, []);
11252
- const L = (H) => {
11264
+ const b = (A) => {
11253
11265
  if (e !== "single") return;
11254
- const b = o.length - 1;
11255
- if (b < 0) return;
11256
- let A = T;
11257
- switch (H.key) {
11266
+ const V = o.length - 1;
11267
+ if (V < 0) return;
11268
+ let y = H;
11269
+ switch (A.key) {
11258
11270
  case "ArrowDown":
11259
11271
  case "ArrowRight":
11260
- A = T >= b ? 0 : T + 1;
11272
+ y = H >= V ? 0 : H + 1;
11261
11273
  break;
11262
11274
  case "ArrowUp":
11263
11275
  case "ArrowLeft":
11264
- A = T <= 0 ? b : T - 1;
11276
+ y = H <= 0 ? V : H - 1;
11265
11277
  break;
11266
11278
  case "Home":
11267
- A = 0;
11279
+ y = 0;
11268
11280
  break;
11269
11281
  case "End":
11270
- A = b;
11282
+ y = V;
11271
11283
  break;
11272
11284
  default:
11273
11285
  return;
11274
11286
  }
11275
- H.preventDefault(), E(A), y.current[A]?.focus();
11287
+ A.preventDefault(), R(y), L.current[y]?.focus();
11276
11288
  };
11277
11289
  return /* @__PURE__ */ c(
11278
11290
  "div",
@@ -11281,7 +11293,7 @@ const z4 = ({
11281
11293
  role: e === "single" ? "radiogroup" : "group",
11282
11294
  "aria-label": t,
11283
11295
  children: [
11284
- o.map((H, b) => /* @__PURE__ */ r(
11296
+ o.map((A, V) => /* @__PURE__ */ r(
11285
11297
  ne.div,
11286
11298
  {
11287
11299
  initial: k ? !1 : { opacity: 0, y: 4 },
@@ -11289,24 +11301,24 @@ const z4 = ({
11289
11301
  transition: {
11290
11302
  duration: k ? 0 : 0.2,
11291
11303
  ease: [0.4, 0, 0.2, 1],
11292
- delay: k ? 0 : 0.12 + b * 0.06
11304
+ delay: k ? 0 : 0.12 + V * 0.06
11293
11305
  },
11294
11306
  children: /* @__PURE__ */ r(
11295
11307
  Or,
11296
11308
  {
11297
- ref: (A) => {
11298
- y.current[b] = A;
11309
+ ref: (y) => {
11310
+ L.current[V] = y;
11299
11311
  },
11300
- option: H,
11301
- isSelected: n.includes(H.id),
11312
+ option: A,
11313
+ isSelected: n.includes(A.id),
11302
11314
  mode: e,
11303
- isTabStop: e === "single" ? b === T : void 0,
11315
+ isTabStop: e === "single" ? V === H : void 0,
11304
11316
  onToggle: m,
11305
- onKeyNavigate: L
11317
+ onKeyNavigate: b
11306
11318
  }
11307
11319
  )
11308
11320
  },
11309
- H.id
11321
+ A.id
11310
11322
  )),
11311
11323
  s && /* @__PURE__ */ r(
11312
11324
  U4,
@@ -11415,24 +11427,24 @@ const z4 = ({
11415
11427
  question: v,
11416
11428
  options: w,
11417
11429
  selectedOptionIds: k,
11418
- selectionMode: V,
11419
- optional: T,
11420
- allowCustomAnswer: E,
11421
- customAnswerText: y,
11422
- isCustomAnswerActive: L
11423
- } = s, H = I(null), b = V ?? "single", A = a > 1, S = i === 0, R = i === a - 1, $ = A ? o.t("ai.clarifyingQuestion.stepOf", {
11430
+ selectionMode: T,
11431
+ optional: H,
11432
+ allowCustomAnswer: R,
11433
+ customAnswerText: L,
11434
+ isCustomAnswerActive: b
11435
+ } = s, A = I(null), V = T ?? "single", y = a > 1, E = i === 0, F = i === a - 1, $ = y ? o.t("ai.clarifyingQuestion.stepOf", {
11424
11436
  current: String(i + 1),
11425
11437
  total: String(a)
11426
- }) : void 0, _ = k.length > 0, z = (y ?? "").trim().length > 0, G = _ || L && z || T === !0, re = t === !0 && R, K = () => {
11438
+ }) : void 0, _ = k.length > 0, z = (L ?? "").trim().length > 0, G = _ || b && z || H === !0, re = t === !0 && F, K = () => {
11427
11439
  re || l();
11428
11440
  }, O = () => {
11429
11441
  re || u();
11430
11442
  }, Z = (ie) => {
11431
- const oe = b === "single" && k.includes(ie);
11432
- d(ie), b === "single" && !R && !oe && Promise.resolve().then(l);
11433
- }, D = R ? o.ai.clarifyingQuestion.submit : o.ai.clarifyingQuestion.next, Q = T === !0 && !_ && !(L && z), W = () => {
11443
+ const oe = V === "single" && k.includes(ie);
11444
+ d(ie), V === "single" && !F && !oe && Promise.resolve().then(l);
11445
+ }, D = F ? o.ai.clarifyingQuestion.submit : o.ai.clarifyingQuestion.next, Q = H === !0 && !_ && !(b && z), W = () => {
11434
11446
  C(), requestAnimationFrame(() => {
11435
- H.current?.focus();
11447
+ A.current?.focus();
11436
11448
  });
11437
11449
  }, he = (ie) => {
11438
11450
  ie.key === "Escape" && (ie.preventDefault(), f());
@@ -11452,8 +11464,8 @@ const z4 = ({
11452
11464
  {
11453
11465
  question: v,
11454
11466
  stepLabel: $,
11455
- isFirstStep: S,
11456
- isFinalStep: R,
11467
+ isFirstStep: E,
11468
+ isFinalStep: F,
11457
11469
  canProceed: G,
11458
11470
  onBack: g,
11459
11471
  onNext: l,
@@ -11463,17 +11475,17 @@ const z4 = ({
11463
11475
  /* @__PURE__ */ r(
11464
11476
  z4,
11465
11477
  {
11466
- mode: b,
11478
+ mode: V,
11467
11479
  question: v,
11468
11480
  options: w,
11469
11481
  selectedOptionIds: k,
11470
- allowCustomAnswer: E,
11482
+ allowCustomAnswer: R,
11471
11483
  hasSelection: _,
11472
11484
  hasCustomText: z,
11473
- customAnswerText: y,
11474
- isCustomAnswerActive: L,
11485
+ customAnswerText: L,
11486
+ isCustomAnswerActive: b,
11475
11487
  canProceed: G,
11476
- customInputRef: H,
11488
+ customInputRef: A,
11477
11489
  onToggleOption: Z,
11478
11490
  onActivateCustom: W,
11479
11491
  onChangeCustomText: m,
@@ -11499,59 +11511,59 @@ const z4 = ({
11499
11511
  ] });
11500
11512
  };
11501
11513
  function Q1(e, t, o, n) {
11502
- const s = Math.max(1, Math.min(e, t)), i = Math.min(o, 20), d = Math.min(i + n, s), l = Math.min(d, Math.floor(e / 2)), u = Math.min(d, Math.floor(t / 2)), f = (W) => W / e * 2 - 1, g = (W) => W / t * 2 - 1, m = 0, h = e, C = 0, v = t, w = l, k = e - l, V = u, T = t - u, E = f(m), y = f(h), L = g(C), H = g(v), b = f(w), A = f(k), S = g(V), R = g(T), $ = 0, _ = 0, z = 1, G = 1, re = l / e, K = 1 - l / e, O = u / t, Z = 1 - u / t, D = new Float32Array([
11514
+ const s = Math.max(1, Math.min(e, t)), i = Math.min(o, 20), d = Math.min(i + n, s), l = Math.min(d, Math.floor(e / 2)), u = Math.min(d, Math.floor(t / 2)), f = (W) => W / e * 2 - 1, g = (W) => W / t * 2 - 1, m = 0, h = e, C = 0, v = t, w = l, k = e - l, T = u, H = t - u, R = f(m), L = f(h), b = g(C), A = g(v), V = f(w), y = f(k), E = g(T), F = g(H), $ = 0, _ = 0, z = 1, G = 1, re = l / e, K = 1 - l / e, O = u / t, Z = 1 - u / t, D = new Float32Array([
11503
11515
  // Top strip
11504
- E,
11505
- L,
11506
- y,
11516
+ R,
11517
+ b,
11507
11518
  L,
11519
+ b,
11520
+ R,
11508
11521
  E,
11509
- S,
11522
+ R,
11510
11523
  E,
11511
- S,
11512
- y,
11513
11524
  L,
11514
- y,
11515
- S,
11516
- // Bottom strip
11525
+ b,
11526
+ L,
11517
11527
  E,
11528
+ // Bottom strip
11518
11529
  R,
11519
- y,
11530
+ F,
11531
+ L,
11532
+ F,
11520
11533
  R,
11521
- E,
11522
- H,
11523
- E,
11524
- H,
11525
- y,
11534
+ A,
11526
11535
  R,
11527
- y,
11528
- H,
11536
+ A,
11537
+ L,
11538
+ F,
11539
+ L,
11540
+ A,
11529
11541
  // Left strip
11530
- E,
11531
- S,
11532
- b,
11533
- S,
11534
- E,
11535
11542
  R,
11536
11543
  E,
11544
+ V,
11545
+ E,
11537
11546
  R,
11538
- b,
11539
- S,
11540
- b,
11547
+ F,
11541
11548
  R,
11549
+ F,
11550
+ V,
11551
+ E,
11552
+ V,
11553
+ F,
11542
11554
  // Right strip
11543
- A,
11544
- S,
11545
11555
  y,
11546
- S,
11547
- A,
11548
- R,
11549
- A,
11550
- R,
11556
+ E,
11557
+ L,
11558
+ E,
11551
11559
  y,
11552
- S,
11560
+ F,
11553
11561
  y,
11554
- R
11562
+ F,
11563
+ L,
11564
+ E,
11565
+ L,
11566
+ F
11555
11567
  ]), Q = new Float32Array([
11556
11568
  // Top strip
11557
11569
  $,
@@ -11937,8 +11949,8 @@ class k9 {
11937
11949
  s.enableVertexAttribArray(w), s.vertexAttribPointer(w, 2, s.FLOAT, !1, 0, 0), this.checkGLError(s, "resize: after UV buffer update"), s.useProgram(i), s.uniform2f(u, this.canvas.width, this.canvas.height), s.uniform1f(this.glr.uBorderWidth, this.options.borderWidth * f), s.uniform1f(this.glr.uGlowWidth, this.options.glowWidth * f), s.uniform1f(this.glr.uBorderRadius, this.options.borderRadius * f), this.checkGLError(s, "resize: after uniform updates");
11938
11950
  const k = performance.now();
11939
11951
  this.lastTime = k;
11940
- const V = (k - this.startTime) * 1e-3;
11941
- this.render(V);
11952
+ const T = (k - this.startTime) * 1e-3;
11953
+ this.render(T);
11942
11954
  }
11943
11955
  /**
11944
11956
  * Automatically resizes the canvas to match the dimensions of the given element.
@@ -12026,13 +12038,13 @@ class k9 {
12026
12038
  t.bindBuffer(t.ARRAY_BUFFER, f), t.bufferData(t.ARRAY_BUFFER, d, t.STATIC_DRAW);
12027
12039
  const g = t.getAttribLocation(o, "aUV");
12028
12040
  t.enableVertexAttribArray(g), t.vertexAttribPointer(g, 2, t.FLOAT, !1, 0, 0), this.checkGLError(t, "setupGL: after UV buffer setup");
12029
- const m = t.getUniformLocation(o, "uResolution"), h = t.getUniformLocation(o, "uTime"), C = t.getUniformLocation(o, "uBorderWidth"), v = t.getUniformLocation(o, "uGlowWidth"), w = t.getUniformLocation(o, "uBorderRadius"), k = t.getUniformLocation(o, "uColors"), V = t.getUniformLocation(o, "uGlowExponent"), T = t.getUniformLocation(o, "uGlowFactor");
12030
- t.useProgram(o), t.uniform1f(C, this.options.borderWidth), t.uniform1f(v, this.options.glowWidth), t.uniform1f(w, this.options.borderRadius), this.options.mode === "dark" ? (t.uniform1f(V, 2), t.uniform1f(T, 1.8)) : (t.uniform1f(V, 1), t.uniform1f(T, 1));
12031
- const E = (this.options.colors || J4).map(e6);
12032
- for (let y = 0; y < E.length; y++)
12041
+ const m = t.getUniformLocation(o, "uResolution"), h = t.getUniformLocation(o, "uTime"), C = t.getUniformLocation(o, "uBorderWidth"), v = t.getUniformLocation(o, "uGlowWidth"), w = t.getUniformLocation(o, "uBorderRadius"), k = t.getUniformLocation(o, "uColors"), T = t.getUniformLocation(o, "uGlowExponent"), H = t.getUniformLocation(o, "uGlowFactor");
12042
+ t.useProgram(o), t.uniform1f(C, this.options.borderWidth), t.uniform1f(v, this.options.glowWidth), t.uniform1f(w, this.options.borderRadius), this.options.mode === "dark" ? (t.uniform1f(T, 2), t.uniform1f(H, 1.8)) : (t.uniform1f(T, 1), t.uniform1f(H, 1));
12043
+ const R = (this.options.colors || J4).map(e6);
12044
+ for (let L = 0; L < R.length; L++)
12033
12045
  t.uniform3f(
12034
- t.getUniformLocation(o, `uColors[${y}]`),
12035
- ...E[y]
12046
+ t.getUniformLocation(o, `uColors[${L}]`),
12047
+ ...R[L]
12036
12048
  );
12037
12049
  this.checkGLError(t, "setupGL: after uniform setup"), t.bindVertexArray(null), t.bindBuffer(t.ARRAY_BUFFER, null), this.glr = {
12038
12050
  gl: t,
@@ -12254,8 +12266,8 @@ class d6 {
12254
12266
  )
12255
12267
  );
12256
12268
  Object.assign(this, { url: n, wrapS: s, wrapT: i, minFilter: a, magFilter: d, flipY: l });
12257
- const g = 0, m = o.RGBA, h = 1, C = 1, v = 0, w = o.RGBA, k = o.UNSIGNED_BYTE, V = new Uint8Array([255, 255, 255, 0]), T = o.createTexture();
12258
- if (o.bindTexture(o.TEXTURE_2D, T), o.texImage2D(
12269
+ const g = 0, m = o.RGBA, h = 1, C = 1, v = 0, w = o.RGBA, k = o.UNSIGNED_BYTE, T = new Uint8Array([255, 255, 255, 0]), H = o.createTexture();
12270
+ if (o.bindTexture(o.TEXTURE_2D, H), o.texImage2D(
12259
12271
  o.TEXTURE_2D,
12260
12272
  g,
12261
12273
  m,
@@ -12264,30 +12276,30 @@ class d6 {
12264
12276
  v,
12265
12277
  w,
12266
12278
  k,
12267
- V
12279
+ T
12268
12280
  ), f) {
12269
- const H = this.setupVideo(n);
12270
- return o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_S, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_T, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MIN_FILTER, o.LINEAR), this._webglTexture = T, this.source = H, this.isVideo = !0, H.play().then(() => this);
12281
+ const A = this.setupVideo(n);
12282
+ return o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_S, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_T, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MIN_FILTER, o.LINEAR), this._webglTexture = H, this.source = A, this.isVideo = !0, A.play().then(() => this);
12271
12283
  }
12272
- async function E() {
12273
- return new Promise((H, b) => {
12274
- const A = new Image();
12275
- A.crossOrigin = "anonymous", A.onload = () => {
12276
- H(A);
12277
- }, A.onerror = () => {
12278
- b(new Error(be(`failed loading url: ${n}`)));
12279
- }, A.src = n ?? "";
12284
+ async function R() {
12285
+ return new Promise((A, V) => {
12286
+ const y = new Image();
12287
+ y.crossOrigin = "anonymous", y.onload = () => {
12288
+ A(y);
12289
+ }, y.onerror = () => {
12290
+ V(new Error(be(`failed loading url: ${n}`)));
12291
+ }, y.src = n ?? "";
12280
12292
  });
12281
12293
  }
12282
- let y = await E(), L = (y.width & y.width - 1) === 0 && (y.height & y.height - 1) === 0;
12283
- return (t.wrapS !== ft || t.wrapT !== ft || t.minFilter !== dt && t.minFilter !== d1) && !L && (y = this.makePowerOf2(y), L = !0), o.bindTexture(o.TEXTURE_2D, T), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, l), o.texImage2D(
12294
+ let L = await R(), b = (L.width & L.width - 1) === 0 && (L.height & L.height - 1) === 0;
12295
+ return (t.wrapS !== ft || t.wrapT !== ft || t.minFilter !== dt && t.minFilter !== d1) && !b && (L = this.makePowerOf2(L), b = !0), o.bindTexture(o.TEXTURE_2D, H), o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL, l), o.texImage2D(
12284
12296
  o.TEXTURE_2D,
12285
12297
  g,
12286
12298
  m,
12287
12299
  w,
12288
12300
  k,
12289
- y
12290
- ), L && t.minFilter !== dt && t.minFilter !== d1 && o.generateMipmap(o.TEXTURE_2D), o.texParameteri(
12301
+ L
12302
+ ), b && t.minFilter !== dt && t.minFilter !== d1 && o.generateMipmap(o.TEXTURE_2D), o.texParameteri(
12291
12303
  o.TEXTURE_2D,
12292
12304
  o.TEXTURE_WRAP_S,
12293
12305
  this.wrapS || ut
@@ -12303,7 +12315,7 @@ class d6 {
12303
12315
  o.TEXTURE_2D,
12304
12316
  o.TEXTURE_MAG_FILTER,
12305
12317
  this.magFilter || d1
12306
- ), this._webglTexture = T, this.source = y, this.isVideo = !1, this.isLoaded = !0, this.width = y.width || 0, this.height = y.height || 0, this;
12318
+ ), this._webglTexture = H, this.source = L, this.isVideo = !1, this.isLoaded = !0, this.width = L.width || 0, this.height = L.height || 0, this;
12307
12319
  };
12308
12320
  }
12309
12321
  const be = (e) => `react-shaders: ${e}`, ht = (e) => {
@@ -12328,7 +12340,7 @@ function u6({
12328
12340
  onError: g = console.error,
12329
12341
  onWarning: m = console.warn
12330
12342
  }) {
12331
- const h = I(null), C = I(null), v = I(null), w = I(null), k = I(void 0), V = I(void 0), T = I(!1), E = I(void 0), y = I(0), L = I([0, 0]), H = I([]), b = I(0), A = I(void 0), S = I({
12343
+ const h = I(null), C = I(null), v = I(null), w = I(null), k = I(void 0), T = I(void 0), H = I(!1), R = I(void 0), L = I(0), b = I([0, 0]), A = I([]), V = I(0), y = I(void 0), E = I({
12332
12344
  [rt]: { type: "float", isNeeded: !1, value: 0 },
12333
12345
  [ot]: { type: "float", isNeeded: !1, value: 0 },
12334
12346
  [nt]: { type: "vec4", isNeeded: !1, value: [0, 0, 0, 0] },
@@ -12340,11 +12352,11 @@ function u6({
12340
12352
  isNeeded: !1,
12341
12353
  value: [0, 0, 0, 0]
12342
12354
  }
12343
- }), R = I(n), $ = (M, N) => {
12344
- const F = "width" in M ? M.width ?? 0 : 0, j = "height" in M ? M.height ?? 0 : 0, B = S.current.iChannelResolution;
12355
+ }), F = I(n), $ = (M, S) => {
12356
+ const N = "width" in M ? M.width ?? 0 : 0, j = "height" in M ? M.height ?? 0 : 0, B = E.current.iChannelResolution;
12345
12357
  if (!B) return;
12346
12358
  const U = Array.isArray(B.value) ? B.value : B.value = [];
12347
- U[N * 3] = F * u, U[N * 3 + 1] = j * u, U[N * 3 + 2] = 0;
12359
+ U[S * 3] = N * u, U[S * 3 + 1] = j * u, U[S * 3 + 2] = 0;
12348
12360
  }, _ = () => {
12349
12361
  h.current && (C.current = h.current.getContext("webgl", d) || h.current.getContext(
12350
12362
  "experimental-webgl",
@@ -12353,7 +12365,7 @@ function u6({
12353
12365
  }, z = () => {
12354
12366
  const M = C.current;
12355
12367
  v.current = M?.createBuffer() ?? null, M?.bindBuffer(M.ARRAY_BUFFER, v.current);
12356
- const N = [
12368
+ const S = [
12357
12369
  1,
12358
12370
  1,
12359
12371
  0,
@@ -12367,99 +12379,99 @@ function u6({
12367
12379
  -1,
12368
12380
  0
12369
12381
  ];
12370
- M?.bufferData(M.ARRAY_BUFFER, new Float32Array(N), M.STATIC_DRAW);
12382
+ M?.bufferData(M.ARRAY_BUFFER, new Float32Array(S), M.STATIC_DRAW);
12371
12383
  }, G = ({
12372
12384
  alpha: M,
12373
- beta: N,
12374
- gamma: F
12385
+ beta: S,
12386
+ gamma: N
12375
12387
  }) => {
12376
- S.current.iDeviceOrientation.value = [
12388
+ E.current.iDeviceOrientation.value = [
12377
12389
  M ?? 0,
12390
+ S ?? 0,
12378
12391
  N ?? 0,
12379
- F ?? 0,
12380
12392
  window.orientation ?? 0
12381
12393
  ];
12382
12394
  }, re = (M) => {
12383
- const [N = 0, F = 0] = ht(M), j = N - (E.current?.left ?? 0) - window.pageXOffset, B = (E.current?.height ?? 0) - F - (E.current?.top ?? 0) - window.pageYOffset;
12384
- T.current = !0;
12385
- const U = Array.isArray(S.current.iMouse?.value) ? S.current.iMouse.value : void 0;
12386
- U && (U[2] = j, U[3] = B), L.current[0] = j, L.current[1] = B;
12395
+ const [S = 0, N = 0] = ht(M), j = S - (R.current?.left ?? 0) - window.pageXOffset, B = (R.current?.height ?? 0) - N - (R.current?.top ?? 0) - window.pageYOffset;
12396
+ H.current = !0;
12397
+ const U = Array.isArray(E.current.iMouse?.value) ? E.current.iMouse.value : void 0;
12398
+ U && (U[2] = j, U[3] = B), b.current[0] = j, b.current[1] = B;
12387
12399
  }, K = (M) => {
12388
- E.current = h.current?.getBoundingClientRect();
12389
- const [N = 0, F = 0] = ht(M), j = N - (E.current?.left ?? 0), B = (E.current?.height ?? 0) - F - (E.current?.top ?? 0);
12400
+ R.current = h.current?.getBoundingClientRect();
12401
+ const [S = 0, N = 0] = ht(M), j = S - (R.current?.left ?? 0), B = (R.current?.height ?? 0) - N - (R.current?.top ?? 0);
12390
12402
  if (l !== 1)
12391
- L.current[0] = j, L.current[1] = B;
12403
+ b.current[0] = j, b.current[1] = B;
12392
12404
  else {
12393
- const U = Array.isArray(S.current.iMouse?.value) ? S.current.iMouse.value : void 0;
12405
+ const U = Array.isArray(E.current.iMouse?.value) ? E.current.iMouse.value : void 0;
12394
12406
  U && (U[0] = j, U[1] = B);
12395
12407
  }
12396
12408
  }, O = () => {
12397
- const M = Array.isArray(S.current.iMouse?.value) ? S.current.iMouse.value : void 0;
12409
+ const M = Array.isArray(E.current.iMouse?.value) ? E.current.iMouse.value : void 0;
12398
12410
  M && (M[2] = 0, M[3] = 0);
12399
12411
  }, Z = () => {
12400
12412
  const M = C.current;
12401
12413
  if (!M) return;
12402
- E.current = h.current?.getBoundingClientRect();
12403
- const N = u, F = Math.floor(
12404
- (E.current?.width ?? 1) * N
12414
+ R.current = h.current?.getBoundingClientRect();
12415
+ const S = u, N = Math.floor(
12416
+ (R.current?.width ?? 1) * S
12405
12417
  ), j = Math.floor(
12406
- (E.current?.height ?? 1) * N
12418
+ (R.current?.height ?? 1) * S
12407
12419
  );
12408
- if (M.canvas.width = F, M.canvas.height = j, S.current.iResolution?.isNeeded && w.current) {
12420
+ if (M.canvas.width = N, M.canvas.height = j, E.current.iResolution?.isNeeded && w.current) {
12409
12421
  const B = M.getUniformLocation(
12410
12422
  w.current,
12411
12423
  at
12412
12424
  );
12413
12425
  M.uniform2fv(B, [M.canvas.width, M.canvas.height]);
12414
12426
  }
12415
- }, D = (M, N) => {
12416
- const F = C.current;
12417
- if (!F) return null;
12418
- const j = F.createShader(M);
12427
+ }, D = (M, S) => {
12428
+ const N = C.current;
12429
+ if (!N) return null;
12430
+ const j = N.createShader(M);
12419
12431
  if (!j) return null;
12420
- if (F.shaderSource(j, N), F.compileShader(j), !F.getShaderParameter(j, F.COMPILE_STATUS)) {
12432
+ if (N.shaderSource(j, S), N.compileShader(j), !N.getShaderParameter(j, N.COMPILE_STATUS)) {
12421
12433
  m?.(be(`Error compiling the shader:
12422
- ${N}`));
12423
- const B = F.getShaderInfoLog(j);
12424
- F.deleteShader(j), g?.(be(`Shader compiler log: ${B}`));
12434
+ ${S}`));
12435
+ const B = N.getShaderInfoLog(j);
12436
+ N.deleteShader(j), g?.(be(`Shader compiler log: ${B}`));
12425
12437
  }
12426
12438
  return j;
12427
- }, Q = (M, N) => {
12428
- const F = C.current;
12429
- if (!F) return;
12430
- const j = D(F.FRAGMENT_SHADER, M), B = D(F.VERTEX_SHADER, N);
12431
- if (w.current = F.createProgram(), !(!w.current || !B || !j)) {
12432
- if (F.attachShader(w.current, B), F.attachShader(w.current, j), F.linkProgram(w.current), !F.getProgramParameter(w.current, F.LINK_STATUS)) {
12439
+ }, Q = (M, S) => {
12440
+ const N = C.current;
12441
+ if (!N) return;
12442
+ const j = D(N.FRAGMENT_SHADER, M), B = D(N.VERTEX_SHADER, S);
12443
+ if (w.current = N.createProgram(), !(!w.current || !B || !j)) {
12444
+ if (N.attachShader(w.current, B), N.attachShader(w.current, j), N.linkProgram(w.current), !N.getProgramParameter(w.current, N.LINK_STATUS)) {
12433
12445
  g?.(
12434
12446
  be(
12435
- `Unable to initialize the shader program: ${F.getProgramInfoLog(
12447
+ `Unable to initialize the shader program: ${N.getProgramInfoLog(
12436
12448
  w.current
12437
12449
  )}`
12438
12450
  )
12439
12451
  );
12440
12452
  return;
12441
12453
  }
12442
- F.useProgram(w.current), k.current = F.getAttribLocation(
12454
+ N.useProgram(w.current), k.current = N.getAttribLocation(
12443
12455
  w.current,
12444
12456
  "aVertexPosition"
12445
- ), F.enableVertexAttribArray(k.current);
12457
+ ), N.enableVertexAttribArray(k.current);
12446
12458
  }
12447
12459
  }, W = () => {
12448
12460
  if (n)
12449
12461
  for (const M of Object.keys(n)) {
12450
- const N = n[M];
12451
- if (!N) continue;
12452
- const { value: F, type: j } = N, B = c6(j);
12462
+ const S = n[M];
12463
+ if (!S) continue;
12464
+ const { value: N, type: j } = S, B = c6(j);
12453
12465
  if (!B) continue;
12454
12466
  const U = {};
12455
- if (n6(j, F)) {
12456
- const ae = j.length, J = Number.parseInt(j.charAt(ae - 3)), we = Math.floor(F.length / (J * J));
12457
- F.length > J * J && (U.arraySize = `[${we}]`);
12458
- } else s6(j, F) && (U.arraySize = `[${Math.floor(F.length / Number.parseInt(j.charAt(0)))}]`);
12459
- S.current[M] = {
12467
+ if (n6(j, N)) {
12468
+ const ae = j.length, J = Number.parseInt(j.charAt(ae - 3)), we = Math.floor(N.length / (J * J));
12469
+ N.length > J * J && (U.arraySize = `[${we}]`);
12470
+ } else s6(j, N) && (U.arraySize = `[${Math.floor(N.length / Number.parseInt(j.charAt(0)))}]`);
12471
+ E.current[M] = {
12460
12472
  type: B,
12461
12473
  isNeeded: !1,
12462
- value: F,
12474
+ value: N,
12463
12475
  ...U
12464
12476
  };
12465
12477
  }
@@ -12467,140 +12479,140 @@ ${N}`));
12467
12479
  const M = C.current;
12468
12480
  if (M)
12469
12481
  if (o && o.length > 0) {
12470
- S.current[`${ct}`] = {
12482
+ E.current[`${ct}`] = {
12471
12483
  type: "vec3",
12472
12484
  isNeeded: !1,
12473
12485
  arraySize: `[${o.length}]`,
12474
12486
  value: []
12475
12487
  };
12476
- const N = o.map(
12477
- (F, j) => (S.current[`${o6}${j}`] = {
12488
+ const S = o.map(
12489
+ (N, j) => (E.current[`${o6}${j}`] = {
12478
12490
  type: "sampler2D",
12479
12491
  isNeeded: !1
12480
- }, $(F, j), H.current[j] = new d6(M), H.current[j]?.load(F).then((B) => {
12492
+ }, $(N, j), A.current[j] = new d6(M), A.current[j]?.load(N).then((B) => {
12481
12493
  $(B, j);
12482
12494
  }))
12483
12495
  );
12484
- Promise.all(N).then(() => {
12496
+ Promise.all(S).then(() => {
12485
12497
  f && f();
12486
- }).catch((F) => {
12487
- g?.(F), f && f();
12498
+ }).catch((N) => {
12499
+ g?.(N), f && f();
12488
12500
  });
12489
12501
  } else f && f();
12490
12502
  }, ge = (M) => {
12491
- const N = et.includes(i ?? "highp"), F = `precision ${N ? i : et[1]} float;
12503
+ const S = et.includes(i ?? "highp"), N = `precision ${S ? i : et[1]} float;
12492
12504
  `;
12493
- N || m?.(
12505
+ S || m?.(
12494
12506
  be(
12495
12507
  `wrong precision type ${i}, please make sure to pass one of a valid precision lowp, mediump, highp, by default you shader precision will be set to highp.`
12496
12508
  )
12497
12509
  );
12498
- let j = F.concat(`#define DPR ${u.toFixed(1)}
12510
+ let j = N.concat(`#define DPR ${u.toFixed(1)}
12499
12511
  `).concat(M.replace(/texture\(/g, "texture2D("));
12500
- for (const U of Object.keys(S.current))
12512
+ for (const U of Object.keys(E.current))
12501
12513
  if (M.includes(U)) {
12502
- const ae = S.current[U];
12514
+ const ae = E.current[U];
12503
12515
  if (!ae) continue;
12504
12516
  j = f6(
12505
12517
  j,
12506
12518
  `uniform ${ae.type} ${U}${ae.arraySize || ""};
12507
12519
  `,
12508
- j.lastIndexOf(F) + F.length
12520
+ j.lastIndexOf(N) + N.length
12509
12521
  ), ae.isNeeded = !0;
12510
12522
  }
12511
12523
  return M.includes("mainImage") && (j = j.concat(t6)), j;
12512
12524
  }, ie = (M) => {
12513
- const N = C.current;
12514
- if (!N || !w.current) return;
12515
- const F = b.current ? (M - b.current) / 1e3 : 0;
12516
- b.current = M;
12517
- const j = R.current;
12525
+ const S = C.current;
12526
+ if (!S || !w.current) return;
12527
+ const N = V.current ? (M - V.current) / 1e3 : 0;
12528
+ V.current = M;
12529
+ const j = F.current;
12518
12530
  if (j)
12519
12531
  for (const B of Object.keys(j)) {
12520
12532
  const U = j[B];
12521
- if (U && S.current[B]?.isNeeded) {
12533
+ if (U && E.current[B]?.isNeeded) {
12522
12534
  if (!w.current) return;
12523
- const ae = N.getUniformLocation(
12535
+ const ae = S.getUniformLocation(
12524
12536
  w.current,
12525
12537
  B
12526
12538
  );
12527
12539
  if (!ae) return;
12528
12540
  a6(
12529
- N,
12541
+ S,
12530
12542
  ae,
12531
12543
  U.type,
12532
12544
  U.value
12533
12545
  );
12534
12546
  }
12535
12547
  }
12536
- if (S.current.iMouse?.isNeeded) {
12537
- const B = N.getUniformLocation(
12548
+ if (E.current.iMouse?.isNeeded) {
12549
+ const B = S.getUniformLocation(
12538
12550
  w.current,
12539
12551
  it
12540
12552
  );
12541
- N.uniform4fv(B, S.current.iMouse.value);
12553
+ S.uniform4fv(B, E.current.iMouse.value);
12542
12554
  }
12543
- if (S.current.iChannelResolution?.isNeeded) {
12544
- const B = N.getUniformLocation(
12555
+ if (E.current.iChannelResolution?.isNeeded) {
12556
+ const B = S.getUniformLocation(
12545
12557
  w.current,
12546
12558
  ct
12547
12559
  );
12548
- N.uniform3fv(
12560
+ S.uniform3fv(
12549
12561
  B,
12550
- S.current.iChannelResolution.value
12562
+ E.current.iChannelResolution.value
12551
12563
  );
12552
12564
  }
12553
- if (S.current.iDeviceOrientation?.isNeeded) {
12554
- const B = N.getUniformLocation(
12565
+ if (E.current.iDeviceOrientation?.isNeeded) {
12566
+ const B = S.getUniformLocation(
12555
12567
  w.current,
12556
12568
  lt
12557
12569
  );
12558
- N.uniform4fv(
12570
+ S.uniform4fv(
12559
12571
  B,
12560
- S.current.iDeviceOrientation.value
12572
+ E.current.iDeviceOrientation.value
12561
12573
  );
12562
12574
  }
12563
- if (S.current.iTime?.isNeeded) {
12564
- const B = N.getUniformLocation(
12575
+ if (E.current.iTime?.isNeeded) {
12576
+ const B = S.getUniformLocation(
12565
12577
  w.current,
12566
12578
  rt
12567
12579
  );
12568
- N.uniform1f(B, y.current += F);
12580
+ S.uniform1f(B, L.current += N);
12569
12581
  }
12570
- if (S.current.iTimeDelta?.isNeeded) {
12571
- const B = N.getUniformLocation(
12582
+ if (E.current.iTimeDelta?.isNeeded) {
12583
+ const B = S.getUniformLocation(
12572
12584
  w.current,
12573
12585
  ot
12574
12586
  );
12575
- N.uniform1f(B, F);
12587
+ S.uniform1f(B, N);
12576
12588
  }
12577
- if (S.current.iDate?.isNeeded) {
12578
- const B = /* @__PURE__ */ new Date(), U = B.getMonth() + 1, ae = B.getDate(), J = B.getFullYear(), we = B.getHours() * 60 * 60 + B.getMinutes() * 60 + B.getSeconds() + B.getMilliseconds() * 1e-3, Ee = N.getUniformLocation(
12589
+ if (E.current.iDate?.isNeeded) {
12590
+ const B = /* @__PURE__ */ new Date(), U = B.getMonth() + 1, ae = B.getDate(), J = B.getFullYear(), we = B.getHours() * 60 * 60 + B.getMinutes() * 60 + B.getSeconds() + B.getMilliseconds() * 1e-3, Ee = S.getUniformLocation(
12579
12591
  w.current,
12580
12592
  nt
12581
12593
  );
12582
- N.uniform4fv(Ee, [J, U, ae, we]);
12594
+ S.uniform4fv(Ee, [J, U, ae, we]);
12583
12595
  }
12584
- if (S.current.iFrame?.isNeeded) {
12585
- const B = N.getUniformLocation(
12596
+ if (E.current.iFrame?.isNeeded) {
12597
+ const B = S.getUniformLocation(
12586
12598
  w.current,
12587
12599
  st
12588
- ), U = S.current.iFrame.value;
12589
- N.uniform1i(B, U), S.current.iFrame.value = U + 1;
12600
+ ), U = E.current.iFrame.value;
12601
+ S.uniform1i(B, U), E.current.iFrame.value = U + 1;
12590
12602
  }
12591
- if (H.current.length > 0)
12592
- for (let B = 0; B < H.current.length; B++) {
12593
- const U = H.current[B];
12603
+ if (A.current.length > 0)
12604
+ for (let B = 0; B < A.current.length; B++) {
12605
+ const U = A.current[B];
12594
12606
  if (!U) return;
12595
12607
  const { isVideo: ae, _webglTexture: J, source: we, flipY: Ee, isLoaded: Te } = U;
12596
12608
  if (!Te || !J || !we) return;
12597
- if (S.current[`iChannel${B}`]?.isNeeded) {
12609
+ if (E.current[`iChannel${B}`]?.isNeeded) {
12598
12610
  if (!w.current) return;
12599
- const Ce = N.getUniformLocation(
12611
+ const Ce = S.getUniformLocation(
12600
12612
  w.current,
12601
12613
  `iChannel${B}`
12602
12614
  );
12603
- N.activeTexture(N.TEXTURE0 + B), N.bindTexture(N.TEXTURE_2D, J), N.uniform1i(Ce, B), ae && U.updateTexture(
12615
+ S.activeTexture(S.TEXTURE0 + B), S.bindTexture(S.TEXTURE_2D, J), S.uniform1i(Ce, B), ae && U.updateTexture(
12604
12616
  J,
12605
12617
  we,
12606
12618
  Ee
@@ -12608,55 +12620,55 @@ ${N}`));
12608
12620
  }
12609
12621
  }
12610
12622
  }, oe = (M) => {
12611
- const N = C.current;
12612
- if (!N) return;
12613
- N.viewport(0, 0, N.drawingBufferWidth, N.drawingBufferHeight), N.clear(N.COLOR_BUFFER_BIT | N.DEPTH_BUFFER_BIT), N.bindBuffer(N.ARRAY_BUFFER, v.current), N.vertexAttribPointer(
12623
+ const S = C.current;
12624
+ if (!S) return;
12625
+ S.viewport(0, 0, S.drawingBufferWidth, S.drawingBufferHeight), S.clear(S.COLOR_BUFFER_BIT | S.DEPTH_BUFFER_BIT), S.bindBuffer(S.ARRAY_BUFFER, v.current), S.vertexAttribPointer(
12614
12626
  k.current ?? 0,
12615
12627
  3,
12616
- N.FLOAT,
12628
+ S.FLOAT,
12617
12629
  !1,
12618
12630
  0,
12619
12631
  0
12620
- ), ie(M), N.drawArrays(N.TRIANGLE_STRIP, 0, 4);
12621
- const F = S.current.iMouse?.value;
12622
- if (S.current.iMouse?.isNeeded && l !== 1 && Array.isArray(F)) {
12623
- const j = F[0] ?? 0, B = F[1] ?? 0;
12624
- F[0] = gt(j, L.current[0] ?? 0, l), F[1] = gt(B, L.current[1] ?? 0, l);
12632
+ ), ie(M), S.drawArrays(S.TRIANGLE_STRIP, 0, 4);
12633
+ const N = E.current.iMouse?.value;
12634
+ if (E.current.iMouse?.isNeeded && l !== 1 && Array.isArray(N)) {
12635
+ const j = N[0] ?? 0, B = N[1] ?? 0;
12636
+ N[0] = gt(j, b.current[0] ?? 0, l), N[1] = gt(B, b.current[1] ?? 0, l);
12625
12637
  }
12626
- V.current = requestAnimationFrame(oe);
12638
+ T.current = requestAnimationFrame(oe);
12627
12639
  }, se = () => {
12628
12640
  const M = { passive: !0 };
12629
- S.current.iMouse?.isNeeded && h.current && (h.current.addEventListener("mousemove", K, M), h.current.addEventListener("mouseout", O, M), h.current.addEventListener("mouseup", O, M), h.current.addEventListener("mousedown", re, M), h.current.addEventListener("touchmove", K, M), h.current.addEventListener("touchend", O, M), h.current.addEventListener("touchstart", re, M)), S.current.iDeviceOrientation?.isNeeded && window.addEventListener(
12641
+ E.current.iMouse?.isNeeded && h.current && (h.current.addEventListener("mousemove", K, M), h.current.addEventListener("mouseout", O, M), h.current.addEventListener("mouseup", O, M), h.current.addEventListener("mousedown", re, M), h.current.addEventListener("touchmove", K, M), h.current.addEventListener("touchend", O, M), h.current.addEventListener("touchstart", re, M)), E.current.iDeviceOrientation?.isNeeded && window.addEventListener(
12630
12642
  "deviceorientation",
12631
12643
  G,
12632
12644
  M
12633
- ), h.current && (A.current = new ResizeObserver(Z), A.current.observe(h.current), window.addEventListener("resize", Z, M));
12645
+ ), h.current && (y.current = new ResizeObserver(Z), y.current.observe(h.current), window.addEventListener("resize", Z, M));
12634
12646
  }, de = () => {
12635
12647
  const M = { passive: !0 };
12636
- S.current.iMouse?.isNeeded && h.current && (h.current.removeEventListener("mousemove", K, M), h.current.removeEventListener("mouseout", O, M), h.current.removeEventListener("mouseup", O, M), h.current.removeEventListener("mousedown", re, M), h.current.removeEventListener("touchmove", K, M), h.current.removeEventListener("touchend", O, M), h.current.removeEventListener("touchstart", re, M)), S.current.iDeviceOrientation?.isNeeded && window.removeEventListener(
12648
+ E.current.iMouse?.isNeeded && h.current && (h.current.removeEventListener("mousemove", K, M), h.current.removeEventListener("mouseout", O, M), h.current.removeEventListener("mouseup", O, M), h.current.removeEventListener("mousedown", re, M), h.current.removeEventListener("touchmove", K, M), h.current.removeEventListener("touchend", O, M), h.current.removeEventListener("touchstart", re, M)), E.current.iDeviceOrientation?.isNeeded && window.removeEventListener(
12637
12649
  "deviceorientation",
12638
12650
  G,
12639
12651
  M
12640
- ), A.current && (A.current.disconnect(), window.removeEventListener("resize", Z, M));
12652
+ ), y.current && (y.current.disconnect(), window.removeEventListener("resize", Z, M));
12641
12653
  };
12642
12654
  return X(() => {
12643
- R.current = n;
12655
+ F.current = n;
12644
12656
  }, [n]), X(() => {
12645
- const M = H.current;
12646
- function N() {
12657
+ const M = A.current;
12658
+ function S() {
12647
12659
  _();
12648
- const F = C.current;
12649
- F && h.current && (F.clearColor(...s), F.clearDepth(1), F.enable(F.DEPTH_TEST), F.depthFunc(F.LEQUAL), F.viewport(0, 0, h.current.width, h.current.height), h.current.height = h.current.clientHeight, h.current.width = h.current.clientWidth, W(), he(), Q(ge(e || r6), t || tt), z(), requestAnimationFrame(oe), se(), Z());
12660
+ const N = C.current;
12661
+ N && h.current && (N.clearColor(...s), N.clearDepth(1), N.enable(N.DEPTH_TEST), N.depthFunc(N.LEQUAL), N.viewport(0, 0, h.current.width, h.current.height), h.current.height = h.current.clientHeight, h.current.width = h.current.clientWidth, W(), he(), Q(ge(e || r6), t || tt), z(), requestAnimationFrame(oe), se(), Z());
12650
12662
  }
12651
- return requestAnimationFrame(N), () => {
12652
- const F = C.current;
12653
- if (F) {
12654
- if (F.getExtension("WEBGL_lose_context")?.loseContext(), F.useProgram(null), F.deleteProgram(w.current ?? null), M.length > 0)
12663
+ return requestAnimationFrame(S), () => {
12664
+ const N = C.current;
12665
+ if (N) {
12666
+ if (N.getExtension("WEBGL_lose_context")?.loseContext(), N.useProgram(null), N.deleteProgram(w.current ?? null), M.length > 0)
12655
12667
  for (const j of M)
12656
- F.deleteTexture(j._webglTexture);
12668
+ N.deleteTexture(j._webglTexture);
12657
12669
  w.current = null;
12658
12670
  }
12659
- de(), cancelAnimationFrame(V.current ?? 0);
12671
+ de(), cancelAnimationFrame(T.current ?? 0);
12660
12672
  };
12661
12673
  }, []), /* @__PURE__ */ r(
12662
12674
  "canvas",
@@ -13311,10 +13323,10 @@ const N6 = ({
13311
13323
  } = e, [f, g] = P(!1), [m, h] = P(!1), C = f || m, v = ye(), w = C && !!d, k = {
13312
13324
  duration: v ? 0 : 0.2,
13313
13325
  ease: [0.33, 1, 0.68, 1]
13314
- }, V = () => {
13326
+ }, T = () => {
13315
13327
  a?.();
13316
- }, T = (E) => {
13317
- E.currentTarget === E.target && (E.key === "Enter" || E.key === " ") && (E.preventDefault(), a?.());
13328
+ }, H = (R) => {
13329
+ R.currentTarget === R.target && (R.key === "Enter" || R.key === " ") && (R.preventDefault(), a?.());
13318
13330
  };
13319
13331
  return /* @__PURE__ */ c("div", { className: "relative", children: [
13320
13332
  i && /* @__PURE__ */ c(xe, { children: [
@@ -13356,8 +13368,8 @@ const N6 = ({
13356
13368
  a && me(),
13357
13369
  l
13358
13370
  ),
13359
- onClick: a ? V : void 0,
13360
- onKeyDown: a ? T : void 0,
13371
+ onClick: a ? T : void 0,
13372
+ onKeyDown: a ? H : void 0,
13361
13373
  onMouseEnter: () => g(!0),
13362
13374
  onMouseLeave: () => g(!1),
13363
13375
  onFocus: () => h(!0),
@@ -14259,10 +14271,10 @@ const R9 = ({
14259
14271
  }) => {
14260
14272
  const f = Y(), [g, m] = P("");
14261
14273
  X(() => {
14262
- const L = (H) => {
14263
- H.key === "Escape" && e();
14274
+ const b = (A) => {
14275
+ A.key === "Escape" && e();
14264
14276
  };
14265
- return document.addEventListener("keydown", L), () => document.removeEventListener("keydown", L);
14277
+ return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
14266
14278
  }, [e]);
14267
14279
  const h = ee(
14268
14280
  () => ({
@@ -14279,30 +14291,30 @@ const R9 = ({
14279
14291
  ]
14280
14292
  ), C = ee(() => {
14281
14293
  if (!g.trim()) return n;
14282
- const L = g.toLowerCase();
14283
- return n.filter((H) => H.title.toLowerCase().includes(L));
14294
+ const b = g.toLowerCase();
14295
+ return n.filter((A) => A.title.toLowerCase().includes(b));
14284
14296
  }, [n, g]), v = ee(
14285
- () => C.filter((L) => a.has(L.id)),
14297
+ () => C.filter((b) => a.has(b.id)),
14286
14298
  [C, a]
14287
14299
  ), w = ee(
14288
- () => C.filter((L) => !a.has(L.id)),
14300
+ () => C.filter((b) => !a.has(b.id)),
14289
14301
  [C, a]
14290
14302
  ), k = ee(
14291
14303
  () => K6(w),
14292
14304
  [w]
14293
- ), V = q(
14294
- (L, H) => {
14295
- t(L, H), e();
14305
+ ), T = q(
14306
+ (b, A) => {
14307
+ t(b, A), e();
14296
14308
  },
14297
14309
  [t, e]
14298
- ), T = q(() => {
14310
+ ), H = q(() => {
14299
14311
  o(), e();
14300
- }, [o, e]), E = q(
14301
- (L) => {
14302
- u(L);
14312
+ }, [o, e]), R = q(
14313
+ (b) => {
14314
+ u(b);
14303
14315
  },
14304
14316
  [u]
14305
- ), y = v.length > 0 || k.length > 0;
14317
+ ), L = v.length > 0 || k.length > 0;
14306
14318
  return Kt(
14307
14319
  /* @__PURE__ */ c(xe, { children: [
14308
14320
  /* @__PURE__ */ r(
@@ -14340,7 +14352,7 @@ const R9 = ({
14340
14352
  {
14341
14353
  type: "text",
14342
14354
  value: g,
14343
- onChange: (L) => m(L.target.value),
14355
+ onChange: (b) => m(b.target.value),
14344
14356
  placeholder: f.ai.searchChats,
14345
14357
  className: x(
14346
14358
  "w-full",
@@ -14358,7 +14370,7 @@ const R9 = ({
14358
14370
  variant: "ghost",
14359
14371
  size: "md",
14360
14372
  className: "py-1 [&>div>span>span]:w-full",
14361
- onClick: T,
14373
+ onClick: H,
14362
14374
  children: /* @__PURE__ */ c("div", { className: "flex w-full items-center gap-2", children: [
14363
14375
  /* @__PURE__ */ r(le, { icon: E1, color: "default", size: "md" }),
14364
14376
  /* @__PURE__ */ r(ce, { lines: 1, className: "text-left", children: f.ai.startNewChat })
@@ -14367,31 +14379,31 @@ const R9 = ({
14367
14379
  ),
14368
14380
  s && /* @__PURE__ */ r(J6, {}),
14369
14381
  !s && i && /* @__PURE__ */ r("p", { className: "py-8 text-center text-base text-f1-foreground-tertiary", children: i }),
14370
- !s && !i && !y && /* @__PURE__ */ r("p", { className: "py-8 text-center text-base text-f1-foreground-tertiary", children: f.ai.noPreviousChats }),
14382
+ !s && !i && !L && /* @__PURE__ */ r("p", { className: "py-8 text-center text-base text-f1-foreground-tertiary", children: f.ai.noPreviousChats }),
14371
14383
  !s && !i && v.length > 0 && /* @__PURE__ */ r(
14372
14384
  Ct,
14373
14385
  {
14374
14386
  label: f.ai.pinnedChats,
14375
14387
  threads: v,
14376
14388
  pinnedIds: a,
14377
- onSelect: V,
14389
+ onSelect: T,
14378
14390
  onPin: d,
14379
14391
  onUnpin: l,
14380
- onDelete: E
14392
+ onDelete: R
14381
14393
  }
14382
14394
  ),
14383
- !s && !i && k.map((L) => /* @__PURE__ */ r(
14395
+ !s && !i && k.map((b) => /* @__PURE__ */ r(
14384
14396
  Ct,
14385
14397
  {
14386
- label: h[L.key],
14387
- threads: L.threads,
14398
+ label: h[b.key],
14399
+ threads: b.threads,
14388
14400
  pinnedIds: a,
14389
- onSelect: V,
14401
+ onSelect: T,
14390
14402
  onPin: d,
14391
14403
  onUnpin: l,
14392
- onDelete: E
14404
+ onDelete: R
14393
14405
  },
14394
- L.key
14406
+ b.key
14395
14407
  ))
14396
14408
  ] })
14397
14409
  ]