rgb-curve 1.0.0

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 ADDED
@@ -0,0 +1,793 @@
1
+ import { jsx as W, jsxs as J } from "react/jsx-runtime";
2
+ import { useState as N, useRef as K, useCallback as M, useEffect as z, memo as Q, useMemo as O, forwardRef as oe, useImperativeHandle as te } from "react";
3
+ function H(n, o, e) {
4
+ return Math.min(Math.max(n, o), e);
5
+ }
6
+ function _() {
7
+ return [
8
+ { x: 0, y: 0 },
9
+ { x: 255, y: 255 }
10
+ ];
11
+ }
12
+ function U() {
13
+ return {
14
+ master: _(),
15
+ red: _(),
16
+ green: _(),
17
+ blue: _()
18
+ };
19
+ }
20
+ function S(n) {
21
+ return [...n].sort((o, e) => o.x - e.x);
22
+ }
23
+ function V(n, o) {
24
+ const e = S(n), r = e.length;
25
+ if (r === 0) return o;
26
+ if (r === 1 || o <= e[0].x) return e[0].y;
27
+ if (o >= e[r - 1].x) return e[r - 1].y;
28
+ let t = 0;
29
+ for (; t < r - 1 && e[t + 1].x < o; )
30
+ t++;
31
+ const g = e[t].x, d = e[t + 1].x, v = e[t].y, i = e[t + 1].y, s = d - g, a = i - v;
32
+ if (s === 0) return v;
33
+ let b, f;
34
+ if (t === 0)
35
+ b = a / s;
36
+ else {
37
+ const y = g - e[t - 1].x, p = v - e[t - 1].y;
38
+ b = y === 0 ? 0 : (a / s + p / y) / 2;
39
+ }
40
+ if (t === r - 2)
41
+ f = a / s;
42
+ else {
43
+ const y = e[t + 2].x - d, p = e[t + 2].y - i;
44
+ f = y === 0 ? 0 : (a / s + p / y) / 2;
45
+ }
46
+ const h = a / s;
47
+ if (h === 0)
48
+ b = 0, f = 0;
49
+ else {
50
+ const y = b / h, p = f / h;
51
+ y < 0 && (b = 0), p < 0 && (f = 0);
52
+ const c = y * y + p * p;
53
+ if (c > 9) {
54
+ const P = 3 / Math.sqrt(c);
55
+ b = P * y * h, f = P * p * h;
56
+ }
57
+ }
58
+ const C = (o - g) / s, m = C * C, k = m * C, I = 2 * k - 3 * m + 1, l = k - 2 * m + C, u = -2 * k + 3 * m, w = k - m, T = I * v + l * s * b + u * i + w * s * f;
59
+ return H(Math.round(T), 0, 255);
60
+ }
61
+ function Z(n, o) {
62
+ const e = S(n), r = e.length;
63
+ if (r === 0) return o;
64
+ if (r === 1 || o <= e[0].x) return e[0].y;
65
+ if (o >= e[r - 1].x) return e[r - 1].y;
66
+ let t = 0;
67
+ for (; t < r - 1 && e[t + 1].x < o; )
68
+ t++;
69
+ const g = e[Math.max(0, t - 1)], d = e[t], v = e[Math.min(r - 1, t + 1)], i = e[Math.min(r - 1, t + 2)], s = v.x - d.x;
70
+ if (s === 0) return d.y;
71
+ const a = (o - d.x) / s, b = a * a, f = b * a, h = 0.5 * (2 * d.y + (-g.y + v.y) * a + (2 * g.y - 5 * d.y + 4 * v.y - i.y) * b + (-g.y + 3 * d.y - 3 * v.y + i.y) * f);
72
+ return H(Math.round(h), 0, 255);
73
+ }
74
+ function G(n, o = "monotone") {
75
+ const e = new Uint8Array(256), r = o === "monotone" ? V : Z;
76
+ for (let t = 0; t < 256; t++)
77
+ e[t] = r(n, t);
78
+ return e;
79
+ }
80
+ function q(n, o = "monotone") {
81
+ return {
82
+ master: G(n.master, o),
83
+ red: G(n.red, o),
84
+ green: G(n.green, o),
85
+ blue: G(n.blue, o)
86
+ };
87
+ }
88
+ function Ce(n, o, e, r) {
89
+ let t = r.red[H(n, 0, 255)], g = r.green[H(o, 0, 255)], d = r.blue[H(e, 0, 255)];
90
+ return t = r.master[t], g = r.master[g], d = r.master[d], [t, g, d];
91
+ }
92
+ function re(n, o, e) {
93
+ const r = n.x - o.x, t = n.y - o.y;
94
+ return Math.sqrt(r * r + t * t) <= e;
95
+ }
96
+ const se = ["master", "red", "green", "blue"], ae = {
97
+ master: { label: "Master", shortLabel: "RGB" },
98
+ red: { label: "Red", shortLabel: "R" },
99
+ green: { label: "Green", shortLabel: "G" },
100
+ blue: { label: "Blue", shortLabel: "B" }
101
+ }, ie = 300, le = 300, R = {
102
+ container: {
103
+ display: "flex",
104
+ flexDirection: "column",
105
+ gap: "12px",
106
+ padding: "16px",
107
+ backgroundColor: "#1a1a1a",
108
+ borderRadius: "12px",
109
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
110
+ },
111
+ canvasWrapper: {
112
+ position: "relative",
113
+ borderRadius: "8px",
114
+ overflow: "hidden",
115
+ backgroundColor: "#0d0d0d"
116
+ },
117
+ grid: {
118
+ color: "#2a2a2a",
119
+ lineWidth: 1,
120
+ subdivisions: 4,
121
+ showDiagonal: !0,
122
+ diagonalColor: "#333333"
123
+ },
124
+ curve: {
125
+ master: {
126
+ color: "#e0e0e0",
127
+ width: 2,
128
+ shadowColor: "rgba(255, 255, 255, 0.3)",
129
+ shadowBlur: 4
130
+ },
131
+ red: {
132
+ color: "#ff6b6b",
133
+ width: 2,
134
+ shadowColor: "rgba(255, 107, 107, 0.4)",
135
+ shadowBlur: 4
136
+ },
137
+ green: {
138
+ color: "#51cf66",
139
+ width: 2,
140
+ shadowColor: "rgba(81, 207, 102, 0.4)",
141
+ shadowBlur: 4
142
+ },
143
+ blue: {
144
+ color: "#339af0",
145
+ width: 2,
146
+ shadowColor: "rgba(51, 154, 240, 0.4)",
147
+ shadowBlur: 4
148
+ }
149
+ },
150
+ controlPoint: {
151
+ radius: 6,
152
+ fill: "#ffffff",
153
+ stroke: "#000000",
154
+ strokeWidth: 2,
155
+ activeFill: "#ffd43b",
156
+ activeStroke: "#000000",
157
+ hoverScale: 1.2
158
+ },
159
+ tabs: {
160
+ background: "#252525",
161
+ borderRadius: 8,
162
+ gap: 4,
163
+ tab: {
164
+ padding: "8px 16px",
165
+ borderRadius: 6,
166
+ fontSize: 13,
167
+ fontWeight: 500,
168
+ color: "#808080",
169
+ background: "transparent",
170
+ hoverBackground: "#333333",
171
+ activeColor: "#ffffff",
172
+ activeBackground: "#404040"
173
+ }
174
+ },
175
+ histogram: {
176
+ show: !1,
177
+ opacity: 0.3,
178
+ fillColor: "#666666"
179
+ }
180
+ }, ce = {
181
+ master: "#e0e0e0",
182
+ red: "#ff6b6b",
183
+ green: "#51cf66",
184
+ blue: "#339af0"
185
+ }, ue = 12, Y = 5;
186
+ function de(n) {
187
+ const {
188
+ points: o,
189
+ channel: e,
190
+ width: r,
191
+ height: t,
192
+ disabled: g = !1,
193
+ onAddPoint: d,
194
+ onRemovePoint: v,
195
+ onUpdatePoint: i
196
+ } = n, [s, a] = N(null), [b, f] = N(
197
+ null
198
+ ), h = K(!1), C = M(
199
+ (p, c) => ({
200
+ x: Math.round(p / r * 255),
201
+ y: Math.round((1 - c / t) * 255)
202
+ // Flip Y axis
203
+ }),
204
+ [r, t]
205
+ ), m = M(
206
+ (p, c) => ({
207
+ x: p / 255 * r,
208
+ y: (1 - c / 255) * t
209
+ // Flip Y axis
210
+ }),
211
+ [r, t]
212
+ ), k = M(
213
+ (p, c) => {
214
+ const P = S(o);
215
+ for (let x = 0; x < P.length; x++) {
216
+ const L = m(P[x].x, P[x].y);
217
+ if (re(
218
+ { x: p, y: c },
219
+ L,
220
+ ue
221
+ ))
222
+ return x;
223
+ }
224
+ return null;
225
+ },
226
+ [o, m]
227
+ ), I = M(
228
+ (p) => {
229
+ const c = p.currentTarget.getBoundingClientRect();
230
+ return {
231
+ x: p.clientX - c.left,
232
+ y: p.clientY - c.top
233
+ };
234
+ },
235
+ []
236
+ ), l = M(
237
+ (p) => {
238
+ if (g) return;
239
+ const c = I(p), P = k(c.x, c.y);
240
+ if (P !== null)
241
+ a(P), h.current = !0;
242
+ else {
243
+ const x = C(c.x, c.y);
244
+ d(e, x);
245
+ }
246
+ },
247
+ [
248
+ g,
249
+ I,
250
+ k,
251
+ C,
252
+ e,
253
+ d
254
+ ]
255
+ ), u = M(
256
+ (p) => {
257
+ if (g) return;
258
+ const c = I(p);
259
+ if (h.current && s !== null) {
260
+ const P = C(c.x, c.y);
261
+ i(e, s, P);
262
+ } else {
263
+ const P = k(c.x, c.y);
264
+ f(P);
265
+ }
266
+ },
267
+ [
268
+ g,
269
+ I,
270
+ s,
271
+ C,
272
+ e,
273
+ i,
274
+ k
275
+ ]
276
+ ), w = M(() => {
277
+ h.current = !1, a(null);
278
+ }, []), T = M(() => {
279
+ h.current = !1, a(null), f(null);
280
+ }, []), y = M(
281
+ (p) => {
282
+ if (g) return;
283
+ const c = I(p), P = k(c.x, c.y);
284
+ P !== null && v(e, P);
285
+ },
286
+ [g, I, k, e, v]
287
+ );
288
+ return z(() => {
289
+ const p = () => {
290
+ h.current = !1, a(null);
291
+ };
292
+ return window.addEventListener("mouseup", p), () => {
293
+ window.removeEventListener("mouseup", p);
294
+ };
295
+ }, []), {
296
+ activePointIndex: s,
297
+ hoveredPointIndex: b,
298
+ handleMouseDown: l,
299
+ handleMouseMove: u,
300
+ handleMouseUp: w,
301
+ handleMouseLeave: T,
302
+ handleDoubleClick: y
303
+ };
304
+ }
305
+ const fe = Q(function({
306
+ width: o,
307
+ height: e,
308
+ points: r,
309
+ channel: t,
310
+ gridStyle: g = R.grid,
311
+ curveStyle: d,
312
+ controlPointStyle: v = R.controlPoint,
313
+ histogramStyle: i = R.histogram,
314
+ histogramData: s,
315
+ wrapperStyle: a = R.canvasWrapper,
316
+ disabled: b = !1,
317
+ interpolation: f = "monotone",
318
+ onAddPoint: h,
319
+ onRemovePoint: C,
320
+ onUpdatePoint: m
321
+ }) {
322
+ const k = K(null), {
323
+ activePointIndex: I,
324
+ hoveredPointIndex: l,
325
+ handleMouseDown: u,
326
+ handleMouseMove: w,
327
+ handleMouseUp: T,
328
+ handleMouseLeave: y,
329
+ handleDoubleClick: p
330
+ } = de({
331
+ points: r,
332
+ channel: t,
333
+ width: o,
334
+ height: e,
335
+ disabled: b,
336
+ onAddPoint: h,
337
+ onRemovePoint: C,
338
+ onUpdatePoint: m
339
+ }), c = typeof window < "u" && window.devicePixelRatio || 1, P = M(() => {
340
+ const x = k.current;
341
+ if (!x) return;
342
+ const L = x.getContext("2d");
343
+ if (!L) return;
344
+ L.clearRect(0, 0, o * c, e * c), L.save(), L.scale(c, c), i != null && i.show && s && be(L, s, i, o, e), ve(L, g, o, e), pe(L, r, d, o, e, f === "monotone" ? V : Z), ge(
345
+ L,
346
+ r,
347
+ v,
348
+ o,
349
+ e,
350
+ I,
351
+ l
352
+ ), L.restore();
353
+ }, [
354
+ o,
355
+ e,
356
+ c,
357
+ r,
358
+ g,
359
+ d,
360
+ v,
361
+ i,
362
+ s,
363
+ f,
364
+ I,
365
+ l
366
+ ]);
367
+ return z(() => {
368
+ P();
369
+ }, [P]), z(() => {
370
+ const x = k.current;
371
+ x && (x.width = o * c, x.height = e * c, x.style.width = `${o}px`, x.style.height = `${e}px`, P());
372
+ }, [o, e, c, P]), /* @__PURE__ */ W("div", { style: a, children: /* @__PURE__ */ W(
373
+ "canvas",
374
+ {
375
+ ref: k,
376
+ style: {
377
+ display: "block",
378
+ cursor: b ? "not-allowed" : l !== null ? "grab" : "crosshair"
379
+ },
380
+ onMouseDown: u,
381
+ onMouseMove: w,
382
+ onMouseUp: T,
383
+ onMouseLeave: y,
384
+ onDoubleClick: p
385
+ }
386
+ ) });
387
+ });
388
+ function ve(n, o, e, r) {
389
+ const { color: t, lineWidth: g, subdivisions: d, showDiagonal: v, diagonalColor: i } = {
390
+ ...R.grid,
391
+ ...o
392
+ };
393
+ n.strokeStyle = t, n.lineWidth = g;
394
+ const s = e / d;
395
+ for (let a = 1; a < d; a++) {
396
+ const b = a * s;
397
+ n.beginPath(), n.moveTo(b, 0), n.lineTo(b, r), n.stroke(), n.beginPath(), n.moveTo(0, b), n.lineTo(e, b), n.stroke();
398
+ }
399
+ n.strokeRect(0.5, 0.5, e - 1, r - 1), v && (n.strokeStyle = i, n.setLineDash([4, 4]), n.beginPath(), n.moveTo(0, r), n.lineTo(e, 0), n.stroke(), n.setLineDash([]));
400
+ }
401
+ function be(n, o, e, r, t) {
402
+ const { opacity: g, fillColor: d } = { ...R.histogram, ...e };
403
+ let v = 0;
404
+ for (let s = 0; s < o.length; s++)
405
+ o[s] > v && (v = o[s]);
406
+ if (v === 0) return;
407
+ n.fillStyle = d, n.globalAlpha = g;
408
+ const i = r / 256;
409
+ for (let s = 0; s < 256; s++) {
410
+ const a = o[s] / v * t, b = s * i;
411
+ n.fillRect(b, t - a, i, a);
412
+ }
413
+ n.globalAlpha = 1;
414
+ }
415
+ function pe(n, o, e, r, t, g) {
416
+ const d = S(o);
417
+ if (d.length === 0) return;
418
+ const { color: v, width: i, shadowColor: s, shadowBlur: a } = {
419
+ ...R.curve.master,
420
+ ...e
421
+ };
422
+ s && a && (n.shadowColor = s, n.shadowBlur = a), n.strokeStyle = v, n.lineWidth = i, n.lineCap = "round", n.lineJoin = "round", n.beginPath();
423
+ for (let b = 0; b <= r; b++) {
424
+ const f = b / r * 255, h = g(d, f), C = t - h / 255 * t;
425
+ b === 0 ? n.moveTo(b, C) : n.lineTo(b, C);
426
+ }
427
+ n.stroke(), n.shadowColor = "transparent", n.shadowBlur = 0;
428
+ }
429
+ function ge(n, o, e, r, t, g, d) {
430
+ const v = S(o), {
431
+ radius: i,
432
+ fill: s,
433
+ stroke: a,
434
+ strokeWidth: b,
435
+ activeFill: f,
436
+ activeStroke: h,
437
+ hoverScale: C
438
+ } = {
439
+ ...R.controlPoint,
440
+ ...e
441
+ };
442
+ v.forEach((m, k) => {
443
+ const I = m.x / 255 * r, l = t - m.y / 255 * t, u = k === g, y = i * (k === d || u ? C : 1);
444
+ n.beginPath(), n.arc(I, l, y, 0, Math.PI * 2), n.fillStyle = u ? f : s, n.fill(), n.strokeStyle = u ? h : a, n.lineWidth = b, n.stroke();
445
+ });
446
+ }
447
+ const he = Q(function({
448
+ activeChannel: o,
449
+ onChange: e,
450
+ style: r,
451
+ disabled: t = !1
452
+ }) {
453
+ const [g, d] = N(null), v = {
454
+ ...R.tabs,
455
+ ...r,
456
+ tab: {
457
+ ...R.tabs.tab,
458
+ ...r == null ? void 0 : r.tab
459
+ }
460
+ }, i = {
461
+ display: "flex",
462
+ alignItems: "center",
463
+ gap: v.gap,
464
+ padding: "4px",
465
+ backgroundColor: v.background,
466
+ borderRadius: v.borderRadius
467
+ }, s = M(
468
+ (f) => {
469
+ const h = f === o, C = f === g, m = v.tab;
470
+ return {
471
+ display: "flex",
472
+ alignItems: "center",
473
+ gap: "6px",
474
+ padding: m.padding,
475
+ borderRadius: m.borderRadius,
476
+ fontSize: m.fontSize,
477
+ fontWeight: m.fontWeight,
478
+ color: h ? m.activeColor : m.color,
479
+ backgroundColor: h ? m.activeBackground : C ? m.hoverBackground : m.background,
480
+ border: "none",
481
+ cursor: t ? "not-allowed" : "pointer",
482
+ transition: "all 0.15s ease",
483
+ opacity: t ? 0.5 : 1,
484
+ outline: "none"
485
+ };
486
+ },
487
+ [o, g, v.tab, t]
488
+ ), a = (f) => {
489
+ const h = ce[f];
490
+ return {
491
+ width: "8px",
492
+ height: "8px",
493
+ borderRadius: "50%",
494
+ backgroundColor: h,
495
+ boxShadow: f === o ? `0 0 6px ${h}` : "none",
496
+ transition: "box-shadow 0.15s ease"
497
+ };
498
+ }, b = M(
499
+ (f) => {
500
+ t || e(f);
501
+ },
502
+ [t, e]
503
+ );
504
+ return /* @__PURE__ */ W("div", { style: i, role: "tablist", children: se.map((f) => /* @__PURE__ */ J(
505
+ "button",
506
+ {
507
+ role: "tab",
508
+ "aria-selected": f === o,
509
+ "aria-disabled": t,
510
+ style: s(f),
511
+ onClick: () => b(f),
512
+ onMouseEnter: () => d(f),
513
+ onMouseLeave: () => d(null),
514
+ children: [
515
+ /* @__PURE__ */ W("span", { style: a(f) }),
516
+ /* @__PURE__ */ W("span", { children: ae[f].label })
517
+ ]
518
+ },
519
+ f
520
+ )) });
521
+ });
522
+ function me(n = {}) {
523
+ const {
524
+ defaultPoints: o,
525
+ controlledPoints: e,
526
+ interpolation: r = "monotone",
527
+ onChange: t
528
+ } = n, g = O(() => {
529
+ const l = U();
530
+ return o ? {
531
+ master: o.master || l.master,
532
+ red: o.red || l.red,
533
+ green: o.green || l.green,
534
+ blue: o.blue || l.blue
535
+ } : l;
536
+ }, [o]), [d, v] = N(g), i = O(() => {
537
+ if (e) {
538
+ const l = U();
539
+ return {
540
+ master: e.master || l.master,
541
+ red: e.red || l.red,
542
+ green: e.green || l.green,
543
+ blue: e.blue || l.blue
544
+ };
545
+ }
546
+ return d;
547
+ }, [e, d]), s = O(() => q(i, r), [i, r]), a = M(
548
+ (l) => {
549
+ if (e || v(l), t) {
550
+ const u = q(l, r);
551
+ t(l, u);
552
+ }
553
+ },
554
+ [e, t, r]
555
+ ), b = M(
556
+ (l, u) => {
557
+ const w = i[l], T = S(w);
558
+ for (const c of T)
559
+ if (Math.abs(c.x - u.x) < Y)
560
+ return;
561
+ const y = S([...w, u]), p = {
562
+ ...i,
563
+ [l]: y
564
+ };
565
+ a(p);
566
+ },
567
+ [i, a]
568
+ ), f = M(
569
+ (l, u) => {
570
+ const w = i[l];
571
+ if (w.length <= 2) return;
572
+ const T = S(w);
573
+ if (u === 0 || u === T.length - 1) return;
574
+ const y = T.filter((c, P) => P !== u), p = {
575
+ ...i,
576
+ [l]: y
577
+ };
578
+ a(p);
579
+ },
580
+ [i, a]
581
+ ), h = M(
582
+ (l, u, w) => {
583
+ const T = S(i[l]), y = u === 0, p = u === T.length - 1;
584
+ let c = w.x;
585
+ if (y)
586
+ c = 0;
587
+ else if (p)
588
+ c = 255;
589
+ else {
590
+ const A = T[u - 1].x + Y, E = T[u + 1].x - Y;
591
+ c = H(c, A, E);
592
+ }
593
+ const P = H(w.y, 0, 255), x = T.map(
594
+ (A, E) => E === u ? { x: c, y: P } : A
595
+ ), L = {
596
+ ...i,
597
+ [l]: x
598
+ };
599
+ a(L);
600
+ },
601
+ [i, a]
602
+ ), C = M(
603
+ (l) => {
604
+ const u = U(), w = {
605
+ ...i,
606
+ [l]: u[l]
607
+ };
608
+ a(w);
609
+ },
610
+ [i, a]
611
+ ), m = M(() => {
612
+ const l = U();
613
+ a(l);
614
+ }, [a]), k = M(
615
+ (l, u) => {
616
+ const w = {
617
+ ...i,
618
+ [l]: S(u)
619
+ };
620
+ a(w);
621
+ },
622
+ [i, a]
623
+ ), I = M(
624
+ (l) => {
625
+ const u = U(), w = {
626
+ master: S(l.master || u.master),
627
+ red: S(l.red || u.red),
628
+ green: S(l.green || u.green),
629
+ blue: S(l.blue || u.blue)
630
+ };
631
+ a(w);
632
+ },
633
+ [a]
634
+ );
635
+ return {
636
+ points: i,
637
+ lut: s,
638
+ addPoint: b,
639
+ removePoint: f,
640
+ updatePoint: h,
641
+ resetChannel: C,
642
+ resetAll: m,
643
+ setChannelPoints: k,
644
+ setAllPoints: I
645
+ };
646
+ }
647
+ const we = oe(
648
+ function({
649
+ width: o = ie,
650
+ height: e = le,
651
+ defaultPoints: r,
652
+ points: t,
653
+ defaultChannel: g = "master",
654
+ activeChannel: d,
655
+ onChange: v,
656
+ onChannelChange: i,
657
+ styles: s = {},
658
+ showTabs: a = !0,
659
+ showHistogram: b = !1,
660
+ histogramData: f,
661
+ disabled: h = !1,
662
+ className: C,
663
+ interpolation: m = "monotone"
664
+ }, k) {
665
+ const [I, l] = N(g), u = d ?? I, w = M(
666
+ (B, F) => {
667
+ v && v({
668
+ points: B,
669
+ lut: F,
670
+ activeChannel: u
671
+ });
672
+ },
673
+ [v, u]
674
+ ), {
675
+ points: T,
676
+ lut: y,
677
+ addPoint: p,
678
+ removePoint: c,
679
+ updatePoint: P,
680
+ resetChannel: x,
681
+ resetAll: L,
682
+ setAllPoints: A
683
+ } = me({
684
+ defaultPoints: r,
685
+ controlledPoints: t,
686
+ interpolation: m,
687
+ onChange: w
688
+ }), E = M(
689
+ (B) => {
690
+ d || l(B), i && i(B);
691
+ },
692
+ [d, i]
693
+ );
694
+ te(
695
+ k,
696
+ () => ({
697
+ reset: L,
698
+ resetChannel: x,
699
+ getLUT: () => y,
700
+ getPoints: () => T,
701
+ setPoints: A
702
+ }),
703
+ [L, x, y, T, A]
704
+ );
705
+ const D = O(() => {
706
+ var B, F, X, $, j;
707
+ return {
708
+ container: { ...R.container, ...s.container },
709
+ canvasWrapper: {
710
+ ...R.canvasWrapper,
711
+ ...s.canvasWrapper
712
+ },
713
+ grid: { ...R.grid, ...s.grid },
714
+ curve: {
715
+ master: { ...R.curve.master, ...(B = s.curve) == null ? void 0 : B.master },
716
+ red: { ...R.curve.red, ...(F = s.curve) == null ? void 0 : F.red },
717
+ green: { ...R.curve.green, ...(X = s.curve) == null ? void 0 : X.green },
718
+ blue: { ...R.curve.blue, ...($ = s.curve) == null ? void 0 : $.blue }
719
+ },
720
+ controlPoint: {
721
+ ...R.controlPoint,
722
+ ...s.controlPoint
723
+ },
724
+ tabs: {
725
+ ...R.tabs,
726
+ ...s.tabs,
727
+ tab: { ...R.tabs.tab, ...(j = s.tabs) == null ? void 0 : j.tab }
728
+ },
729
+ histogram: { ...R.histogram, ...s.histogram }
730
+ };
731
+ }, [s]), ee = D.curve[u], ne = {
732
+ ...D.container,
733
+ width: "fit-content"
734
+ };
735
+ return /* @__PURE__ */ J("div", { style: ne, className: C, children: [
736
+ a && /* @__PURE__ */ W(
737
+ he,
738
+ {
739
+ activeChannel: u,
740
+ onChange: E,
741
+ style: D.tabs,
742
+ disabled: h
743
+ }
744
+ ),
745
+ /* @__PURE__ */ W(
746
+ fe,
747
+ {
748
+ width: o,
749
+ height: e,
750
+ points: T[u],
751
+ channel: u,
752
+ gridStyle: D.grid,
753
+ curveStyle: ee,
754
+ controlPointStyle: D.controlPoint,
755
+ histogramStyle: {
756
+ ...D.histogram,
757
+ show: b
758
+ },
759
+ histogramData: f,
760
+ wrapperStyle: D.canvasWrapper,
761
+ disabled: h,
762
+ interpolation: m,
763
+ onAddPoint: p,
764
+ onRemovePoint: c,
765
+ onUpdatePoint: P
766
+ }
767
+ )
768
+ ] });
769
+ }
770
+ );
771
+ export {
772
+ se as CHANNELS,
773
+ ce as CHANNEL_COLORS,
774
+ ae as CHANNEL_INFO,
775
+ he as ChannelTabs,
776
+ fe as CurveCanvas,
777
+ le as DEFAULT_HEIGHT,
778
+ R as DEFAULT_STYLES,
779
+ ie as DEFAULT_WIDTH,
780
+ we as RGBCurve,
781
+ Ce as applyLUT,
782
+ Z as catmullRomInterpolation,
783
+ H as clamp,
784
+ G as generateChannelLUT,
785
+ q as generateLUT,
786
+ U as getDefaultChannelPoints,
787
+ _ as getDefaultPoints,
788
+ V as monotoneCubicInterpolation,
789
+ S as sortPoints,
790
+ de as useCanvasInteraction,
791
+ me as useCurvePoints
792
+ };
793
+ //# sourceMappingURL=index.mjs.map