@kolkrabbi/design-editor 0.13.0 → 0.14.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.
@@ -0,0 +1,2958 @@
1
+ import { B as e, C as t, H as n, M as r, S as i, a, c as o, d as s, en as c, f as l, l as u, n as d, o as f, r as p, s as m, t as h, tn as g, u as _, zt as v } from "./EditorIcon-BbFMmc1G.js";
2
+ import { A as ee, F as y, I as b, L as te, M as x, N as S, P as C, Q as w, R as ne, X as re, Y as ie, Z as T, a as ae, c as oe, d as E, f as D, i as O, j as k, l as A, n as j, o as se, p as ce, s as M, u as le } from "./registry-C7rLJN2U.js";
3
+ import { a as ue, i as de, n as N, t as fe, y as P } from "./TreePicker-DlEXH2kw.js";
4
+ import { n as F, t as I } from "./useLayerEdit-BElo4uVW.js";
5
+ import { i as pe, t as me } from "./RuleRow-D0nV-GvB.js";
6
+ import { Button as L, Dropdown as R, Input as he, LabeledControl as z, LabeledControlSection as ge, SegmentedToggle as _e, SettingsRow as ve, Slider as B, ViewToggle as ye } from "@kolkrabbi/kol-component";
7
+ import { useEffect as be, useRef as xe, useState as Se } from "react";
8
+ import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
9
+ //#region src/loops/taxonomy.js
10
+ var Ce = [
11
+ {
12
+ label: "Scanline",
13
+ groups: ["scanline"]
14
+ },
15
+ {
16
+ label: "Pattern",
17
+ groups: ["pattern"]
18
+ },
19
+ {
20
+ label: "Loops",
21
+ groups: [
22
+ "shape",
23
+ "field",
24
+ "patternloop"
25
+ ]
26
+ },
27
+ {
28
+ label: "Math",
29
+ groups: ["math"]
30
+ },
31
+ {
32
+ label: "Penrose",
33
+ groups: ["penrose"]
34
+ },
35
+ {
36
+ label: "Drift",
37
+ groups: ["drift"]
38
+ },
39
+ {
40
+ label: "Gradients",
41
+ groups: ["gradients"]
42
+ },
43
+ {
44
+ label: "Soft Forms",
45
+ groups: ["softforms"]
46
+ },
47
+ {
48
+ label: "Soft Forms 3D",
49
+ groups: ["softforms3d"]
50
+ },
51
+ {
52
+ label: "3D Scene",
53
+ groups: [
54
+ "scene",
55
+ "ribbon",
56
+ "forms",
57
+ "environment",
58
+ "abstract"
59
+ ],
60
+ labels: { scene: "Primitive" }
61
+ }
62
+ ], we = [{
63
+ label: "Para Type",
64
+ groups: ["paratype"]
65
+ }], Te = Ce, Ee = {
66
+ optic: "Pattern · Effects",
67
+ paratype: "Para Type · Misc",
68
+ distress: "Distressor · Vector",
69
+ modulator: "Modulator · Vector"
70
+ }, De = Object.fromEntries(ee.params.map((e) => [e.key, e.default]));
71
+ function Oe(e) {
72
+ let t = { ...De };
73
+ for (let n of Object.keys(De)) {
74
+ let r = e[n];
75
+ r != null && typeof r != "object" && (t[n] = r);
76
+ }
77
+ return t;
78
+ }
79
+ function ke(e, t) {
80
+ let n = t.stemWidth ?? 18, r = 0;
81
+ return (t.serif ?? 0) > 0 && (r = Math.max(2, n * .7) * t.serif + (t.jut ?? 0) * n * 1.5 + 1), e === "i" && (r = Math.max(r, n * .1 + 1)), r;
82
+ }
83
+ var W = (e) => Number(e.toFixed(2));
84
+ function Ae(e, t, n) {
85
+ if (!e || e.loopId !== "paratype-glyph") return null;
86
+ let r = Math.max(1, e.w ?? 480), i = Math.max(1, e.h ?? 480), a = Oe(e), o = k(a, r, i);
87
+ if (!o.length) return null;
88
+ let s = [];
89
+ t.bg && s.push({
90
+ id: n("shape"),
91
+ type: "shape",
92
+ kind: "rect",
93
+ color: t.bg,
94
+ x: 0,
95
+ y: 0,
96
+ w: r,
97
+ h: i,
98
+ visible: !0,
99
+ opacity: 1,
100
+ blend: "normal"
101
+ });
102
+ for (let e of o) {
103
+ let r = ke(e.name, a) + 1.5, i = 1.5, o = e.gw + r * 2, c = e.gh + i * 2, l = e.g.paths.map((e) => `<path d="${e.d.replace(/\s+/g, " ").trim()}"${e.fillRule ? ` fill-rule="${e.fillRule}"` : ""} fill="currentColor"/>`).join(""), u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W(o)} ${W(c)}" preserveAspectRatio="none"><g transform="translate(${W(r)} ${W(e.y1 + i)}) scale(1 -1)">${l}</g></svg>`;
104
+ s.push({
105
+ id: n("shape"),
106
+ type: "shape",
107
+ kind: "flatten",
108
+ svg: u,
109
+ fit: "fill",
110
+ color: t.fg,
111
+ x: W(e.tx - r * e.s),
112
+ y: W(e.ty - (e.y1 + i) * e.s),
113
+ w: Math.max(1, W(o * e.s)),
114
+ h: Math.max(1, W(c * e.s)),
115
+ visible: !0,
116
+ opacity: 1,
117
+ blend: "normal"
118
+ });
119
+ }
120
+ return {
121
+ id: n("group"),
122
+ type: "group",
123
+ x: e.x ?? 0,
124
+ y: e.y ?? 0,
125
+ w: r,
126
+ h: i,
127
+ visible: e.visible ?? !0,
128
+ opacity: e.opacity ?? 1,
129
+ blend: e.blend ?? "normal",
130
+ children: s
131
+ };
132
+ }
133
+ //#endregion
134
+ //#region src/editor/compose/inspectors/LoopPicker.jsx
135
+ function je({ layer: e, tree: t = Te, inline: n = !1 }) {
136
+ let { updateLayer: i } = r(), a = e.loopGroup ?? "shape", o = t.find((e) => e.groups.includes(a)) ?? null, s = E(a), c = s.find((t) => t.id === e.presetId), l = [...new Set(s.map((e) => e.sub).filter(Boolean))], u = c?.sub ?? l[0], d = l.length ? s.filter((e) => e.sub === u) : s, f = (t, n = a) => {
137
+ t && i(e.id, {
138
+ loopGroup: n,
139
+ presetId: t.id,
140
+ presetLabel: t.label,
141
+ loopId: t.loop,
142
+ _framePreset: "custom",
143
+ _formPreset: "custom",
144
+ _lookPreset: "custom",
145
+ ...le(t)
146
+ });
147
+ };
148
+ return /* @__PURE__ */ U(V, { children: [
149
+ t.length > 1 || !o ? /* @__PURE__ */ H(N, {
150
+ label: "Type",
151
+ inline: n,
152
+ children: /* @__PURE__ */ U("div", {
153
+ className: "flex flex-col gap-1 w-full",
154
+ children: [o ? /* @__PURE__ */ H(fe, {
155
+ options: t.map((e) => ({
156
+ value: e.label,
157
+ label: e.label
158
+ })),
159
+ value: o.label,
160
+ onChange: (e) => {
161
+ let n = t.find((t) => t.label === e);
162
+ n && f(E(n.groups[0])[0], n.groups[0]);
163
+ }
164
+ }) : /* @__PURE__ */ H("span", {
165
+ className: "kol-helper-12 text-meta px-1",
166
+ children: Ee[a] ?? j(a).label
167
+ }), o && o.groups.length > 1 && /* @__PURE__ */ H(fe, {
168
+ options: o.groups.map((e) => ({
169
+ value: e,
170
+ label: o.labels?.[e] ?? j(e).label
171
+ })),
172
+ value: a,
173
+ onChange: (e) => f(E(e)[0], e)
174
+ })]
175
+ })
176
+ }) : null,
177
+ l.length > 1 && /* @__PURE__ */ H(N, {
178
+ inline: n,
179
+ label: "Category",
180
+ options: l.map((e) => ({
181
+ value: e,
182
+ label: e
183
+ })),
184
+ value: u,
185
+ onChange: (e) => f(s.find((t) => t.sub === e))
186
+ }),
187
+ /* @__PURE__ */ H(N, {
188
+ inline: n,
189
+ label: "Preset",
190
+ options: d.map((e) => ({
191
+ value: e.id,
192
+ label: e.label
193
+ })),
194
+ value: e.presetId,
195
+ onChange: (e) => f(s.find((t) => t.id === e))
196
+ })
197
+ ] });
198
+ }
199
+ //#endregion
200
+ //#region src/editor/params/motionPresets.js
201
+ var Me = (e) => c("generators")?.loopById(e) ?? null, Ne = {
202
+ frame: [
203
+ {
204
+ id: "static",
205
+ label: "Static",
206
+ params: { flow: 0 }
207
+ },
208
+ {
209
+ id: "drift",
210
+ label: "Drift",
211
+ params: {
212
+ flow: 1,
213
+ spin: 0
214
+ }
215
+ },
216
+ {
217
+ id: "spin",
218
+ label: "Spin",
219
+ params: {
220
+ flow: 1,
221
+ spin: 1
222
+ }
223
+ },
224
+ {
225
+ id: "rush",
226
+ label: "Rush",
227
+ params: {
228
+ flow: 2,
229
+ spin: 0
230
+ }
231
+ }
232
+ ],
233
+ form: [
234
+ {
235
+ id: "static",
236
+ label: "Static",
237
+ params: {
238
+ sweep: 0,
239
+ pulse: 0
240
+ }
241
+ },
242
+ {
243
+ id: "sweep",
244
+ label: "Sweep",
245
+ params: {
246
+ sweep: .6,
247
+ pulse: 0
248
+ }
249
+ },
250
+ {
251
+ id: "breathe",
252
+ label: "Breathe",
253
+ params: {
254
+ sweep: 0,
255
+ pulse: .5
256
+ }
257
+ },
258
+ {
259
+ id: "ripple",
260
+ label: "Ripple",
261
+ params: {
262
+ sweep: .5,
263
+ pulse: .4
264
+ }
265
+ }
266
+ ]
267
+ }, Pe = [
268
+ {
269
+ id: "static",
270
+ label: "Static",
271
+ params: { camFlow: 0 }
272
+ },
273
+ {
274
+ id: "pan-right",
275
+ label: "Pan Right",
276
+ params: {
277
+ camFlow: 1,
278
+ panDir: "right"
279
+ }
280
+ },
281
+ {
282
+ id: "pan-left",
283
+ label: "Pan Left",
284
+ params: {
285
+ camFlow: 1,
286
+ panDir: "left"
287
+ }
288
+ },
289
+ {
290
+ id: "pan-up",
291
+ label: "Pan Up",
292
+ params: {
293
+ camFlow: 1,
294
+ panDir: "up"
295
+ }
296
+ },
297
+ {
298
+ id: "pan-down",
299
+ label: "Pan Down",
300
+ params: {
301
+ camFlow: 1,
302
+ panDir: "down"
303
+ }
304
+ },
305
+ {
306
+ id: "drift",
307
+ label: "Drift",
308
+ params: {
309
+ camFlow: 1,
310
+ panDir: "diag"
311
+ }
312
+ },
313
+ {
314
+ id: "glide",
315
+ label: "Glide",
316
+ params: {
317
+ camFlow: 2,
318
+ panDir: "anti"
319
+ }
320
+ }
321
+ ], Fe = [
322
+ {
323
+ id: "static",
324
+ label: "Static",
325
+ params: {
326
+ spin: 0,
327
+ animAxis: "none",
328
+ animCycles: 1,
329
+ animWaves: 2,
330
+ pulse: 0,
331
+ fade: 0,
332
+ swing: 0,
333
+ colorMix: 0
334
+ }
335
+ },
336
+ {
337
+ id: "spin",
338
+ label: "Spin",
339
+ params: {
340
+ spin: 1,
341
+ animAxis: "none",
342
+ animCycles: 1,
343
+ animWaves: 2,
344
+ pulse: 0,
345
+ fade: 0,
346
+ swing: 0,
347
+ colorMix: 0
348
+ }
349
+ },
350
+ {
351
+ id: "breathe",
352
+ label: "Breathe",
353
+ params: {
354
+ spin: 0,
355
+ animAxis: "radial",
356
+ animCycles: 1,
357
+ animWaves: 2,
358
+ pulse: .6,
359
+ fade: 0,
360
+ swing: 0,
361
+ colorMix: 0
362
+ }
363
+ },
364
+ {
365
+ id: "pulse-wave",
366
+ label: "Pulse Wave",
367
+ params: {
368
+ spin: 0,
369
+ animAxis: "diag",
370
+ animCycles: 1,
371
+ animWaves: 3,
372
+ pulse: .7,
373
+ fade: 0,
374
+ swing: 0,
375
+ colorMix: 0
376
+ }
377
+ },
378
+ {
379
+ id: "fade-wave",
380
+ label: "Fade Wave",
381
+ params: {
382
+ spin: 0,
383
+ animAxis: "col",
384
+ animCycles: 1,
385
+ animWaves: 2,
386
+ pulse: 0,
387
+ fade: .8,
388
+ swing: 0,
389
+ colorMix: 0
390
+ }
391
+ },
392
+ {
393
+ id: "sway",
394
+ label: "Sway",
395
+ params: {
396
+ spin: 0,
397
+ animAxis: "diag",
398
+ animCycles: 1,
399
+ animWaves: 2,
400
+ pulse: 0,
401
+ fade: 0,
402
+ swing: 60,
403
+ colorMix: 0
404
+ }
405
+ },
406
+ {
407
+ id: "colour-sweep",
408
+ label: "Colour Sweep",
409
+ params: {
410
+ spin: 0,
411
+ animAxis: "diag",
412
+ animCycles: 1,
413
+ animWaves: 2,
414
+ pulse: 0,
415
+ fade: 0,
416
+ swing: 0,
417
+ colorMix: 1
418
+ }
419
+ },
420
+ {
421
+ id: "ripple",
422
+ label: "Ripple",
423
+ params: {
424
+ spin: 0,
425
+ animAxis: "radial",
426
+ animCycles: 1,
427
+ animWaves: 4,
428
+ pulse: .5,
429
+ fade: .5,
430
+ swing: 0,
431
+ colorMix: 0
432
+ }
433
+ }
434
+ ], Ie = [
435
+ {
436
+ id: "static",
437
+ label: "Static",
438
+ params: {
439
+ camFlow: 0,
440
+ panDir: "right"
441
+ }
442
+ },
443
+ {
444
+ id: "drift",
445
+ label: "Drift",
446
+ params: {
447
+ camFlow: 1,
448
+ panDir: "right"
449
+ }
450
+ },
451
+ {
452
+ id: "reverse",
453
+ label: "Reverse",
454
+ params: {
455
+ camFlow: 1,
456
+ panDir: "left"
457
+ }
458
+ },
459
+ {
460
+ id: "glide",
461
+ label: "Glide",
462
+ params: {
463
+ camFlow: 2,
464
+ panDir: "right"
465
+ }
466
+ },
467
+ {
468
+ id: "rush",
469
+ label: "Rush",
470
+ params: {
471
+ camFlow: 3,
472
+ panDir: "right"
473
+ }
474
+ },
475
+ {
476
+ id: "bias",
477
+ label: "Bias",
478
+ params: {
479
+ camFlow: 1,
480
+ panDir: "right",
481
+ stripeAngle: 30
482
+ }
483
+ },
484
+ {
485
+ id: "diagonal",
486
+ label: "Diagonal",
487
+ params: {
488
+ camFlow: 1,
489
+ panDir: "right",
490
+ stripeAngle: 45
491
+ }
492
+ },
493
+ {
494
+ id: "counter",
495
+ label: "Counter",
496
+ params: {
497
+ camFlow: 1,
498
+ panDir: "right",
499
+ stripeAngle: 135
500
+ }
501
+ }
502
+ ], Le = [
503
+ {
504
+ id: "static",
505
+ label: "Static",
506
+ params: {
507
+ camFlow: 0,
508
+ waveFlow: 0,
509
+ panDir: "right"
510
+ }
511
+ },
512
+ {
513
+ id: "drift",
514
+ label: "Drift",
515
+ params: {
516
+ camFlow: 1,
517
+ waveFlow: 0,
518
+ panDir: "right"
519
+ }
520
+ },
521
+ {
522
+ id: "travel",
523
+ label: "Travel",
524
+ params: {
525
+ camFlow: 0,
526
+ waveFlow: 1,
527
+ panDir: "right"
528
+ }
529
+ },
530
+ {
531
+ id: "both",
532
+ label: "Both",
533
+ params: {
534
+ camFlow: 1,
535
+ waveFlow: 1,
536
+ panDir: "right"
537
+ }
538
+ },
539
+ {
540
+ id: "reverse",
541
+ label: "Reverse",
542
+ params: {
543
+ camFlow: 1,
544
+ waveFlow: 0,
545
+ panDir: "left"
546
+ }
547
+ },
548
+ {
549
+ id: "glide",
550
+ label: "Glide",
551
+ params: {
552
+ camFlow: 1,
553
+ waveFlow: 2,
554
+ panDir: "right"
555
+ }
556
+ },
557
+ {
558
+ id: "diagonal",
559
+ label: "Diagonal",
560
+ params: {
561
+ camFlow: 1,
562
+ waveFlow: 1,
563
+ panDir: "right",
564
+ stripeAngle: 45
565
+ }
566
+ }
567
+ ], Re = [
568
+ {
569
+ id: "static",
570
+ label: "Static",
571
+ params: {
572
+ fieldSway: 0,
573
+ fieldStagger: 0,
574
+ fieldCycles: 1
575
+ }
576
+ },
577
+ {
578
+ id: "sway",
579
+ label: "Sway",
580
+ params: {
581
+ fieldSway: .5,
582
+ fieldStagger: .3,
583
+ fieldCycles: 1
584
+ }
585
+ },
586
+ {
587
+ id: "alternate",
588
+ label: "Alternate",
589
+ params: {
590
+ fieldSway: .6,
591
+ fieldStagger: 1,
592
+ fieldCycles: 1
593
+ }
594
+ },
595
+ {
596
+ id: "ripple",
597
+ label: "Ripple",
598
+ params: {
599
+ fieldSway: .45,
600
+ fieldStagger: .5,
601
+ fieldCycles: 1
602
+ }
603
+ }
604
+ ], ze = [
605
+ {
606
+ id: "static",
607
+ label: "Static",
608
+ params: {
609
+ animAxis: "none",
610
+ animCycles: 1,
611
+ animWaves: 2,
612
+ pulse: 0,
613
+ fade: 0
614
+ }
615
+ },
616
+ {
617
+ id: "pulse",
618
+ label: "Pulse",
619
+ params: {
620
+ animAxis: "diag",
621
+ animCycles: 1,
622
+ animWaves: 3,
623
+ pulse: .6,
624
+ fade: 0
625
+ }
626
+ },
627
+ {
628
+ id: "fade",
629
+ label: "Fade",
630
+ params: {
631
+ animAxis: "col",
632
+ animCycles: 1,
633
+ animWaves: 2,
634
+ pulse: 0,
635
+ fade: .7
636
+ }
637
+ },
638
+ {
639
+ id: "ripple",
640
+ label: "Ripple",
641
+ params: {
642
+ animAxis: "radial",
643
+ animCycles: 1,
644
+ animWaves: 4,
645
+ pulse: .4,
646
+ fade: .4
647
+ }
648
+ }
649
+ ], Be = {
650
+ frame: [
651
+ {
652
+ id: "static",
653
+ label: "Static",
654
+ params: { flow: 0 }
655
+ },
656
+ {
657
+ id: "drift",
658
+ label: "Drift",
659
+ params: {
660
+ flow: 1,
661
+ panDir: "right"
662
+ }
663
+ },
664
+ {
665
+ id: "reverse",
666
+ label: "Reverse",
667
+ params: {
668
+ flow: 1,
669
+ panDir: "left"
670
+ }
671
+ },
672
+ {
673
+ id: "rise",
674
+ label: "Rise",
675
+ params: {
676
+ flow: 1,
677
+ panDir: "up"
678
+ }
679
+ },
680
+ {
681
+ id: "fall",
682
+ label: "Fall",
683
+ params: {
684
+ flow: 1,
685
+ panDir: "down"
686
+ }
687
+ },
688
+ {
689
+ id: "diagonal",
690
+ label: "Diagonal",
691
+ params: {
692
+ flow: 1,
693
+ panDir: "diag"
694
+ }
695
+ },
696
+ {
697
+ id: "glide",
698
+ label: "Glide",
699
+ params: {
700
+ flow: 2,
701
+ panDir: "anti"
702
+ }
703
+ },
704
+ {
705
+ id: "rush",
706
+ label: "Rush",
707
+ params: {
708
+ flow: 3,
709
+ panDir: "right"
710
+ }
711
+ }
712
+ ],
713
+ form: [
714
+ {
715
+ id: "static",
716
+ label: "Static",
717
+ params: {
718
+ speed: 0,
719
+ stagger: 0,
720
+ pulse: 0,
721
+ fade: 0,
722
+ swing: 0
723
+ }
724
+ },
725
+ {
726
+ id: "scroll",
727
+ label: "Scroll",
728
+ params: {
729
+ speed: .45,
730
+ stagger: 0,
731
+ pulse: 0,
732
+ fade: 0,
733
+ swing: 0
734
+ }
735
+ },
736
+ {
737
+ id: "morph",
738
+ label: "Morph",
739
+ params: {
740
+ speed: .3,
741
+ stagger: .5,
742
+ pulse: 0,
743
+ fade: 0,
744
+ swing: 0
745
+ }
746
+ },
747
+ {
748
+ id: "sway",
749
+ label: "Sway",
750
+ params: {
751
+ speed: .3,
752
+ stagger: 0,
753
+ pulse: 0,
754
+ fade: 0,
755
+ swing: 30
756
+ }
757
+ },
758
+ {
759
+ id: "breathe",
760
+ label: "Breathe",
761
+ params: {
762
+ speed: .3,
763
+ stagger: 0,
764
+ pulse: .6,
765
+ fade: 0,
766
+ swing: 0
767
+ }
768
+ },
769
+ {
770
+ id: "shimmer",
771
+ label: "Shimmer",
772
+ params: {
773
+ speed: .4,
774
+ stagger: 0,
775
+ pulse: 0,
776
+ fade: .7,
777
+ swing: 0
778
+ }
779
+ },
780
+ {
781
+ id: "rich",
782
+ label: "Rich",
783
+ params: {
784
+ speed: .4,
785
+ stagger: .35,
786
+ pulse: .4,
787
+ fade: .3,
788
+ swing: 18
789
+ }
790
+ }
791
+ ]
792
+ }, Ve = {
793
+ frame: [
794
+ {
795
+ id: "static",
796
+ label: "Static",
797
+ params: { spin: 0 }
798
+ },
799
+ {
800
+ id: "orbit",
801
+ label: "Orbit",
802
+ params: { spin: 1 }
803
+ },
804
+ {
805
+ id: "spin",
806
+ label: "Spin",
807
+ params: { spin: 2 }
808
+ }
809
+ ],
810
+ form: [
811
+ {
812
+ id: "static",
813
+ label: "Static",
814
+ params: {
815
+ morph: 0,
816
+ ripple: 0,
817
+ fade: 0
818
+ }
819
+ },
820
+ {
821
+ id: "breathe",
822
+ label: "Breathe",
823
+ params: {
824
+ morph: .25,
825
+ ripple: 0,
826
+ fade: 0
827
+ }
828
+ },
829
+ {
830
+ id: "pulse",
831
+ label: "Pulse",
832
+ params: {
833
+ morph: .5,
834
+ ripple: 0,
835
+ fade: 0
836
+ }
837
+ },
838
+ {
839
+ id: "ripple",
840
+ label: "Ripple",
841
+ params: {
842
+ morph: 0,
843
+ ripple: .6,
844
+ fade: 0
845
+ }
846
+ },
847
+ {
848
+ id: "shimmer",
849
+ label: "Shimmer",
850
+ params: {
851
+ morph: 0,
852
+ ripple: 0,
853
+ fade: .6
854
+ }
855
+ },
856
+ {
857
+ id: "rich",
858
+ label: "Rich",
859
+ params: {
860
+ morph: .3,
861
+ ripple: .4,
862
+ fade: .3
863
+ }
864
+ }
865
+ ]
866
+ }, He = {
867
+ frame: [
868
+ {
869
+ id: "static",
870
+ label: "Static",
871
+ params: {
872
+ flowSpeed: 0,
873
+ swirl: 0,
874
+ drift: 0
875
+ }
876
+ },
877
+ {
878
+ id: "drift",
879
+ label: "Drift",
880
+ params: {
881
+ flowSpeed: 1,
882
+ swirl: 0,
883
+ drift: 0
884
+ }
885
+ },
886
+ {
887
+ id: "wind",
888
+ label: "Wind",
889
+ params: {
890
+ flowSpeed: 1,
891
+ swirl: 0,
892
+ drift: .6,
893
+ driftDir: "right"
894
+ }
895
+ },
896
+ {
897
+ id: "vortex",
898
+ label: "Vortex",
899
+ params: {
900
+ flowSpeed: 1,
901
+ swirl: .5,
902
+ drift: 0
903
+ }
904
+ },
905
+ {
906
+ id: "rush",
907
+ label: "Rush",
908
+ params: {
909
+ flowSpeed: 2.4,
910
+ swirl: 0,
911
+ drift: 0
912
+ }
913
+ }
914
+ ],
915
+ form: [
916
+ {
917
+ id: "lines",
918
+ label: "Lines",
919
+ params: {
920
+ dots: !1,
921
+ pulse: 0,
922
+ jitter: 0
923
+ }
924
+ },
925
+ {
926
+ id: "dots",
927
+ label: "Dots",
928
+ params: {
929
+ dots: !0,
930
+ pulse: 0,
931
+ jitter: 0
932
+ }
933
+ },
934
+ {
935
+ id: "pulse",
936
+ label: "Pulse",
937
+ params: {
938
+ dots: !1,
939
+ pulse: .6,
940
+ jitter: 0
941
+ }
942
+ },
943
+ {
944
+ id: "shimmer",
945
+ label: "Shimmer",
946
+ params: {
947
+ dots: !0,
948
+ pulse: .3,
949
+ jitter: .5
950
+ }
951
+ }
952
+ ]
953
+ }, Ue = {
954
+ frame: [
955
+ {
956
+ id: "static",
957
+ label: "Static",
958
+ params: {
959
+ hueSpeed: 0,
960
+ cspin: 0,
961
+ czoom: 0
962
+ }
963
+ },
964
+ {
965
+ id: "cycle",
966
+ label: "Cycle",
967
+ params: {
968
+ hueSpeed: 1,
969
+ cspin: 0,
970
+ czoom: 0
971
+ }
972
+ },
973
+ {
974
+ id: "turn",
975
+ label: "Turn",
976
+ params: {
977
+ hueSpeed: .4,
978
+ cspin: .6,
979
+ czoom: 0
980
+ }
981
+ },
982
+ {
983
+ id: "breathe",
984
+ label: "Breathe",
985
+ params: {
986
+ hueSpeed: .4,
987
+ cspin: 0,
988
+ czoom: .6
989
+ }
990
+ },
991
+ {
992
+ id: "rush",
993
+ label: "Rush",
994
+ params: {
995
+ hueSpeed: 2,
996
+ cspin: 1,
997
+ czoom: 0
998
+ }
999
+ }
1000
+ ],
1001
+ form: [
1002
+ {
1003
+ id: "static",
1004
+ label: "Static",
1005
+ params: {
1006
+ ringSpeed: 0,
1007
+ shade: 0
1008
+ }
1009
+ },
1010
+ {
1011
+ id: "rings",
1012
+ label: "Rings",
1013
+ params: {
1014
+ ringSpeed: 1,
1015
+ shade: 0
1016
+ }
1017
+ },
1018
+ {
1019
+ id: "pulse",
1020
+ label: "Pulse",
1021
+ params: {
1022
+ ringSpeed: 1,
1023
+ shade: .4
1024
+ }
1025
+ },
1026
+ {
1027
+ id: "fast",
1028
+ label: "Fast",
1029
+ params: {
1030
+ ringSpeed: 2.4,
1031
+ shade: 0
1032
+ }
1033
+ }
1034
+ ]
1035
+ }, We = {
1036
+ frame: [
1037
+ {
1038
+ id: "static",
1039
+ label: "Static",
1040
+ params: {
1041
+ vpSpin: 0,
1042
+ vpZoom: 1
1043
+ }
1044
+ },
1045
+ {
1046
+ id: "spin",
1047
+ label: "Spin",
1048
+ params: {
1049
+ vpSpin: 1,
1050
+ vpZoom: 1
1051
+ }
1052
+ },
1053
+ {
1054
+ id: "spin2",
1055
+ label: "Spin ×2",
1056
+ params: {
1057
+ vpSpin: 2,
1058
+ vpZoom: 1
1059
+ }
1060
+ },
1061
+ {
1062
+ id: "push",
1063
+ label: "Push in",
1064
+ params: {
1065
+ vpSpin: 0,
1066
+ vpZoom: 1.3
1067
+ }
1068
+ }
1069
+ ],
1070
+ form: [
1071
+ {
1072
+ id: "static",
1073
+ label: "Static",
1074
+ params: {
1075
+ vpPulse: 0,
1076
+ vpWobble: 0
1077
+ }
1078
+ },
1079
+ {
1080
+ id: "pulse",
1081
+ label: "Pulse",
1082
+ params: {
1083
+ vpPulse: .3,
1084
+ vpWobble: 0
1085
+ }
1086
+ },
1087
+ {
1088
+ id: "wobble",
1089
+ label: "Wobble",
1090
+ params: {
1091
+ vpPulse: 0,
1092
+ vpWobble: 8
1093
+ }
1094
+ },
1095
+ {
1096
+ id: "breathe",
1097
+ label: "Breathe",
1098
+ params: {
1099
+ vpPulse: .22,
1100
+ vpWobble: 5
1101
+ }
1102
+ }
1103
+ ]
1104
+ };
1105
+ function Ge(e, t = {}) {
1106
+ switch (e) {
1107
+ case "scanline": return Ne;
1108
+ case "pattern-rules": {
1109
+ let e = t.render ?? "tiles", n = e === "field" && t.field === "organic";
1110
+ return {
1111
+ frame: e === "tiles" ? Pe : n ? Le : Ie,
1112
+ form: e === "tiles" ? Fe : e === "weave" ? ze : Re
1113
+ };
1114
+ }
1115
+ case "math-waveform": return Be;
1116
+ case "math-surface": return Ve;
1117
+ case "math-field": return (t.kind ?? "scalar") === "complex" ? Ue : He;
1118
+ default: return Me(e)?.params?.some((e) => e.key === "vpSpin") ? We : null;
1119
+ }
1120
+ }
1121
+ function Ke(e) {
1122
+ let t = /* @__PURE__ */ new Set();
1123
+ for (let n of e ?? []) for (let e of Object.keys(n.params ?? {})) t.add(e);
1124
+ return t;
1125
+ }
1126
+ //#endregion
1127
+ //#region src/editor/params/lookPresets.js
1128
+ var qe = {
1129
+ Spectrum: {
1130
+ palette: "spectrum",
1131
+ spectral: !0,
1132
+ hue: 0,
1133
+ irid: 1.1
1134
+ },
1135
+ Iris: {
1136
+ palette: "iris",
1137
+ spectral: !1,
1138
+ hue: .1,
1139
+ irid: 1.05
1140
+ },
1141
+ Aqua: {
1142
+ palette: "aqua",
1143
+ spectral: !1,
1144
+ hue: .5,
1145
+ irid: 1
1146
+ },
1147
+ Magma: {
1148
+ palette: "magma",
1149
+ spectral: !1,
1150
+ hue: .05,
1151
+ irid: .95
1152
+ },
1153
+ Candy: {
1154
+ palette: "candy",
1155
+ spectral: !1,
1156
+ hue: .8,
1157
+ irid: 1.15
1158
+ },
1159
+ Noir: {
1160
+ palette: "spectrum",
1161
+ spectral: !0,
1162
+ hue: 0,
1163
+ irid: .6,
1164
+ rim: 1
1165
+ }
1166
+ };
1167
+ function Je(e) {
1168
+ return e === "softforms" || e === "softforms3d" ? qe : null;
1169
+ }
1170
+ //#endregion
1171
+ //#region src/loops/gl/primitiveEasing.js
1172
+ function Ye(e) {
1173
+ let t = 7.5625, n = 2.75;
1174
+ return e < 1 / n ? t * e * e : e < 2 / n ? (e -= 1.5 / n, t * e * e + .75) : e < 2.5 / n ? (e -= 2.25 / n, t * e * e + .9375) : (e -= 2.625 / n, t * e * e + .984375);
1175
+ }
1176
+ var Xe = {
1177
+ linear: (e) => e,
1178
+ in: (e) => e * e,
1179
+ out: (e) => 1 - (1 - e) * (1 - e),
1180
+ inout: (e) => e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2,
1181
+ sine: (e) => -(Math.cos(Math.PI * e) - 1) / 2,
1182
+ cubicIn: (e) => e * e * e,
1183
+ cubicOut: (e) => 1 - (1 - e) ** 3,
1184
+ cubicInOut: (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2,
1185
+ expoOut: (e) => e >= 1 ? 1 : 1 - 2 ** (-10 * e),
1186
+ expoInOut: (e) => e <= 0 ? 0 : e >= 1 ? 1 : e < .5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2,
1187
+ backOut: (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2,
1188
+ backInOut: (e) => {
1189
+ let t = 1.70158 * 1.525;
1190
+ return e < .5 ? (2 * e) ** 2 * (3.5949095 * 2 * e - t) / 2 : ((2 * e - 2) ** 2 * (3.5949095 * (e * 2 - 2) + t) + 2) / 2;
1191
+ },
1192
+ elasticOut: (e) => {
1193
+ if (e <= 0) return 0;
1194
+ if (e >= 1) return 1;
1195
+ let t = 2 * Math.PI / 3;
1196
+ return 2 ** (-10 * e) * Math.sin((e * 10 - .75) * t) + 1;
1197
+ },
1198
+ bounceOut: Ye
1199
+ }, Ze = {
1200
+ linear: "Linear",
1201
+ in: "Ease in",
1202
+ out: "Ease out",
1203
+ inout: "Ease in-out",
1204
+ sine: "Sine",
1205
+ cubicIn: "Cubic in",
1206
+ cubicOut: "Cubic out",
1207
+ cubicInOut: "Cubic in-out",
1208
+ expoOut: "Expo out",
1209
+ expoInOut: "Expo in-out",
1210
+ backOut: "Back out",
1211
+ backInOut: "Back in-out",
1212
+ elasticOut: "Elastic out",
1213
+ bounceOut: "Bounce out"
1214
+ }, Qe = Object.keys(Xe).map((e) => ({
1215
+ value: e,
1216
+ label: Ze[e] || e
1217
+ })), $e = (e, t, n) => [
1218
+ P(e[0], t[0], n),
1219
+ P(e[1], t[1], n),
1220
+ P(e[2], t[2], n)
1221
+ ], et = (e) => ({
1222
+ rot: e.rot || [
1223
+ 0,
1224
+ 0,
1225
+ 0
1226
+ ],
1227
+ pos: e.pos || [
1228
+ 0,
1229
+ 0,
1230
+ 0
1231
+ ],
1232
+ scale: e.scale ?? 1
1233
+ });
1234
+ function tt(e, t) {
1235
+ if (!e || !e.length) return {};
1236
+ if (e.length === 1) return et(e[0]);
1237
+ let n = 0;
1238
+ for (; n < e.length - 1 && t > e[n + 1].t;) n++;
1239
+ let r = e[n], i = e[n + 1] || r, a = i.t - r.t || 1, o = Math.max(0, Math.min(1, (t - r.t) / a));
1240
+ return o = (Xe[i.ease] || Xe.inout)(o), {
1241
+ rot: $e(r.rot || [
1242
+ 0,
1243
+ 0,
1244
+ 0
1245
+ ], i.rot || [
1246
+ 0,
1247
+ 0,
1248
+ 0
1249
+ ], o),
1250
+ pos: $e(r.pos || [
1251
+ 0,
1252
+ 0,
1253
+ 0
1254
+ ], i.pos || [
1255
+ 0,
1256
+ 0,
1257
+ 0
1258
+ ], o),
1259
+ scale: P(r.scale ?? 1, i.scale ?? 1, o)
1260
+ };
1261
+ }
1262
+ var nt = [{
1263
+ t: 0,
1264
+ rot: [
1265
+ 0,
1266
+ 0,
1267
+ 0
1268
+ ],
1269
+ pos: [
1270
+ 0,
1271
+ 0,
1272
+ 0
1273
+ ],
1274
+ scale: 1,
1275
+ ease: "inout"
1276
+ }, {
1277
+ t: 1,
1278
+ rot: [
1279
+ 0,
1280
+ Math.PI * 2,
1281
+ 0
1282
+ ],
1283
+ pos: [
1284
+ 0,
1285
+ 0,
1286
+ 0
1287
+ ],
1288
+ scale: 1,
1289
+ ease: "inout"
1290
+ }];
1291
+ //#endregion
1292
+ //#region src/loops/gl/phase.js
1293
+ function rt(e, t) {
1294
+ let n = Number(e), r = Number(t);
1295
+ return !n || n <= 0 || !r || r <= 0 ? 1 : Math.max(1, Math.round(r / n));
1296
+ }
1297
+ function it(e, t) {
1298
+ return e * t % 1;
1299
+ }
1300
+ //#endregion
1301
+ //#region src/editor/compose/inspectors/KeyframeEditor.jsx
1302
+ var at = (e) => Math.round((e || 0) * 180 / Math.PI), ot = (e) => e * Math.PI / 180;
1303
+ function st({ layer: e, patch: t, defaultDuration: n = 8 }) {
1304
+ let r = Array.isArray(e.keyframes) && e.keyframes.length ? e.keyframes : nt, [i, a] = Se(0), o = Math.min(i, r.length - 1), s = r[o] || {
1305
+ rot: [
1306
+ 0,
1307
+ 0,
1308
+ 0
1309
+ ],
1310
+ pos: [
1311
+ 0,
1312
+ 0,
1313
+ 0
1314
+ ],
1315
+ scale: 1
1316
+ }, c = (e) => t({ keyframes: e }), l = () => rt(e.duration ?? n, v.getLoopSeconds()), u = (e) => {
1317
+ a(e), v.pause(), v.seek((r[e].t ?? 0) / l());
1318
+ }, d = () => {
1319
+ let e = v.getT() * l() % 1, t = r[o] || {
1320
+ rot: [
1321
+ 0,
1322
+ 0,
1323
+ 0
1324
+ ],
1325
+ pos: [
1326
+ 0,
1327
+ 0,
1328
+ 0
1329
+ ],
1330
+ scale: 1,
1331
+ ease: "inout"
1332
+ }, n = {
1333
+ t: Math.max(0, Math.min(1, e)),
1334
+ rot: [...t.rot || [
1335
+ 0,
1336
+ 0,
1337
+ 0
1338
+ ]],
1339
+ pos: [...t.pos || [
1340
+ 0,
1341
+ 0,
1342
+ 0
1343
+ ]],
1344
+ scale: t.scale ?? 1,
1345
+ ease: t.ease || "inout"
1346
+ }, i = [...r, n].sort((e, t) => e.t - t.t);
1347
+ c(i), a(i.indexOf(n));
1348
+ }, f = () => {
1349
+ r.length <= 1 || (c(r.filter((e, t) => t !== o)), a((e) => Math.max(0, e - 1)));
1350
+ }, p = (e) => c(r.map((t, n) => n === o ? {
1351
+ ...t,
1352
+ ...e
1353
+ } : t)), m = (e, t) => {
1354
+ let n = [...s.rot || [
1355
+ 0,
1356
+ 0,
1357
+ 0
1358
+ ]];
1359
+ n[e] = ot(t), p({ rot: n });
1360
+ }, h = (e, t) => {
1361
+ let n = [...s.pos || [
1362
+ 0,
1363
+ 0,
1364
+ 0
1365
+ ]];
1366
+ n[e] = t, p({ pos: n });
1367
+ }, g = (e, t, n, r, i, a) => /* @__PURE__ */ H(z, {
1368
+ label: e,
1369
+ children: /* @__PURE__ */ H(B, {
1370
+ min: t,
1371
+ max: n,
1372
+ step: r,
1373
+ value: i,
1374
+ onChange: a
1375
+ })
1376
+ });
1377
+ return /* @__PURE__ */ U(V, { children: [
1378
+ /* @__PURE__ */ H("span", {
1379
+ className: "kol-helper-10 text-meta",
1380
+ children: "Keyframes"
1381
+ }),
1382
+ /* @__PURE__ */ H("div", {
1383
+ className: "flex flex-col gap-1",
1384
+ children: r.map((e, t) => /* @__PURE__ */ U(L, {
1385
+ variant: t === o ? "primary" : "secondary",
1386
+ size: "sm",
1387
+ className: "w-full",
1388
+ style: { justifyContent: "space-between" },
1389
+ onClick: () => u(t),
1390
+ children: [/* @__PURE__ */ U("span", { children: ["Key ", t + 1] }), /* @__PURE__ */ U("span", {
1391
+ className: "kol-helper-10 tabular-nums",
1392
+ children: [Math.round((e.t ?? 0) * 100), "%"]
1393
+ })]
1394
+ }, t))
1395
+ }),
1396
+ /* @__PURE__ */ U("div", {
1397
+ className: "flex gap-2",
1398
+ children: [/* @__PURE__ */ H(L, {
1399
+ variant: "primary",
1400
+ size: "sm",
1401
+ className: "flex-1",
1402
+ onClick: d,
1403
+ children: "Add @ playhead"
1404
+ }), /* @__PURE__ */ H(L, {
1405
+ variant: "ghost",
1406
+ size: "sm",
1407
+ title: "Delete keyframe",
1408
+ onClick: f,
1409
+ disabled: r.length <= 1,
1410
+ children: "Delete"
1411
+ })]
1412
+ }),
1413
+ /* @__PURE__ */ H("span", {
1414
+ className: "kol-helper-10 text-meta",
1415
+ children: "Pose"
1416
+ }),
1417
+ g("Rotate X", -360, 360, 1, at(s.rot?.[0]), (e) => m(0, e)),
1418
+ g("Rotate Y", -360, 360, 1, at(s.rot?.[1]), (e) => m(1, e)),
1419
+ g("Rotate Z", -360, 360, 1, at(s.rot?.[2]), (e) => m(2, e)),
1420
+ g("Move X", -2, 2, .05, s.pos?.[0] || 0, (e) => h(0, e)),
1421
+ g("Move Y", -2, 2, .05, s.pos?.[1] || 0, (e) => h(1, e)),
1422
+ g("Move Z", -2, 2, .05, s.pos?.[2] || 0, (e) => h(2, e)),
1423
+ g("Scale", .2, 2, .05, s.scale ?? 1, (e) => p({ scale: e })),
1424
+ /* @__PURE__ */ H(z, {
1425
+ label: "Ease",
1426
+ children: /* @__PURE__ */ H(R, {
1427
+ variant: "subtle",
1428
+ size: "sm",
1429
+ className: "w-full",
1430
+ options: Qe,
1431
+ value: s.ease || "inout",
1432
+ onChange: (e) => p({ ease: e })
1433
+ })
1434
+ })
1435
+ ] });
1436
+ }
1437
+ //#endregion
1438
+ //#region src/editor/compose/inspectors/CameraPoseSlots.jsx
1439
+ function ct({ layer: e, patch: t, camParams: n, isEngine: r, showHeader: i = !1 }) {
1440
+ let a = Array.isArray(e._camSlots) ? e._camSlots : [], o = [
1441
+ a[0] ?? null,
1442
+ a[1] ?? null,
1443
+ a[2] ?? null
1444
+ ], s = (r) => {
1445
+ let i = {};
1446
+ for (let t of n) i[t.key] = e[t.key] ?? t.default;
1447
+ let a = [...o];
1448
+ a[r] = i, t({ _camSlots: a });
1449
+ }, c = (e) => {
1450
+ o[e] && t({ ...o[e] });
1451
+ };
1452
+ return /* @__PURE__ */ U(V, { children: [i && /* @__PURE__ */ H("span", {
1453
+ className: "kol-helper-10 text-meta",
1454
+ children: "Camera"
1455
+ }), /* @__PURE__ */ U("div", {
1456
+ className: "flex items-center gap-1",
1457
+ children: [n.length > 0 && o.map((e, t) => /* @__PURE__ */ H(L, {
1458
+ variant: e ? "secondary" : "ghost",
1459
+ size: "sm",
1460
+ title: e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1461
+ onClick: (n) => n.shiftKey || !e ? s(t) : c(t),
1462
+ children: t + 1
1463
+ }, t)), /* @__PURE__ */ H(L, {
1464
+ variant: "primary",
1465
+ size: "sm",
1466
+ className: "ml-auto",
1467
+ onClick: () => {
1468
+ let i = {};
1469
+ for (let e of n) i[e.key] = e.default;
1470
+ t(i), r && import("./host-BMD1sgpp.js").then((t) => t.hostAction?.(e.id, "resetCamera")).catch(() => {});
1471
+ },
1472
+ children: "Reset"
1473
+ })]
1474
+ })] });
1475
+ }
1476
+ //#endregion
1477
+ //#region src/editor/compose/inspectors/RulesEditor.jsx
1478
+ function lt({ layer: e, patch: t, seed: n }) {
1479
+ let r = e.rules ?? [], i = (e, n) => t({
1480
+ rules: e,
1481
+ ...n
1482
+ }), a = () => i([...r, re()]), o = (e, t) => i(r.map((n, r) => r === e ? t : n)), s = (e) => i(r.filter((t, n) => n !== e)), c = (e) => {
1483
+ let t = n.take(), a = _(t >>> 0);
1484
+ i(r.map((t, n) => n === e ? {
1485
+ ...T(a),
1486
+ id: t.id
1487
+ } : t), { _rollSeed: t });
1488
+ };
1489
+ return /* @__PURE__ */ H(z, {
1490
+ label: `Rules · ${r.length}`,
1491
+ children: /* @__PURE__ */ U("div", {
1492
+ className: "flex flex-col gap-2",
1493
+ children: [r.map((e, t) => /* @__PURE__ */ H(me, {
1494
+ rule: e,
1495
+ onChange: (e) => o(t, e),
1496
+ onRemove: () => s(t),
1497
+ onReroll: () => c(t)
1498
+ }, e.id ?? t)), /* @__PURE__ */ U("div", {
1499
+ className: "grid grid-cols-2 gap-2",
1500
+ children: [/* @__PURE__ */ H(L, {
1501
+ iconComponent: h,
1502
+ variant: "primary",
1503
+ size: "sm",
1504
+ iconLeft: "plus",
1505
+ onClick: a,
1506
+ children: "Add rule"
1507
+ }), /* @__PURE__ */ H(L, {
1508
+ variant: "primary",
1509
+ size: "sm",
1510
+ onClick: () => {
1511
+ let e = n.take(), t = _(e >>> 0), r = 1 + Math.floor(t() * 3);
1512
+ i(Array.from({ length: r }, () => T(t)), { _rollSeed: e });
1513
+ },
1514
+ children: "Randomize"
1515
+ })]
1516
+ })]
1517
+ })
1518
+ });
1519
+ }
1520
+ //#endregion
1521
+ //#region src/editor/compose/inspectors/ProfileEditor.jsx
1522
+ var G = 240, K = 120, ut = 12, dt = (e, t, n) => Math.max(t, Math.min(n, e)), q = (e) => e * G, J = (e) => K / 2 - e * (K / 2 - ut);
1523
+ function ft({ value: e, onChange: t }) {
1524
+ let n = Array.isArray(e) && e.length > 1 ? e : ie, r = xe(null), i = xe(null), a = (e) => {
1525
+ let t = r.current, n = t.createSVGPoint();
1526
+ n.x = e.clientX, n.y = e.clientY;
1527
+ let i = n.matrixTransform(t.getScreenCTM().inverse());
1528
+ return {
1529
+ nx: i.x / G,
1530
+ ny: (K / 2 - i.y) / (K / 2 - ut)
1531
+ };
1532
+ }, o = (e) => {
1533
+ let r = i.current;
1534
+ if (!r) return;
1535
+ let { nx: o, ny: s } = a(e), c = dt(s, -1, 1), l = n.map((e) => ({ ...e })), u = l[r.i];
1536
+ if (r.type === "anchor") {
1537
+ let e = r.i === 0, t = r.i === l.length - 1;
1538
+ !e && !t && (u.x = dt(o, l[r.i - 1].x + .02, l[r.i + 1].x - .02)), u.y = c, e && (l[l.length - 1].y = c), t && (l[0].y = c);
1539
+ } else r.type === "hr" ? (u.hrx = o - u.x, u.hry = c - u.y) : (u.hlx = o - u.x, u.hly = c - u.y);
1540
+ t(l);
1541
+ }, s = (e, t) => (n) => {
1542
+ n.stopPropagation(), i.current = {
1543
+ type: e,
1544
+ i: t
1545
+ };
1546
+ try {
1547
+ n.target.setPointerCapture(n.pointerId);
1548
+ } catch {}
1549
+ }, c = (e) => {
1550
+ i.current = null;
1551
+ try {
1552
+ e.target.releasePointerCapture(e.pointerId);
1553
+ } catch {}
1554
+ }, l = (e) => {
1555
+ let { nx: r, ny: i } = a(e), o = dt(r, .04, .96), s = n.findIndex((e) => e.x > o), c = s < 0 ? n.length - 1 : s, l = n.map((e) => ({ ...e }));
1556
+ l.splice(c, 0, {
1557
+ x: o,
1558
+ y: dt(i, -1, 1),
1559
+ hlx: -.08,
1560
+ hly: 0,
1561
+ hrx: .08,
1562
+ hry: 0
1563
+ }), t(l);
1564
+ }, u = (e) => (r) => {
1565
+ r.stopPropagation(), !(e === 0 || e === n.length - 1 || n.length <= 3) && t(n.filter((t, n) => n !== e));
1566
+ }, d = n.map((e, t) => {
1567
+ if (t === 0) return `M ${q(e.x)} ${J(e.y)}`;
1568
+ let r = n[t - 1];
1569
+ return `C ${q(r.x + r.hrx)} ${J(r.y + r.hry)}, ${q(e.x + e.hlx)} ${J(e.y + e.hly)}, ${q(e.x)} ${J(e.y)}`;
1570
+ }).join(" ");
1571
+ return /* @__PURE__ */ U("svg", {
1572
+ ref: r,
1573
+ width: "100%",
1574
+ height: K,
1575
+ viewBox: `0 0 ${G} ${K}`,
1576
+ className: "rounded touch-none select-none",
1577
+ style: { background: "var(--kol-surface-primary)" },
1578
+ onPointerMove: o,
1579
+ onPointerUp: c,
1580
+ onPointerLeave: c,
1581
+ onDoubleClick: l,
1582
+ children: [
1583
+ /* @__PURE__ */ H("line", {
1584
+ x1: "0",
1585
+ y1: K / 2,
1586
+ x2: G,
1587
+ y2: K / 2,
1588
+ stroke: "var(--kol-fg-16)",
1589
+ strokeWidth: "1"
1590
+ }),
1591
+ /* @__PURE__ */ H("path", {
1592
+ d,
1593
+ fill: "none",
1594
+ stroke: "var(--kol-fg-80)",
1595
+ strokeWidth: "1.5",
1596
+ vectorEffect: "non-scaling-stroke"
1597
+ }),
1598
+ n.map((e, t) => /* @__PURE__ */ U("g", { children: [
1599
+ /* @__PURE__ */ H("line", {
1600
+ x1: q(e.x),
1601
+ y1: J(e.y),
1602
+ x2: q(e.x + e.hlx),
1603
+ y2: J(e.y + e.hly),
1604
+ stroke: "var(--kol-fg-32)",
1605
+ vectorEffect: "non-scaling-stroke"
1606
+ }),
1607
+ /* @__PURE__ */ H("line", {
1608
+ x1: q(e.x),
1609
+ y1: J(e.y),
1610
+ x2: q(e.x + e.hrx),
1611
+ y2: J(e.y + e.hry),
1612
+ stroke: "var(--kol-fg-32)",
1613
+ vectorEffect: "non-scaling-stroke"
1614
+ }),
1615
+ /* @__PURE__ */ H("circle", {
1616
+ cx: q(e.x + e.hlx),
1617
+ cy: J(e.y + e.hly),
1618
+ r: "3.5",
1619
+ fill: "var(--kol-fg-48)",
1620
+ className: "cursor-grab",
1621
+ onPointerDown: s("hl", t)
1622
+ }),
1623
+ /* @__PURE__ */ H("circle", {
1624
+ cx: q(e.x + e.hrx),
1625
+ cy: J(e.y + e.hry),
1626
+ r: "3.5",
1627
+ fill: "var(--kol-fg-48)",
1628
+ className: "cursor-grab",
1629
+ onPointerDown: s("hr", t)
1630
+ }),
1631
+ /* @__PURE__ */ H("circle", {
1632
+ cx: q(e.x),
1633
+ cy: J(e.y),
1634
+ r: "5",
1635
+ fill: "var(--kol-surface-on-primary)",
1636
+ className: "cursor-grab",
1637
+ onPointerDown: s("anchor", t),
1638
+ onDoubleClick: u(t)
1639
+ })
1640
+ ] }, t))
1641
+ ]
1642
+ });
1643
+ }
1644
+ function pt({ layer: e, patch: t }) {
1645
+ return e.render !== "field" || e.field !== "organic" || e.waveProfile !== "custom" ? null : /* @__PURE__ */ H(z, {
1646
+ label: "Profile curve",
1647
+ children: /* @__PURE__ */ H(ft, {
1648
+ value: Array.isArray(e.waveCurve) && e.waveCurve.length > 1 ? e.waveCurve : ie,
1649
+ onChange: (e) => t({ waveCurve: e })
1650
+ })
1651
+ });
1652
+ }
1653
+ //#endregion
1654
+ //#region src/editor/compose/inspectors/CurveEditor.jsx
1655
+ var Y = (e, t) => {
1656
+ let n = Number(e);
1657
+ return Number.isFinite(n) ? n : t;
1658
+ };
1659
+ function X({ label: e, value: t, args: n, onCommit: r }) {
1660
+ let [i, a] = Se(t ?? "");
1661
+ return be(() => {
1662
+ a(t ?? "");
1663
+ }, [t]), /* @__PURE__ */ H(z, {
1664
+ label: e,
1665
+ hint: String(i).trim() !== "" && !b(i, n) ? "doesn’t compile — last good kept" : void 0,
1666
+ children: /* @__PURE__ */ H(he, {
1667
+ variant: "filled",
1668
+ size: "sm",
1669
+ className: "w-full",
1670
+ style: {
1671
+ fontFamily: "var(--kol-font-family-mono, monospace)",
1672
+ fontVariantLigatures: "none"
1673
+ },
1674
+ value: i,
1675
+ onChange: (e) => a(e.target.value),
1676
+ onBlur: () => {
1677
+ i !== t && r(i);
1678
+ },
1679
+ onKeyDown: (e) => {
1680
+ e.key === "Enter" && e.currentTarget.blur();
1681
+ }
1682
+ })
1683
+ });
1684
+ }
1685
+ function mt({ def: e, commit: t }) {
1686
+ let [n, r] = e.range || [0, 1];
1687
+ return /* @__PURE__ */ U("div", {
1688
+ className: "grid grid-cols-2 gap-2",
1689
+ children: [/* @__PURE__ */ H(z, {
1690
+ label: "Start",
1691
+ children: /* @__PURE__ */ H(l, {
1692
+ variant: "filled",
1693
+ size: "sm",
1694
+ value: n,
1695
+ onCommit: (e) => t({ range: [Y(e, n), r] })
1696
+ })
1697
+ }), /* @__PURE__ */ H(z, {
1698
+ label: "End",
1699
+ children: /* @__PURE__ */ H(l, {
1700
+ variant: "filled",
1701
+ size: "sm",
1702
+ value: r,
1703
+ onCommit: (e) => t({ range: [n, Y(e, r)] })
1704
+ })
1705
+ })]
1706
+ });
1707
+ }
1708
+ function ht({ def: e, commit: t }) {
1709
+ let n = e.terms || [], r = (e, r, i) => t({ terms: n.map((t, n) => n === e ? {
1710
+ ...t,
1711
+ [r]: i
1712
+ } : t) }), i = () => t({ terms: [...n, {
1713
+ amp: .5,
1714
+ freq: 2,
1715
+ phase: 0
1716
+ }] }), a = (e) => t({ terms: n.filter((t, n) => n !== e) });
1717
+ return /* @__PURE__ */ U("div", {
1718
+ className: "flex flex-col gap-2",
1719
+ children: [/* @__PURE__ */ U("div", {
1720
+ className: "flex items-center justify-between",
1721
+ children: [/* @__PURE__ */ H("span", {
1722
+ className: "kol-helper-10 text-meta",
1723
+ children: "Vectors"
1724
+ }), /* @__PURE__ */ H(L, {
1725
+ variant: "primary",
1726
+ size: "sm",
1727
+ onClick: i,
1728
+ children: "Add"
1729
+ })]
1730
+ }), /* @__PURE__ */ U("div", {
1731
+ className: "grid grid-cols-[1fr_1fr_1fr_auto] gap-1.5 items-center min-w-0 [&>*]:min-w-0",
1732
+ children: [
1733
+ /* @__PURE__ */ H("span", {
1734
+ className: "kol-helper-10 text-fg-48 text-center",
1735
+ children: "amp"
1736
+ }),
1737
+ /* @__PURE__ */ H("span", {
1738
+ className: "kol-helper-10 text-fg-48 text-center",
1739
+ children: "freq"
1740
+ }),
1741
+ /* @__PURE__ */ H("span", {
1742
+ className: "kol-helper-10 text-fg-48 text-center",
1743
+ children: "phase"
1744
+ }),
1745
+ /* @__PURE__ */ H("span", {}),
1746
+ n.map((e, t) => /* @__PURE__ */ H(gt, {
1747
+ term: e,
1748
+ onSet: (e, n) => r(t, e, n),
1749
+ onRemove: () => a(t),
1750
+ canRemove: n.length > 1
1751
+ }, t))
1752
+ ]
1753
+ })]
1754
+ });
1755
+ }
1756
+ function gt({ term: e, onSet: t, onRemove: n, canRemove: r }) {
1757
+ let i = (n, r) => /* @__PURE__ */ H(l, {
1758
+ variant: "filled",
1759
+ size: "sm",
1760
+ value: e[n] ?? r,
1761
+ onCommit: (i) => t(n, Y(i, e[n] ?? r))
1762
+ });
1763
+ return /* @__PURE__ */ U(V, { children: [
1764
+ i("amp", 1),
1765
+ i("freq", 1),
1766
+ i("phase", 0),
1767
+ /* @__PURE__ */ H(L, {
1768
+ variant: "ghost",
1769
+ size: "sm",
1770
+ onClick: n,
1771
+ disabled: !r,
1772
+ "aria-label": "Remove vector",
1773
+ children: "×"
1774
+ })
1775
+ ] });
1776
+ }
1777
+ function _t({ layer: e, patch: t }) {
1778
+ let n = e.clip === "custom", r = n ? null : y(e.clip), i = n ? e.custom ?? C("polar") : r.def, a = i.kind || "polar", o = (a) => {
1779
+ let o = {};
1780
+ n || (o.clip = "custom", (e.copies ?? 1) <= 1 && r.copies > 1 && (o.copies = r.copies), !(e.spiral > 0) && r.spiral > 0 && (o.spiral = r.spiral)), t({
1781
+ ...o,
1782
+ custom: {
1783
+ ...i,
1784
+ ...a
1785
+ }
1786
+ });
1787
+ };
1788
+ return /* @__PURE__ */ U("div", {
1789
+ className: "flex flex-col gap-3",
1790
+ children: [
1791
+ /* @__PURE__ */ H("span", {
1792
+ className: "kol-helper-10 text-meta",
1793
+ children: "Curve"
1794
+ }),
1795
+ /* @__PURE__ */ H(R, {
1796
+ size: "sm",
1797
+ variant: "subtle",
1798
+ className: "w-full",
1799
+ options: S,
1800
+ value: a,
1801
+ onChange: (e) => {
1802
+ e !== a && t({
1803
+ clip: "custom",
1804
+ custom: C(e)
1805
+ });
1806
+ }
1807
+ }),
1808
+ !n && /* @__PURE__ */ U("p", {
1809
+ className: "kol-helper-10 text-meta",
1810
+ children: [
1811
+ "Editing “",
1812
+ (x.find((t) => t.id === e.clip) || x[0]).label,
1813
+ "” forks it to a custom curve."
1814
+ ]
1815
+ }),
1816
+ a === "epicycle" && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(z, {
1817
+ label: "Turns",
1818
+ children: /* @__PURE__ */ H(l, {
1819
+ variant: "filled",
1820
+ size: "sm",
1821
+ value: i.turns ?? 1,
1822
+ onCommit: (e) => o({ turns: Y(e, i.turns ?? 1) })
1823
+ })
1824
+ }), /* @__PURE__ */ H(ht, {
1825
+ def: i,
1826
+ commit: o
1827
+ })] }),
1828
+ a === "polar" && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(mt, {
1829
+ def: i,
1830
+ commit: o
1831
+ }), /* @__PURE__ */ H(X, {
1832
+ label: "r(th)",
1833
+ value: i.r,
1834
+ args: ["th"],
1835
+ onCommit: (e) => o({ r: e })
1836
+ })] }),
1837
+ (a === "param2d" || a === "param3d") && /* @__PURE__ */ U(V, { children: [
1838
+ /* @__PURE__ */ H(mt, {
1839
+ def: i,
1840
+ commit: o
1841
+ }),
1842
+ /* @__PURE__ */ H(X, {
1843
+ label: "x(t)",
1844
+ value: i.x,
1845
+ args: ["t"],
1846
+ onCommit: (e) => o({ x: e })
1847
+ }),
1848
+ /* @__PURE__ */ H(X, {
1849
+ label: "y(t)",
1850
+ value: i.y,
1851
+ args: ["t"],
1852
+ onCommit: (e) => o({ y: e })
1853
+ }),
1854
+ a === "param3d" && /* @__PURE__ */ H(X, {
1855
+ label: "z(t)",
1856
+ value: i.z,
1857
+ args: ["t"],
1858
+ onCommit: (e) => o({ z: e })
1859
+ })
1860
+ ] }),
1861
+ a === "points" && /* @__PURE__ */ U(V, { children: [
1862
+ /* @__PURE__ */ H(z, {
1863
+ label: "Count",
1864
+ children: /* @__PURE__ */ H(l, {
1865
+ variant: "filled",
1866
+ size: "sm",
1867
+ value: i.count ?? 1400,
1868
+ onCommit: (e) => o({ count: Math.max(1, Math.round(Y(e, i.count ?? 1400))) })
1869
+ })
1870
+ }),
1871
+ /* @__PURE__ */ H(X, {
1872
+ label: "a(k)",
1873
+ value: i.a,
1874
+ args: ["k"],
1875
+ onCommit: (e) => o({ a: e })
1876
+ }),
1877
+ /* @__PURE__ */ H(X, {
1878
+ label: "r(k)",
1879
+ value: i.r,
1880
+ args: ["k"],
1881
+ onCommit: (e) => o({ r: e })
1882
+ })
1883
+ ] }),
1884
+ a === "maurer" && /* @__PURE__ */ U("div", {
1885
+ className: "grid grid-cols-2 gap-2",
1886
+ children: [/* @__PURE__ */ H(z, {
1887
+ label: "n",
1888
+ children: /* @__PURE__ */ H(l, {
1889
+ variant: "filled",
1890
+ size: "sm",
1891
+ value: i.n ?? 6,
1892
+ onCommit: (e) => o({ n: Y(e, i.n ?? 6) })
1893
+ })
1894
+ }), /* @__PURE__ */ H(z, {
1895
+ label: "d°",
1896
+ children: /* @__PURE__ */ H(l, {
1897
+ variant: "filled",
1898
+ size: "sm",
1899
+ value: i.d ?? 71,
1900
+ onCommit: (e) => o({ d: Y(e, i.d ?? 71) })
1901
+ })
1902
+ })]
1903
+ })
1904
+ ]
1905
+ });
1906
+ }
1907
+ //#endregion
1908
+ //#region src/editor/compose/inspectors/XYPad.jsx
1909
+ function vt({ xValue: e, yValue: t, xMin: n = 0, xMax: r = 1, yMin: i = 0, yMax: a = 1, onChange: o, xLabel: s, yLabel: c, className: l = "" }) {
1910
+ let u = xe(null), d = (e) => {
1911
+ let t = u.current;
1912
+ if (!t) return;
1913
+ let s = t.getBoundingClientRect(), c = Math.max(0, Math.min(1, (e.clientX - s.left) / s.width)), l = Math.max(0, Math.min(1, (e.clientY - s.top) / s.height)), d = n + c * (r - n), f = a - l * (a - i);
1914
+ o?.(d, f);
1915
+ }, f = (e) => {
1916
+ e.target.setPointerCapture?.(e.pointerId), d(e);
1917
+ }, p = (e) => {
1918
+ e.buttons !== 0 && d(e);
1919
+ }, m = (e, t) => e - t || 1, h = (e - n) / m(r, n) * 100, g = (1 - (t - i) / m(a, i)) * 100;
1920
+ return /* @__PURE__ */ U("div", {
1921
+ className: `flex flex-col gap-1 ${l}`,
1922
+ children: [/* @__PURE__ */ U("div", {
1923
+ className: "flex justify-between kol-helper-10 tracking-widest text-meta",
1924
+ children: [/* @__PURE__ */ H("span", { children: s }), /* @__PURE__ */ H("span", { children: c })]
1925
+ }), /* @__PURE__ */ U("div", {
1926
+ ref: u,
1927
+ onPointerDown: f,
1928
+ onPointerMove: p,
1929
+ className: "relative w-full aspect-square border border-oq-16 bg-fg-04 rounded cursor-crosshair touch-none",
1930
+ children: [
1931
+ /* @__PURE__ */ H("div", { className: "absolute inset-x-0 top-1/2 border-t border-oq-08" }),
1932
+ /* @__PURE__ */ H("div", { className: "absolute inset-y-0 left-1/2 border-l border-oq-08" }),
1933
+ /* @__PURE__ */ H("div", {
1934
+ className: "absolute w-3 h-3 -ml-1.5 -mt-1.5 rounded-full bg-fg-96 border border-oq-04 pointer-events-none",
1935
+ style: {
1936
+ left: `${h}%`,
1937
+ top: `${g}%`
1938
+ }
1939
+ })
1940
+ ]
1941
+ })]
1942
+ });
1943
+ }
1944
+ //#endregion
1945
+ //#region src/editor/compose/inspectors/ParatypeTools.jsx
1946
+ function yt({ layer: e, patch: t, tab: n }) {
1947
+ return e?.loopId === "paratype-glyph" ? n === "generate" ? /* @__PURE__ */ H(bt, { layer: e }) : n === "style" ? /* @__PURE__ */ H(xt, {
1948
+ layer: e,
1949
+ patch: t
1950
+ }) : null : null;
1951
+ }
1952
+ function bt({ layer: e }) {
1953
+ let { flattenParatype: t } = r();
1954
+ return t ? /* @__PURE__ */ H(L, {
1955
+ variant: "primary",
1956
+ size: "sm",
1957
+ className: "w-full",
1958
+ onClick: () => t(e.id),
1959
+ title: "Flatten the glyph(s) to vector shape layers (one-way)",
1960
+ children: "Flatten to vector"
1961
+ }) : null;
1962
+ }
1963
+ function xt({ layer: e, patch: t }) {
1964
+ let r = n(se(e.loopId)?.params ?? [], e).filter((e) => e.type === "range");
1965
+ if (r.length < 2) return null;
1966
+ let i = (e, t) => r.some((t) => t.key === e) && e !== t ? e : r.find((e) => e.key !== t)?.key, a = i(e._xyX ?? "stemWidth", null), o = i(e._xyY ?? "oWidth", a), s = r.find((e) => e.key === a), c = r.find((e) => e.key === o);
1967
+ if (!s || !c) return null;
1968
+ let l = (t, n) => typeof e[t] == "number" ? e[t] : n.default, u = (e, t) => {
1969
+ let n = t.step ?? 1;
1970
+ return n < 1 ? Number((Math.round(e / n) * n).toFixed(4)) : Math.round(e);
1971
+ }, d = r.map((e) => ({
1972
+ value: e.key,
1973
+ label: e.label
1974
+ }));
1975
+ return /* @__PURE__ */ U(V, { children: [
1976
+ /* @__PURE__ */ H("span", {
1977
+ className: "kol-helper-10 text-meta",
1978
+ children: "Explore"
1979
+ }),
1980
+ /* @__PURE__ */ U("div", {
1981
+ className: "grid grid-cols-2 gap-2",
1982
+ children: [/* @__PURE__ */ H(z, {
1983
+ label: "X axis",
1984
+ children: /* @__PURE__ */ H(R, {
1985
+ variant: "subtle",
1986
+ size: "sm",
1987
+ className: "w-full",
1988
+ options: d,
1989
+ value: a,
1990
+ onChange: (e) => t({ _xyX: e })
1991
+ })
1992
+ }), /* @__PURE__ */ H(z, {
1993
+ label: "Y axis",
1994
+ children: /* @__PURE__ */ H(R, {
1995
+ variant: "subtle",
1996
+ size: "sm",
1997
+ className: "w-full",
1998
+ options: d,
1999
+ value: o,
2000
+ onChange: (e) => t({ _xyY: e })
2001
+ })
2002
+ })]
2003
+ }),
2004
+ /* @__PURE__ */ H(vt, {
2005
+ xValue: l(a, s),
2006
+ yValue: l(o, c),
2007
+ xMin: s.min ?? 0,
2008
+ xMax: s.max ?? 1,
2009
+ yMin: c.min ?? 0,
2010
+ yMax: c.max ?? 1,
2011
+ xLabel: s.label,
2012
+ yLabel: c.label,
2013
+ onChange: (e, n) => t({
2014
+ [a]: u(e, s),
2015
+ [o]: u(n, c)
2016
+ })
2017
+ })
2018
+ ] });
2019
+ }
2020
+ //#endregion
2021
+ //#region src/editor/compose/inspectors/SoftformsLayers.jsx
2022
+ var St = 5, Ct = [
2023
+ {
2024
+ value: "teardrop",
2025
+ label: "Teardrop"
2026
+ },
2027
+ {
2028
+ value: "pill",
2029
+ label: "Pill"
2030
+ },
2031
+ {
2032
+ value: "dome",
2033
+ label: "Dome"
2034
+ },
2035
+ {
2036
+ value: "orb",
2037
+ label: "Orb"
2038
+ },
2039
+ {
2040
+ value: "super",
2041
+ label: "Lozenge"
2042
+ }
2043
+ ], wt = [
2044
+ {
2045
+ value: "sphere",
2046
+ label: "Sphere"
2047
+ },
2048
+ {
2049
+ value: "capsule",
2050
+ label: "Capsule"
2051
+ },
2052
+ {
2053
+ value: "teardrop",
2054
+ label: "Teardrop"
2055
+ },
2056
+ {
2057
+ value: "lozenge",
2058
+ label: "Lozenge"
2059
+ }
2060
+ ], Tt = [
2061
+ {
2062
+ k: "x",
2063
+ label: "Position X",
2064
+ min: -1,
2065
+ max: 1,
2066
+ step: .01,
2067
+ def: 0
2068
+ },
2069
+ {
2070
+ k: "y",
2071
+ label: "Position Y",
2072
+ min: -1,
2073
+ max: 1,
2074
+ step: .01,
2075
+ def: 0
2076
+ },
2077
+ {
2078
+ k: "sx",
2079
+ label: "Scale X",
2080
+ min: .12,
2081
+ max: 1.6,
2082
+ step: .01,
2083
+ def: .6
2084
+ },
2085
+ {
2086
+ k: "sy",
2087
+ label: "Scale Y",
2088
+ min: .12,
2089
+ max: 1.6,
2090
+ step: .01,
2091
+ def: .6,
2092
+ fallback: "sx"
2093
+ },
2094
+ {
2095
+ k: "rot",
2096
+ label: "Rotation",
2097
+ min: 0,
2098
+ max: 360,
2099
+ step: 1,
2100
+ def: 0
2101
+ },
2102
+ {
2103
+ k: "hue",
2104
+ label: "Hue",
2105
+ min: 0,
2106
+ max: 1,
2107
+ step: .01,
2108
+ def: 0
2109
+ }
2110
+ ], Et = [
2111
+ {
2112
+ k: "x",
2113
+ label: "Position X",
2114
+ min: -1.2,
2115
+ max: 1.2,
2116
+ step: .01,
2117
+ def: 0
2118
+ },
2119
+ {
2120
+ k: "y",
2121
+ label: "Position Y",
2122
+ min: -1.2,
2123
+ max: 1.2,
2124
+ step: .01,
2125
+ def: 0
2126
+ },
2127
+ {
2128
+ k: "z",
2129
+ label: "Position Z",
2130
+ min: -1.2,
2131
+ max: 1.2,
2132
+ step: .01,
2133
+ def: 0
2134
+ },
2135
+ {
2136
+ k: "sx",
2137
+ label: "Scale X",
2138
+ min: .12,
2139
+ max: 1.6,
2140
+ step: .01,
2141
+ def: .7
2142
+ },
2143
+ {
2144
+ k: "sy",
2145
+ label: "Scale Y",
2146
+ min: .12,
2147
+ max: 1.6,
2148
+ step: .01,
2149
+ def: .7,
2150
+ fallback: "sx"
2151
+ },
2152
+ {
2153
+ k: "sz",
2154
+ label: "Scale Z",
2155
+ min: .12,
2156
+ max: 1.6,
2157
+ step: .01,
2158
+ def: .7,
2159
+ fallback: "sx"
2160
+ },
2161
+ {
2162
+ k: "rot",
2163
+ label: "Rotation",
2164
+ min: 0,
2165
+ max: 360,
2166
+ step: 1,
2167
+ def: 0
2168
+ },
2169
+ {
2170
+ k: "hue",
2171
+ label: "Hue",
2172
+ min: 0,
2173
+ max: 1,
2174
+ step: .01,
2175
+ def: 0
2176
+ }
2177
+ ], Dt = Math.PI * 2, Ot = (e, t, n) => Math.min(n, Math.max(t, e)), Z = (e) => Math.round(e * 100) / 100, Q = (e, t, n) => t + e() * (n - t), kt = (e, t) => {
2178
+ let n = t * Math.sqrt(e()), r = e() * Dt;
2179
+ return [n * Math.cos(r), n * Math.sin(r)];
2180
+ }, At = (e, t) => {
2181
+ let n = t * Math.cbrt(e()), r = e() * Dt, i = Math.acos(2 * e() - 1);
2182
+ return [
2183
+ n * Math.sin(i) * Math.cos(r),
2184
+ n * Math.sin(i) * Math.sin(r),
2185
+ n * Math.cos(i) * .8
2186
+ ];
2187
+ }, jt = (e) => {
2188
+ let t = e.length || 1, n = e.reduce((e, n) => ({
2189
+ x: e.x + n.x / t,
2190
+ y: e.y + n.y / t
2191
+ }), {
2192
+ x: 0,
2193
+ y: 0
2194
+ });
2195
+ return e.map((e) => ({
2196
+ ...e,
2197
+ x: Z(e.x - n.x),
2198
+ y: Z(e.y - n.y)
2199
+ }));
2200
+ }, Mt = (e) => {
2201
+ let t = e.length || 1, n = e.reduce((e, n) => ({
2202
+ x: e.x + n.x / t,
2203
+ y: e.y + n.y / t,
2204
+ z: e.z + n.z / t
2205
+ }), {
2206
+ x: 0,
2207
+ y: 0,
2208
+ z: 0
2209
+ });
2210
+ return e.map((e) => ({
2211
+ ...e,
2212
+ x: Z(e.x - n.x),
2213
+ y: Z(e.y - n.y),
2214
+ z: Z(e.z - n.z)
2215
+ }));
2216
+ }, Nt = (e, t) => e.find((e) => e.value === t)?.label ?? t;
2217
+ function Pt({ layer: e }) {
2218
+ let { updateLayer: t } = r(), n = I(e.id, { history: "coalesce" }), i = e.loopId === "softforms3d", a = i && !!e.metaball, o = i ? wt : Ct, c = i ? Et : Tt, l = a ? 2 : 1, u = Array.isArray(e.forms) ? e.forms : [], [d, f] = Se(-1), p = d >= 0 && d < u.length ? u[d] : null, m = (t) => {
2219
+ f(t), window.dispatchEvent(new CustomEvent("kol:softform-select", { detail: {
2220
+ id: e.id,
2221
+ index: t,
2222
+ from: "panel"
2223
+ } }));
2224
+ };
2225
+ be(() => {
2226
+ let t = (t) => {
2227
+ t.detail?.id === e.id && t.detail.from === "canvas" && f(t.detail.index);
2228
+ };
2229
+ return window.addEventListener("kol:softform-select", t), () => window.removeEventListener("kol:softform-select", t);
2230
+ }, [e.id]);
2231
+ let g = (n) => t(e.id, { forms: n }), v = (e, t) => n.patch({ forms: u.map((n, r) => r === d ? {
2232
+ ...n,
2233
+ [e]: t
2234
+ } : n) }), ee = () => {
2235
+ if (u.length >= St) return;
2236
+ let e = i ? {
2237
+ t: "sphere",
2238
+ x: 0,
2239
+ y: 0,
2240
+ z: 0,
2241
+ sx: .7,
2242
+ sy: .7,
2243
+ sz: .7,
2244
+ rot: 0,
2245
+ hue: Z(Math.random())
2246
+ } : {
2247
+ t: "dome",
2248
+ x: 0,
2249
+ y: 0,
2250
+ sx: .6,
2251
+ sy: .6,
2252
+ rot: 0,
2253
+ hue: Z(Math.random())
2254
+ };
2255
+ g([...u, e]), m(u.length);
2256
+ }, y = (e) => {
2257
+ if (u.length >= St) return;
2258
+ let t = {
2259
+ ...u[e],
2260
+ x: Ot((u[e].x ?? 0) + .12, -1.2, 1.2),
2261
+ y: Ot((u[e].y ?? 0) - .1, -1.2, 1.2)
2262
+ };
2263
+ g([
2264
+ ...u.slice(0, e + 1),
2265
+ t,
2266
+ ...u.slice(e + 1)
2267
+ ]), m(e + 1);
2268
+ }, b = (e) => {
2269
+ u.length <= l || (g(u.filter((t, n) => n !== e)), m(-1));
2270
+ }, te = (e, t) => {
2271
+ if (t < 0 || t >= u.length) return;
2272
+ let n = [...u];
2273
+ [n[e], n[t]] = [n[t], n[e]], g(n), m(t);
2274
+ };
2275
+ return /* @__PURE__ */ U("div", {
2276
+ className: "flex flex-col gap-2",
2277
+ children: [
2278
+ /* @__PURE__ */ H("span", {
2279
+ className: "kol-helper-10 text-meta",
2280
+ children: "Forms"
2281
+ }),
2282
+ /* @__PURE__ */ H("div", {
2283
+ className: "flex flex-col gap-1",
2284
+ children: u.map((e, t) => {
2285
+ let n = u.length - 1 - t, r = u[n];
2286
+ return /* @__PURE__ */ U("div", {
2287
+ onClick: () => m(n),
2288
+ className: `flex items-center gap-2 pl-2 pr-1 py-1 rounded cursor-pointer kol-helper-12 ${n === d ? "bg-[color-mix(in_srgb,var(--kol-accent-primary)_26%,transparent)] text-emphasis" : "text-body hover:bg-fg-04 hover:text-emphasis"}`,
2289
+ children: [
2290
+ /* @__PURE__ */ H("span", {
2291
+ className: "kol-helper-10 text-meta shrink-0",
2292
+ children: n + 1
2293
+ }),
2294
+ /* @__PURE__ */ H("span", {
2295
+ className: "truncate flex-1 min-w-0",
2296
+ children: Nt(o, r.t)
2297
+ }),
2298
+ /* @__PURE__ */ H(L, {
2299
+ iconComponent: h,
2300
+ variant: "ghost",
2301
+ size: "sm",
2302
+ quiet: !0,
2303
+ iconOnly: "chevron-down",
2304
+ iconSize: 12,
2305
+ "aria-label": "Move form up",
2306
+ title: "Move form up",
2307
+ disabled: n >= u.length - 1,
2308
+ onClick: (e) => {
2309
+ e.stopPropagation(), te(n, n + 1);
2310
+ },
2311
+ style: { transform: "rotate(180deg)" }
2312
+ }),
2313
+ /* @__PURE__ */ H(L, {
2314
+ iconComponent: h,
2315
+ variant: "ghost",
2316
+ size: "sm",
2317
+ quiet: !0,
2318
+ iconOnly: "chevron-down",
2319
+ iconSize: 12,
2320
+ "aria-label": "Move form down",
2321
+ title: "Move form down",
2322
+ disabled: n <= 0,
2323
+ onClick: (e) => {
2324
+ e.stopPropagation(), te(n, n - 1);
2325
+ }
2326
+ }),
2327
+ /* @__PURE__ */ H(L, {
2328
+ iconComponent: h,
2329
+ variant: "ghost",
2330
+ size: "sm",
2331
+ quiet: !0,
2332
+ iconOnly: "duplicate",
2333
+ iconSize: 12,
2334
+ "aria-label": "Duplicate form",
2335
+ title: "Duplicate form",
2336
+ disabled: u.length >= St,
2337
+ onClick: (e) => {
2338
+ e.stopPropagation(), y(n);
2339
+ }
2340
+ }),
2341
+ /* @__PURE__ */ H(L, {
2342
+ iconComponent: h,
2343
+ variant: "ghost",
2344
+ size: "sm",
2345
+ quiet: !0,
2346
+ iconOnly: "trash",
2347
+ iconSize: 12,
2348
+ "aria-label": "Delete form",
2349
+ title: "Delete form",
2350
+ disabled: u.length <= l,
2351
+ onClick: (e) => {
2352
+ e.stopPropagation(), b(n);
2353
+ }
2354
+ })
2355
+ ]
2356
+ }, n);
2357
+ })
2358
+ }),
2359
+ /* @__PURE__ */ H(L, {
2360
+ iconComponent: h,
2361
+ variant: "primary",
2362
+ size: "sm",
2363
+ className: "w-full",
2364
+ iconLeft: "plus",
2365
+ iconSize: 12,
2366
+ disabled: u.length >= St,
2367
+ onClick: ee,
2368
+ children: "Add form"
2369
+ }),
2370
+ !i && /* @__PURE__ */ H(L, {
2371
+ variant: "primary",
2372
+ size: "sm",
2373
+ className: "w-full",
2374
+ title: "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
2375
+ onClick: () => window.dispatchEvent(new CustomEvent("kol:softform-edit", { detail: {
2376
+ id: e.id,
2377
+ index: Math.max(0, d)
2378
+ } })),
2379
+ children: "Edit forms on canvas"
2380
+ }),
2381
+ p && /* @__PURE__ */ U("div", {
2382
+ className: "flex flex-col gap-2 pt-1",
2383
+ children: [
2384
+ /* @__PURE__ */ H("span", {
2385
+ className: "kol-helper-10 text-meta",
2386
+ children: "Selected form"
2387
+ }),
2388
+ /* @__PURE__ */ H(z, {
2389
+ label: "Type",
2390
+ children: /* @__PURE__ */ H(R, {
2391
+ variant: "subtle",
2392
+ size: "sm",
2393
+ className: "w-full",
2394
+ options: o,
2395
+ value: p.t,
2396
+ onChange: (e) => g(u.map((t, n) => n === d ? {
2397
+ ...t,
2398
+ t: e
2399
+ } : t))
2400
+ })
2401
+ }),
2402
+ c.map((e) => {
2403
+ let t = p[e.k] ?? (e.fallback ? p[e.fallback] : void 0), n = typeof t == "number" ? t : e.def;
2404
+ return /* @__PURE__ */ H(z, {
2405
+ label: e.label,
2406
+ children: /* @__PURE__ */ H(B, {
2407
+ min: e.min,
2408
+ max: e.max,
2409
+ step: e.step,
2410
+ value: n,
2411
+ onChange: (t) => v(e.k, t)
2412
+ })
2413
+ }, e.k);
2414
+ })
2415
+ ]
2416
+ }),
2417
+ /* @__PURE__ */ H("span", {
2418
+ className: "kol-helper-10 text-meta pt-1",
2419
+ children: "Randomise forms"
2420
+ }),
2421
+ /* @__PURE__ */ U("div", {
2422
+ className: "grid grid-cols-2 gap-2",
2423
+ children: [
2424
+ /* @__PURE__ */ H(L, {
2425
+ variant: "primary",
2426
+ size: "sm",
2427
+ onClick: () => {
2428
+ let e = _(s());
2429
+ g(u.map((t) => ({
2430
+ ...t,
2431
+ hue: Z(e())
2432
+ })));
2433
+ },
2434
+ children: "Color"
2435
+ }),
2436
+ /* @__PURE__ */ H(L, {
2437
+ variant: "primary",
2438
+ size: "sm",
2439
+ onClick: () => {
2440
+ let e = _(s());
2441
+ g(u.map((t) => i ? {
2442
+ ...t,
2443
+ x: Z(Q(e, -.7, .7)),
2444
+ y: Z(Q(e, -.7, .7)),
2445
+ z: Z(Q(e, -.5, .5)),
2446
+ rot: Math.round(Q(e, 0, 360))
2447
+ } : {
2448
+ ...t,
2449
+ x: Z(Q(e, -.55, .55)),
2450
+ y: Z(Q(e, -.75, .75)),
2451
+ rot: Math.round(Q(e, 0, 360))
2452
+ }));
2453
+ },
2454
+ children: "Transform"
2455
+ }),
2456
+ /* @__PURE__ */ H(L, {
2457
+ variant: "primary",
2458
+ size: "sm",
2459
+ onClick: () => {
2460
+ let e = _(s());
2461
+ g(u.map((t) => {
2462
+ let n = Z(Q(e, .35, .95)), r = Z(Q(e, .35, .95));
2463
+ return i ? {
2464
+ ...t,
2465
+ sx: n,
2466
+ sy: r,
2467
+ sz: Z(Q(e, .35, .95))
2468
+ } : {
2469
+ ...t,
2470
+ sx: n,
2471
+ sy: r
2472
+ };
2473
+ }));
2474
+ },
2475
+ children: "Scale"
2476
+ }),
2477
+ /* @__PURE__ */ H(L, {
2478
+ variant: "primary",
2479
+ size: "sm",
2480
+ onClick: () => {
2481
+ let n = _(s());
2482
+ t(e.id, {
2483
+ motion: Z(Q(n, 0, 1.1)),
2484
+ sweep: Math.round(Q(n, 0, 360))
2485
+ });
2486
+ },
2487
+ children: "Animation"
2488
+ })
2489
+ ]
2490
+ }),
2491
+ /* @__PURE__ */ H(L, {
2492
+ variant: "primary",
2493
+ size: "sm",
2494
+ className: "w-full",
2495
+ onClick: () => {
2496
+ let e = _(s());
2497
+ if (i) {
2498
+ if (a) {
2499
+ let t = 2 + Math.floor(e() * 4), n = Q(e, .45, .9);
2500
+ g(Mt(Array.from({ length: t }, (r, i) => {
2501
+ let [a, o, s] = At(e, n), c = Z(Q(e, .5, .92));
2502
+ return {
2503
+ t: "sphere",
2504
+ x: Z(a),
2505
+ y: Z(o),
2506
+ z: Z(s),
2507
+ sx: c,
2508
+ sy: c,
2509
+ sz: c,
2510
+ rot: 0,
2511
+ hue: Z(i / t)
2512
+ };
2513
+ })));
2514
+ } else {
2515
+ let t = Q(e, .6, 1.15);
2516
+ g(Mt(u.map((n) => {
2517
+ let [r, i, a] = At(e, t);
2518
+ return {
2519
+ ...n,
2520
+ x: Z(r),
2521
+ y: Z(i),
2522
+ z: Z(a),
2523
+ rot: Math.round(Q(e, 0, 360))
2524
+ };
2525
+ })));
2526
+ }
2527
+ return;
2528
+ }
2529
+ let t = 2 + Math.floor(e() * 4), n = Q(e, .45, .85);
2530
+ g(jt(Array.from({ length: t }, (r, i) => {
2531
+ let [a, o] = kt(e, n);
2532
+ return {
2533
+ t: Ct[Math.floor(e() * Ct.length)].value,
2534
+ x: Z(a),
2535
+ y: Z(o),
2536
+ sx: Z(Q(e, .4, .85)),
2537
+ sy: Z(Q(e, .4, .85)),
2538
+ rot: Math.round(Q(e, 0, 360)),
2539
+ hue: Z(i / t)
2540
+ };
2541
+ })));
2542
+ },
2543
+ children: "Rearrange"
2544
+ })
2545
+ ]
2546
+ });
2547
+ }
2548
+ //#endregion
2549
+ //#region src/loops/theme.js
2550
+ function Ft(e, t, n, r) {
2551
+ let i = ue(n, r), a = {
2552
+ bg: i.bg,
2553
+ fg: i.fg,
2554
+ accent: i.accent,
2555
+ dim: i.dim ?? i.accent,
2556
+ warm: i.warm ?? i.accent
2557
+ }, o = { ...e };
2558
+ for (let e of t || []) e.type === "color" && e.role && a[e.role] && (o[e.key] = a[e.role]);
2559
+ return o;
2560
+ }
2561
+ //#endregion
2562
+ //#region src/editor/compose/inspectors/LoopFields.jsx
2563
+ var It = (e, t) => {
2564
+ let n = e.map((e) => ({
2565
+ value: e.id,
2566
+ label: e.label
2567
+ }));
2568
+ return t == null || t === "custom" ? [{
2569
+ value: "custom",
2570
+ label: "Custom"
2571
+ }, ...n] : n;
2572
+ };
2573
+ function $({ inline: e, label: t, align: n = "fill", children: r }) {
2574
+ return e ? /* @__PURE__ */ H(ve, {
2575
+ label: t,
2576
+ align: n,
2577
+ labelWidth: 96,
2578
+ children: r
2579
+ }) : /* @__PURE__ */ H(z, {
2580
+ label: t,
2581
+ children: r
2582
+ });
2583
+ }
2584
+ var Lt = [{
2585
+ value: "off",
2586
+ label: "Off"
2587
+ }, {
2588
+ value: "on",
2589
+ label: "On"
2590
+ }];
2591
+ function Rt({ inline: e, cs: t, on: n, onChange: r }) {
2592
+ return e ? /* @__PURE__ */ H(_e, {
2593
+ size: t,
2594
+ className: `w-full ${i(t) ?? ""}`,
2595
+ options: Lt,
2596
+ value: n ? "on" : "off",
2597
+ onChange: (e) => r(e === "on")
2598
+ }) : /* @__PURE__ */ H(ye, {
2599
+ size: t,
2600
+ options: Lt,
2601
+ viewMode: n ? "on" : "off",
2602
+ onViewChange: (e) => r(e === "on")
2603
+ });
2604
+ }
2605
+ function zt({ layer: n, setProp: r, patch: i, updateLayer: s, palette: c, renderAnimate: l, tab: h, tabStrip: g, tree: v, picker: ee = !0, inline: y = !1 }) {
2606
+ let b = t(), x = se(n.loopId), S = x?.params ?? [], C = n.themeId ?? "kol", w = !!n.themeInvert, re = (e) => s(n.id, {
2607
+ themeId: e,
2608
+ ...Ft(n, x?.params, e, w)
2609
+ }), ie = (e) => s(n.id, {
2610
+ themeInvert: e,
2611
+ ...Ft(n, x?.params, C, e)
2612
+ }), T = Je(n.loopId), oe = T ? Object.keys(T).map((e) => ({
2613
+ id: e,
2614
+ label: e
2615
+ })) : null, D = T ? new Set(Object.values(T).flatMap((e) => Object.keys(e))) : null, O = u(n), k = m(S, n), A = Ge(n.loopId, n), j = (e, t, r) => {
2616
+ let i = f(n, e, O.take(), {
2617
+ stripNoRandom: !!t?.motion,
2618
+ ...r
2619
+ });
2620
+ A && t?.motion && (t.id !== "Form" && (i._framePreset = "custom"), t.id !== "Frame" && (i._formPreset = "custom")), D && Object.keys(i).some((e) => D.has(e)) && (i._lookPreset = "custom"), s(n.id, i);
2621
+ }, M = (e) => {
2622
+ let t = E(n.loopGroup).find((e) => e.id === n.presetId)?.params ?? {}, r = {};
2623
+ for (let n of e) {
2624
+ let e = t[n.key] === void 0 ? n.default : t[n.key];
2625
+ e !== void 0 && (r[n.key] = e);
2626
+ }
2627
+ s(n.id, r);
2628
+ }, le = A ? Ke(A.frame) : null, ue = A ? Ke(A.form) : null, N = (e, t) => {
2629
+ let n = {};
2630
+ le?.has(e) && (n._framePreset = "custom"), ue?.has(e) && (n._formPreset = "custom"), D?.has(e) && (n._lookPreset = "custom"), i({
2631
+ [e]: t,
2632
+ ...n
2633
+ });
2634
+ }, fe = (e, t) => (n) => {
2635
+ let r = t.find((e) => e.id === n);
2636
+ i({
2637
+ [e]: n,
2638
+ ...r?.params ?? {}
2639
+ });
2640
+ }, P = (e) => i({
2641
+ _lookPreset: e,
2642
+ ...T?.[e] ?? {}
2643
+ }), I = x?.camera ? x.camera.map((e) => ({
2644
+ ...e,
2645
+ section: "Camera"
2646
+ })) : null, me = [...x?.camera ?? [], ...S.filter((t) => e(t) === "Camera")], he = x?.kind === "engine", z = me.length > 0 || he && x?.orbit, _e = x?.engine === "scene" && (n.animMode === "keyframes" || n.animMode === "keyframe"), ve = x?.orbit ? {
2647
+ yaw: 1,
2648
+ dist: 1
2649
+ } : ce(x), B = ve ? /* @__PURE__ */ U("p", {
2650
+ className: `kol-mono-10 text-meta${y ? "" : " col-span-2"}`,
2651
+ children: [
2652
+ "Press C (Orbit tool) to move the camera — ",
2653
+ x?.orbit ? "drag to orbit, scroll to zoom" : ve.yaw ? "drag to rotate, scroll to zoom" : "scroll to zoom",
2654
+ "."
2655
+ ]
2656
+ }) : null;
2657
+ return /* @__PURE__ */ U(V, { children: [
2658
+ ee && (y ? /* @__PURE__ */ H(ge, {
2659
+ divided: !0,
2660
+ children: /* @__PURE__ */ H(je, {
2661
+ layer: n,
2662
+ tree: v,
2663
+ inline: !0
2664
+ })
2665
+ }) : /* @__PURE__ */ H(je, {
2666
+ layer: n,
2667
+ tree: v
2668
+ })),
2669
+ g,
2670
+ (h === "generate" || h === "labs-effect") && /* @__PURE__ */ U(V, { children: [
2671
+ (n.loopId === "softforms" || n.loopId === "softforms3d") && /* @__PURE__ */ H(Pt, { layer: n }),
2672
+ T && !y && /* @__PURE__ */ H($, {
2673
+ inline: y,
2674
+ label: "Look",
2675
+ children: /* @__PURE__ */ H(R, {
2676
+ variant: "subtle",
2677
+ size: b,
2678
+ className: "w-full",
2679
+ options: It(oe, n._lookPreset),
2680
+ value: n._lookPreset ?? "custom",
2681
+ onChange: P
2682
+ })
2683
+ }),
2684
+ y && /* @__PURE__ */ U(ge, {
2685
+ divided: !0,
2686
+ children: [
2687
+ T && /* @__PURE__ */ H($, {
2688
+ inline: !0,
2689
+ label: "Look",
2690
+ children: /* @__PURE__ */ H(R, {
2691
+ variant: "subtle",
2692
+ size: b,
2693
+ className: "w-full",
2694
+ options: It(oe, n._lookPreset),
2695
+ value: n._lookPreset ?? "custom",
2696
+ onChange: P
2697
+ })
2698
+ }),
2699
+ /* @__PURE__ */ H($, {
2700
+ inline: !0,
2701
+ label: "Theme",
2702
+ children: /* @__PURE__ */ H(R, {
2703
+ variant: "subtle",
2704
+ size: b,
2705
+ className: "w-full",
2706
+ options: de,
2707
+ value: C,
2708
+ onChange: re
2709
+ })
2710
+ }),
2711
+ /* @__PURE__ */ H($, {
2712
+ inline: !0,
2713
+ label: "Invert",
2714
+ children: /* @__PURE__ */ H(Rt, {
2715
+ inline: !0,
2716
+ cs: b,
2717
+ on: w,
2718
+ onChange: ie
2719
+ })
2720
+ }),
2721
+ ae(x) && /* @__PURE__ */ H($, {
2722
+ inline: !0,
2723
+ label: "Background",
2724
+ children: /* @__PURE__ */ H(Rt, {
2725
+ inline: !0,
2726
+ cs: b,
2727
+ on: n.bgOn !== !1,
2728
+ onChange: (e) => r("bgOn", e)
2729
+ })
2730
+ }),
2731
+ B
2732
+ ]
2733
+ }),
2734
+ !y && /* @__PURE__ */ U("div", {
2735
+ className: "grid grid-cols-2 gap-2",
2736
+ children: [
2737
+ /* @__PURE__ */ H($, {
2738
+ inline: !1,
2739
+ label: "Theme",
2740
+ children: /* @__PURE__ */ H(R, {
2741
+ variant: "subtle",
2742
+ size: b,
2743
+ className: "w-full",
2744
+ options: de,
2745
+ value: C,
2746
+ onChange: re
2747
+ })
2748
+ }),
2749
+ /* @__PURE__ */ H($, {
2750
+ inline: !1,
2751
+ label: "Invert",
2752
+ children: /* @__PURE__ */ H(Rt, {
2753
+ inline: !1,
2754
+ cs: b,
2755
+ on: w,
2756
+ onChange: ie
2757
+ })
2758
+ }),
2759
+ ae(x) && /* @__PURE__ */ H($, {
2760
+ inline: !1,
2761
+ label: "Background",
2762
+ children: /* @__PURE__ */ H(Rt, {
2763
+ inline: !1,
2764
+ cs: b,
2765
+ on: n.bgOn !== !1,
2766
+ onChange: (e) => r("bgOn", e)
2767
+ })
2768
+ }),
2769
+ B
2770
+ ]
2771
+ }),
2772
+ /* @__PURE__ */ H(F, {
2773
+ schema: S,
2774
+ layer: n,
2775
+ setProp: N,
2776
+ palette: c,
2777
+ renderAnimate: l,
2778
+ tab: "generate",
2779
+ inline: y
2780
+ }),
2781
+ o(n).length > 0 && /* @__PURE__ */ H(L, {
2782
+ variant: "primary",
2783
+ size: b,
2784
+ className: "w-full",
2785
+ onClick: () => {
2786
+ let e = a(n, O.take());
2787
+ e && s(n.id, e);
2788
+ },
2789
+ children: "Randomize preset"
2790
+ }),
2791
+ /* @__PURE__ */ H(L, {
2792
+ variant: "primary",
2793
+ size: b,
2794
+ className: "w-full",
2795
+ onClick: (e) => e.altKey ? M(p(S, n)) : j(p(S, n), void 0, { withFilters: !0 }),
2796
+ children: "Randomize all"
2797
+ }),
2798
+ k.length > 0 && /* @__PURE__ */ U("div", {
2799
+ className: "grid grid-cols-2 gap-2",
2800
+ children: [k.map((e) => /* @__PURE__ */ H(L, {
2801
+ variant: "primary",
2802
+ size: b,
2803
+ onClick: (t) => t.altKey ? M(e.params) : j(e.params, e),
2804
+ children: e.label
2805
+ }, e.id)), n.loopId === "math-expression" && /* @__PURE__ */ H(L, {
2806
+ variant: "primary",
2807
+ size: b,
2808
+ onClick: (e) => {
2809
+ if (e.altKey) return M(k.find((e) => e.id === "Expression")?.params ?? []);
2810
+ let t = O.take();
2811
+ s(n.id, {
2812
+ expr: ne(_(t >>> 0)),
2813
+ _rollSeed: t
2814
+ });
2815
+ },
2816
+ children: "Wild"
2817
+ })]
2818
+ }),
2819
+ !y && /* @__PURE__ */ H(d, { seed: O }),
2820
+ n.loopId === "pattern-rules" && (n.render ?? "tiles") === "tiles" && /* @__PURE__ */ H(lt, {
2821
+ layer: n,
2822
+ patch: i,
2823
+ seed: O
2824
+ })
2825
+ ] }),
2826
+ (h === "style" || h === "labs-effect") && /* @__PURE__ */ U(V, { children: [
2827
+ /* @__PURE__ */ H(F, {
2828
+ schema: S,
2829
+ layer: n,
2830
+ setProp: N,
2831
+ palette: c,
2832
+ renderAnimate: l,
2833
+ tab: "style",
2834
+ inline: y
2835
+ }),
2836
+ n.loopId === "pattern-rules" && /* @__PURE__ */ H(pt, {
2837
+ layer: n,
2838
+ patch: i
2839
+ }),
2840
+ n.loopId === "math-curves" && /* @__PURE__ */ H(_t, {
2841
+ layer: n,
2842
+ patch: i
2843
+ }),
2844
+ n.loopId === "math-expression" && /* @__PURE__ */ U("div", {
2845
+ className: "grid grid-cols-2 gap-2",
2846
+ children: [/* @__PURE__ */ H(L, {
2847
+ variant: "primary",
2848
+ size: b,
2849
+ onClick: () => s(n.id, te(n)),
2850
+ children: "Fit"
2851
+ }), /* @__PURE__ */ H(L, {
2852
+ variant: "primary",
2853
+ size: b,
2854
+ onClick: () => M(k.find((e) => e.id === "View")?.params ?? []),
2855
+ children: "Reset"
2856
+ })]
2857
+ })
2858
+ ] }),
2859
+ h === "anim" && /* @__PURE__ */ U(V, { children: [
2860
+ A && /* @__PURE__ */ U(V, { children: [
2861
+ /* @__PURE__ */ H("span", {
2862
+ className: "kol-helper-10 text-meta",
2863
+ children: "Motion"
2864
+ }),
2865
+ /* @__PURE__ */ H($, {
2866
+ inline: y,
2867
+ label: "Frame",
2868
+ children: /* @__PURE__ */ H(R, {
2869
+ variant: "subtle",
2870
+ size: b,
2871
+ className: "w-full",
2872
+ options: It(A.frame, n._framePreset),
2873
+ value: n._framePreset ?? "custom",
2874
+ onChange: fe("_framePreset", A.frame)
2875
+ })
2876
+ }),
2877
+ /* @__PURE__ */ H($, {
2878
+ inline: y,
2879
+ label: "Form",
2880
+ children: /* @__PURE__ */ H(R, {
2881
+ variant: "subtle",
2882
+ size: b,
2883
+ className: "w-full",
2884
+ options: It(A.form, n._formPreset),
2885
+ value: n._formPreset ?? "custom",
2886
+ onChange: fe("_formPreset", A.form)
2887
+ })
2888
+ })
2889
+ ] }),
2890
+ /* @__PURE__ */ H(pe, {
2891
+ layer: n,
2892
+ schema: S,
2893
+ setProp: N
2894
+ }),
2895
+ /* @__PURE__ */ H(F, {
2896
+ schema: S,
2897
+ layer: n,
2898
+ setProp: N,
2899
+ palette: c,
2900
+ renderAnimate: l,
2901
+ tab: "anim",
2902
+ inline: y
2903
+ }),
2904
+ _e && /* @__PURE__ */ H(st, {
2905
+ layer: n,
2906
+ patch: i,
2907
+ defaultDuration: x?.duration ?? 8
2908
+ }),
2909
+ I && /* @__PURE__ */ H(F, {
2910
+ schema: I,
2911
+ layer: n,
2912
+ setProp: r,
2913
+ palette: c,
2914
+ renderAnimate: l,
2915
+ inline: y
2916
+ }),
2917
+ z && /* @__PURE__ */ H(ct, {
2918
+ layer: n,
2919
+ patch: i,
2920
+ camParams: me,
2921
+ isEngine: he,
2922
+ showHeader: !I
2923
+ })
2924
+ ] }),
2925
+ /* @__PURE__ */ H(yt, {
2926
+ layer: n,
2927
+ patch: i,
2928
+ tab: h === "labs-effect" ? "style" : h
2929
+ })
2930
+ ] });
2931
+ }
2932
+ //#endregion
2933
+ //#region src/packs/generators.js
2934
+ var Bt = {
2935
+ layerTypes: ["loop", "misc"],
2936
+ loopById: se,
2937
+ loopDrawParams: M,
2938
+ resolveCameraKeys: ce,
2939
+ loopBgToggleable: ae,
2940
+ presetById: oe,
2941
+ presetParams: le,
2942
+ presetsInGroup: E,
2943
+ presetsInSub: D,
2944
+ presetLayerPatch: A,
2945
+ isToolPreset: O,
2946
+ groupById: j,
2947
+ drawLoopFrame: w,
2948
+ GENERATIVE_TREE: Ce,
2949
+ MISC_TREE: we,
2950
+ THEME_OPTIONS: de,
2951
+ buildParatypeFlattenGroup: Ae,
2952
+ LoopPicker: je,
2953
+ LoopFields: zt,
2954
+ loadGlHost: () => import("./host-BMD1sgpp.js")
2955
+ };
2956
+ g("generators", Bt);
2957
+ //#endregion
2958
+ export { nt as a, we as c, it as i, zt as n, tt as o, rt as r, Ce as s, Bt as t };