@kolkrabbi/design-editor 0.26.0 → 0.27.1

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.
@@ -1,37 +1,395 @@
1
- import { B as e, D as t, F as n, I as r, In as i, J as a, L as o, Ln as s, P as c, Tt as l, Wt as u, _n as d, a as f, an as p, d as m, en as h, et as g, f as _, gn as v, i as y, in as b, it as x, j as S, n as C, o as w, p as T, r as E, rt as D, tn as O, vn as k, yn as A } from "./rolls-BGtqxVYq.js";
2
- import { A as j, D as M, E as N, a as P, b as F, c as I, d as L, f as R, h as z, i as ee, k as B, m as te, n as ne, o as re, p as ie, r as V, s as ae, t as oe, w as H, x as se, y as U } from "./useLayerEdit-BFcZhiNX.js";
3
- import { C as W, E as ce, N as le, S as ue, T as de, _ as fe, b as pe, c as me, d as he, f as ge, g as _e, i as ve, j as ye, l as be, m as xe, p as Se, r as Ce, v as we, w as Te, x as Ee, y as De } from "./ColorModesWindow-CWhL6nfm.js";
4
- import { c as Oe, d as ke, f as Ae, l as je, m as Me, n as Ne, p as Pe, r as Fe, u as Ie } from "./generators-D1tFSZgG.js";
5
- import { r as Le } from "./TreePicker-nMf17QGH.js";
6
- import { n as Re, r as ze, t as Be } from "./BindDot-CMUtpJPX.js";
7
- import { n as Ve, r as He } from "./effects-DZEmfY7a.js";
8
- import { T as Ue, a as We, b as Ge, d as Ke, f as qe, h as Je, i as Ye, l as G, m as Xe, o as Ze, p as Qe, r as $e, s as et, u as tt, x as nt } from "./timelinePinned-BwYq1Msi.js";
9
- import { i as rt, n as it, r as at } from "./motion-BJ8xqUKI.js";
10
- import { $ as ot, A as st, B as ct, C as lt, Ct as ut, D as dt, E as ft, F as pt, G as mt, H as ht, I as gt, J as _t, K as vt, L as yt, M as bt, N as xt, O as St, P as Ct, Q as wt, R as Tt, S as Et, St as Dt, T as Ot, U as kt, V as At, W as jt, X as Mt, Y as Nt, Z as Pt, _ as Ft, _t as It, a as Lt, at as Rt, b as zt, bt as Bt, c as Vt, ct as Ht, d as Ut, dt as Wt, et as Gt, f as Kt, ft as qt, g as Jt, gt as Yt, h as Xt, ht as Zt, i as Qt, it as $t, j as en, k as tn, l as nn, lt as rn, m as an, mt as on, n as sn, nt as cn, o as ln, ot as un, p as dn, pt as fn, q as pn, r as mn, rt as hn, s as gn, st as _n, t as vn, tt as yn, u as bn, ut as xn, v as Sn, vt as Cn, w as wn, wt as Tn, x as En, xt as Dn, y as On, yt as kn, z as An } from "./core-CfGqY4VB.js";
11
- import { Button as K, Divider as jn, Dropdown as Mn, LabeledControlSection as q, MultiSelect as Nn, SegmentedToggle as J, SettingsRow as Pn, StepList as Fn, Tag as In, ToggleSwitch as Ln, Tooltip as Rn, useGrabEdge as zn, useModal as Bn } from "@kolkrabbi/kol-component";
12
- import { createContext as Vn, useContext as Hn, useEffect as Y, useRef as X, useState as Z, useSyncExternalStore as Un } from "react";
13
- import { Fragment as Wn, jsx as Q, jsxs as $ } from "react/jsx-runtime";
14
- import { Icon as Gn } from "@kolkrabbi/kol-icons";
15
- import { useDragResize as Kn, useTheme as qn } from "@kolkrabbi/kol-framework";
16
- import { createPortal as Jn } from "react-dom";
1
+ import { B as e, D as t, F as n, I as r, J as i, L as a, On as o, P as s, Tt as c, Wt as l, _n as u, a as d, an as f, bn as p, d as m, et as h, f as g, i as _, it as v, j as y, kn as b, n as x, nn as S, o as C, on as w, p as T, r as E, rt as D, tn as O, vn as ee, yn as k } from "./rolls-CGma4Bua.js";
2
+ import { n as A, r as j, t as te } from "./useLayerEdit-CnPxtfWc.js";
3
+ import { C as M, D as ne, E as N, _ as P, a as F, c as I, d as re, f as L, g as R, i as ie, l as ae, m as z, n as B, r as oe, t as se, u as ce, v as V, w as H, x as U, y as le } from "./effectCategories-DJrQJ7vg.js";
4
+ import { r as ue } from "./TreePicker-BQYPaQv3.js";
5
+ import { _ as de, a as W, b as fe, f as pe, g as me, h as he, i as ge, m as _e, n as ve, o as ye, p as be, r as xe, s as Se, v as Ce, y as we } from "./generators-CQQxNX9W.js";
6
+ import { C as Te, E as Ee, S as De, T as Oe, _ as ke, b as Ae, c as je, d as Me, f as Ne, g as Pe, i as Fe, l as Ie, m as Le, n as Re, p as ze, r as Be, v as Ve, w as He, x as Ue, y as We } from "./ColorModesWindow-D65R5YR5.js";
7
+ import { a as Ge, c as Ke, d as qe, f as Je, i as Ye, l as Xe, n as Ze, o as Qe, p as $e, r as et, s as G, t as tt, u as nt } from "./morphStore-DaOLa9oj.js";
8
+ import { n as rt, r as it, t as at } from "./BindDot-CaZu6Uuz.js";
9
+ import { n as ot, r as st } from "./effects-dbxBWOCp.js";
10
+ import { a as ct, i as lt, n as ut, o as dt, r as ft } from "./motion-yfgCBe5u.js";
11
+ import { n as pt, r as mt, t as ht } from "./Timeline-OZsY9CvR.js";
12
+ import { $ as gt, A as _t, B as vt, C as yt, D as bt, E as xt, F as St, G as Ct, H as wt, I as Tt, J as Et, K as Dt, L as Ot, M as kt, N as At, O as jt, P as Mt, Q as Nt, R as Pt, S as Ft, T as It, U as Lt, V as Rt, W as zt, X as Bt, Y as Vt, Z as Ht, _ as Ut, a as Wt, at as Gt, b as Kt, c as qt, ct as Jt, d as Yt, dt as Xt, et as Zt, f as Qt, ft as $t, g as en, h as tn, i as nn, it as rn, j as an, k as on, l as sn, lt as cn, m as ln, n as un, nt as dn, o as fn, ot as pn, p as mn, q as hn, r as gn, rt as _n, s as vn, st as yn, t as bn, tt as xn, u as Sn, ut as Cn, v as wn, w as Tn, x as En, y as Dn, z as On } from "./core-DP3uwW4A.js";
13
+ import { Button as K, Divider as kn, Dropdown as An, LabeledControlSection as q, MultiSelect as jn, SegmentedToggle as J, SettingsRow as Mn, StepList as Nn, Tag as Pn, ToggleSwitch as Fn, Tooltip as In, useGrabEdge as Ln, useModal as Rn } from "@kolkrabbi/kol-component";
14
+ import { createContext as zn, useContext as Bn, useEffect as Y, useRef as X, useState as Z, useSyncExternalStore as Vn } from "react";
15
+ import { Fragment as Hn, jsx as Q, jsxs as $ } from "react/jsx-runtime";
16
+ import { Icon as Un } from "@kolkrabbi/kol-icons";
17
+ import { useDragResize as Wn, useTheme as Gn } from "@kolkrabbi/kol-framework";
18
+ import { createPortal as Kn } from "react-dom";
17
19
  //#region src/phoneFloats.js
18
- var Yn = (e) => {
20
+ var qn = (e) => {
19
21
  let t = e, n = /* @__PURE__ */ new Set(), r = (e) => (n.add(e), () => n.delete(e));
20
22
  return {
21
23
  set: (e) => {
22
24
  e !== t && (t = e, n.forEach((e) => e()));
23
25
  },
24
- use: () => Un(r, () => t, () => t)
26
+ use: () => Vn(r, () => t, () => t)
25
27
  };
26
- }, Xn = Yn(null), Zn = Yn(null), Qn = Xn.set;
27
- Xn.use, Zn.set;
28
- var $n = Zn.use;
28
+ }, Jn = qn(null), Yn = qn(null), Xn = Jn.set;
29
+ Jn.use, Yn.set;
30
+ var Zn = Yn.use, Qn = [
31
+ {
32
+ id: "shape",
33
+ label: "Shape",
34
+ icon: "line-circle"
35
+ },
36
+ {
37
+ id: "blend",
38
+ label: "Blend",
39
+ icon: "shaper-scurve"
40
+ },
41
+ {
42
+ id: "crossfade",
43
+ label: "Crossfade",
44
+ icon: "dashed-circle"
45
+ }
46
+ ], $n = {
47
+ shape: [
48
+ ["Loops", ["morph-circle", "star-morph"]],
49
+ ["Loops", [
50
+ "square-circle",
51
+ "blob",
52
+ "lissajous"
53
+ ]],
54
+ ["Loops", [
55
+ "morph-circle",
56
+ "star-morph",
57
+ "blob",
58
+ "spiral"
59
+ ]],
60
+ ["Math", ["math-spinner", "math-threads"]],
61
+ ["Field", ["halftone", "checker-field"]],
62
+ ["Flow", ["flow-obstacles", "flow-voronoi"]]
63
+ ],
64
+ crossfade: [
65
+ ["Scanline", ["scanline", "plasma"]],
66
+ ["Scanline", [
67
+ "scanline",
68
+ "flow-charges",
69
+ "math-surface"
70
+ ]],
71
+ ["Field", ["plasma", "math-field"]],
72
+ ["Field", ["gradient-field", "optic-moire"]],
73
+ ["Penrose", ["penrose-02-diffgrow", "flow-growth"]],
74
+ ["Penrose", [
75
+ "penrose-01-packing-lloyd",
76
+ "optic-reaction",
77
+ "abstract-rd",
78
+ "flow-voronoi"
79
+ ]],
80
+ ["Math", ["math-threads", "flow-ascii"]],
81
+ ["Math", ["math-waveform", "scanline"]]
82
+ ],
83
+ blend: [
84
+ [
85
+ "Scanline",
86
+ "scanline",
87
+ 2
88
+ ],
89
+ [
90
+ "Scanline",
91
+ "scanline",
92
+ 3
93
+ ],
94
+ [
95
+ "Field",
96
+ "plasma",
97
+ 2
98
+ ],
99
+ [
100
+ "Math",
101
+ "math-curves",
102
+ 2
103
+ ],
104
+ [
105
+ "Math",
106
+ "math-spinner",
107
+ 4
108
+ ],
109
+ [
110
+ "Optic",
111
+ "optic-moire",
112
+ 2
113
+ ],
114
+ [
115
+ "Flow",
116
+ "flow-obstacles",
117
+ 2
118
+ ]
119
+ ]
120
+ }, er = null;
121
+ function tr(e) {
122
+ if (!er) {
123
+ er = /* @__PURE__ */ new Map();
124
+ let e = /* @__PURE__ */ new Set();
125
+ for (let t of z) for (let n of N(t.id)) e.has(n.id) || le(n) || (e.add(n.id), er.has(n.loop) || er.set(n.loop, []), er.get(n.loop).push(n));
126
+ }
127
+ return er.get(e) ?? [];
128
+ }
129
+ var nr = (e, t) => e.length < t ? null : Array.from({ length: t }, (n, r) => e[Math.round(r * (e.length - 1) / (t - 1))]), rr = null;
130
+ function ir() {
131
+ if (rr) return rr;
132
+ let e = [];
133
+ for (let t of Qn) for (let n of $n[t.id]) {
134
+ let [r] = n, i = t.id === "blend" ? nr(tr(n[1]), n[2]) : n[1].map((e) => tr(e)[0]);
135
+ if (!i || i.some((e) => !e) || new Set(i.map((e) => e.id)).size < i.length) continue;
136
+ let a = i.map((e) => e.label).join(" → "), o = `ship:morph:${t.id}:${i.map((e) => e.id).join("--")}`;
137
+ e.push({
138
+ id: o,
139
+ type: t.id,
140
+ typeLabel: t.label,
141
+ category: r,
142
+ sub: `${t.label} · ${r}`,
143
+ label: a,
144
+ steps: i,
145
+ morph: {
146
+ mode: t.id,
147
+ loopId: i[0].loop,
148
+ steps: i.map(ge),
149
+ curve: "in-out",
150
+ cycle: "loop",
151
+ resolution: 0,
152
+ syncLoop: !1,
153
+ seconds: 2 * i.length
154
+ }
155
+ });
156
+ }
157
+ return rr = e;
158
+ }
159
+ var ar = () => Qn.map((e) => ({
160
+ label: e.label,
161
+ subs: [...new Set(ir().filter((t) => t.type === e.id).map((e) => e.sub))]
162
+ })), or = (e, t) => ir().find((n) => n.type === e && (!t || n.category === t)), sr = (e) => ir().find((t) => t.id === e);
163
+ function cr(e) {
164
+ e && (Qe({
165
+ active: !0,
166
+ ...e.morph,
167
+ fileId: null,
168
+ fileName: e.label,
169
+ presetId: e.id
170
+ }), O.setLoopSeconds(e.morph.seconds), /\/morph\/?$/.test(window.location.pathname) || Jt("/morph"));
171
+ }
172
+ //#endregion
173
+ //#region src/editor/labs/catalog.js
174
+ var lr = {
175
+ "fx:halftone": "ptrn-dot",
176
+ "fx:scanline": "grid-horizontal",
177
+ "fx:crt": "desktop",
178
+ "fx:refraction": "circle",
179
+ "fx:fx-rack": "target",
180
+ "fx:pattern": "ptrn-checker",
181
+ "fx:other": "more",
182
+ "gen:Scanline": "grid-horizontal",
183
+ "gen:Pattern": "ptrn-checker",
184
+ "gen:Loops": "refresh",
185
+ "gen:Math": "sum",
186
+ "gen:Penrose": "a-framed",
187
+ "gen:Flow": "wave",
188
+ "gen:Letter Gap": "letter-spacing",
189
+ "gen:Drift": "dith-flow",
190
+ "gen:Gradients": "circle",
191
+ "gen:Soft Forms": "paint-drop",
192
+ "gen:3D Scene": "ball",
193
+ "kin:Type": "font-01",
194
+ "kin:Kinetic": "font-01",
195
+ "misc:Para Type": "aa",
196
+ "vec:Distressor": "scribble",
197
+ "vec:Modulator": "dashed-circle"
198
+ }, ur = {
199
+ effects: "filter",
200
+ generative: "layers",
201
+ vector: "pen-nib",
202
+ composition: "type",
203
+ morph: "swap",
204
+ mode: "mode-toggle-01"
205
+ }, dr = [
206
+ "Moiré",
207
+ "Mesh Gradient",
208
+ "Reaction",
209
+ "Halftone"
210
+ ], fr = [
211
+ {
212
+ label: "Spaced",
213
+ patch: {
214
+ geometry: "rows",
215
+ mark: "dots"
216
+ }
217
+ },
218
+ {
219
+ label: "Glyph",
220
+ patch: { mark: "glyph" }
221
+ },
222
+ {
223
+ label: "Lattice",
224
+ patch: { mark: "lattice" }
225
+ },
226
+ {
227
+ label: "Vortex",
228
+ patch: {
229
+ geometry: "radial",
230
+ swirl: .8,
231
+ rayCount: 220
232
+ }
233
+ },
234
+ {
235
+ label: "Rings",
236
+ patch: { geometry: "rings" }
237
+ },
238
+ {
239
+ label: "Spiral",
240
+ patch: { geometry: "spiral" }
241
+ }
242
+ ], pr = (e = {}) => {
243
+ let t = e.geometry ?? "rows";
244
+ return t === "radial" ? "Vortex" : t === "rings" ? "Rings" : t === "spiral" ? "Spiral" : e.mark === "glyph" ? "Glyph" : e.mark === "lattice" ? "Lattice" : "Spaced";
245
+ };
246
+ function mr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource: i }) {
247
+ let a = () => e?.type === "photo" ? (e.filters ?? []).filter((e) => e?.id === "fx-media") : [], o = (e, o) => {
248
+ let s = a(), c = t("photo", {
249
+ ...i(),
250
+ filters: s,
251
+ fxGroup: null
252
+ });
253
+ c && (n(c, e), o && r(c, s.length, o)), window.dispatchEvent(new CustomEvent("kol:open-effects"));
254
+ }, s = (e) => {
255
+ t("photo", {
256
+ ...i(),
257
+ filters: a(),
258
+ fxGroup: e
259
+ }), window.dispatchEvent(new CustomEvent("kol:open-effects"));
260
+ }, c = (e, n) => {
261
+ t("loop", H(e, n)), window.dispatchEvent(new CustomEvent("kol:open-params"));
262
+ }, l = (e) => {
263
+ t("kinetic", {
264
+ presetId: e.id,
265
+ presetLabel: e.label,
266
+ comp: dt(e)
267
+ }), window.dispatchEvent(new CustomEvent("kol:open-params"));
268
+ }, u = e?.presetId ?? null, d = (e?.filters ?? []).find((e) => e?.id !== "fx-media")?.id ?? null, f = u ? N(e?.loopGroup).find((e) => e.id === u) ?? null : null, p = (n, r = "loop", i) => {
269
+ let a = N(n), o = [...new Set(a.map((e) => e.sub).filter(Boolean))], s = (e) => r === "misc" ? () => {
270
+ t("misc", H(e, n)), window.dispatchEvent(new CustomEvent("kol:open-params"));
271
+ } : () => c(e, n);
272
+ return o.length ? o.map((t) => ({
273
+ label: t,
274
+ onSelect: s(ne(n, t)[0]),
275
+ active: e?.loopGroup === n && f?.sub === t
276
+ })) : [{
277
+ label: i ?? P(n).label,
278
+ onSelect: s(a[0]),
279
+ active: e?.loopGroup === n
280
+ }];
281
+ }, m = (e) => e.groups.flatMap((t) => {
282
+ let n = e.labels?.[t] ?? P(t).label, r = N(t).some((e) => e.sub), i = p(t, "loop", n);
283
+ return e.groups.length > 1 && r ? [{
284
+ label: n,
285
+ children: i
286
+ }] : i;
287
+ });
288
+ return [
289
+ {
290
+ id: "color",
291
+ label: "Color",
292
+ icon: "clr-tri",
293
+ onSelect: Re,
294
+ pages: []
295
+ },
296
+ {
297
+ id: "sec:effects",
298
+ label: "Effects"
299
+ },
300
+ ...oe(L).map((t) => ({
301
+ id: `fx:${t.id}`,
302
+ label: t.label,
303
+ icon: lr[`fx:${t.id}`] ?? "square",
304
+ pages: t.rack ? se.map((t) => ({
305
+ label: t.label,
306
+ onSelect: () => s(t.id),
307
+ active: e?.fxGroup === t.id
308
+ })) : t.id === "pattern" ? dr.map((t) => ({
309
+ label: t,
310
+ onSelect: () => c(ne("optic", t)[0], "optic"),
311
+ active: e?.loopGroup === "optic" && f?.sub === t
312
+ })) : t.id === "scanline" ? fr.map((t) => ({
313
+ label: t.label,
314
+ onSelect: () => o("scanline", t.patch),
315
+ active: !e?.fxGroup && d === "scanline" && pr((e?.filters ?? []).find((e) => e?.id === "scanline")?.params) === t.label
316
+ })) : t.filters.map((t) => ({
317
+ label: t.label ?? t.id,
318
+ onSelect: () => o(t.id),
319
+ active: !e?.fxGroup && d === t.id
320
+ }))
321
+ })),
322
+ {
323
+ id: "sec:generative",
324
+ label: "Generative"
325
+ },
326
+ ...we.map((e) => ({
327
+ id: `gen:${e.label}`,
328
+ label: e.label,
329
+ icon: lr[`gen:${e.label}`] ?? "square",
330
+ pages: m(e)
331
+ })),
332
+ {
333
+ id: "sec:morph",
334
+ label: "Morph"
335
+ },
336
+ ...Qn.map((e) => ({
337
+ id: `morph:${e.id}`,
338
+ label: e.label,
339
+ icon: e.icon,
340
+ pages: [...new Set(ir().filter((t) => t.type === e.id).map((e) => e.category))].map((t) => ({
341
+ label: t,
342
+ onSelect: () => cr(or(e.id, t)),
343
+ active: (() => {
344
+ let n = ir().find((e) => e.id === Ze().presetId);
345
+ return n?.type === e.id && n.category === t;
346
+ })()
347
+ }))
348
+ })),
349
+ {
350
+ id: "sec:vector",
351
+ label: "Vector"
352
+ },
353
+ {
354
+ id: "vec:Distressor",
355
+ label: "Distressor",
356
+ icon: lr["vec:Distressor"] ?? "square",
357
+ pages: p("distress")
358
+ },
359
+ {
360
+ id: "vec:Modulator",
361
+ label: "Modulator",
362
+ icon: lr["vec:Modulator"] ?? "square",
363
+ pages: p("modulator")
364
+ },
365
+ {
366
+ id: "sec:composition",
367
+ label: "Composition"
368
+ },
369
+ ...ct.map((t) => ({
370
+ id: `kin:${t.label}`,
371
+ label: t.label,
372
+ icon: lr[`kin:${t.label}`] ?? "square",
373
+ pages: t.subs.map((t) => ({
374
+ label: t,
375
+ onSelect: () => l(lt.find((e) => e.sub === t)),
376
+ active: e?.type === "kinetic" && lt.some((e) => e.sub === t && e.id === u)
377
+ }))
378
+ })),
379
+ ...fe.map((e) => ({
380
+ id: `misc:${e.label}`,
381
+ label: e.label,
382
+ icon: lr[`misc:${e.label}`] ?? "square",
383
+ pages: e.groups.flatMap((e) => p(e, "misc"))
384
+ }))
385
+ ];
386
+ }
29
387
  //#endregion
30
388
  //#region src/editor/labs/LabsNav.jsx
31
- function er() {
32
- let { addFilter: e, patchFilter: t } = a(), { layer: n, setOnly: r } = un(), i = X(null);
389
+ function hr() {
390
+ let { addFilter: e, patchFilter: t } = i(), { layer: n, setOnly: r } = W(), a = X(null);
33
391
  Y(() => {
34
- n?.type === "photo" && n.src && (i.current = {
392
+ n?.type === "photo" && n.src && (a.current = {
35
393
  src: n.src,
36
394
  srcType: n.srcType,
37
395
  fit: n.fit
@@ -42,7 +400,7 @@ function er() {
42
400
  n?.srcType,
43
401
  n?.fit
44
402
  ]);
45
- let o = wt({
403
+ let o = mr({
46
404
  layer: n,
47
405
  setOnly: r,
48
406
  addFilter: e,
@@ -51,7 +409,7 @@ function er() {
51
409
  src: n.src,
52
410
  srcType: n.srcType,
53
411
  fit: n.fit
54
- } : i.current ?? {}
412
+ } : a.current ?? {}
55
413
  });
56
414
  return Y(() => {
57
415
  let e = /* @__PURE__ */ new Map(), t = [];
@@ -59,14 +417,14 @@ function er() {
59
417
  if (n.id.startsWith("sec:")) {
60
418
  let e = n.id.slice(4);
61
419
  t.push({
62
- icon: Pt[e] ?? "square",
63
- path: `${gn}${n.id}`,
420
+ icon: ur[e] ?? "square",
421
+ path: `${vn}${n.id}`,
64
422
  label: n.label,
65
423
  sub: []
66
424
  });
67
425
  return;
68
426
  }
69
- let r = `${gn}${n.id}`, i = n.pages ?? [], a = n.onSelect ?? i[0]?.onSelect ?? i[0]?.children?.[0]?.onSelect;
427
+ let r = `${vn}${n.id}`, i = n.pages ?? [], a = n.onSelect ?? i[0]?.onSelect ?? i[0]?.children?.[0]?.onSelect;
70
428
  a && e.set(r, a);
71
429
  let o = t[t.length - 1], s = {
72
430
  icon: n.icon,
@@ -74,30 +432,30 @@ function er() {
74
432
  label: n.label
75
433
  };
76
434
  o?.sub ? o.sub.push(s) : t.push(s);
77
- }), Vt({
435
+ }), qt({
78
436
  items: t,
79
437
  dispatch: (t) => {
80
438
  let n = e.get(t);
81
439
  return n ? (n(), !0) : !1;
82
440
  }
83
- }), () => Vt(null);
441
+ }), () => qt(null);
84
442
  }), null;
85
443
  }
86
444
  //#endregion
87
445
  //#region src/editor/morph/MorphTab.jsx
88
- var tr = (e, t) => JSON.stringify(e) === JSON.stringify(t), nr = [
446
+ var gr = (e, t) => JSON.stringify(e) === JSON.stringify(t), _r = [
89
447
  {
90
448
  key: "curve",
91
449
  label: "Curve",
92
450
  type: "select",
93
- options: Qe,
451
+ options: qe,
94
452
  section: "Curve"
95
453
  },
96
454
  {
97
455
  key: "cycle",
98
456
  label: "Cycle",
99
457
  type: "select",
100
- options: Xe,
458
+ options: Je,
101
459
  section: "Curve"
102
460
  },
103
461
  {
@@ -118,51 +476,51 @@ var tr = (e, t) => JSON.stringify(e) === JSON.stringify(t), nr = [
118
476
  when: (e) => e.mode === "shape"
119
477
  }
120
478
  ];
121
- function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
122
- let i = o(), s = qe(), { steps: c, curve: l, cycle: u, mode: d, resolution: f, editing: p, fileId: m, editRequest: g } = s, { updateLayer: _, removeLayer: v, setCurrentPresetId: y, setCurrentPresetName: x, palette: S } = a(), { setOnly: C } = un(), { buildSavedSpec: w } = ht(), { addItem: T, updateItem: E } = ge(), D = Bn(), O = b(), k = oe(e?.id ?? null, { history: "coalesce" }), [A, j] = Z("generate"), M = c[0], N = c.every((e) => e.loopId === M?.loopId), P = c.filter((e) => !jt(H(e.loopId)) || !kt(H(e.loopId))), F = P.length === 0, I = {
123
- blend: N ? null : "Blend tweens one generator — these steps are different generators",
124
- shape: F ? null : `No outline to morph: ${P.map((e) => tt(e, c.indexOf(e))).join(", ")} (GL)`,
125
- crossfade: F ? null : `Cannot fade: ${P.map((e) => tt(e, c.indexOf(e))).join(", ")} (GL)`
126
- }, L = [
479
+ function vr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
480
+ let o = a(), s = nt(), { steps: c, curve: l, cycle: u, mode: d, resolution: p, editing: m, fileId: h, editRequest: g } = s, { updateLayer: _, removeLayer: v, setCurrentPresetId: y, setCurrentPresetName: b, palette: x } = i(), { setOnly: S } = W(), { buildSavedSpec: C } = wt(), { addItem: w, updateItem: T } = Ne(), E = Rn(), D = f(), ee = te(e?.id ?? null, { history: "coalesce" }), [k, j] = Z("generate"), M = c[0], ne = c.every((e) => e.loopId === M?.loopId), N = c.filter((e) => !zt(U(e.loopId)) || !Lt(U(e.loopId))), P = N.length === 0, F = {
481
+ blend: ne ? null : "Blend tweens one generator — these steps are different generators",
482
+ shape: P ? null : `No outline to morph: ${N.map((e) => Ke(e, c.indexOf(e))).join(", ")} (GL)`,
483
+ crossfade: P ? null : `Cannot fade: ${N.map((e) => Ke(e, c.indexOf(e))).join(", ")} (GL)`
484
+ }, I = [
127
485
  {
128
486
  value: "shape",
129
487
  label: "Shape",
130
- disabled: !!I.shape,
131
- tooltip: I.shape ?? void 0
488
+ disabled: !!F.shape,
489
+ tooltip: F.shape ?? void 0
132
490
  },
133
491
  {
134
492
  value: "blend",
135
493
  label: "Blend",
136
- disabled: !!I.blend,
137
- tooltip: I.blend ?? void 0
494
+ disabled: !!F.blend,
495
+ tooltip: F.blend ?? void 0
138
496
  },
139
497
  {
140
498
  value: "crossfade",
141
499
  label: "Crossfade",
142
- disabled: !!I.crossfade,
143
- tooltip: I.crossfade ?? void 0
500
+ disabled: !!F.crossfade,
501
+ tooltip: F.crossfade ?? void 0
144
502
  }
145
503
  ];
146
504
  Y(() => {
147
- if (t || c.length < 2 || !I[d]) return;
505
+ if (t || c.length < 2 || !F[d]) return;
148
506
  let e = [
149
507
  "shape",
150
508
  "crossfade",
151
509
  "blend"
152
- ].find((e) => !I[e]);
510
+ ].find((e) => !F[e]);
153
511
  e && G({ mode: e });
154
512
  }, [
155
513
  d,
156
- N,
157
- F,
514
+ ne,
515
+ P,
158
516
  c.length,
159
517
  t
160
518
  ]), Y(() => {
161
- !t && c.length === 0 && e?.type === "loop" && e.loopId && !e.morph && $e(Rt(e));
519
+ !t && c.length === 0 && e?.type === "loop" && e.loopId && !e.morph && tt(xe(e));
162
520
  }, []);
163
- let R = X(c.length), z = () => {
164
- let t = c.length < R.current;
165
- if (R.current = c.length, c.length < 2) {
521
+ let re = X(c.length), L = () => {
522
+ let t = c.length < re.current;
523
+ if (re.current = c.length, c.length < 2) {
166
524
  if (!e || !t) return;
167
525
  if (c.length === 0) {
168
526
  v(e.id);
@@ -193,18 +551,18 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
193
551
  steps: c.map((e, t) => ({
194
552
  loopId: e.loopId,
195
553
  params: e.params,
196
- label: tt(e, t)
554
+ label: Ke(e, t)
197
555
  })),
198
556
  cycle: u,
199
557
  curve: l,
200
- resolution: f,
558
+ resolution: p,
201
559
  syncLoop: s.syncLoop,
202
560
  name: s.fileName
203
561
  }, i = d === "blend" ? {
204
562
  ...n,
205
- ...Je({
563
+ ...$e({
206
564
  snapshots: c.map((e) => e.params),
207
- schema: H(M.loopId)?.params ?? [],
565
+ schema: U(M.loopId)?.params ?? [],
208
566
  curve: l,
209
567
  cycle: u
210
568
  }).patch,
@@ -216,43 +574,43 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
216
574
  morph: r,
217
575
  morphT: {
218
576
  bind: "track",
219
- keys: mt(c.length, u, l)
577
+ keys: Ct(c.length, u, l)
220
578
  }
221
579
  };
222
- e ? _(e.id, i) : C("loop", i);
223
- }, ee = X(z);
224
- ee.current = z;
225
- let B = JSON.stringify([
580
+ e ? _(e.id, i) : S("loop", i);
581
+ }, R = X(L);
582
+ R.current = L;
583
+ let ie = JSON.stringify([
226
584
  d,
227
585
  c.map((e) => [e.loopId, e.params]),
228
586
  l,
229
587
  u,
230
- f,
588
+ p,
231
589
  s.syncLoop
232
- ]), te = X(null);
590
+ ]), ae = X(null);
233
591
  Y(() => {
234
- t || p != null || B === te.current || c.length >= 2 && I[d] || (te.current = B, ee.current());
592
+ t || m != null || ie === ae.current || c.length >= 2 && F[d] || (ae.current = ie, R.current());
235
593
  }, [
236
- B,
237
- p,
594
+ ie,
595
+ m,
238
596
  c.length,
239
597
  t
240
598
  ]), Y(() => {
241
- if (t || p == null || !e) return;
242
- let n = We(e, H(e.loopId)?.params ?? []);
243
- tr(n, c[p]?.params) || Ke(p, n);
599
+ if (t || m == null || !e) return;
600
+ let n = et(e, U(e.loopId)?.params ?? []);
601
+ gr(n, c[m]?.params) || Xe(m, n);
244
602
  }, [e]), Y(() => {
245
- t || !O || p == null || (G({ editing: null }), te.current = null);
603
+ t || !D || m == null || (G({ editing: null }), ae.current = null);
246
604
  }, [
247
- O,
248
- p,
605
+ D,
606
+ m,
249
607
  t
250
608
  ]), Y(() => () => {
251
- !t && s.editing != null && (G({ editing: null }), ee.current());
609
+ !t && s.editing != null && (G({ editing: null }), R.current());
252
610
  }, []);
253
- let re = (e) => {
611
+ let z = (e) => {
254
612
  let t = c[e];
255
- t && (h.pause(), G({ editing: e }), C("loop", {
613
+ t && (O.pause(), G({ editing: e }), S("loop", {
256
614
  loopGroup: t.loopGroup,
257
615
  presetId: t.presetId,
258
616
  presetLabel: t.presetLabel,
@@ -263,7 +621,7 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
263
621
  }));
264
622
  };
265
623
  return Y(() => {
266
- t || g == null || (G({ editRequest: null }), re(g));
624
+ t || g == null || (G({ editRequest: null }), z(g));
267
625
  }, [g]), /* @__PURE__ */ $("div", {
268
626
  className: "flex flex-col gap-5",
269
627
  children: [
@@ -271,35 +629,35 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
271
629
  tone: "sunken",
272
630
  value: d,
273
631
  onChange: (e) => !t && G({ mode: e }),
274
- options: L,
275
- size: i,
276
- className: r(i)
632
+ options: I,
633
+ size: o,
634
+ className: r(o)
277
635
  }),
278
636
  !t && /* @__PURE__ */ Q(q, {
279
637
  divided: !0,
280
- children: /* @__PURE__ */ Q(Le, {
281
- tree: hn(),
282
- presets: cn(),
283
- current: yn(s.presetId) ?? { typeLabel: ot.find((e) => e.id === d)?.label },
638
+ children: /* @__PURE__ */ Q(ue, {
639
+ tree: ar(),
640
+ presets: ir(),
641
+ current: sr(s.presetId) ?? { typeLabel: Qn.find((e) => e.id === d)?.label },
284
642
  subLabel: (e) => e.split(" · ").pop(),
285
- onPick: Gt
643
+ onPick: cr
286
644
  })
287
645
  }),
288
646
  /* @__PURE__ */ $(q, {
289
647
  divided: !0,
290
648
  children: [
291
- /* @__PURE__ */ Q(Fn, {
649
+ /* @__PURE__ */ Q(Nn, {
292
650
  items: c.map((e, t) => ({
293
651
  id: t,
294
- label: tt(e, t)
652
+ label: Ke(e, t)
295
653
  })),
296
- activeIndex: p,
654
+ activeIndex: m,
297
655
  reorder: "grab",
298
656
  readOnly: t,
299
- size: i,
300
- onSelect: re,
301
- onRemove: Ze,
302
- onMove: et,
657
+ size: o,
658
+ onSelect: z,
659
+ onRemove: Ye,
660
+ onMove: Ge,
303
661
  onAdd: () => G({
304
662
  active: !0,
305
663
  picker: "preset"
@@ -310,31 +668,31 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
310
668
  className: "kol-mono-12 text-meta",
311
669
  children: "Two steps or more and the stage plays the morph."
312
670
  }),
313
- c.length >= 2 && I[d] && /* @__PURE__ */ Q("p", {
671
+ c.length >= 2 && F[d] && /* @__PURE__ */ Q("p", {
314
672
  className: "kol-mono-12 text-meta",
315
- children: I[d]
673
+ children: F[d]
316
674
  })
317
675
  ]
318
676
  }),
319
- p != null && !t && e && n && /* @__PURE__ */ $(q, {
320
- label: `Step ${p + 1}`,
677
+ m != null && !t && e && n && /* @__PURE__ */ $(q, {
678
+ label: `Step ${m + 1}`,
321
679
  divided: !0,
322
680
  children: [
323
681
  /* @__PURE__ */ Q(J, {
324
682
  tone: "sunken",
325
- value: A,
683
+ value: k,
326
684
  onChange: j,
327
685
  options: n,
328
- size: i,
329
- className: r(i)
686
+ size: o,
687
+ className: r(o)
330
688
  }),
331
- /* @__PURE__ */ Q(Ne, {
689
+ /* @__PURE__ */ Q(ye, {
332
690
  layer: e,
333
- setProp: k.setProp,
334
- patch: k.patch,
691
+ setProp: ee.setProp,
692
+ patch: ee.patch,
335
693
  updateLayer: _,
336
- palette: S,
337
- tab: A,
694
+ palette: x,
695
+ tab: k,
338
696
  tabStrip: null,
339
697
  inline: !0,
340
698
  picker: !1
@@ -343,14 +701,14 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
343
701
  className: "kol-mono-12 text-emphasis",
344
702
  children: [
345
703
  "Editing step ",
346
- p + 1,
704
+ m + 1,
347
705
  " — press Play to run the morph."
348
706
  ]
349
707
  })
350
708
  ]
351
709
  }),
352
- /* @__PURE__ */ Q(ne, {
353
- schema: nr,
710
+ /* @__PURE__ */ Q(A, {
711
+ schema: _r,
354
712
  layer: s,
355
713
  setProp: (e, n) => {
356
714
  !t && (typeof n != "object" || !n) && G({ [e]: n });
@@ -361,15 +719,15 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
361
719
  divided: !0,
362
720
  children: /* @__PURE__ */ Q(K, {
363
721
  tone: "primary",
364
- size: i,
722
+ size: o,
365
723
  className: "w-full",
366
724
  onClick: async () => {
367
725
  if (c.length < 2) return;
368
726
  let e = s.fileName;
369
- if (!m && (e = await D.prompt("Name this morph:", ""), e === null)) return;
370
- p != null && (G({ editing: null }), ee.current());
727
+ if (!h && (e = await E.prompt("Name this morph:", ""), e === null)) return;
728
+ m != null && (G({ editing: null }), R.current());
371
729
  let t = {
372
- ...await w(e || null),
730
+ ...await C(e || null),
373
731
  mode: "morph",
374
732
  morph: {
375
733
  mode: d,
@@ -377,22 +735,22 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
377
735
  steps: c,
378
736
  curve: l,
379
737
  cycle: u,
380
- resolution: f,
738
+ resolution: p,
381
739
  syncLoop: s.syncLoop,
382
- seconds: h.getLoopSeconds()
740
+ seconds: O.getLoopSeconds()
383
741
  }
384
742
  };
385
- if (m) {
386
- E("preset", m, t);
743
+ if (h) {
744
+ T("preset", h, t);
387
745
  return;
388
746
  }
389
- let n = T("preset", t);
747
+ let n = w("preset", t);
390
748
  n && (G({
391
749
  fileId: n,
392
750
  fileName: e || null
393
- }), y(n), x(e || null));
751
+ }), y(n), b(e || null));
394
752
  },
395
- children: m ? "Save" : "Save…"
753
+ children: h ? "Save" : "Save…"
396
754
  })
397
755
  })
398
756
  ]
@@ -400,7 +758,7 @@ function rr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
400
758
  }
401
759
  //#endregion
402
760
  //#region src/editor/params/QuickMotion.jsx
403
- var ir = [
761
+ var yr = [
404
762
  {
405
763
  value: "breathe",
406
764
  label: "Breathe",
@@ -419,26 +777,26 @@ var ir = [
419
777
  source: "lfo-square",
420
778
  rate: 8
421
779
  }
422
- ], ar = .2;
423
- function or(e) {
780
+ ], br = .2;
781
+ function xr(e) {
424
782
  if (!t(e)) return "off";
425
783
  if (e.bind !== "mod") return "custom";
426
- let n = ir.find((t) => t.source === e.source && (e.transform?.rate ?? 1) === t.rate);
784
+ let n = yr.find((t) => t.source === e.source && (e.transform?.rate ?? 1) === t.rate);
427
785
  return n ? n.value : "custom";
428
786
  }
429
- function sr({ schema: e, layer: t, setProp: r, label: i = "Modulate" }) {
430
- let a = o(), s = x(e ?? [], t).filter((e) => e.type === "range" && e.animatable !== !1 && D(e) !== "anim" && e.min != null && e.max != null && !/seed/i.test(e.key));
787
+ function Sr({ schema: e, layer: t, setProp: r, label: i = "Modulate" }) {
788
+ let o = a(), s = v(e ?? [], t).filter((e) => e.type === "range" && e.animatable !== !1 && D(e) !== "anim" && e.min != null && e.max != null && !/seed/i.test(e.key));
431
789
  if (!s.length) return null;
432
790
  let c = (e, n) => {
433
791
  let i = t[e.key];
434
792
  if (n === "off") {
435
793
  let n = i?.transform?.range;
436
- r(e.key, Array.isArray(n) ? (n[0] + n[1]) / 2 : S(i, h.getCtx(), t) ?? e.default ?? e.min);
794
+ r(e.key, Array.isArray(n) ? (n[0] + n[1]) / 2 : y(i, O.getCtx(), t) ?? e.default ?? e.min);
437
795
  return;
438
796
  }
439
- let a = ir.find((e) => e.value === n);
797
+ let a = yr.find((e) => e.value === n);
440
798
  if (!a) return;
441
- let o = Number(S(i, h.getCtx(), t) ?? e.default ?? e.min), s = (e.max - e.min) * ar, c = Math.max(e.min, o - s), l = Math.min(e.max, o + s);
799
+ let o = Number(y(i, O.getCtx(), t) ?? e.default ?? e.min), s = (e.max - e.min) * br, c = Math.max(e.min, o - s), l = Math.min(e.max, o + s);
442
800
  r(e.key, {
443
801
  bind: "mod",
444
802
  source: a.source,
@@ -452,12 +810,12 @@ function sr({ schema: e, layer: t, setProp: r, label: i = "Modulate" }) {
452
810
  label: i,
453
811
  divided: !0,
454
812
  children: s.map((e) => {
455
- let r = or(t[e.key]), i = [
813
+ let r = xr(t[e.key]), i = [
456
814
  {
457
815
  value: "off",
458
816
  label: "Off"
459
817
  },
460
- ...ir.map(({ value: e, label: t }) => ({
818
+ ...yr.map(({ value: e, label: t }) => ({
461
819
  value: e,
462
820
  label: t
463
821
  })),
@@ -466,12 +824,12 @@ function sr({ schema: e, layer: t, setProp: r, label: i = "Modulate" }) {
466
824
  label: "Custom"
467
825
  }] : []
468
826
  ];
469
- return /* @__PURE__ */ Q(Pn, {
827
+ return /* @__PURE__ */ Q(Mn, {
470
828
  label: e.label,
471
829
  align: "fill",
472
830
  labelWidth: n,
473
- children: /* @__PURE__ */ Q(Mn, {
474
- size: a,
831
+ children: /* @__PURE__ */ Q(An, {
832
+ size: o,
475
833
  variant: "subtle",
476
834
  className: "w-full",
477
835
  options: i,
@@ -484,7 +842,7 @@ function sr({ schema: e, layer: t, setProp: r, label: i = "Modulate" }) {
484
842
  }
485
843
  //#endregion
486
844
  //#region src/editor/params/InputRows.jsx
487
- var cr = [
845
+ var Cr = [
488
846
  {
489
847
  value: "off",
490
848
  label: "Off"
@@ -509,19 +867,19 @@ var cr = [
509
867
  value: "lfo-sine",
510
868
  label: "LFO"
511
869
  }
512
- ], lr = new Set(cr.map((e) => e.value));
513
- function ur({ schema: e, layer: n, setProp: r, inputs: i = null }) {
514
- let a = o(), s = x(e ?? [], n).filter((e) => e.type === "range" && e.animatable !== !1 && e.min != null && e.max != null && !/seed/i.test(e.key));
870
+ ], wr = new Set(Cr.map((e) => e.value));
871
+ function Tr({ schema: e, layer: n, setProp: r, inputs: i = null }) {
872
+ let o = a(), s = v(e ?? [], n).filter((e) => e.type === "range" && e.animatable !== !1 && e.min != null && e.max != null && !/seed/i.test(e.key));
515
873
  if (!s.length) return null;
516
874
  let c = new Map(s.map((e) => [e.key, e])), l = (i ?? []).filter((e) => c.has(e)), u = [...l, ...s.map((e) => e.key).filter((e) => !l.includes(e))], d = l.length ? l : u.slice(0, 3), f = (e) => {
517
875
  let r = n[e];
518
- return t(r) && r.bind === "mod" && lr.has(r.source);
519
- }, m = u.filter(f), g = (e) => {
876
+ return t(r) && r.bind === "mod" && wr.has(r.source);
877
+ }, p = u.filter(f), m = (e) => {
520
878
  let t = c.get(e);
521
- return Number(S(n[e], h.getCtx(), n) ?? t.default ?? t.min);
522
- }, _ = (e, i, a = t(n[e]) ? n[e].transform?.base ?? g(e) : g(e)) => {
879
+ return Number(y(n[e], O.getCtx(), n) ?? t.default ?? t.min);
880
+ }, h = (e, i, a = t(n[e]) ? n[e].transform?.base ?? m(e) : m(e)) => {
523
881
  let o = c.get(e);
524
- p(i)?.ensure?.().catch(() => {}), r(e, {
882
+ w(i)?.ensure?.().catch(() => {}), r(e, {
525
883
  bind: "mod",
526
884
  source: i,
527
885
  transform: {
@@ -530,17 +888,17 @@ function ur({ schema: e, layer: n, setProp: r, inputs: i = null }) {
530
888
  ...i.startsWith("lfo") ? { rate: 1 } : {}
531
889
  }
532
890
  });
533
- }, v = (e) => r(e, t(n[e]) ? n[e].transform?.base ?? g(e) : g(e)), y = d.find((e) => !f(e)) ?? u.find((e) => !f(e));
891
+ }, g = (e) => r(e, t(n[e]) ? n[e].transform?.base ?? m(e) : m(e)), _ = d.find((e) => !f(e)) ?? u.find((e) => !f(e));
534
892
  return /* @__PURE__ */ $(q, {
535
893
  label: "Inputs",
536
894
  divided: !0,
537
- children: [m.map((e) => /* @__PURE__ */ Q(Nn, {
538
- size: a,
895
+ children: [p.map((e) => /* @__PURE__ */ Q(jn, {
896
+ size: o,
539
897
  className: "w-full [&>button]:w-full",
540
898
  groups: [{
541
899
  id: "source",
542
900
  label: "Source",
543
- options: cr
901
+ options: Cr
544
902
  }, {
545
903
  id: "drives",
546
904
  label: "Drives",
@@ -553,30 +911,30 @@ function ur({ schema: e, layer: n, setProp: r, inputs: i = null }) {
553
911
  source: n[e].source,
554
912
  drives: e
555
913
  },
556
- label: `${cr.find((t) => t.value === n[e].source)?.label} → ${c.get(e).label}`,
914
+ label: `${Cr.find((t) => t.value === n[e].source)?.label} → ${c.get(e).label}`,
557
915
  onChange: (t, r) => {
558
916
  if (t === "source") {
559
- r === "off" ? v(e) : _(e, r);
917
+ r === "off" ? g(e) : h(e, r);
560
918
  return;
561
919
  }
562
920
  if (r === e || f(r)) return;
563
921
  let i = n[e].source;
564
- v(e), _(r, i);
922
+ g(e), h(r, i);
565
923
  }
566
- }, e)), y && /* @__PURE__ */ Q(K, {
567
- size: a,
924
+ }, e)), _ && /* @__PURE__ */ Q(K, {
925
+ size: o,
568
926
  iconLeft: "plus",
569
927
  className: "w-full",
570
- onClick: () => _(y, "mouseX"),
928
+ onClick: () => h(_, "mouseX"),
571
929
  children: "Add input"
572
930
  })]
573
931
  });
574
932
  }
575
933
  //#endregion
576
934
  //#region src/editor/labs/ModelSource.jsx
577
- var dr = /\.(obj|glb|gltf|stl)$/i, fr = (e) => dr.test(e.key ?? e.name ?? ""), pr = (e) => (e.match(dr)?.[1] ?? "obj").toLowerCase(), mr = (e) => e?.startsWith("data:") ? "Local file" : decodeURIComponent(String(e ?? "").split("/").pop() || "—");
578
- function hr({ layer: e, setProp: t }) {
579
- let n = o(), [r, i] = Z(!1), a = X(null), s = (e, n) => {
935
+ var Er = /\.(obj|glb|gltf|stl)$/i, Dr = (e) => Er.test(e.key ?? e.name ?? ""), Or = (e) => (e.match(Er)?.[1] ?? "obj").toLowerCase(), kr = (e) => e?.startsWith("data:") ? "Local file" : decodeURIComponent(String(e ?? "").split("/").pop() || "—");
936
+ function Ar({ layer: e, setProp: t }) {
937
+ let n = a(), [r, i] = Z(!1), o = X(null), s = (e, n) => {
580
938
  t("meshSrc", e), t("meshType", n);
581
939
  };
582
940
  return /* @__PURE__ */ $(q, {
@@ -585,7 +943,7 @@ function hr({ layer: e, setProp: t }) {
585
943
  children: [
586
944
  /* @__PURE__ */ Q("span", {
587
945
  className: "kol-mono-12 text-meta truncate",
588
- children: mr(e.meshSrc)
946
+ children: kr(e.meshSrc)
589
947
  }),
590
948
  /* @__PURE__ */ $("div", {
591
949
  className: "grid grid-cols-2 gap-2",
@@ -597,12 +955,12 @@ function hr({ layer: e, setProp: t }) {
597
955
  }), /* @__PURE__ */ Q(K, {
598
956
  tone: "primary",
599
957
  size: n,
600
- onClick: () => a.current?.click(),
958
+ onClick: () => o.current?.click(),
601
959
  children: "Upload"
602
960
  })]
603
961
  }),
604
962
  /* @__PURE__ */ Q("input", {
605
- ref: a,
963
+ ref: o,
606
964
  type: "file",
607
965
  accept: ".obj,.glb,.gltf,.stl",
608
966
  className: "hidden",
@@ -610,15 +968,15 @@ function hr({ layer: e, setProp: t }) {
610
968
  let t = e.target.files?.[0];
611
969
  if (e.target.value = "", !t) return;
612
970
  let n = new FileReader();
613
- n.onload = () => s(n.result, pr(t.name)), n.readAsDataURL(t);
971
+ n.onload = () => s(n.result, Or(t.name)), n.readAsDataURL(t);
614
972
  }
615
973
  }),
616
- /* @__PURE__ */ Q(Jt, {
974
+ /* @__PURE__ */ Q(en, {
617
975
  open: r,
618
- accept: fr,
976
+ accept: Dr,
619
977
  onClose: () => i(!1),
620
978
  onSelect: (e) => {
621
- i(!1), s(Sn(e), pr(e));
979
+ i(!1), s(wn(e), Or(e));
622
980
  }
623
981
  })
624
982
  ]
@@ -626,23 +984,23 @@ function hr({ layer: e, setProp: t }) {
626
984
  }
627
985
  //#endregion
628
986
  //#region src/editor/labs/useLabsKeys.js
629
- function gr(e, t) {
987
+ function jr(e, t) {
630
988
  Y(() => {
631
989
  let n = (n) => {
632
- n.key !== "r" && n.key !== "R" || n.metaKey || n.ctrlKey || n.altKey || Tt(n) || (n.preventDefault(), n.shiftKey ? t?.() : e?.());
990
+ n.key !== "r" && n.key !== "R" || n.metaKey || n.ctrlKey || n.altKey || Pt(n) || (n.preventDefault(), n.shiftKey ? t?.() : e?.());
633
991
  };
634
992
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
635
993
  });
636
994
  }
637
995
  //#endregion
638
996
  //#region src/editor/labs/LabsParams.jsx
639
- var _r = [{
997
+ var Mr = [{
640
998
  value: "effect",
641
999
  label: "Effect"
642
1000
  }, {
643
1001
  value: "anim",
644
1002
  label: "Motion"
645
- }], vr = [
1003
+ }], Nr = [
646
1004
  {
647
1005
  value: "generate",
648
1006
  label: "Generate"
@@ -655,7 +1013,7 @@ var _r = [{
655
1013
  value: "anim",
656
1014
  label: "Animation"
657
1015
  }
658
- ], yr = [
1016
+ ], Pr = [
659
1017
  {
660
1018
  value: "generate",
661
1019
  label: "Gen"
@@ -669,11 +1027,11 @@ var _r = [{
669
1027
  label: "Anim"
670
1028
  }
671
1029
  ];
672
- function br({ options: e, active: t, onPick: n, spread: i = !1, pills: a = !1 }) {
673
- let s = o();
674
- return e?.length ? a ? /* @__PURE__ */ Q("div", {
1030
+ function Fr({ options: e, active: t, onPick: n, spread: i = !1, pills: o = !1 }) {
1031
+ let s = a();
1032
+ return e?.length ? o ? /* @__PURE__ */ Q("div", {
675
1033
  className: "flex items-center gap-1 flex-wrap",
676
- children: e.map((e) => /* @__PURE__ */ Q(In, {
1034
+ children: e.map((e) => /* @__PURE__ */ Q(Pn, {
677
1035
  size: "xs",
678
1036
  hash: !1,
679
1037
  active: e.value === t,
@@ -690,27 +1048,27 @@ function br({ options: e, active: t, onPick: n, spread: i = !1, pills: a = !1 })
690
1048
  className: r(s)
691
1049
  }) : null;
692
1050
  }
693
- function xr() {
694
- let { undo: e, redo: t, canUndo: n, canRedo: r } = a(), i = o(), s = (e, t) => e ? t : /* @__PURE__ */ Q("span", {
1051
+ function Ir() {
1052
+ let { undo: e, redo: t, canUndo: n, canRedo: r } = i(), o = a(), s = (e, t) => e ? t : /* @__PURE__ */ Q("span", {
695
1053
  "aria-hidden": "true",
696
1054
  className: "invisible pointer-events-none",
697
1055
  children: t
698
1056
  });
699
- return /* @__PURE__ */ $(Wn, { children: [s(n, /* @__PURE__ */ Q(Rn, {
1057
+ return /* @__PURE__ */ $(Hn, { children: [s(n, /* @__PURE__ */ Q(In, {
700
1058
  label: "Undo",
701
1059
  shortcut: "⌘Z",
702
1060
  children: /* @__PURE__ */ Q(K, {
703
- size: i,
1061
+ size: o,
704
1062
  iconOnly: "arrow-left",
705
1063
  "aria-label": "Undo",
706
1064
  tabIndex: n ? void 0 : -1,
707
1065
  onClick: e
708
1066
  })
709
- })), s(r, /* @__PURE__ */ Q(Rn, {
1067
+ })), s(r, /* @__PURE__ */ Q(In, {
710
1068
  label: "Redo",
711
1069
  shortcut: "⇧⌘Z",
712
1070
  children: /* @__PURE__ */ Q(K, {
713
- size: i,
1071
+ size: o,
714
1072
  iconOnly: "arrow-right",
715
1073
  "aria-label": "Redo",
716
1074
  tabIndex: r ? void 0 : -1,
@@ -718,8 +1076,8 @@ function xr() {
718
1076
  })
719
1077
  }))] });
720
1078
  }
721
- function Sr({ chips: e, active: t, onPick: r, spread: i, pills: a, title: s, tabStrip: c, preStrip: l, fx: u = !1, scope: d, ghostLabels: f, children: p }) {
722
- let m = o() === "sm";
1079
+ function Lr({ chips: e, active: t, onPick: r, spread: i, pills: o, title: s, tabStrip: c, preStrip: l, fx: u = !1, scope: d, ghostLabels: f, children: p }) {
1080
+ let m = a() === "sm";
723
1081
  return /* @__PURE__ */ $("div", {
724
1082
  className: `flex flex-col gap-5${u ? " kol-labs-fx" : ""}`,
725
1083
  "data-label-scope": d,
@@ -729,14 +1087,14 @@ function Sr({ chips: e, active: t, onPick: r, spread: i, pills: a, title: s, tab
729
1087
  children: [/* @__PURE__ */ Q("p", {
730
1088
  className: "kol-eyebrow text-fg-96 flex-1 min-w-0",
731
1089
  children: s
732
- }), /* @__PURE__ */ Q(xr, {})]
1090
+ }), /* @__PURE__ */ Q(Ir, {})]
733
1091
  }),
734
- e && /* @__PURE__ */ Q(br, {
1092
+ e && /* @__PURE__ */ Q(Fr, {
735
1093
  options: e,
736
1094
  active: t,
737
1095
  onPick: r,
738
1096
  spread: i,
739
- pills: a
1097
+ pills: o
740
1098
  }),
741
1099
  l,
742
1100
  c,
@@ -753,27 +1111,27 @@ function Sr({ chips: e, active: t, onPick: r, spread: i, pills: a, title: s, tab
753
1111
  ]
754
1112
  });
755
1113
  }
756
- function Cr({ layer: e, showMod: t }) {
757
- let i = A(), s = o(), [c, l] = Z("effect");
1114
+ function Rr({ layer: e, showMod: t }) {
1115
+ let o = p(), s = a(), [c, l] = Z("effect");
758
1116
  Y(() => {
759
1117
  let e = () => l("effect");
760
1118
  return window.addEventListener("kol:open-effects", e), () => window.removeEventListener("kol:open-effects", e);
761
1119
  }, []);
762
- let { addFilter: u, replaceFilter: p, removeFilter: m, toggleFilter: h, updateLayer: v, palette: y } = a(), b = oe(e.id, { history: "coalesce" }), x = g(e), S = x.findIndex((e) => !e.def?.first), w = S < 0 ? x.length : S, E = S < 0 ? null : x[S], O = re(z).find((e) => e.id === P(E?.id)), k = O?.id === "halftone", j = k ? (O?.filters ?? []).map((e) => ({
1120
+ let { addFilter: u, replaceFilter: f, removeFilter: m, toggleFilter: _, updateLayer: v, palette: y } = i(), b = te(e.id, { history: "coalesce" }), S = h(e), C = S.findIndex((e) => !e.def?.first), w = C < 0 ? S.length : C, E = C < 0 ? null : S[C], O = oe(L).find((e) => e.id === B(E?.id)), k = O?.id === "halftone", M = k ? (O?.filters ?? []).map((e) => ({
763
1121
  value: e.id,
764
1122
  label: e.label
765
- })) : null, M = !k && E ? E.def.label : null, N = (t) => {
1123
+ })) : null, ne = !k && E ? E.def.label : null, N = (t) => {
766
1124
  if (!E) {
767
1125
  u(e.id, t);
768
1126
  return;
769
1127
  }
770
- t !== E.id && p(e.id, w, t);
771
- }, F = x.map(({ def: e, ...t }) => t), I = E ? {
1128
+ t !== E.id && f(e.id, w, t);
1129
+ }, P = S.map(({ def: e, ...t }) => t), F = E ? {
772
1130
  ...e,
773
1131
  ...E.params,
774
1132
  id: e.id
775
- } : e, L = (e) => (t, n) => {
776
- let r = F.map((r, i) => i === e ? {
1133
+ } : e, I = (e) => (t, n) => {
1134
+ let r = P.map((r, i) => i === e ? {
777
1135
  ...r,
778
1136
  params: {
779
1137
  ...r.params,
@@ -781,12 +1139,12 @@ function Cr({ layer: e, showMod: t }) {
781
1139
  }
782
1140
  } : r);
783
1141
  b.patch({ filters: r });
784
- }, B = L(w), ae = t ? (e) => /* @__PURE__ */ Q(Be, {
785
- layer: I,
1142
+ }, R = I(w), ie = t ? (e) => /* @__PURE__ */ Q(at, {
1143
+ layer: F,
786
1144
  param: e,
787
- setProp: B
788
- }) : void 0, H = (t) => {
789
- let n = F.map((e, n) => n === w ? {
1145
+ setProp: R
1146
+ }) : void 0, z = (t) => {
1147
+ let n = P.map((e, n) => n === w ? {
790
1148
  ...e,
791
1149
  params: {
792
1150
  ...e.params,
@@ -795,60 +1153,60 @@ function Cr({ layer: e, showMod: t }) {
795
1153
  } : e);
796
1154
  v(e.id, { filters: n });
797
1155
  };
798
- gr(() => {
799
- E && v(e.id, { filters: F.map((e, t) => t === 0 ? {
1156
+ jr(() => {
1157
+ E && v(e.id, { filters: P.map((e, t) => t === 0 ? {
800
1158
  ...e,
801
1159
  params: {}
802
1160
  } : e) });
803
1161
  }, () => {
804
- E && H(f(I, C(E.def.params, I), T()));
1162
+ E && z(d(F, x(E.def.params, F), T()));
805
1163
  });
806
- let se = e.fxGroup ? ee.find((t) => t.id === e.fxGroup) : null;
807
- if (se) {
1164
+ let V = e.fxGroup ? se.find((t) => t.id === e.fxGroup) : null;
1165
+ if (V) {
808
1166
  let n = {
809
- chain: x,
1167
+ chain: S,
810
1168
  layer: e,
811
- hostView: I,
812
- toggleFilter: h,
1169
+ hostView: F,
1170
+ toggleFilter: _,
813
1171
  removeFilter: m,
814
- setStagePropAt: L,
1172
+ setStagePropAt: I,
815
1173
  palette: y,
816
1174
  showMod: t
817
1175
  }, i = [{
818
1176
  value: "",
819
1177
  label: "Add effect…"
820
- }, ...te(se, z).map((e) => ({
1178
+ }, ...re(V, L).map((e) => ({
821
1179
  value: e.id,
822
1180
  label: `${e.label ?? e.id}${e.kind === "pixi" ? " · GPU" : ""}`
823
1181
  }))];
824
- return /* @__PURE__ */ $(Sr, {
1182
+ return /* @__PURE__ */ $(Lr, {
825
1183
  title: "Effects",
826
1184
  fx: !0,
827
1185
  tabStrip: /* @__PURE__ */ Q(J, {
828
1186
  tone: "sunken",
829
1187
  value: c,
830
1188
  onChange: l,
831
- options: _r,
1189
+ options: Mr,
832
1190
  size: s,
833
1191
  className: r(s)
834
1192
  }),
835
- children: [c === "effect" && /* @__PURE__ */ $(Wn, { children: [
1193
+ children: [c === "effect" && /* @__PURE__ */ $(Hn, { children: [
836
1194
  /* @__PURE__ */ $(q, {
837
1195
  label: "Effect stack",
838
1196
  divided: !0,
839
- children: [x.length === 0 && /* @__PURE__ */ Q(V, {
1197
+ children: [S.length === 0 && /* @__PURE__ */ Q(j, {
840
1198
  className: "kol-mono-10 text-meta",
841
1199
  children: "No effects yet — add one below."
842
- }), /* @__PURE__ */ Q(Dr, {
1200
+ }), /* @__PURE__ */ Q(Hr, {
843
1201
  ...n,
844
1202
  from: 0
845
1203
  })]
846
1204
  }),
847
- /* @__PURE__ */ Q(jn, {}),
848
- x.length < 8 && /* @__PURE__ */ Q(q, {
849
- label: se.label,
1205
+ /* @__PURE__ */ Q(kn, {}),
1206
+ S.length < 8 && /* @__PURE__ */ Q(q, {
1207
+ label: V.label,
850
1208
  divided: !0,
851
- children: /* @__PURE__ */ Q(Mn, {
1209
+ children: /* @__PURE__ */ Q(An, {
852
1210
  variant: "subtle",
853
1211
  size: s,
854
1212
  className: "w-full",
@@ -859,15 +1217,15 @@ function Cr({ layer: e, showMod: t }) {
859
1217
  }
860
1218
  })
861
1219
  })
862
- ] }), c === "anim" && E?.def?.sweeps && /* @__PURE__ */ Q(He, {
1220
+ ] }), c === "anim" && E?.def?.sweeps && /* @__PURE__ */ Q(st, {
863
1221
  sweeps: Array.isArray(E.params.sweeps) ? E.params.sweeps : [],
864
- onChange: (e) => B("sweeps", e),
1222
+ onChange: (e) => R("sweeps", e),
865
1223
  inline: !0
866
1224
  })]
867
1225
  });
868
1226
  }
869
- if (!E) return /* @__PURE__ */ Q(Sr, {
870
- chips: j,
1227
+ if (!E) return /* @__PURE__ */ Q(Lr, {
1228
+ chips: M,
871
1229
  active: null,
872
1230
  onPick: N,
873
1231
  spread: k,
@@ -876,16 +1234,16 @@ function Cr({ layer: e, showMod: t }) {
876
1234
  tone: "sunken",
877
1235
  value: c,
878
1236
  onChange: l,
879
- options: _r,
1237
+ options: Mr,
880
1238
  size: s,
881
1239
  className: r(s)
882
1240
  }),
883
- children: /* @__PURE__ */ Q(ne, {
884
- schema: Xt,
1241
+ children: /* @__PURE__ */ Q(A, {
1242
+ schema: tn,
885
1243
  layer: e,
886
1244
  setProp: b.setProp,
887
1245
  palette: y,
888
- renderAnimate: (t) => /* @__PURE__ */ Q(Be, {
1246
+ renderAnimate: (t) => /* @__PURE__ */ Q(at, {
889
1247
  layer: e,
890
1248
  param: t,
891
1249
  setProp: b.setProp
@@ -894,28 +1252,28 @@ function Cr({ layer: e, showMod: t }) {
894
1252
  emptyHint: "Pick an effect from the nav."
895
1253
  })
896
1254
  });
897
- let U = E.def.params.filter((e) => D(e) !== "anim"), W = R(E.def.id), ce = W ? U.findIndex((e) => e.key === W) : -1, le = U.length;
898
- if (ce >= 0) {
899
- let e = ce;
900
- for (; e + 1 < U.length && U[e + 1].type === "select";) e++;
901
- le = e + 1;
1255
+ let H = E.def.params.filter((e) => D(e) !== "anim"), U = ae(E.def.id), le = U ? H.findIndex((e) => e.key === U) : -1, ue = H.length;
1256
+ if (le >= 0) {
1257
+ let e = le;
1258
+ for (; e + 1 < H.length && H[e + 1].type === "select";) e++;
1259
+ ue = e + 1;
902
1260
  }
903
- let ue = ce > 0 ? U.slice(0, ce) : [], de = ce >= 0 ? U.slice(ce, le).map((e) => ({
1261
+ let W = le > 0 ? H.slice(0, le) : [], fe = le >= 0 ? H.slice(le, ue).map((e) => ({
904
1262
  ...e,
905
1263
  section: void 0
906
- })) : U, fe = {
907
- layer: I,
908
- setProp: B,
1264
+ })) : H, pe = {
1265
+ layer: F,
1266
+ setProp: R,
909
1267
  palette: y,
910
- renderAnimate: ae,
1268
+ renderAnimate: ie,
911
1269
  inline: !0
912
1270
  };
913
- return /* @__PURE__ */ $(Sr, {
914
- chips: j,
1271
+ return /* @__PURE__ */ $(Lr, {
1272
+ chips: M,
915
1273
  active: E.id,
916
1274
  onPick: N,
917
1275
  spread: k,
918
- title: M,
1276
+ title: ne,
919
1277
  fx: !0,
920
1278
  scope: E.id,
921
1279
  ghostLabels: E.def.params.map((e) => e.label).filter(Boolean),
@@ -923,45 +1281,45 @@ function Cr({ layer: e, showMod: t }) {
923
1281
  tone: "sunken",
924
1282
  value: c,
925
1283
  onChange: l,
926
- options: _r,
1284
+ options: Mr,
927
1285
  size: s,
928
1286
  className: r(s)
929
1287
  }),
930
- children: [c === "effect" && /* @__PURE__ */ $(Wn, { children: [
931
- ue.length > 0 && /* @__PURE__ */ Q(ne, {
932
- schema: ue,
933
- ...fe
1288
+ children: [c === "effect" && /* @__PURE__ */ $(Hn, { children: [
1289
+ W.length > 0 && /* @__PURE__ */ Q(A, {
1290
+ schema: W,
1291
+ ...pe
934
1292
  }),
935
1293
  /* @__PURE__ */ $(q, {
936
1294
  divided: !0,
937
- children: [/* @__PURE__ */ Q(ne, {
938
- schema: de,
939
- ...fe
940
- }), /* @__PURE__ */ Q(Ve, {
1295
+ children: [/* @__PURE__ */ Q(A, {
1296
+ schema: fe,
1297
+ ...pe
1298
+ }), /* @__PURE__ */ Q(ot, {
941
1299
  inline: !0,
942
1300
  def: E.def,
943
- view: I,
1301
+ view: F,
944
1302
  tab: "effect",
945
- onPatch: H,
946
- levels: /* @__PURE__ */ $(Wn, { children: [
1303
+ onPatch: z,
1304
+ levels: /* @__PURE__ */ $(Hn, { children: [
947
1305
  [
948
1306
  ["type", "Type"],
949
1307
  ["category", "Category"],
950
1308
  ["preset", "Preset"]
951
- ].filter(([e]) => Ie(E.def, e)).map(([t, n]) => /* @__PURE__ */ Q(K, {
1309
+ ].filter(([e]) => _e(E.def, e)).map(([t, n]) => /* @__PURE__ */ Q(K, {
952
1310
  tone: "primary",
953
1311
  size: s,
954
1312
  className: "flex-1 min-w-0",
955
1313
  "aria-label": `Randomize ${n.toLowerCase()}`,
956
1314
  onClick: () => {
957
- let n = _(T() >>> 0);
1315
+ let n = g(T() >>> 0);
958
1316
  if (t === "preset") {
959
- let e = Pe(E.def, I, n);
960
- e != null && H(ie(E.def, e));
1317
+ let e = de(E.def, F, n);
1318
+ e != null && z(ce(E.def, e));
961
1319
  return;
962
1320
  }
963
- let r = Ae(E.id, t, n);
964
- r && p(e.id, w, r);
1321
+ let r = me(E.id, t, n);
1322
+ r && f(e.id, w, r);
965
1323
  },
966
1324
  children: n
967
1325
  }, t)),
@@ -971,50 +1329,50 @@ function Cr({ layer: e, showMod: t }) {
971
1329
  className: "flex-1 min-w-0",
972
1330
  "aria-label": "Randomize settings",
973
1331
  onClick: () => {
974
- H(ke(I, C(E.def.params.filter((e) => D(e) !== "anim"), I), _(T() >>> 0)));
1332
+ z(he(F, x(E.def.params.filter((e) => D(e) !== "anim"), F), g(T() >>> 0)));
975
1333
  },
976
1334
  children: "Settings"
977
1335
  }),
978
- /* @__PURE__ */ Q(Fe, {
1336
+ /* @__PURE__ */ Q(Se, {
979
1337
  def: E.def,
980
1338
  isFilter: !0
981
1339
  })
982
1340
  ] })
983
1341
  })]
984
1342
  }),
985
- /* @__PURE__ */ Q(jn, {}),
986
- le < U.length && /* @__PURE__ */ $(Wn, { children: [/* @__PURE__ */ Q(ne, {
987
- schema: U.slice(le),
988
- ...fe
989
- }), /* @__PURE__ */ Q(jn, {})] }),
990
- /* @__PURE__ */ Q(Or, {
991
- chain: x,
1343
+ /* @__PURE__ */ Q(kn, {}),
1344
+ ue < H.length && /* @__PURE__ */ $(Hn, { children: [/* @__PURE__ */ Q(A, {
1345
+ schema: H.slice(ue),
1346
+ ...pe
1347
+ }), /* @__PURE__ */ Q(kn, {})] }),
1348
+ /* @__PURE__ */ Q(Ur, {
1349
+ chain: S,
992
1350
  from: w + 1,
993
1351
  layer: e,
994
- hostView: I,
1352
+ hostView: F,
995
1353
  addFilter: u,
996
1354
  removeFilter: m,
997
- toggleFilter: h,
998
- setStagePropAt: L,
1355
+ toggleFilter: _,
1356
+ setStagePropAt: I,
999
1357
  palette: y,
1000
1358
  showMod: t
1001
1359
  })
1002
- ] }), c === "anim" && /* @__PURE__ */ $(Wn, { children: [
1003
- /* @__PURE__ */ Q(ur, {
1360
+ ] }), c === "anim" && /* @__PURE__ */ $(Hn, { children: [
1361
+ /* @__PURE__ */ Q(Tr, {
1004
1362
  schema: E.def.params,
1005
- layer: I,
1006
- setProp: B,
1363
+ layer: F,
1364
+ setProp: R,
1007
1365
  inputs: E.def.inputs
1008
1366
  }),
1009
- /* @__PURE__ */ Q(ne, {
1367
+ /* @__PURE__ */ Q(A, {
1010
1368
  schema: E.def.params,
1011
- ...fe,
1369
+ ...pe,
1012
1370
  tab: "anim"
1013
1371
  }),
1014
1372
  E.def.orbit && /* @__PURE__ */ Q(q, {
1015
1373
  label: "Interaction",
1016
1374
  divided: !0,
1017
- children: /* @__PURE__ */ Q(Pn, {
1375
+ children: /* @__PURE__ */ Q(Mn, {
1018
1376
  label: "ORBIT (C)",
1019
1377
  align: "fill",
1020
1378
  labelWidth: n,
@@ -1022,7 +1380,7 @@ function Cr({ layer: e, showMod: t }) {
1022
1380
  tone: "sunken",
1023
1381
  size: s,
1024
1382
  className: "w-full",
1025
- value: i.grab && I.orbit !== !1 ? "on" : "off",
1383
+ value: o.grab && F.orbit !== !1 ? "on" : "off",
1026
1384
  options: [{
1027
1385
  value: "off",
1028
1386
  label: "Off"
@@ -1031,54 +1389,54 @@ function Cr({ layer: e, showMod: t }) {
1031
1389
  label: "On"
1032
1390
  }],
1033
1391
  onChange: (e) => {
1034
- B("orbit", e === "on"), e === "on" && !i.grab && d("grab", !0);
1392
+ R("orbit", e === "on"), e === "on" && !o.grab && ee("grab", !0);
1035
1393
  }
1036
1394
  })
1037
1395
  })
1038
1396
  }),
1039
1397
  /* @__PURE__ */ Q(q, {
1040
1398
  divided: !0,
1041
- children: /* @__PURE__ */ Q(Ve, {
1399
+ children: /* @__PURE__ */ Q(ot, {
1042
1400
  inline: !0,
1043
1401
  def: E.def,
1044
- view: I,
1402
+ view: F,
1045
1403
  tab: "anim",
1046
- onPatch: H
1404
+ onPatch: z
1047
1405
  })
1048
1406
  }),
1049
- E.def.sweeps && /* @__PURE__ */ Q(He, {
1407
+ E.def.sweeps && /* @__PURE__ */ Q(st, {
1050
1408
  sweeps: Array.isArray(E.params.sweeps) ? E.params.sweeps : [],
1051
- onChange: (e) => B("sweeps", e),
1409
+ onChange: (e) => R("sweeps", e),
1052
1410
  inline: !0
1053
1411
  }),
1054
- /* @__PURE__ */ Q(sr, {
1412
+ /* @__PURE__ */ Q(Sr, {
1055
1413
  schema: E.def.params,
1056
- layer: I,
1057
- setProp: B
1414
+ layer: F,
1415
+ setProp: R
1058
1416
  }),
1059
- /* @__PURE__ */ Q(Er, {
1060
- chain: x,
1417
+ /* @__PURE__ */ Q(Vr, {
1418
+ chain: S,
1061
1419
  layer: e,
1062
- hostView: I,
1420
+ hostView: F,
1063
1421
  addFilter: u,
1064
1422
  removeFilter: m,
1065
- setStagePropAt: L,
1423
+ setStagePropAt: I,
1066
1424
  palette: y,
1067
1425
  showMod: t
1068
1426
  })
1069
1427
  ] })]
1070
1428
  });
1071
1429
  }
1072
- var wr = z.filter((e) => !e.kind && !e.first);
1073
- function Tr({ layer: e, edit: t, palette: n, showMod: r }) {
1074
- let { addFilter: i, removeFilter: o, toggleFilter: s } = a(), c = g(e), l = c.map(({ def: e, ...t }) => t);
1075
- return /* @__PURE__ */ Q(Or, {
1430
+ var zr = L.filter((e) => !e.kind && !e.first);
1431
+ function Br({ layer: e, edit: t, palette: n, showMod: r }) {
1432
+ let { addFilter: a, removeFilter: o, toggleFilter: s } = i(), c = h(e), l = c.map(({ def: e, ...t }) => t);
1433
+ return /* @__PURE__ */ Q(Ur, {
1076
1434
  chain: c,
1077
1435
  from: 0,
1078
- filters: wr,
1436
+ filters: zr,
1079
1437
  layer: e,
1080
1438
  hostView: e,
1081
- addFilter: i,
1439
+ addFilter: a,
1082
1440
  removeFilter: o,
1083
1441
  toggleFilter: s,
1084
1442
  setStagePropAt: (e) => (n, r) => t.patch({ filters: l.map((t, i) => i === e ? {
@@ -1092,22 +1450,22 @@ function Tr({ layer: e, edit: t, palette: n, showMod: r }) {
1092
1450
  showMod: r
1093
1451
  });
1094
1452
  }
1095
- function Er({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: i, setStagePropAt: a, palette: s, showMod: c }) {
1096
- let l = o(), u = e.findIndex((e) => e.id === "fx-media"), d = u < 0 ? null : e[u], f = d ? {
1453
+ function Vr({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: i, setStagePropAt: o, palette: s, showMod: c }) {
1454
+ let l = a(), u = e.findIndex((e) => e.id === "fx-media"), d = u < 0 ? null : e[u], f = d ? {
1097
1455
  ...n,
1098
1456
  ...d.params,
1099
1457
  id: t.id
1100
- } : null, p = d ? a(u) : null;
1458
+ } : null, p = d ? o(u) : null;
1101
1459
  return /* @__PURE__ */ Q(q, {
1102
1460
  label: "Media",
1103
1461
  divided: !0,
1104
- children: d?.def ? /* @__PURE__ */ $(Wn, { children: [/* @__PURE__ */ Q(ne, {
1462
+ children: d?.def ? /* @__PURE__ */ $(Hn, { children: [/* @__PURE__ */ Q(A, {
1105
1463
  schema: d.def.params,
1106
1464
  layer: f,
1107
1465
  setProp: p,
1108
1466
  palette: s,
1109
1467
  inline: !0,
1110
- renderAnimate: c ? (e) => /* @__PURE__ */ Q(Be, {
1468
+ renderAnimate: c ? (e) => /* @__PURE__ */ Q(at, {
1111
1469
  layer: f,
1112
1470
  param: e,
1113
1471
  setProp: p
@@ -1131,10 +1489,10 @@ function Er({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: i, se
1131
1489
  })
1132
1490
  });
1133
1491
  }
1134
- function Dr({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, removeFilter: a, setStagePropAt: s, palette: c, showMod: l }) {
1135
- let u = o();
1136
- return e.slice(t).map((e, o) => {
1137
- let d = o + t, f = e.enabled !== !1, p = {
1492
+ function Hr({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, removeFilter: o, setStagePropAt: s, palette: c, showMod: l }) {
1493
+ let u = a();
1494
+ return e.slice(t).map((e, a) => {
1495
+ let d = a + t, f = e.enabled !== !1, p = {
1138
1496
  ...r,
1139
1497
  ...e.params,
1140
1498
  id: n.id
@@ -1143,12 +1501,12 @@ function Dr({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, rem
1143
1501
  className: "flex flex-col gap-2 p-2 rounded bg-oq-04",
1144
1502
  children: [/* @__PURE__ */ $("div", {
1145
1503
  className: "flex items-center gap-2",
1146
- children: [/* @__PURE__ */ Q(Ln, {
1504
+ children: [/* @__PURE__ */ Q(Fn, {
1147
1505
  size: u,
1148
1506
  checked: f,
1149
1507
  onChange: () => i(n.id, d),
1150
1508
  label: e.def?.label ?? e.id
1151
- }), /* @__PURE__ */ Q(Rn, {
1509
+ }), /* @__PURE__ */ Q(In, {
1152
1510
  asChild: !0,
1153
1511
  label: "Delete effect",
1154
1512
  children: /* @__PURE__ */ Q(K, {
@@ -1158,16 +1516,16 @@ function Dr({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, rem
1158
1516
  iconOnly: "x",
1159
1517
  "aria-label": "Delete effect",
1160
1518
  className: "ml-auto shrink-0",
1161
- onClick: () => a(n.id, d)
1519
+ onClick: () => o(n.id, d)
1162
1520
  })
1163
1521
  })]
1164
- }), f && e.def && /* @__PURE__ */ Q(ne, {
1522
+ }), f && e.def && /* @__PURE__ */ Q(A, {
1165
1523
  schema: e.def.params.filter((e) => D(e) !== "anim"),
1166
1524
  layer: p,
1167
1525
  setProp: m,
1168
1526
  palette: c,
1169
1527
  inline: !0,
1170
- renderAnimate: l ? (e) => /* @__PURE__ */ Q(Be, {
1528
+ renderAnimate: l ? (e) => /* @__PURE__ */ Q(at, {
1171
1529
  layer: p,
1172
1530
  param: e,
1173
1531
  setProp: m
@@ -1176,18 +1534,18 @@ function Dr({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, rem
1176
1534
  }, e.key ?? d);
1177
1535
  });
1178
1536
  }
1179
- function Or({ chain: e, from: t = 1, filters: n = null, layer: r, hostView: i, addFilter: a, removeFilter: s, toggleFilter: c, setStagePropAt: l, palette: u, showMod: d }) {
1180
- let f = o(), p = [{
1537
+ function Ur({ chain: e, from: t = 1, filters: n = null, layer: r, hostView: i, addFilter: o, removeFilter: s, toggleFilter: c, setStagePropAt: l, palette: u, showMod: d }) {
1538
+ let f = a(), p = [{
1181
1539
  value: "",
1182
1540
  label: "Add FX…"
1183
- }, ...(n ?? L(z)).map((e) => ({
1541
+ }, ...(n ?? I(L)).map((e) => ({
1184
1542
  value: e.id,
1185
1543
  label: e.label ?? e.id
1186
1544
  }))];
1187
1545
  return /* @__PURE__ */ $(q, {
1188
1546
  label: "Post-Processing",
1189
1547
  divided: !0,
1190
- children: [/* @__PURE__ */ Q(Dr, {
1548
+ children: [/* @__PURE__ */ Q(Hr, {
1191
1549
  chain: e,
1192
1550
  from: t,
1193
1551
  layer: r,
@@ -1197,61 +1555,61 @@ function Or({ chain: e, from: t = 1, filters: n = null, layer: r, hostView: i, a
1197
1555
  setStagePropAt: l,
1198
1556
  palette: u,
1199
1557
  showMod: d
1200
- }), e.length < 8 && /* @__PURE__ */ Q(Mn, {
1558
+ }), e.length < 8 && /* @__PURE__ */ Q(An, {
1201
1559
  variant: "subtle",
1202
1560
  size: f,
1203
1561
  className: "w-full",
1204
1562
  options: p,
1205
1563
  value: "",
1206
1564
  onChange: (e) => {
1207
- e && a(r.id, e);
1565
+ e && o(r.id, e);
1208
1566
  }
1209
1567
  })]
1210
1568
  });
1211
1569
  }
1212
- function kr({ layer: e, showMod: t, tree: n }) {
1213
- let i = o(), [s, c] = Z("generate"), { updateLayer: l, palette: u } = a(), { setOnly: d } = un(), p = oe(e.id, { history: "coalesce" }), m = B(e.loopGroup).find((t) => t.id === e.presetId), h = F(e.loopGroup), g = (n ?? ye).find((t) => t.groups.includes(e.loopGroup)), _ = g?.labels?.[e.loopGroup] ?? h?.label ?? "", v = g && g.label !== _ ? `${g.label} / ${_}` : _, y = e.loopGroup === "paratype" && m?.sub === "Glyphs" ? j("paratype", "Glyphs") : null, b = y ? y.map((e) => ({
1570
+ function Wr({ layer: e, showMod: t, tree: n }) {
1571
+ let o = a(), [s, c] = Z("generate"), { updateLayer: l, palette: u } = i(), { setOnly: f } = W(), p = te(e.id, { history: "coalesce" }), m = N(e.loopGroup).find((t) => t.id === e.presetId), h = P(e.loopGroup), g = (n ?? we).find((t) => t.groups.includes(e.loopGroup)), _ = g?.labels?.[e.loopGroup] ?? h?.label ?? "", v = g && g.label !== _ ? `${g.label} / ${_}` : _, y = e.loopGroup === "paratype" && m?.sub === "Glyphs" ? ne("paratype", "Glyphs") : null, b = y ? y.map((e) => ({
1214
1572
  value: e.id,
1215
1573
  label: e.label
1216
- })) : null, x = (t) => {
1574
+ })) : null, S = (t) => {
1217
1575
  let n = y?.find((e) => e.id === t);
1218
- n && t !== e.presetId && d(e.type, M(n, e.loopGroup));
1219
- }, S = () => {
1220
- m && d(e.type, M(m, e.loopGroup));
1576
+ n && t !== e.presetId && f(e.type, H(n, e.loopGroup));
1577
+ }, C = () => {
1578
+ m && f(e.type, H(m, e.loopGroup));
1221
1579
  };
1222
- return gr(S, () => {
1223
- let t = H(e.loopId)?.params ?? [];
1224
- l(e.id, f(e, C(t, e), T(), { withFilters: !0 }));
1225
- }), /* @__PURE__ */ $(Sr, {
1580
+ return jr(C, () => {
1581
+ let t = U(e.loopId)?.params ?? [];
1582
+ l(e.id, d(e, x(t, e), T(), { withFilters: !0 }));
1583
+ }), /* @__PURE__ */ $(Lr, {
1226
1584
  title: v,
1227
1585
  chips: b,
1228
1586
  active: e.presetId,
1229
- onPick: x,
1587
+ onPick: S,
1230
1588
  pills: !0,
1231
1589
  scope: e.loopId,
1232
- ghostLabels: (H(e.loopId)?.params ?? []).filter((e) => e.type !== "color" && e.label).map((e) => e.label),
1590
+ ghostLabels: (U(e.loopId)?.params ?? []).filter((e) => e.type !== "color" && e.label).map((e) => e.label),
1233
1591
  tabStrip: /* @__PURE__ */ Q(J, {
1234
1592
  tone: "sunken",
1235
1593
  value: s,
1236
1594
  onChange: c,
1237
- options: i === "sm" ? vr : yr,
1238
- size: i,
1239
- className: r(i)
1595
+ options: o === "sm" ? Nr : Pr,
1596
+ size: o,
1597
+ className: r(o)
1240
1598
  }),
1241
1599
  children: [
1242
- s === "anim" && /* @__PURE__ */ Q(ur, {
1243
- schema: H(e.loopId)?.params ?? [],
1600
+ s === "anim" && /* @__PURE__ */ Q(Tr, {
1601
+ schema: U(e.loopId)?.params ?? [],
1244
1602
  layer: e,
1245
1603
  setProp: p.setProp,
1246
- inputs: H(e.loopId)?.inputs
1604
+ inputs: U(e.loopId)?.inputs
1247
1605
  }),
1248
- /* @__PURE__ */ Q(Ne, {
1606
+ /* @__PURE__ */ Q(ye, {
1249
1607
  layer: e,
1250
1608
  setProp: p.setProp,
1251
1609
  patch: p.patch,
1252
1610
  updateLayer: l,
1253
1611
  palette: u,
1254
- renderAnimate: t ? (t) => /* @__PURE__ */ Q(Be, {
1612
+ renderAnimate: t ? (t) => /* @__PURE__ */ Q(at, {
1255
1613
  layer: e,
1256
1614
  param: t,
1257
1615
  setProp: p.setProp
@@ -1260,102 +1618,168 @@ function kr({ layer: e, showMod: t, tree: n }) {
1260
1618
  tabStrip: null,
1261
1619
  tree: n,
1262
1620
  inline: !0,
1263
- onReset: S
1621
+ onReset: C
1264
1622
  }),
1265
- s === "generate" && e.loopId === "scene3d" && e.primitive === "mesh" && /* @__PURE__ */ Q(hr, {
1623
+ s === "generate" && e.loopId === "scene3d" && e.primitive === "mesh" && /* @__PURE__ */ Q(Ar, {
1266
1624
  layer: e,
1267
1625
  setProp: p.setProp
1268
1626
  }),
1269
- s === "style" && /* @__PURE__ */ Q(Tr, {
1627
+ s === "style" && /* @__PURE__ */ Q(Br, {
1270
1628
  layer: e,
1271
1629
  edit: p,
1272
1630
  palette: u,
1273
1631
  showMod: t
1274
1632
  }),
1275
- s === "anim" && /* @__PURE__ */ Q(sr, {
1276
- schema: H(e.loopId)?.params ?? [],
1633
+ s === "anim" && /* @__PURE__ */ Q(Sr, {
1634
+ schema: U(e.loopId)?.params ?? [],
1277
1635
  layer: e,
1278
1636
  setProp: p.setProp
1279
1637
  })
1280
1638
  ]
1281
1639
  });
1282
1640
  }
1283
- function Ar({ layer: e, showMod: t }) {
1284
- let n = o(), [i, s] = Z("generate"), { updateLayer: c, palette: l } = a(), { setOnly: u } = un(), d = oe(e.id, { history: "coalesce" }), f = Ge.find((t) => t.id === e.presetId), p = nt.find((e) => e.subs.includes(f?.sub))?.label ?? "Kinetic";
1285
- return gr(() => {
1641
+ function Gr({ layer: e, showMod: t }) {
1642
+ let n = a(), [o, s] = Z("generate"), { updateLayer: c, palette: l } = i(), { setOnly: u } = W(), d = te(e.id, { history: "coalesce" }), f = lt.find((t) => t.id === e.presetId), p = ct.find((e) => e.subs.includes(f?.sub))?.label ?? "Kinetic";
1643
+ return jr(() => {
1286
1644
  f && u("kinetic", {
1287
1645
  presetId: f.id,
1288
1646
  presetLabel: f.label,
1289
- comp: Ue(f)
1647
+ comp: dt(f)
1290
1648
  });
1291
1649
  }, () => {
1292
- let t = T(), n = _(t >>> 0), r = e.comp ?? { instances: [] };
1650
+ let t = T(), n = g(t >>> 0), r = e.comp ?? { instances: [] };
1293
1651
  (r.instances ?? []).forEach((e, t) => {
1294
- r = rt(r, t, n);
1652
+ r = ft(r, t, n);
1295
1653
  }), c(e.id, {
1296
1654
  comp: r,
1297
1655
  _rollSeed: t
1298
1656
  });
1299
- }), /* @__PURE__ */ Q(Sr, {
1657
+ }), /* @__PURE__ */ Q(Lr, {
1300
1658
  title: p,
1301
1659
  tabStrip: /* @__PURE__ */ Q(J, {
1302
1660
  tone: "sunken",
1303
- value: i,
1661
+ value: o,
1304
1662
  onChange: s,
1305
- options: n === "sm" ? vr : yr,
1663
+ options: n === "sm" ? Nr : Pr,
1306
1664
  size: n,
1307
1665
  className: r(n)
1308
1666
  }),
1309
- children: /* @__PURE__ */ Q(at, {
1667
+ children: /* @__PURE__ */ Q(ut, {
1310
1668
  layer: e,
1311
1669
  setProp: d.setProp,
1312
1670
  updateLayer: c,
1313
1671
  palette: l,
1314
- renderAnimate: t ? (t) => /* @__PURE__ */ Q(Be, {
1672
+ renderAnimate: t ? (t) => /* @__PURE__ */ Q(at, {
1315
1673
  layer: e,
1316
1674
  param: t,
1317
1675
  setProp: d.setProp
1318
1676
  }) : () => null,
1319
- tab: i,
1677
+ tab: o,
1320
1678
  tabStrip: null
1321
1679
  })
1322
1680
  });
1323
1681
  }
1324
- function jr() {
1325
- let { layer: e } = un(), t = qe(), n = o(), r = ze();
1682
+ function Kr() {
1683
+ let { layer: e } = W(), t = nt(), n = a(), r = it();
1326
1684
  return Y(() => {
1327
1685
  let e = (e) => {
1328
- e.key !== "m" && e.key !== "M" || e.metaKey || e.ctrlKey || e.altKey || Tt(e) || Re();
1686
+ e.key !== "m" && e.key !== "M" || e.metaKey || e.ctrlKey || e.altKey || Pt(e) || rt();
1329
1687
  };
1330
1688
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1331
- }, []), t.active ? /* @__PURE__ */ Q(Sr, {
1689
+ }, []), t.active ? /* @__PURE__ */ Q(Lr, {
1332
1690
  title: "Morph",
1333
- children: /* @__PURE__ */ Q(rr, {
1691
+ children: /* @__PURE__ */ Q(vr, {
1334
1692
  layer: e,
1335
- editTabs: n === "sm" ? vr : yr
1693
+ editTabs: n === "sm" ? Nr : Pr
1336
1694
  })
1337
- }) : e ? e.type === "photo" ? /* @__PURE__ */ Q(Cr, {
1695
+ }) : e ? e.type === "photo" ? /* @__PURE__ */ Q(Rr, {
1338
1696
  layer: e,
1339
1697
  showMod: r
1340
- }, e.id) : e.type === "loop" ? /* @__PURE__ */ Q(kr, {
1698
+ }, e.id) : e.type === "loop" ? /* @__PURE__ */ Q(Wr, {
1341
1699
  layer: e,
1342
1700
  showMod: r
1343
- }, e.id) : e.type === "misc" ? /* @__PURE__ */ Q(kr, {
1701
+ }, e.id) : e.type === "misc" ? /* @__PURE__ */ Q(Wr, {
1344
1702
  layer: e,
1345
1703
  showMod: r,
1346
- tree: le
1347
- }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Q(Ar, {
1704
+ tree: fe
1705
+ }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Q(Gr, {
1348
1706
  layer: e,
1349
1707
  showMod: r
1350
- }, e.id) : /* @__PURE__ */ Q(V, { children: "This layer has no labs surface." }) : /* @__PURE__ */ Q(V, { children: "Pick an effect or generator from the nav." });
1708
+ }, e.id) : /* @__PURE__ */ Q(j, { children: "This layer has no labs surface." }) : /* @__PURE__ */ Q(j, { children: "Pick an effect or generator from the nav." });
1709
+ }
1710
+ //#endregion
1711
+ //#region src/editor/mobile/CategoryScreen.jsx
1712
+ function qr(e) {
1713
+ Y(() => {
1714
+ let t = (t) => {
1715
+ t.key === "Escape" && e?.();
1716
+ };
1717
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1718
+ }, [e]), Y(() => {
1719
+ let e = O.isPlaying();
1720
+ return O.pause(), () => {
1721
+ e && O.play();
1722
+ };
1723
+ }, []);
1724
+ }
1725
+ function Jr({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1726
+ return qr(r ?? n), /* @__PURE__ */ Q("div", {
1727
+ className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
1728
+ style: { zIndex: "var(--kol-z-modal)" },
1729
+ children: /* @__PURE__ */ $("div", {
1730
+ className: "my-auto w-full max-w-sm rounded p-8 flex flex-col gap-6",
1731
+ style: { background: "var(--kol-surface-primary)" },
1732
+ children: [
1733
+ /* @__PURE__ */ Q("div", {
1734
+ className: "kol-eyebrow text-body",
1735
+ children: "Pick a generator"
1736
+ }),
1737
+ /* @__PURE__ */ Q("div", {
1738
+ className: "flex flex-col gap-2",
1739
+ children: we.map((t) => {
1740
+ let n = lr[`gen:${t.label}`] ?? "square";
1741
+ return /* @__PURE__ */ Q(K, {
1742
+ tone: "primary",
1743
+ size: "lg",
1744
+ className: Et,
1745
+ iconLeft: n,
1746
+ iconRight: n,
1747
+ onClick: () => e(t),
1748
+ children: t.label
1749
+ }, t.label);
1750
+ })
1751
+ }),
1752
+ /* @__PURE__ */ $("div", {
1753
+ className: "flex flex-col gap-2",
1754
+ children: [t && /* @__PURE__ */ Q(K, {
1755
+ tone: "grey",
1756
+ size: "lg",
1757
+ className: "w-full [&>span]:w-full [&>span]:justify-between",
1758
+ iconLeft: "image",
1759
+ iconRight: "image",
1760
+ onClick: t,
1761
+ children: "Insert image or video"
1762
+ }), n && /* @__PURE__ */ Q(K, {
1763
+ tone: "grey",
1764
+ size: "lg",
1765
+ className: "w-full [&>span]:w-full [&>span]:justify-between",
1766
+ iconLeft: "arrow-left",
1767
+ iconRight: "arrow-left",
1768
+ onClick: n,
1769
+ children: "Back"
1770
+ })]
1771
+ })
1772
+ ]
1773
+ })
1774
+ });
1351
1775
  }
1352
1776
  //#endregion
1353
1777
  //#region src/editor/labs/LabsSourcePicker.jsx
1354
- var Mr = (e) => /\.svg$/i.test(e.key) || /svg/i.test(e.contentType || "");
1355
- function Nr(e) {
1356
- let { patch: t } = oe(e.id), n = X(null), [r, i] = Z(!1), a = e.type === "loop" && e.loopGroup === "distress";
1778
+ var Yr = (e) => /\.svg$/i.test(e.key) || /svg/i.test(e.contentType || "");
1779
+ function Xr(e) {
1780
+ let { patch: t } = te(e.id), n = X(null), [r, i] = Z(!1), a = e.type === "loop" && e.loopGroup === "distress";
1357
1781
  return {
1358
- nodes: /* @__PURE__ */ $(Wn, { children: [/* @__PURE__ */ Q("input", {
1782
+ nodes: /* @__PURE__ */ $(Hn, { children: [/* @__PURE__ */ Q("input", {
1359
1783
  ref: n,
1360
1784
  type: "file",
1361
1785
  accept: a ? ".svg,image/svg+xml" : "image/*,video/*",
@@ -1369,7 +1793,7 @@ function Nr(e) {
1369
1793
  return;
1370
1794
  }
1371
1795
  if (r.type.startsWith("video/")) {
1372
- l(e.id, r), t({
1796
+ c(e.id, r), t({
1373
1797
  src: URL.createObjectURL(r),
1374
1798
  srcType: "video"
1375
1799
  });
@@ -1381,18 +1805,18 @@ function Nr(e) {
1381
1805
  }));
1382
1806
  }
1383
1807
  }
1384
- }), /* @__PURE__ */ Q(Jt, {
1808
+ }), /* @__PURE__ */ Q(en, {
1385
1809
  open: r,
1386
- accept: a ? Mr : ["image", "video"],
1810
+ accept: a ? Yr : ["image", "video"],
1387
1811
  onClose: () => i(!1),
1388
1812
  onSelect: (e, { contentType: n } = {}) => {
1389
1813
  if (a) {
1390
- t({ svgSrc: Sn(e) });
1814
+ t({ svgSrc: wn(e) });
1391
1815
  return;
1392
1816
  }
1393
1817
  t({
1394
- src: Sn(e),
1395
- srcType: Ft(n) ? "video" : "image"
1818
+ src: wn(e),
1819
+ srcType: Ut(n) ? "video" : "image"
1396
1820
  });
1397
1821
  }
1398
1822
  })] }),
@@ -1400,7 +1824,7 @@ function Nr(e) {
1400
1824
  openLibrary: () => i(!0),
1401
1825
  openUpload: () => n.current?.click(),
1402
1826
  openCamera: () => {
1403
- lt(e.id).then(() => t({
1827
+ yt(e.id).then(() => t({
1404
1828
  src: null,
1405
1829
  srcType: "webcam"
1406
1830
  })).catch(() => {});
@@ -1421,15 +1845,15 @@ function Nr(e) {
1421
1845
  label: "Camera"
1422
1846
  }
1423
1847
  ].slice(0, 2);
1424
- function Pr({ layer: e }) {
1425
- let t = Nr(e);
1848
+ function Zr({ layer: e }) {
1849
+ let t = Xr(e);
1426
1850
  return /* @__PURE__ */ $("div", {
1427
1851
  className: "flex flex-col gap-2",
1428
1852
  children: [
1429
1853
  /* @__PURE__ */ Q(K, {
1430
1854
  tone: "primary",
1431
1855
  size: "lg",
1432
- className: _t,
1856
+ className: Et,
1433
1857
  iconLeft: "image",
1434
1858
  iconRight: "image",
1435
1859
  onClick: t.openLibrary,
@@ -1438,7 +1862,7 @@ function Pr({ layer: e }) {
1438
1862
  /* @__PURE__ */ Q(K, {
1439
1863
  tone: "primary",
1440
1864
  size: "lg",
1441
- className: _t,
1865
+ className: Et,
1442
1866
  iconLeft: "upload",
1443
1867
  iconRight: "upload",
1444
1868
  onClick: t.openUpload,
@@ -1457,8 +1881,8 @@ function Pr({ layer: e }) {
1457
1881
  ]
1458
1882
  });
1459
1883
  }
1460
- function Fr({ layer: e, title: t, onBack: n }) {
1461
- return Nt(n), /* @__PURE__ */ Q("div", {
1884
+ function Qr({ layer: e, title: t, onBack: n }) {
1885
+ return qr(n), /* @__PURE__ */ Q("div", {
1462
1886
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
1463
1887
  style: { zIndex: "calc(var(--kol-z-sticky) - 2)" },
1464
1888
  children: /* @__PURE__ */ $("div", {
@@ -1475,11 +1899,11 @@ function Fr({ layer: e, title: t, onBack: n }) {
1475
1899
  children: "Pick the media it works on."
1476
1900
  })]
1477
1901
  }),
1478
- /* @__PURE__ */ Q(Pr, { layer: e }),
1902
+ /* @__PURE__ */ Q(Zr, { layer: e }),
1479
1903
  /* @__PURE__ */ Q(K, {
1480
1904
  tone: "grey",
1481
1905
  size: "lg",
1482
- className: _t,
1906
+ className: Et,
1483
1907
  iconLeft: "arrow-left",
1484
1908
  iconRight: "arrow-left",
1485
1909
  onClick: n,
@@ -1491,13 +1915,13 @@ function Fr({ layer: e, title: t, onBack: n }) {
1491
1915
  }
1492
1916
  //#endregion
1493
1917
  //#region src/editor/components/PanelHeader.jsx
1494
- function Ir({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1918
+ function $r({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1495
1919
  return /* @__PURE__ */ $("div", {
1496
1920
  className: `flex w-full shrink-0 items-center ${r}`,
1497
1921
  children: [/* @__PURE__ */ $("button", {
1498
1922
  className: "kol-helper-12 text-meta flex flex-1 items-center gap-2 py-2.5",
1499
1923
  onClick: t,
1500
- children: [/* @__PURE__ */ Q("span", { children: e }), /* @__PURE__ */ Q(Gn, {
1924
+ children: [/* @__PURE__ */ Q("span", { children: e }), /* @__PURE__ */ Q(Un, {
1501
1925
  name: "chevron-down",
1502
1926
  size: 16,
1503
1927
  className: "text-oq-48"
@@ -1505,7 +1929,7 @@ function Ir({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1505
1929
  }), n]
1506
1930
  });
1507
1931
  }
1508
- function Lr({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children: i }) {
1932
+ function ei({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children: i }) {
1509
1933
  return /* @__PURE__ */ $("div", {
1510
1934
  className: "pointer-events-none fixed bottom-[max(0.75rem,env(safe-area-inset-bottom))] left-[var(--fxr-rail,0px)] right-0 z-10 flex flex-nowrap items-center gap-2 px-3 [&>*]:pointer-events-auto",
1511
1935
  children: [/* @__PURE__ */ Q(K, {
@@ -1518,7 +1942,7 @@ function Lr({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children
1518
1942
  children: [/* @__PURE__ */ Q("span", {
1519
1943
  className: "truncate",
1520
1944
  children: e
1521
- }), /* @__PURE__ */ Q(Gn, {
1945
+ }), /* @__PURE__ */ Q(Un, {
1522
1946
  name: "chevron-down",
1523
1947
  size: 16,
1524
1948
  className: "rotate-180 shrink-0"
@@ -1527,13 +1951,13 @@ function Lr({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children
1527
1951
  }), i]
1528
1952
  });
1529
1953
  }
1530
- var Rr = {
1954
+ var ti = {
1531
1955
  half: "50dvh",
1532
1956
  tall: "85dvh"
1533
- }, zr = 4;
1534
- function Br({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1957
+ }, ni = 4;
1958
+ function ri({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1535
1959
  let a = X(null);
1536
- zn(a, { axis: "x" });
1960
+ Ln(a, { axis: "x" });
1537
1961
  let o = X({
1538
1962
  y: null,
1539
1963
  h0: 0,
@@ -1553,7 +1977,7 @@ function Br({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1553
1977
  onPointerMove: (e) => {
1554
1978
  if (o.y === null) return;
1555
1979
  let t = e.clientY - o.y;
1556
- Math.abs(t) > zr && (o.moved = !0), o.moved && r && (o.last = o.h0 - t, r(o.last));
1980
+ Math.abs(t) > ni && (o.moved = !0), o.moved && r && (o.last = o.h0 - t, r(o.last));
1557
1981
  },
1558
1982
  onPointerUp: (e) => {
1559
1983
  if (o.y === null) return;
@@ -1575,10 +1999,10 @@ function Br({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1575
1999
  }
1576
2000
  //#endregion
1577
2001
  //#region src/editor/labs/LabsCatalogCard.jsx
1578
- var Vr = new Set(["#rail/sec:effects"]);
1579
- function Hr({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0, onNeedMedia: i }) {
1580
- let { items: a, dispatch: o } = nn(), [s, c] = Z(n);
1581
- Nt(t);
2002
+ var ii = new Set(["#rail/sec:effects"]);
2003
+ function ai({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0, onNeedMedia: i }) {
2004
+ let { items: a, dispatch: o } = sn(), [s, c] = Z(n);
2005
+ qr(t);
1582
2006
  let l = a.find((e) => e.path === s) ?? null, u = l ? l.sub : a;
1583
2007
  return /* @__PURE__ */ Q("div", {
1584
2008
  className: "fixed bottom-0 top-12 md:top-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
@@ -1597,11 +2021,11 @@ function Hr({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0,
1597
2021
  children: [u.map((t) => /* @__PURE__ */ Q(K, {
1598
2022
  tone: "primary",
1599
2023
  size: "lg",
1600
- className: _t,
2024
+ className: Et,
1601
2025
  iconLeft: t.icon,
1602
2026
  iconRight: t.icon,
1603
2027
  onClick: () => {
1604
- if (!l && Vr.has(t.path) && !r && i) {
2028
+ if (!l && ii.has(t.path) && !r && i) {
1605
2029
  i(t.path);
1606
2030
  return;
1607
2031
  }
@@ -1627,8 +2051,8 @@ function Hr({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0,
1627
2051
  }
1628
2052
  //#endregion
1629
2053
  //#region src/editor/labs/sheetLabels.js
1630
- function Ur(e) {
1631
- if (Ye().active) return {
2054
+ function oi(e) {
2055
+ if (Ze().active) return {
1632
2056
  title: "Morph",
1633
2057
  pill: "Morph"
1634
2058
  };
@@ -1637,11 +2061,11 @@ function Ur(e) {
1637
2061
  pill: "Labs"
1638
2062
  };
1639
2063
  if (e.type === "loop" || e.type === "misc") return {
1640
- title: `${F(e.loopGroup)?.label ?? "Labs"} · ${e.presetLabel}`,
2064
+ title: `${P(e.loopGroup)?.label ?? "Labs"} · ${e.presetLabel}`,
1641
2065
  pill: e.presetLabel
1642
2066
  };
1643
2067
  if (e.type === "photo") {
1644
- let t = g(e)[0]?.def?.label ?? "Media";
2068
+ let t = h(e)[0]?.def?.label ?? "Media";
1645
2069
  return {
1646
2070
  title: t,
1647
2071
  pill: t
@@ -1655,15 +2079,15 @@ function Ur(e) {
1655
2079
  }
1656
2080
  //#endregion
1657
2081
  //#region src/editor/labs/LabsView.jsx
1658
- var Wr = .85, Gr = .3, Kr = 2.5, qr = {
2082
+ var si = .85, ci = .3, li = 2.5, ui = {
1659
2083
  0: 1,
1660
2084
  1: .5,
1661
2085
  2: 1,
1662
2086
  3: 1.5,
1663
2087
  4: 2
1664
- }, Jr = "px-2 py-1 rounded border border-oq-08 bg-surface-secondary kol-mono-12 text-emphasis tabular-nums";
1665
- function Yr() {
1666
- let { layer: e } = un(), { removeLayer: t, layers: n, updateLayer: r, beginTransaction: i, commitTransaction: o, select: s } = a(), [c, l] = Z(null);
2088
+ }, di = "px-2 py-1 rounded border border-oq-08 bg-surface-secondary kol-mono-12 text-emphasis tabular-nums";
2089
+ function fi() {
2090
+ let { layer: e } = W(), { removeLayer: t, layers: n, updateLayer: r, beginTransaction: a, commitTransaction: o, select: s } = i(), [c, l] = Z(null);
1667
2091
  Y(() => {
1668
2092
  let e = (e) => {
1669
2093
  let { id: t, index: r } = e.detail || {};
@@ -1682,54 +2106,54 @@ function Yr() {
1682
2106
  c,
1683
2107
  s
1684
2108
  ]);
1685
- let u = c && n.find((e) => e.id === c.id && e.type === "kinetic"), d = e?.type === "photo" && !e.src && e.srcType !== "webcam", [f, p] = Z(1), [m, g] = Z(!1), _ = Ct(m), y = X(null), b = (e) => Math.min(Kr, Math.max(Gr, e)), x = (e) => p((t) => b(t * (e > 0 ? 1.25 : .8))), { tool: S } = vt(), C = S === "orbit", w = X(C);
1686
- w.current = C, Y(() => {
1687
- let e = y.current;
2109
+ let d = c && n.find((e) => e.id === c.id && e.type === "kinetic"), f = e?.type === "photo" && !e.src && e.srcType !== "webcam", [p, m] = Z(1), [h, g] = Z(!1), _ = Mt(h), v = X(null), y = (e) => Math.min(li, Math.max(ci, e)), b = (e) => m((t) => y(t * (e > 0 ? 1.25 : .8))), { tool: x } = Dt(), S = x === "orbit", C = X(S);
2110
+ C.current = S, Y(() => {
2111
+ let e = v.current;
1688
2112
  if (!e) return;
1689
2113
  let t = (e) => {
1690
- w.current || (e.preventDefault(), !v().zoomLock && p((t) => b(t * (e.deltaY > 0 ? .94 : 1.06))));
2114
+ C.current || (e.preventDefault(), !u().zoomLock && m((t) => y(t * (e.deltaY > 0 ? .94 : 1.06))));
1691
2115
  };
1692
2116
  return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
1693
2117
  }, []), Y(() => {
1694
2118
  let e = (e) => {
1695
- if (!(e.metaKey || e.ctrlKey || e.altKey) && !Tt(e)) {
2119
+ if (!(e.metaKey || e.ctrlKey || e.altKey) && !Pt(e)) {
1696
2120
  if (e.key === "f" || e.key === "F") {
1697
2121
  g((e) => !e);
1698
2122
  return;
1699
2123
  }
1700
- if (!(v().zoomLock && (e.key === "-" || e.key === "_" || e.key === "+" || e.key === "=" || qr[e.key] !== void 0))) {
2124
+ if (!(u().zoomLock && (e.key === "-" || e.key === "_" || e.key === "+" || e.key === "=" || ui[e.key] !== void 0))) {
1701
2125
  if (e.key === "-" || e.key === "_") {
1702
- x(-1);
2126
+ b(-1);
1703
2127
  return;
1704
2128
  }
1705
2129
  if (e.key === "+" || e.key === "=") {
1706
- x(1);
2130
+ b(1);
1707
2131
  return;
1708
2132
  }
1709
- qr[e.key] !== void 0 && p(qr[e.key]);
2133
+ ui[e.key] !== void 0 && m(ui[e.key]);
1710
2134
  }
1711
2135
  }
1712
2136
  };
1713
2137
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1714
2138
  }, []);
1715
- let [T, E] = Z({
2139
+ let [w, T] = Z({
1716
2140
  x: 0,
1717
2141
  y: 0
1718
- }), D = X({
2142
+ }), E = X({
1719
2143
  pts: /* @__PURE__ */ new Map(),
1720
2144
  start: null,
1721
2145
  tap: null
1722
- }), O = X({
1723
- zoom: f,
1724
- pan: T
2146
+ }), D = X({
2147
+ zoom: p,
2148
+ pan: w
1725
2149
  });
1726
- O.current = {
1727
- zoom: f,
1728
- pan: T
2150
+ D.current = {
2151
+ zoom: p,
2152
+ pan: w
1729
2153
  };
1730
- let k = (e) => {
2154
+ let ee = (e) => {
1731
2155
  if (e.pointerType !== "touch") return;
1732
- let t = D.current;
2156
+ let t = E.current;
1733
2157
  if (t.pts.set(e.pointerId, {
1734
2158
  x: e.clientX,
1735
2159
  y: e.clientY
@@ -1739,7 +2163,7 @@ function Yr() {
1739
2163
  y: e.clientY,
1740
2164
  at: performance.now()
1741
2165
  } : null, t.pts.size === 2) {
1742
- let [n, r] = [...t.pts.values()], i = y.current.getBoundingClientRect(), a = i.left + i.width / 2, o = i.top + i.height / 2, s = (n.x + r.x) / 2, c = (n.y + r.y) / 2, { zoom: l, pan: u } = O.current;
2166
+ let [n, r] = [...t.pts.values()], i = v.current.getBoundingClientRect(), a = i.left + i.width / 2, o = i.top + i.height / 2, s = (n.x + r.x) / 2, c = (n.y + r.y) / 2, { zoom: l, pan: u } = D.current;
1743
2167
  t.start = {
1744
2168
  d: Math.hypot(n.x - r.x, n.y - r.y),
1745
2169
  cx: a,
@@ -1747,70 +2171,70 @@ function Yr() {
1747
2171
  z0: l,
1748
2172
  qx: (s - a - u.x) / l,
1749
2173
  qy: (c - o - u.y) / l
1750
- }, h.setStagePointer?.(null), e.stopPropagation();
2174
+ }, O.setStagePointer?.(null), e.stopPropagation();
1751
2175
  }
1752
- }, A = (e) => {
1753
- let t = D.current;
2176
+ }, k = (e) => {
2177
+ let t = E.current;
1754
2178
  if (!(e.pointerType !== "touch" || !t.pts.has(e.pointerId)) && (t.pts.set(e.pointerId, {
1755
2179
  x: e.clientX,
1756
2180
  y: e.clientY
1757
2181
  }), t.pts.size >= 2 && t.start)) {
1758
2182
  e.stopPropagation();
1759
- let [n, r] = [...t.pts.values()], i = t.start, a = v().zoomLock ? i.z0 : b(i.z0 * (Math.hypot(n.x - r.x, n.y - r.y) / i.d)), o = (n.x + r.x) / 2, s = (n.y + r.y) / 2;
1760
- p(a), E({
2183
+ let [n, r] = [...t.pts.values()], i = t.start, a = u().zoomLock ? i.z0 : y(i.z0 * (Math.hypot(n.x - r.x, n.y - r.y) / i.d)), o = (n.x + r.x) / 2, s = (n.y + r.y) / 2;
2184
+ m(a), T({
1761
2185
  x: o - i.cx - a * i.qx,
1762
2186
  y: s - i.cy - a * i.qy
1763
2187
  });
1764
2188
  }
1765
- }, j = (t) => {
1766
- let n = D.current;
2189
+ }, A = (t) => {
2190
+ let n = E.current;
1767
2191
  if (t.pointerType !== "touch") return;
1768
2192
  let r = n.tap;
1769
- r && r.id === t.pointerId && t.type === "pointerup" && !n.start && performance.now() - r.at < 350 && Math.hypot(t.clientX - r.x, t.clientY - r.y) < 12 && (e?.type === "loop" ? H(e.loopId) : null)?.group !== "penrose" && h.toggle(), r?.id === t.pointerId && (n.tap = null), n.pts.delete(t.pointerId), n.pts.size < 2 && (n.start = null);
2193
+ r && r.id === t.pointerId && t.type === "pointerup" && !n.start && performance.now() - r.at < 350 && Math.hypot(t.clientX - r.x, t.clientY - r.y) < 12 && (e?.type === "loop" ? U(e.loopId) : null)?.group !== "penrose" && O.toggle(), r?.id === t.pointerId && (n.tap = null), n.pts.delete(t.pointerId), n.pts.size < 2 && (n.start = null);
1770
2194
  };
1771
2195
  return /* @__PURE__ */ $("div", {
1772
- ref: y,
2196
+ ref: v,
1773
2197
  className: "relative w-full h-full flex items-center justify-center overflow-hidden touch-none",
1774
2198
  style: { background: "var(--kol-surface-secondary)" },
1775
2199
  onDoubleClick: () => {
1776
- p(1), E({
2200
+ m(1), T({
1777
2201
  x: 0,
1778
2202
  y: 0
1779
2203
  });
1780
2204
  },
1781
- onPointerDownCapture: k,
1782
- onPointerMoveCapture: A,
1783
- onPointerUpCapture: j,
1784
- onPointerCancelCapture: j,
2205
+ onPointerDownCapture: ee,
2206
+ onPointerMoveCapture: k,
2207
+ onPointerUpCapture: A,
2208
+ onPointerCancelCapture: A,
1785
2209
  children: [
1786
2210
  /* @__PURE__ */ Q("div", {
1787
2211
  style: {
1788
2212
  flex: "none",
1789
- width: `${f * Wr * 100}%`,
1790
- height: `${f * Wr * 100}%`,
1791
- transform: `translate(${T.x}px, ${T.y}px)`
2213
+ width: `${p * si * 100}%`,
2214
+ height: `${p * si * 100}%`,
2215
+ transform: `translate(${w.x}px, ${w.y}px)`
1792
2216
  },
1793
- children: /* @__PURE__ */ Q(bn, { overlay: u ? (e) => /* @__PURE__ */ Q(Et, {
1794
- layer: u,
2217
+ children: /* @__PURE__ */ Q(Sn, { overlay: d ? (e) => /* @__PURE__ */ Q(Ft, {
2218
+ layer: d,
1795
2219
  initialIndex: c.index,
1796
2220
  toVirtual: e,
1797
2221
  updateLayer: r,
1798
- beginTransaction: i,
2222
+ beginTransaction: a,
1799
2223
  commitTransaction: o,
1800
2224
  onExit: () => l(null)
1801
2225
  }) : void 0 })
1802
2226
  }),
1803
- d && /* @__PURE__ */ Q(Fr, {
2227
+ f && /* @__PURE__ */ Q(Qr, {
1804
2228
  layer: e,
1805
- title: Ur(e).title,
2229
+ title: oi(e).title,
1806
2230
  onBack: () => t(e.id)
1807
2231
  }),
1808
- m && /* @__PURE__ */ Q("div", {
2232
+ h && /* @__PURE__ */ Q("div", {
1809
2233
  className: "absolute bottom-3 right-3 z-[var(--kol-z-base)] flex items-center gap-2 [@media(pointer:coarse)]:bottom-1",
1810
- children: /* @__PURE__ */ Q(Rn, {
2234
+ children: /* @__PURE__ */ Q(In, {
1811
2235
  label: "Framerate — press F to hide",
1812
2236
  children: /* @__PURE__ */ $("span", {
1813
- className: Jr,
2237
+ className: di,
1814
2238
  children: [_, " fps"]
1815
2239
  })
1816
2240
  })
@@ -1818,8 +2242,8 @@ function Yr() {
1818
2242
  ]
1819
2243
  });
1820
2244
  }
1821
- function Xr() {
1822
- let e = X(null), { grabProps: t } = Kn(e, {
2245
+ function pi() {
2246
+ let e = X(null), { grabProps: t } = Wn(e, {
1823
2247
  token: "kol-rail",
1824
2248
  side: "right"
1825
2249
  });
@@ -1865,14 +2289,14 @@ function Xr() {
1865
2289
  className: "kol-compose-rail kol-compose-rail--inspector",
1866
2290
  children: [/* @__PURE__ */ Q("div", { ...t }), /* @__PURE__ */ Q("div", {
1867
2291
  className: "kol-compose-inspector-body",
1868
- children: /* @__PURE__ */ Q(jr, {})
2292
+ children: /* @__PURE__ */ Q(Kr, {})
1869
2293
  })]
1870
2294
  });
1871
2295
  }
1872
- var Zr = Vn(null);
1873
- function Qr() {
1874
- let { tall: e, setTall: t, collapseParams: n, setSheetPx: r } = Hn(Zr);
1875
- return /* @__PURE__ */ Q(Br, {
2296
+ var mi = zn(null);
2297
+ function hi() {
2298
+ let { tall: e, setTall: t, collapseParams: n, setSheetPx: r } = Bn(mi);
2299
+ return /* @__PURE__ */ Q(ri, {
1876
2300
  tall: e,
1877
2301
  onToggle: () => {
1878
2302
  r(null), t((e) => !e);
@@ -1883,20 +2307,20 @@ function Qr() {
1883
2307
  }
1884
2308
  });
1885
2309
  }
1886
- var $r = [
2310
+ var gi = [
1887
2311
  2,
1888
2312
  4,
1889
2313
  8,
1890
2314
  12,
1891
2315
  16
1892
2316
  ];
1893
- function ei({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, railHeight: i }) {
1894
- let { playing: a, loopSeconds: o, play: s, pause: c, stop: l, rewind: u, setLoopSeconds: d } = O(), [f, p] = Z(!0), m = [
2317
+ function _i({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, railHeight: i }) {
2318
+ let { playing: a, loopSeconds: o, play: s, pause: c, stop: l, rewind: u, setLoopSeconds: d } = S(), [f, p] = Z(!0), m = [
1895
2319
  {
1896
2320
  icon: "home-01",
1897
2321
  path: "#home",
1898
2322
  label: "Home",
1899
- onPress: () => Bt("/")
2323
+ onPress: () => Jt("/")
1900
2324
  },
1901
2325
  {
1902
2326
  icon: "grid",
@@ -1923,13 +2347,13 @@ function ei({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, rai
1923
2347
  icon: "download",
1924
2348
  label: "Output",
1925
2349
  onPress: () => {
1926
- t(!0), Ot("Output");
2350
+ t(!0), It("Output");
1927
2351
  }
1928
2352
  }, {
1929
2353
  icon: "file",
1930
2354
  label: "File",
1931
2355
  onPress: () => {
1932
- t(!0), Ot("File");
2356
+ t(!0), It("File");
1933
2357
  }
1934
2358
  }], g = f ? {
1935
2359
  items: [
@@ -1965,14 +2389,14 @@ function ei({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, rai
1965
2389
  onPress: u
1966
2390
  }
1967
2391
  ],
1968
- sheetFor: { loop: $r.map((e) => ({
2392
+ sheetFor: { loop: gi.map((e) => ({
1969
2393
  label: `${e} s`,
1970
2394
  checked: o === e,
1971
2395
  onPress: () => d(e)
1972
2396
  })) }
1973
2397
  } : void 0;
1974
2398
  return Y(() => {
1975
- Qn({
2399
+ Xn({
1976
2400
  items: m,
1977
2401
  actions: h,
1978
2402
  transport: g,
@@ -1986,62 +2410,62 @@ function ei({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, rai
1986
2410
  a,
1987
2411
  o,
1988
2412
  i
1989
- ]), Y(() => () => Qn(null), []), null;
2413
+ ]), Y(() => () => Xn(null), []), null;
1990
2414
  }
1991
- function ti() {
2415
+ function vi() {
1992
2416
  return /* @__PURE__ */ Q("div", {
1993
2417
  className: "kol-compose-rail kol-compose-rail--inspector",
1994
2418
  children: /* @__PURE__ */ Q("div", {
1995
2419
  className: "kol-compose-inspector-body",
1996
- children: /* @__PURE__ */ Q(jr, {})
2420
+ children: /* @__PURE__ */ Q(Kr, {})
1997
2421
  })
1998
2422
  });
1999
2423
  }
2000
- var ni = {
2424
+ var yi = {
2001
2425
  topbar: () => null,
2002
- canvas: Yr,
2426
+ canvas: fi,
2003
2427
  panels: [
2004
2428
  {
2005
2429
  slot: "canvas.footer",
2006
2430
  order: 0,
2007
- Component: it
2431
+ Component: ht
2008
2432
  },
2009
2433
  {
2010
2434
  slot: "right.body",
2011
2435
  order: 0,
2012
- Component: Xr
2436
+ Component: pi
2013
2437
  },
2014
2438
  {
2015
2439
  slot: "right.footer",
2016
2440
  order: 0,
2017
- Component: an
2441
+ Component: ln
2018
2442
  }
2019
2443
  ]
2020
- }, ri = {
2021
- ...ni,
2444
+ }, bi = {
2445
+ ...yi,
2022
2446
  panels: [{
2023
2447
  slot: "right.header",
2024
2448
  order: 0,
2025
- Component: Qr
2026
- }, ...ni.panels.map((e) => e.Component === Xr ? {
2449
+ Component: hi
2450
+ }, ...yi.panels.map((e) => e.Component === pi ? {
2027
2451
  ...e,
2028
- Component: ti
2452
+ Component: vi
2029
2453
  } : e)]
2030
2454
  };
2031
- function ii() {
2032
- let { setAspect: e, selectedId: t, select: n } = a(), { layer: r, setOnly: i } = un(), o = X(!1), s = qt(_n), l = rn() && !on() || s;
2455
+ function xi() {
2456
+ let { setAspect: e, selectedId: t, select: n } = i(), { layer: r, setOnly: a } = W(), o = X(!1), c = gt(hn), l = Bt() && !xn() || c;
2033
2457
  Y(() => {
2034
2458
  l && document.documentElement.removeAttribute("data-rail");
2035
2459
  }, [l]);
2036
- let [u, f] = Z(!0), [p, m] = Z(!1), [g, _] = Z(null), y = g ? `${g}px` : p ? Rr.tall : Rr.half, b = { "--kol-sheet-h": y }, x = $n(), S = qe(), [C, w] = Z(() => !r);
2460
+ let [d, f] = Z(!0), [m, h] = Z(!1), [g, _] = Z(null), v = g ? `${g}px` : m ? ti.tall : ti.half, y = { "--kol-sheet-h": v }, b = Zn(), x = nt(), [S, C] = Z(() => !r);
2037
2461
  Y(() => {
2038
- w(!r);
2462
+ C(!r);
2039
2463
  }, [r?.id]);
2040
- let [T, E] = Z(null), D = r?.type === "photo" && (!!r.src || r.srcType === "webcam");
2464
+ let [w, T] = Z(null), E = r?.type === "photo" && (!!r.src || r.srcType === "webcam");
2041
2465
  Y(() => {
2042
- T && D && w(!0);
2043
- }, [T, D]), Y(() => {
2044
- r || E(null);
2466
+ w && E && C(!0);
2467
+ }, [w, E]), Y(() => {
2468
+ r || T(null);
2045
2469
  }, [r]), Y(() => {
2046
2470
  if (!r || l) return;
2047
2471
  let e = 0, t = 0;
@@ -2051,68 +2475,68 @@ function ii() {
2051
2475
  cancelAnimationFrame(e), cancelAnimationFrame(t);
2052
2476
  };
2053
2477
  }, [r?.id]), Y(() => {
2054
- if (!S.active || l) return;
2478
+ if (!x.active || l) return;
2055
2479
  let e = 0, t = 0;
2056
2480
  return e = requestAnimationFrame(() => {
2057
2481
  t = requestAnimationFrame(() => document.documentElement.removeAttribute("data-rail"));
2058
2482
  }), () => {
2059
2483
  cancelAnimationFrame(e), cancelAnimationFrame(t);
2060
2484
  };
2061
- }, [S.active, l]), Y(() => ct((e) => i("photo", {
2485
+ }, [x.active, l]), Y(() => vt((e) => a("photo", {
2062
2486
  src: e.url,
2063
2487
  srcType: e.srcType
2064
- })), [i]), Y(() => {
2488
+ })), [a]), Y(() => {
2065
2489
  if (!l) return;
2066
2490
  let e = () => f(!0);
2067
2491
  return window.addEventListener("kol:open-params", e), window.addEventListener("kol:open-effects", e), () => {
2068
2492
  window.removeEventListener("kol:open-params", e), window.removeEventListener("kol:open-effects", e);
2069
2493
  };
2070
- }, [l]), gt(), Y(() => (Dt("labs"), () => Dt(null)), []), Y(() => {
2494
+ }, [l]), Tt(), Y(() => (Cn("labs"), () => Cn(null)), []), Y(() => {
2071
2495
  if (o.current) return;
2072
2496
  o.current = !0;
2073
- let t = v();
2074
- t.defaultAspect && t.defaultAspect !== "custom" && e(t.defaultAspect), t.defaultLoopSeconds && h.setLoopSeconds(t.defaultLoopSeconds);
2497
+ let t = u();
2498
+ t.defaultAspect && t.defaultAspect !== "custom" && e(t.defaultAspect), t.defaultLoopSeconds && O.setLoopSeconds(t.defaultLoopSeconds);
2075
2499
  }, []);
2076
- let O = X(!1);
2500
+ let D = X(!1);
2077
2501
  Y(() => {
2078
- if (O.current) return;
2079
- O.current = !0;
2080
- let e = At();
2502
+ if (D.current) return;
2503
+ D.current = !0;
2504
+ let e = Rt();
2081
2505
  if (e.open || e.fresh) return;
2082
- let t = new URLSearchParams(window.location.search).get("preset"), n = t ? se(t) : null;
2083
- n && i("loop", M(N(t), n));
2084
- }, [i]);
2085
- let { clearHistory: k } = a();
2506
+ let t = new URLSearchParams(window.location.search).get("preset"), n = t ? V(t) : null;
2507
+ n && a("loop", H(M(t), n));
2508
+ }, [a]);
2509
+ let { clearHistory: k } = i();
2086
2510
  Y(() => {
2087
2511
  let e = setTimeout(k, 800);
2088
2512
  return () => clearTimeout(e);
2089
2513
  }, [k]);
2090
- let { tool: j, setTool: P } = vt(), F = X(j);
2091
- F.current = j;
2092
- let { updateLayer: I, undo: L, redo: R } = a(), z = X({
2093
- undo: L,
2094
- redo: R
2514
+ let { tool: A, setTool: j } = Dt(), te = X(A);
2515
+ te.current = A;
2516
+ let { updateLayer: ne, undo: N, redo: P } = i(), F = X({
2517
+ undo: N,
2518
+ redo: P
2095
2519
  });
2096
- z.current = {
2097
- undo: L,
2098
- redo: R
2520
+ F.current = {
2521
+ undo: N,
2522
+ redo: P
2099
2523
  };
2100
- let ee = !!A().grab;
2524
+ let I = !!p().grab;
2101
2525
  Y(() => {
2102
- P(ee ? "orbit" : "select");
2103
- }, [ee, P]);
2104
- let B = X(r);
2105
- B.current = r;
2106
- let te = X(I);
2107
- return te.current = I, Y(() => {
2526
+ j(I ? "orbit" : "select");
2527
+ }, [I, j]);
2528
+ let re = X(r);
2529
+ re.current = r;
2530
+ let L = X(ne);
2531
+ return L.current = ne, Y(() => {
2108
2532
  let e = (e) => {
2109
- if (Tt(e)) return;
2533
+ if (Pt(e)) return;
2110
2534
  if ((e.metaKey || e.ctrlKey) && (e.key === "z" || e.key === "Z")) {
2111
- e.preventDefault(), e.shiftKey ? z.current.redo() : z.current.undo();
2535
+ e.preventDefault(), e.shiftKey ? F.current.redo() : F.current.undo();
2112
2536
  return;
2113
2537
  }
2114
2538
  if (e.code === "Space") {
2115
- e.preventDefault(), h.toggle();
2539
+ e.preventDefault(), O.toggle();
2116
2540
  return;
2117
2541
  }
2118
2542
  if ((e.key === "s" || e.key === "S") && !e.metaKey && !e.ctrlKey && !e.altKey) {
@@ -2120,21 +2544,21 @@ function ii() {
2120
2544
  return;
2121
2545
  }
2122
2546
  if ((e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey) {
2123
- d("grab", !v().grab);
2547
+ ee("grab", !u().grab);
2124
2548
  return;
2125
2549
  }
2126
2550
  if ((e.key === "z" || e.key === "Z") && !e.metaKey && !e.ctrlKey && !e.altKey) {
2127
- d("zoomLock", !v().zoomLock);
2551
+ ee("zoomLock", !u().zoomLock);
2128
2552
  return;
2129
2553
  }
2130
- let t = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && je[e.key.length === 1 ? e.key.toLowerCase() : e.key];
2131
- if (t && B.current) {
2132
- let n = Me(B.current, t[1], t[0]);
2133
- n && (e.preventDefault(), te.current(B.current.id, n));
2554
+ let t = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && be[e.key.length === 1 ? e.key.toLowerCase() : e.key];
2555
+ if (t && re.current) {
2556
+ let n = Ce(re.current, t[1], t[0]);
2557
+ n && (e.preventDefault(), L.current(re.current.id, n));
2134
2558
  }
2135
2559
  };
2136
2560
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2137
- }, [P]), Y(() => {
2561
+ }, [j]), Y(() => {
2138
2562
  if (!r?.presetId) return;
2139
2563
  let e = new URLSearchParams(window.location.search);
2140
2564
  e.get("preset") !== r.presetId && (e.delete("view"), e.set("preset", r.presetId), r.loopGroup ? e.set("cat", r.loopGroup) : e.delete("cat"), window.history.replaceState(null, "", `${window.location.pathname}?${e}`));
@@ -2147,61 +2571,61 @@ function ii() {
2147
2571
  ]), /* @__PURE__ */ $("div", {
2148
2572
  className: "kol-editor-labs contents",
2149
2573
  "data-touch": l || void 0,
2150
- "data-params": u ? "open" : void 0,
2151
- "data-empty": r || S.active ? void 0 : "",
2152
- style: b,
2574
+ "data-params": d ? "open" : void 0,
2575
+ "data-empty": r || x.active ? void 0 : "",
2576
+ style: y,
2153
2577
  children: [
2154
- /* @__PURE__ */ Q(er, {}),
2155
- l ? /* @__PURE__ */ $(Zr.Provider, {
2578
+ /* @__PURE__ */ Q(hr, {}),
2579
+ l ? /* @__PURE__ */ $(mi.Provider, {
2156
2580
  value: {
2157
2581
  collapseParams: () => f(!1),
2158
- tall: p,
2159
- setTall: m,
2582
+ tall: m,
2583
+ setTall: h,
2160
2584
  setSheetPx: _,
2161
- catalog: C,
2162
- toggleCatalog: () => w((e) => !e)
2585
+ catalog: S,
2586
+ toggleCatalog: () => C((e) => !e)
2163
2587
  },
2164
- children: [/* @__PURE__ */ Q(c.Provider, {
2588
+ children: [/* @__PURE__ */ Q(s.Provider, {
2165
2589
  value: "md",
2166
- children: /* @__PURE__ */ Q(wn, {
2167
- registry: ri,
2168
- rightIn: (e) => x ? Jn(/* @__PURE__ */ Q("div", {
2590
+ children: /* @__PURE__ */ Q(Tn, {
2591
+ registry: bi,
2592
+ rightIn: (e) => b ? Kn(/* @__PURE__ */ Q("div", {
2169
2593
  className: "kol-editor-labs flex flex-col h-full",
2170
2594
  "data-touch": "",
2171
2595
  "data-params": "open",
2172
- style: b,
2596
+ style: y,
2173
2597
  children: e
2174
- }), x) : null
2598
+ }), b) : null
2175
2599
  })
2176
- }), /* @__PURE__ */ Q(ei, {
2177
- paramsOpen: u,
2600
+ }), /* @__PURE__ */ Q(_i, {
2601
+ paramsOpen: d,
2178
2602
  setParamsOpen: f,
2179
- catalog: C,
2180
- toggleCatalog: () => w((e) => !e),
2181
- railHeight: y
2603
+ catalog: S,
2604
+ toggleCatalog: () => C((e) => !e),
2605
+ railHeight: v
2182
2606
  })]
2183
- }) : /* @__PURE__ */ Q(wn, { registry: ni }),
2184
- C && !S.picker && !(S.active && !r) && /* @__PURE__ */ Q(Hr, {
2185
- initialOpen: T,
2186
- hasMedia: D,
2607
+ }) : /* @__PURE__ */ Q(Tn, { registry: yi }),
2608
+ S && !x.picker && !(x.active && !r) && /* @__PURE__ */ Q(ai, {
2609
+ initialOpen: w,
2610
+ hasMedia: E,
2187
2611
  onNeedMedia: (e) => {
2188
- E(e), i("photo", {
2612
+ T(e), a("photo", {
2189
2613
  filters: [],
2190
2614
  fxGroup: null
2191
2615
  });
2192
2616
  },
2193
2617
  onPicked: () => {
2194
- E(null), w(!1);
2618
+ T(null), C(!1);
2195
2619
  },
2196
2620
  onClose: () => {
2197
- E(null), w(!1);
2621
+ T(null), C(!1);
2198
2622
  }
2199
2623
  })
2200
2624
  ]
2201
2625
  });
2202
2626
  }
2203
- var ai = "kol.editor.labs-draft";
2204
- function oi() {
2627
+ var Si = "kol.editor.labs-draft";
2628
+ function Ci() {
2205
2629
  let e = /\/morph\/?$/.test(typeof window > "u" ? "" : window.location.pathname);
2206
2630
  return Y(() => (G(e ? { active: !0 } : {
2207
2631
  active: !1,
@@ -2209,21 +2633,21 @@ function oi() {
2209
2633
  }), () => G({
2210
2634
  active: !1,
2211
2635
  editing: null
2212
- })), [e]), /* @__PURE__ */ $(dn, {
2213
- draftKey: ai,
2636
+ })), [e]), /* @__PURE__ */ $(mn, {
2637
+ draftKey: Si,
2214
2638
  children: [
2215
- /* @__PURE__ */ Q(ii, {}),
2216
- /* @__PURE__ */ Q(tn, {}),
2217
- /* @__PURE__ */ Q($t, {})
2639
+ /* @__PURE__ */ Q(xi, {}),
2640
+ /* @__PURE__ */ Q(on, {}),
2641
+ /* @__PURE__ */ Q(ve, {})
2218
2642
  ]
2219
2643
  });
2220
2644
  }
2221
2645
  //#endregion
2222
2646
  //#region src/editor/mobile/EffectScreen.jsx
2223
- function si({ layer: e, chain: t, onPick: n, onBack: r }) {
2647
+ function wi({ layer: e, chain: t, onPick: n, onBack: r }) {
2224
2648
  let [i, a] = Z(null);
2225
- Nt(r);
2226
- let { engineHost: o } = ae(e), s = o && !t.some((e) => e.def?.kind === "engine"), c = I(z.filter((e) => e.kind !== "engine" || s)), l = c.find((e) => e.id === i) ?? null;
2649
+ qr(r);
2650
+ let { engineHost: o } = ie(e), s = o && !t.some((e) => e.def?.kind === "engine"), c = F(L.filter((e) => e.kind !== "engine" || s)), l = c.find((e) => e.id === i) ?? null;
2227
2651
  return /* @__PURE__ */ Q("div", {
2228
2652
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
2229
2653
  style: { zIndex: "var(--kol-z-modal)" },
@@ -2240,7 +2664,7 @@ function si({ layer: e, chain: t, onPick: n, onBack: r }) {
2240
2664
  children: (l ? l.filters : c).map((e) => /* @__PURE__ */ Q(K, {
2241
2665
  tone: "primary",
2242
2666
  size: "lg",
2243
- className: _t,
2667
+ className: Et,
2244
2668
  iconLeft: l ? "filter" : "chevron-right",
2245
2669
  iconRight: l ? "filter" : "chevron-right",
2246
2670
  onClick: () => l ? n(e.id) : a(e.id),
@@ -2250,7 +2674,7 @@ function si({ layer: e, chain: t, onPick: n, onBack: r }) {
2250
2674
  /* @__PURE__ */ Q(K, {
2251
2675
  tone: "grey",
2252
2676
  size: "lg",
2253
- className: _t,
2677
+ className: Et,
2254
2678
  iconLeft: "arrow-left",
2255
2679
  iconRight: "arrow-left",
2256
2680
  onClick: () => l ? a(null) : r(),
@@ -2262,7 +2686,7 @@ function si({ layer: e, chain: t, onPick: n, onBack: r }) {
2262
2686
  }
2263
2687
  //#endregion
2264
2688
  //#region src/editor/mobile/MobileOverlay.jsx
2265
- var ci = { background: "var(--kol-surface-primary)" }, li = [
2689
+ var Ti = { background: "var(--kol-surface-primary)" }, Ei = [
2266
2690
  {
2267
2691
  value: "generate",
2268
2692
  label: "Generate"
@@ -2279,29 +2703,29 @@ var ci = { background: "var(--kol-surface-primary)" }, li = [
2279
2703
  value: "output",
2280
2704
  label: "Output"
2281
2705
  }
2282
- ], ui = li.filter((e) => e.value !== "generate"), di = "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-1 [&_.kol-seg-cell]:overflow-hidden [@media(hover:none)]:[&_.kol-seg-cell:hover]:text-[var(--kol-oq-48)]", fi = {
2706
+ ], Di = Ei.filter((e) => e.value !== "generate"), Oi = "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-1 [&_.kol-seg-cell]:overflow-hidden [@media(hover:none)]:[&_.kol-seg-cell:hover]:text-[var(--kol-oq-48)]", ki = {
2283
2707
  lg: 9.6,
2284
2708
  sm: 7.2
2285
- }, pi = 10, mi = 232;
2286
- function hi(e, t) {
2287
- let n = t === "sm" ? mi : Math.min(window.innerWidth, 480) - 24, r = [], i = [], a = 0;
2709
+ }, Ai = 10, ji = 232;
2710
+ function Mi(e, t) {
2711
+ let n = t === "sm" ? ji : Math.min(window.innerWidth, 480) - 24, r = [], i = [], a = 0;
2288
2712
  for (let o of e) {
2289
- let e = o.label.length * fi[t] + pi, s = Math.max(a, e);
2713
+ let e = o.label.length * ki[t] + Ai, s = Math.max(a, e);
2290
2714
  i.length && (i.length + 1) * s > n ? (r.push(i), i = [o], a = e) : (i.push(o), a = s);
2291
2715
  }
2292
2716
  return i.length && r.push(i), r;
2293
2717
  }
2294
- function gi({ cells: e, size: t }) {
2295
- return hi(e, t).map((e, n) => /* @__PURE__ */ Q(J, {
2718
+ function Ni({ cells: e, size: t }) {
2719
+ return Mi(e, t).map((e, n) => /* @__PURE__ */ Q(J, {
2296
2720
  value: null,
2297
2721
  onChange: (t) => e.find((e) => e.value === t)?.run(),
2298
2722
  options: e,
2299
2723
  size: t,
2300
2724
  ariaLabel: "Randomize scope",
2301
- className: di
2725
+ className: Oi
2302
2726
  }, n));
2303
2727
  }
2304
- var _i = [
2728
+ var Pi = [
2305
2729
  2,
2306
2730
  4,
2307
2731
  8,
@@ -2310,17 +2734,17 @@ var _i = [
2310
2734
  value: String(e),
2311
2735
  label: `${e}s`
2312
2736
  }));
2313
- function vi({ size: e }) {
2314
- let { loopSeconds: t, setLoopSeconds: n } = O();
2737
+ function Fi({ size: e }) {
2738
+ let { loopSeconds: t, setLoopSeconds: n } = S();
2315
2739
  return /* @__PURE__ */ Q(J, {
2316
2740
  value: String(t),
2317
2741
  onChange: (e) => n(Number(e)),
2318
- options: _i,
2742
+ options: Pi,
2319
2743
  size: e,
2320
2744
  ariaLabel: "Loop length"
2321
2745
  });
2322
2746
  }
2323
- var yi = [
2747
+ var Ii = [
2324
2748
  {
2325
2749
  value: "9:16",
2326
2750
  label: "9:16"
@@ -2337,7 +2761,7 @@ var yi = [
2337
2761
  value: "1:1",
2338
2762
  label: "1:1"
2339
2763
  }
2340
- ], bi = [
2764
+ ], Li = [
2341
2765
  {
2342
2766
  value: "5:4",
2343
2767
  label: "5:4"
@@ -2355,138 +2779,138 @@ var yi = [
2355
2779
  label: "Fill"
2356
2780
  }
2357
2781
  ];
2358
- function xi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectValue: o, onAspect: s, openEffects: c = !1, rail: l = !1, onRail: u, onSheet: d }) {
2359
- let p = qe(), { updateLayer: _, addFilter: v, removeFilter: b } = a(), { onExportPng: x } = ht(), [S, T] = Z(!1), [D, O] = Z(!0), [k, A] = Z(!1), [j, N] = Z(!1), [P, I] = Z("generate"), [L, R] = Z(!1), [z, ee] = Z(!1), { aspect: te } = a(), [ne, re] = Z(null), ie = m(e);
2782
+ function Ri({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectValue: a, onAspect: s, openEffects: c = !1, rail: l = !1, onRail: u, onSheet: f }) {
2783
+ let p = nt(), { updateLayer: g, addFilter: v, removeFilter: y } = i(), { onExportPng: b } = wt(), [S, w] = Z(!1), [T, D] = Z(!0), [ee, k] = Z(!1), [A, j] = Z(!1), [te, M] = Z("generate"), [ne, F] = Z(!1), [I, re] = Z(!1), { aspect: L } = i(), [R, ae] = Z(null), z = m(e);
2360
2784
  Y(() => {
2361
- c && (O(!0), N(!0));
2785
+ c && (D(!0), j(!0));
2362
2786
  }, [c]);
2363
- let V = l ? "sm" : "lg", oe = l && !!e && D && !S;
2787
+ let B = l ? "sm" : "lg", oe = l && !!e && T && !S;
2364
2788
  Y(() => (u?.(oe), () => u?.(!1)), [oe]);
2365
- let se = !l && e && D && !S ? ne ? `${ne}px` : L ? Rr.tall : Rr.half : null;
2366
- Y(() => (d?.(se), () => d?.(null)), [se]);
2367
- let U = () => {
2368
- let t = e?.type === "loop" && B(e.loopGroup).find((t) => t.id === e.presetId);
2369
- t && _(e.id, M(t, e.loopGroup));
2789
+ let se = !l && e && T && !S ? R ? `${R}px` : ne ? ti.tall : ti.half : null;
2790
+ Y(() => (f?.(se), () => f?.(null)), [se]);
2791
+ let ce = () => {
2792
+ let t = e?.type === "loop" && N(e.loopGroup).find((t) => t.id === e.presetId);
2793
+ t && g(e.id, H(t, e.loopGroup));
2370
2794
  };
2371
- if (gr(U, () => {
2372
- e?.type === "loop" && _(e.id, f(e, C(H(e.loopId)?.params ?? [], e), ie.take(), { withFilters: !0 }));
2795
+ if (jr(ce, () => {
2796
+ e?.type === "loop" && g(e.id, d(e, x(U(e.loopId)?.params ?? [], e), z.take(), { withFilters: !0 }));
2373
2797
  }), !e) return null;
2374
2798
  if (S) return /* @__PURE__ */ Q("button", {
2375
2799
  "aria-label": "Show controls",
2376
2800
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] z-20",
2377
- onClick: () => T(!1)
2801
+ onClick: () => w(!1)
2378
2802
  });
2379
- let W = e.type === "loop", ce = W ? `${F(e.loopGroup).label} · ${e.presetLabel}` : "Media", le = W ? H(e.loopId)?.params ?? [] : [], ue = W ? w(le, e) : [], de = () => _(e.id, f(e, C(le, e), ie.take(), { withFilters: !0 })), fe = (t) => _(e.id, f(e, t.params, ie.take(), { stripNoRandom: !!t.motion })), pe = () => {
2380
- let t = y(e, ie.take());
2381
- t && _(e.id, t);
2382
- }, me = g(e), { effectable: he } = ae(e), ge = () => {
2383
- let t = E(e, ie.take());
2384
- t && _(e.id, { filters: t });
2803
+ let V = e.type === "loop", le = V ? `${P(e.loopGroup).label} · ${e.presetLabel}` : "Media", ue = V ? U(e.loopId)?.params ?? [] : [], de = V ? C(ue, e) : [], W = () => g(e.id, d(e, x(ue, e), z.take(), { withFilters: !0 })), fe = (t) => g(e.id, d(e, t.params, z.take(), { stripNoRandom: !!t.motion })), me = () => {
2804
+ let t = _(e, z.take());
2805
+ t && g(e.id, t);
2806
+ }, he = h(e), { effectable: ge } = ie(e), _e = () => {
2807
+ let t = E(e, z.take());
2808
+ t && g(e.id, { filters: t });
2385
2809
  };
2386
- if (!D) return /* @__PURE__ */ $(Lr, {
2387
- label: W ? e.presetLabel : "Media",
2388
- onOpen: () => O(!0),
2389
- size: V,
2810
+ if (!T) return /* @__PURE__ */ $(ei, {
2811
+ label: V ? e.presetLabel : "Media",
2812
+ onOpen: () => D(!0),
2813
+ size: B,
2390
2814
  children: [
2391
- (W || me.length > 0) && /* @__PURE__ */ Q(Rn, {
2815
+ (V || he.length > 0) && /* @__PURE__ */ Q(In, {
2392
2816
  label: "Randomize all",
2393
2817
  children: /* @__PURE__ */ Q(K, {
2394
2818
  tone: "primary",
2395
- size: V,
2819
+ size: B,
2396
2820
  iconOnly: "bolt",
2397
2821
  "aria-label": "Randomize all",
2398
- onClick: de,
2822
+ onClick: W,
2399
2823
  className: "shrink-0"
2400
2824
  })
2401
2825
  }),
2402
- /* @__PURE__ */ Q(Rn, {
2826
+ /* @__PURE__ */ Q(In, {
2403
2827
  label: "Download",
2404
2828
  children: /* @__PURE__ */ Q(K, {
2405
2829
  tone: "primary",
2406
- size: V,
2830
+ size: B,
2407
2831
  iconOnly: "download",
2408
2832
  "aria-label": "Download",
2409
- onClick: () => x(2),
2833
+ onClick: () => b(2),
2410
2834
  className: "shrink-0"
2411
2835
  })
2412
2836
  }),
2413
- /* @__PURE__ */ Q(Rn, {
2837
+ /* @__PURE__ */ Q(In, {
2414
2838
  label: "Hide UI",
2415
2839
  children: /* @__PURE__ */ Q(K, {
2416
2840
  tone: "primary",
2417
- size: V,
2841
+ size: B,
2418
2842
  iconOnly: "eye-off",
2419
2843
  "aria-label": "Hide UI",
2420
- onClick: () => T(!0),
2844
+ onClick: () => w(!0),
2421
2845
  className: "shrink-0"
2422
2846
  })
2423
2847
  }),
2424
- /* @__PURE__ */ Q(Rn, {
2425
- label: o === "fill" ? "Back to the frame" : "Fill the screen",
2848
+ /* @__PURE__ */ Q(In, {
2849
+ label: a === "fill" ? "Back to the frame" : "Fill the screen",
2426
2850
  children: /* @__PURE__ */ Q(K, {
2427
2851
  tone: "primary",
2428
- size: V,
2852
+ size: B,
2429
2853
  iconOnly: "maximize",
2430
- "aria-label": o === "fill" ? "Back to the frame" : "Fill the screen",
2431
- "aria-pressed": o === "fill",
2432
- onClick: () => s(o === "fill" ? te : "fill"),
2854
+ "aria-label": a === "fill" ? "Back to the frame" : "Fill the screen",
2855
+ "aria-pressed": a === "fill",
2856
+ onClick: () => s(a === "fill" ? L : "fill"),
2433
2857
  className: "shrink-0"
2434
2858
  })
2435
2859
  })
2436
2860
  ]
2437
2861
  });
2438
- let _e = [...W ? li : ui, ...W && p.steps.length >= 2 ? [{
2862
+ let ve = [...V ? Ei : Di, ...V && p.steps.length >= 2 ? [{
2439
2863
  value: "morph",
2440
2864
  label: "Morph"
2441
- }] : []].filter((e) => (e.value !== "effects" || he) && (e.value !== "transport" || i("motion"))), ve = _e.some((e) => e.value === P) ? P : _e[0].value;
2442
- return /* @__PURE__ */ $(Wn, { children: [
2443
- /* @__PURE__ */ Q(Oe, {
2444
- open: z,
2445
- onClose: () => ee(!1),
2446
- schema: le,
2865
+ }] : []].filter((e) => (e.value !== "effects" || ge) && (e.value !== "transport" || o("motion"))), ye = ve.some((e) => e.value === te) ? te : ve[0].value;
2866
+ return /* @__PURE__ */ $(Hn, { children: [
2867
+ /* @__PURE__ */ Q(pe, {
2868
+ open: I,
2869
+ onClose: () => re(!1),
2870
+ schema: ue,
2447
2871
  layer: e,
2448
- size: V
2872
+ size: B
2449
2873
  }),
2450
- k && /* @__PURE__ */ Q(pn, {
2874
+ ee && /* @__PURE__ */ Q(Jr, {
2451
2875
  onPick: (e) => {
2452
- t(e), A(!1);
2876
+ t(e), k(!1);
2453
2877
  },
2454
2878
  onInsert: () => {
2455
- A(!1), n();
2879
+ k(!1), n();
2456
2880
  },
2457
2881
  onBack: () => {
2458
- A(!1), r();
2882
+ k(!1), r();
2459
2883
  },
2460
- onDismiss: () => A(!1)
2884
+ onDismiss: () => k(!1)
2461
2885
  }),
2462
- j && /* @__PURE__ */ Q(si, {
2886
+ A && /* @__PURE__ */ Q(wi, {
2463
2887
  layer: e,
2464
- chain: me,
2888
+ chain: he,
2465
2889
  onPick: (t) => {
2466
- v(e.id, t), N(!1);
2890
+ v(e.id, t), j(!1);
2467
2891
  },
2468
- onBack: () => N(!1)
2892
+ onBack: () => j(!1)
2469
2893
  }),
2470
2894
  /* @__PURE__ */ $("div", {
2471
2895
  className: l ? "fixed top-0 right-0 bottom-0 z-10 flex w-[var(--kol-sidenav-w,320px)] flex-col overflow-y-auto border-l border-oq-08" : "fixed right-0 left-[var(--fxr-rail,0px)] bottom-0 z-10 flex flex-col pb-[env(safe-area-inset-bottom)]",
2472
- style: l ? ci : {
2473
- ...ci,
2474
- top: `calc(100dvh - ${se ?? Rr.half})`
2896
+ style: l ? Ti : {
2897
+ ...Ti,
2898
+ top: `calc(100dvh - ${se ?? ti.half})`
2475
2899
  },
2476
2900
  children: [
2477
- !l && /* @__PURE__ */ Q(Br, {
2478
- tall: L,
2901
+ !l && /* @__PURE__ */ Q(ri, {
2902
+ tall: ne,
2479
2903
  onToggle: () => {
2480
- re(null), R((e) => !e);
2904
+ ae(null), F((e) => !e);
2481
2905
  },
2482
- onResize: (e) => re(Math.max(96, Math.min(window.innerHeight * .92, e))),
2906
+ onResize: (e) => ae(Math.max(96, Math.min(window.innerHeight * .92, e))),
2483
2907
  onResizeEnd: (e) => {
2484
- e < 96 && (re(null), O(!1));
2908
+ e < 96 && (ae(null), D(!1));
2485
2909
  }
2486
2910
  }),
2487
- /* @__PURE__ */ Q(Ir, {
2488
- title: ce,
2489
- onCollapse: () => O(!1),
2911
+ /* @__PURE__ */ Q($r, {
2912
+ title: le,
2913
+ onCollapse: () => D(!1),
2490
2914
  className: l ? "px-4 pt-2.5 pb-1.5" : "px-3",
2491
2915
  action: /* @__PURE__ */ Q(K, {
2492
2916
  tone: "ghost",
@@ -2500,31 +2924,31 @@ function xi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2500
2924
  className: l ? "px-4 pb-5" : "min-h-0 flex-1 overflow-y-auto px-3 pb-3",
2501
2925
  children: [
2502
2926
  /* @__PURE__ */ Q(J, {
2503
- value: ve,
2504
- onChange: I,
2505
- options: _e,
2506
- size: V,
2507
- className: l ? di : "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-2 [&_.kol-seg-cell]:overflow-hidden"
2927
+ value: ye,
2928
+ onChange: M,
2929
+ options: ve,
2930
+ size: B,
2931
+ className: l ? Oi : "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-2 [&_.kol-seg-cell]:overflow-hidden"
2508
2932
  }),
2509
- ve === "morph" && W && /* @__PURE__ */ Q(rr, {
2933
+ ye === "morph" && V && /* @__PURE__ */ Q(vr, {
2510
2934
  layer: e,
2511
2935
  readOnly: !0
2512
2936
  }),
2513
- ve === "generate" && W && /* @__PURE__ */ $("div", {
2937
+ ye === "generate" && V && /* @__PURE__ */ $("div", {
2514
2938
  className: "flex flex-col gap-2 pt-3",
2515
2939
  children: [
2516
2940
  /* @__PURE__ */ $("div", {
2517
2941
  className: "grid grid-cols-2 gap-2",
2518
2942
  children: [/* @__PURE__ */ Q(K, {
2519
2943
  tone: "primary",
2520
- size: V,
2944
+ size: B,
2521
2945
  iconRight: "refresh",
2522
- onClick: pe,
2946
+ onClick: me,
2523
2947
  children: "Preset"
2524
2948
  }), /* @__PURE__ */ Q(K, {
2525
2949
  tone: "primary",
2526
- size: V,
2527
- onClick: () => A(!0),
2950
+ size: B,
2951
+ onClick: () => k(!0),
2528
2952
  children: "Generator"
2529
2953
  })]
2530
2954
  }),
@@ -2533,77 +2957,77 @@ function xi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2533
2957
  children: [
2534
2958
  /* @__PURE__ */ Q(K, {
2535
2959
  tone: "primary",
2536
- size: V,
2960
+ size: B,
2537
2961
  className: "flex-1 min-w-0",
2538
- onClick: de,
2962
+ onClick: W,
2539
2963
  children: "Randomize all"
2540
2964
  }),
2541
- /* @__PURE__ */ Q(Rn, {
2965
+ /* @__PURE__ */ Q(In, {
2542
2966
  label: "What Randomize all rolls",
2543
2967
  children: /* @__PURE__ */ Q(K, {
2544
2968
  tone: "primary",
2545
- size: V,
2969
+ size: B,
2546
2970
  iconOnly: "nav-settings",
2547
2971
  "aria-label": "What Randomize all rolls",
2548
- onClick: () => ee(!0),
2972
+ onClick: () => re(!0),
2549
2973
  className: "shrink-0"
2550
2974
  })
2551
2975
  }),
2552
- /* @__PURE__ */ Q(Rn, {
2976
+ /* @__PURE__ */ Q(In, {
2553
2977
  label: "Reset to defaults",
2554
2978
  shortcut: "R",
2555
2979
  children: /* @__PURE__ */ Q(K, {
2556
2980
  tone: "primary",
2557
- size: V,
2981
+ size: B,
2558
2982
  iconOnly: "refresh",
2559
2983
  "aria-label": "Reset to defaults",
2560
- onClick: U,
2984
+ onClick: ce,
2561
2985
  className: "shrink-0"
2562
2986
  })
2563
2987
  })
2564
2988
  ]
2565
2989
  }),
2566
- ue.length > 0 && /* @__PURE__ */ Q(gi, {
2567
- size: V,
2568
- cells: [...ue.map((e) => ({
2990
+ de.length > 0 && /* @__PURE__ */ Q(Ni, {
2991
+ size: B,
2992
+ cells: [...de.map((e) => ({
2569
2993
  value: e.id,
2570
2994
  label: e.label,
2571
2995
  run: () => fe(e)
2572
2996
  })), {
2573
2997
  value: "__retrigger",
2574
2998
  label: "Re-trigger",
2575
- run: () => h.rewind()
2999
+ run: () => O.rewind()
2576
3000
  }]
2577
3001
  })
2578
3002
  ]
2579
3003
  }),
2580
- ve === "effects" && /* @__PURE__ */ $("div", {
3004
+ ye === "effects" && /* @__PURE__ */ $("div", {
2581
3005
  className: "flex flex-col gap-2 pt-3",
2582
3006
  children: [/* @__PURE__ */ $("div", {
2583
3007
  className: "grid grid-cols-2 gap-2",
2584
3008
  children: [
2585
3009
  /* @__PURE__ */ Q(K, {
2586
3010
  tone: "primary",
2587
- size: V,
2588
- onClick: () => N(!0),
3011
+ size: B,
3012
+ onClick: () => j(!0),
2589
3013
  children: "Add effect"
2590
3014
  }),
2591
- me.length > 0 && /* @__PURE__ */ Q(K, {
3015
+ he.length > 0 && /* @__PURE__ */ Q(K, {
2592
3016
  tone: "primary",
2593
- size: V,
2594
- onClick: ge,
3017
+ size: B,
3018
+ onClick: _e,
2595
3019
  children: "Randomize"
2596
3020
  }),
2597
3021
  " "
2598
3022
  ]
2599
- }), me.map((t, n) => {
3023
+ }), he.map((t, n) => {
2600
3024
  let r = {
2601
3025
  ...e,
2602
3026
  ...t.params,
2603
3027
  id: e.id
2604
- }, i = t.def ? w(t.def.params, r) : [], a = (t) => {
2605
- let i = f(r, t.params, ie.take(), { stripNoRandom: !!t.motion }), a = me.map(({ def: e, ...t }) => t);
2606
- _(e.id, { filters: a.map((e, t) => t === n ? {
3028
+ }, i = t.def ? C(t.def.params, r) : [], a = (t) => {
3029
+ let i = d(r, t.params, z.take(), { stripNoRandom: !!t.motion }), a = he.map(({ def: e, ...t }) => t);
3030
+ g(e.id, { filters: a.map((e, t) => t === n ? {
2607
3031
  ...e,
2608
3032
  params: {
2609
3033
  ...e.params,
@@ -2615,14 +3039,14 @@ function xi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2615
3039
  className: "flex flex-col gap-2",
2616
3040
  children: [/* @__PURE__ */ Q(K, {
2617
3041
  tone: "grey",
2618
- size: V,
3042
+ size: B,
2619
3043
  className: "w-full [&>span]:w-full [&>span]:justify-between",
2620
3044
  iconLeft: "trash",
2621
3045
  iconRight: "trash",
2622
- onClick: () => b(e.id, n),
3046
+ onClick: () => y(e.id, n),
2623
3047
  children: `${n + 1}. ${t.def?.label ?? t.id}`
2624
- }), i.length > 0 && /* @__PURE__ */ Q(gi, {
2625
- size: V,
3048
+ }), i.length > 0 && /* @__PURE__ */ Q(Ni, {
3049
+ size: B,
2626
3050
  cells: i.map((e) => ({
2627
3051
  value: e.id,
2628
3052
  label: e.label,
@@ -2632,28 +3056,28 @@ function xi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2632
3056
  }, t.key);
2633
3057
  })]
2634
3058
  }),
2635
- ve === "transport" && i("motion") && /* @__PURE__ */ $("div", {
3059
+ ye === "transport" && o("motion") && /* @__PURE__ */ $("div", {
2636
3060
  className: "flex flex-col gap-2 pt-3",
2637
3061
  children: [(() => {
2638
- let e = i("motion").TransportBar;
2639
- return /* @__PURE__ */ Q(e, { size: V });
2640
- })(), /* @__PURE__ */ Q(vi, { size: V })]
3062
+ let e = o("motion").TransportBar;
3063
+ return /* @__PURE__ */ Q(e, { size: B });
3064
+ })(), /* @__PURE__ */ Q(Fi, { size: B })]
2641
3065
  }),
2642
- ve === "output" && /* @__PURE__ */ $("div", {
3066
+ ye === "output" && /* @__PURE__ */ $("div", {
2643
3067
  className: "flex flex-col gap-2 pt-3",
2644
3068
  children: [
2645
3069
  /* @__PURE__ */ Q(J, {
2646
- value: o,
3070
+ value: a,
2647
3071
  onChange: s,
2648
- options: yi,
2649
- size: V,
3072
+ options: Ii,
3073
+ size: B,
2650
3074
  ariaLabel: "Aspect"
2651
3075
  }),
2652
3076
  /* @__PURE__ */ Q(J, {
2653
- value: o,
3077
+ value: a,
2654
3078
  onChange: s,
2655
- options: bi,
2656
- size: V,
3079
+ options: Li,
3080
+ size: B,
2657
3081
  ariaLabel: "Aspect (landscape) and fill"
2658
3082
  }),
2659
3083
  /* @__PURE__ */ $("div", {
@@ -2661,25 +3085,25 @@ function xi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2661
3085
  children: [
2662
3086
  /* @__PURE__ */ Q(K, {
2663
3087
  tone: "primary",
2664
- size: V,
2665
- onClick: () => en({ focusName: !0 }),
3088
+ size: B,
3089
+ onClick: () => an({ focusName: !0 }),
2666
3090
  children: "Save…"
2667
3091
  }),
2668
3092
  /* @__PURE__ */ Q(K, {
2669
3093
  tone: "primary",
2670
- size: V,
2671
- onClick: () => x(2),
3094
+ size: B,
3095
+ onClick: () => b(2),
2672
3096
  children: "Download"
2673
3097
  }),
2674
3098
  /* @__PURE__ */ Q(K, {
2675
3099
  tone: "primary",
2676
- size: V,
2677
- onClick: () => T(!0),
3100
+ size: B,
3101
+ onClick: () => w(!0),
2678
3102
  children: "Hide UI"
2679
3103
  }),
2680
3104
  /* @__PURE__ */ Q(K, {
2681
3105
  tone: "primary",
2682
- size: V,
3106
+ size: B,
2683
3107
  onClick: r,
2684
3108
  children: "Start over"
2685
3109
  })
@@ -2695,7 +3119,7 @@ function xi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2695
3119
  }
2696
3120
  //#endregion
2697
3121
  //#region src/editor/mobile/MobileView.jsx
2698
- function Si({ onGenerate: e, onEffects: t, chromes: n }) {
3122
+ function zi({ onGenerate: e, onEffects: t, chromes: n }) {
2699
3123
  return /* @__PURE__ */ Q("div", {
2700
3124
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center justify-center p-6",
2701
3125
  style: { zIndex: "var(--kol-z-modal)" },
@@ -2713,45 +3137,45 @@ function Si({ onGenerate: e, onEffects: t, chromes: n }) {
2713
3137
  })]
2714
3138
  }) : /* @__PURE__ */ Q("span", {
2715
3139
  className: "kol-eyebrow text-body",
2716
- children: kn("randomiser").label
3140
+ children: yn("randomiser").label
2717
3141
  }), /* @__PURE__ */ $("div", {
2718
3142
  className: "flex flex-col gap-2",
2719
3143
  children: [
2720
3144
  /* @__PURE__ */ Q(K, {
2721
3145
  tone: "primary",
2722
3146
  size: "lg",
2723
- className: _t,
2724
- iconLeft: Mt.randomiser,
2725
- iconRight: Mt.randomiser,
3147
+ className: Et,
3148
+ iconLeft: _n.randomiser,
3149
+ iconRight: _n.randomiser,
2726
3150
  onClick: e,
2727
3151
  children: "Generate"
2728
3152
  }),
2729
3153
  /* @__PURE__ */ Q(K, {
2730
3154
  tone: "primary",
2731
3155
  size: "lg",
2732
- className: _t,
3156
+ className: Et,
2733
3157
  iconLeft: "filter",
2734
3158
  iconRight: "filter",
2735
3159
  onClick: t,
2736
3160
  children: "Effects"
2737
3161
  }),
2738
- n && xn() && /* @__PURE__ */ Q(K, {
3162
+ n && Ht() && /* @__PURE__ */ Q(K, {
2739
3163
  tone: "primary",
2740
3164
  size: "lg",
2741
3165
  className: "w-full [&>span]:w-full [&>span]:justify-between",
2742
- iconLeft: Mt.editor,
2743
- iconRight: Mt.editor,
2744
- onClick: Ht,
2745
- children: kn("editor").label
3166
+ iconLeft: _n.editor,
3167
+ iconRight: _n.editor,
3168
+ onClick: Vt,
3169
+ children: yn("editor").label
2746
3170
  }),
2747
3171
  n && /* @__PURE__ */ Q(K, {
2748
3172
  tone: "primary",
2749
3173
  size: "lg",
2750
3174
  className: "w-full [&>span]:w-full [&>span]:justify-between",
2751
- iconLeft: Mt.labs,
2752
- iconRight: Mt.labs,
2753
- onClick: Cn,
2754
- children: kn("labs").label
3175
+ iconLeft: _n.labs,
3176
+ iconRight: _n.labs,
3177
+ onClick: pn,
3178
+ children: yn("labs").label
2755
3179
  }),
2756
3180
  n && /* @__PURE__ */ Q(K, {
2757
3181
  tone: "primary",
@@ -2759,7 +3183,7 @@ function Si({ onGenerate: e, onEffects: t, chromes: n }) {
2759
3183
  className: "w-full [&>span]:w-full [&>span]:justify-between",
2760
3184
  iconLeft: "swap",
2761
3185
  iconRight: "swap",
2762
- onClick: () => Bt("/morph"),
3186
+ onClick: () => Jt("/morph"),
2763
3187
  children: "Morph"
2764
3188
  })
2765
3189
  ]
@@ -2767,15 +3191,15 @@ function Si({ onGenerate: e, onEffects: t, chromes: n }) {
2767
3191
  })
2768
3192
  });
2769
3193
  }
2770
- function Ci() {
2771
- let { layers: t, addLayer: n, removeLayer: r, updateLayer: i, canvasW: o, canvasH: s, aspect: c, setAspect: l } = a(), { setTool: d } = vt(), f = rn() && !on(), p = fn(), m = () => {
3194
+ function Bi() {
3195
+ let { layers: t, addLayer: n, removeLayer: r, updateLayer: a, canvasW: o, canvasH: s, aspect: c, setAspect: u } = i(), { setTool: d } = Dt(), f = Bt() && !xn(), p = Zt(), m = () => {
2772
3196
  let e = new URLSearchParams(window.location.search);
2773
3197
  return e.get("open") ? "live" : e.get("start") === "category" ? "category" : "entry";
2774
- }, [g, _] = Z(m), [v, y] = Z(!1), [b, x] = Z(null), [S, C] = Z("contain"), [w, T] = Z(!1), [E, D] = Z(null), [O, k] = Z({
3198
+ }, [h, g] = Z(m), [_, v] = Z(!1), [y, b] = Z(null), [x, S] = Z("contain"), [C, w] = Z(!1), [T, E] = Z(null), [D, ee] = Z({
2775
3199
  s: 1,
2776
3200
  x: 0,
2777
3201
  y: 0
2778
- }), A = X(null), j = X({
3202
+ }), k = X(null), A = X({
2779
3203
  pts: /* @__PURE__ */ new Map(),
2780
3204
  start: null,
2781
3205
  live: {
@@ -2783,165 +3207,165 @@ function Ci() {
2783
3207
  x: 0,
2784
3208
  y: 0
2785
3209
  }
2786
- }), M = X(null), N = () => {
2787
- let [e, t] = [...j.current.pts.values()];
3210
+ }), j = X(null), te = () => {
3211
+ let [e, t] = [...A.current.pts.values()];
2788
3212
  return {
2789
3213
  d: Math.hypot(e.x - t.x, e.y - t.y),
2790
3214
  mx: (e.x + t.x) / 2,
2791
3215
  my: (e.y + t.y) / 2
2792
3216
  };
2793
- }, P = (e) => `translate(${e.x}px, ${e.y}px) scale(${e.s})`, F = (e) => {
2794
- if (j.current.pts.set(e.pointerId, {
3217
+ }, M = (e) => `translate(${e.x}px, ${e.y}px) scale(${e.s})`, ne = (e) => {
3218
+ if (A.current.pts.set(e.pointerId, {
2795
3219
  x: e.clientX,
2796
3220
  y: e.clientY
2797
- }), M.current = j.current.pts.size === 1 ? {
3221
+ }), j.current = A.current.pts.size === 1 ? {
2798
3222
  id: e.pointerId,
2799
3223
  x: e.clientX,
2800
3224
  y: e.clientY,
2801
3225
  t: performance.now()
2802
- } : null, j.current.pts.size === 2) {
2803
- let t = A.current?.getBoundingClientRect(), n = N(), r = (t?.left ?? 0) - O.x, i = (t?.top ?? 0) - O.y;
2804
- j.current.start = {
3226
+ } : null, A.current.pts.size === 2) {
3227
+ let t = k.current?.getBoundingClientRect(), n = te(), r = (t?.left ?? 0) - D.x, i = (t?.top ?? 0) - D.y;
3228
+ A.current.start = {
2805
3229
  ...n,
2806
3230
  ox: r,
2807
3231
  oy: i,
2808
- v: O,
2809
- px: (n.mx - r - O.x) / O.s,
2810
- py: (n.my - i - O.y) / O.s
2811
- }, j.current.live = O, h.setStagePointer(null), e.stopPropagation();
3232
+ v: D,
3233
+ px: (n.mx - r - D.x) / D.s,
3234
+ py: (n.my - i - D.y) / D.s
3235
+ }, A.current.live = D, O.setStagePointer(null), e.stopPropagation();
2812
3236
  }
2813
- }, I = (e) => {
2814
- let t = j.current;
3237
+ }, N = (e) => {
3238
+ let t = A.current;
2815
3239
  if (t.pts.has(e.pointerId) && (t.pts.set(e.pointerId, {
2816
3240
  x: e.clientX,
2817
3241
  y: e.clientY
2818
3242
  }), t.pts.size >= 2 && t.start)) {
2819
3243
  e.stopPropagation();
2820
- let n = N(), r = t.start, i = Math.min(4, Math.max(.5, r.v.s * (n.d / r.d)));
3244
+ let n = te(), r = t.start, i = Math.min(4, Math.max(.5, r.v.s * (n.d / r.d)));
2821
3245
  t.live = {
2822
3246
  s: i,
2823
3247
  x: n.mx - r.ox - i * r.px,
2824
3248
  y: n.my - r.oy - i * r.py
2825
- }, A.current && (A.current.style.transform = P(t.live));
3249
+ }, k.current && (k.current.style.transform = M(t.live));
2826
3250
  }
2827
- }, L = (e) => {
2828
- let t = M.current;
2829
- t && t.id === e.pointerId && e.type === "pointerup" && g === "live" && performance.now() - t.t < 350 && Math.hypot(e.clientX - t.x, e.clientY - t.y) < 12 && (R?.type === "loop" ? H(R.loopId) : null)?.group !== "penrose" && h.toggle(), t?.id === e.pointerId && (M.current = null), j.current.pts.delete(e.pointerId), j.current.pts.size < 2 && j.current.start && (j.current.start = null, k(j.current.live));
3251
+ }, P = (e) => {
3252
+ let t = j.current;
3253
+ t && t.id === e.pointerId && e.type === "pointerup" && h === "live" && performance.now() - t.t < 350 && Math.hypot(e.clientX - t.x, e.clientY - t.y) < 12 && (F?.type === "loop" ? U(F.loopId) : null)?.group !== "penrose" && O.toggle(), t?.id === e.pointerId && (j.current = null), A.current.pts.delete(e.pointerId), A.current.pts.size < 2 && A.current.start && (A.current.start = null, ee(A.current.live));
2830
3254
  };
2831
- qn(), Y(() => (Dt("randomiser"), () => Dt(null)), []), Y(() => {
2832
- l("4:5"), d("orbit");
3255
+ Gn(), Y(() => (Cn("randomiser"), () => Cn(null)), []), Y(() => {
3256
+ u("4:5"), d("orbit");
2833
3257
  }, []);
2834
- let R = t.find((e) => e.id === b) ?? (t.length === 1 ? t[0] : null), z = g === "live" && R?.type === "photo" && !R.src && R.srcType !== "webcam";
3258
+ let F = t.find((e) => e.id === y) ?? (t.length === 1 ? t[0] : null), I = h === "live" && F?.type === "photo" && !F.src && F.srcType !== "webcam";
2835
3259
  Y(() => {
2836
- if (!z) return;
3260
+ if (!I) return;
2837
3261
  let e = (e) => {
2838
- e.key === "Escape" && re();
3262
+ e.key === "Escape" && z();
2839
3263
  };
2840
3264
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2841
3265
  }), Y(() => {
2842
- if (!z) return;
2843
- let e = h.isPlaying();
2844
- return h.pause(), () => {
2845
- e && h.play();
3266
+ if (!I) return;
3267
+ let e = O.isPlaying();
3268
+ return O.pause(), () => {
3269
+ e && O.play();
2846
3270
  };
2847
- }, [z]);
2848
- let ee = (e) => {
2849
- let t = U(e);
2850
- t && (x(n("loop", t)), _("live"));
2851
- }, B = (e) => {
2852
- let t = U(e);
2853
- t && b && i(b, t);
2854
- }, te = () => {
2855
- x(n("photo", {
3271
+ }, [I]);
3272
+ let re = (e) => {
3273
+ let t = R(e);
3274
+ t && (b(n("loop", t)), g("live"));
3275
+ }, L = (e) => {
3276
+ let t = R(e);
3277
+ t && y && a(y, t);
3278
+ }, ie = () => {
3279
+ b(n("photo", {
2856
3280
  fit: "cover",
2857
3281
  x: 0,
2858
3282
  y: 0,
2859
3283
  w: e,
2860
3284
  h: Math.round(e * s / o)
2861
- })), _("live");
3285
+ })), g("live");
2862
3286
  };
2863
3287
  Y(() => {
2864
3288
  let e = new URL(window.location.href), t = e.searchParams.get("start");
2865
- t && (t === "effects" && (y(!0), te()), e.searchParams.delete("start"), window.history.replaceState(window.history.state, "", e));
3289
+ t && (t === "effects" && (v(!0), ie()), e.searchParams.delete("start"), window.history.replaceState(window.history.state, "", e));
2866
3290
  }, []);
2867
- let ne = (t) => {
3291
+ let ae = (t) => {
2868
3292
  if (t === "fill") {
2869
- C("cover");
3293
+ S("cover");
2870
3294
  return;
2871
3295
  }
2872
- C("contain"), l(t);
2873
- let n = u[t];
2874
- b && n && i(b, {
3296
+ S("contain"), u(t);
3297
+ let n = l[t];
3298
+ y && n && a(y, {
2875
3299
  x: 0,
2876
3300
  y: 0,
2877
3301
  w: e,
2878
3302
  h: Math.round(e * n.h / n.w)
2879
3303
  });
2880
- }, re = () => {
3304
+ }, z = () => {
2881
3305
  for (let e of [...t]) r(e.id);
2882
- x(null), k({
3306
+ b(null), ee({
2883
3307
  s: 1,
2884
3308
  x: 0,
2885
3309
  y: 0
2886
- }), y(!1), _(m());
3310
+ }), v(!1), g(m());
2887
3311
  };
2888
3312
  return /* @__PURE__ */ $("div", {
2889
3313
  className: "kol-editor-randomiser relative h-dvh bg-black",
2890
3314
  children: [
2891
3315
  /* @__PURE__ */ Q("div", {
2892
- ref: A,
3316
+ ref: k,
2893
3317
  className: "absolute inset-y-0 left-0 touch-none overflow-hidden",
2894
3318
  style: {
2895
- transform: P(O),
3319
+ transform: M(D),
2896
3320
  transformOrigin: "0 0",
2897
- right: w ? "var(--kol-sidenav-w, 320px)" : 0,
2898
- bottom: E ?? 0
3321
+ right: C ? "var(--kol-sidenav-w, 320px)" : 0,
3322
+ bottom: T ?? 0
2899
3323
  },
2900
- onPointerDownCapture: F,
2901
- onPointerMoveCapture: I,
2902
- onPointerUpCapture: L,
2903
- onPointerCancelCapture: L,
2904
- onPointerLeave: L,
2905
- children: /* @__PURE__ */ Q(Ut, { fit: S })
3324
+ onPointerDownCapture: ne,
3325
+ onPointerMoveCapture: N,
3326
+ onPointerUpCapture: P,
3327
+ onPointerCancelCapture: P,
3328
+ onPointerLeave: P,
3329
+ children: /* @__PURE__ */ Q(Yt, { fit: x })
2906
3330
  }),
2907
- g === "entry" && /* @__PURE__ */ Q(Si, {
3331
+ h === "entry" && /* @__PURE__ */ Q(zi, {
2908
3332
  chromes: f,
2909
- onGenerate: () => _("category"),
3333
+ onGenerate: () => g("category"),
2910
3334
  onEffects: () => {
2911
- y(!0), te();
3335
+ v(!0), ie();
2912
3336
  }
2913
3337
  }),
2914
- g === "category" && /* @__PURE__ */ Q(pn, {
2915
- onPick: ee,
2916
- onInsert: te,
2917
- onBack: () => _("entry")
3338
+ h === "category" && /* @__PURE__ */ Q(Jr, {
3339
+ onPick: re,
3340
+ onInsert: ie,
3341
+ onBack: () => g("entry")
2918
3342
  }),
2919
- g === "live" && !z && /* @__PURE__ */ Q(xi, {
2920
- layer: R,
2921
- onSwitchCategory: B,
3343
+ h === "live" && !I && /* @__PURE__ */ Q(Ri, {
3344
+ layer: F,
3345
+ onSwitchCategory: L,
2922
3346
  onInsert: () => {
2923
- re(), te();
3347
+ z(), ie();
2924
3348
  },
2925
- onRestart: re,
2926
- aspectValue: S === "cover" ? "fill" : c,
2927
- openEffects: v && !z,
2928
- onAspect: ne,
3349
+ onRestart: z,
3350
+ aspectValue: x === "cover" ? "fill" : c,
3351
+ openEffects: _ && !I,
3352
+ onAspect: ae,
2929
3353
  rail: !f && !p,
2930
- onRail: T,
2931
- onSheet: D
3354
+ onRail: w,
3355
+ onSheet: E
2932
3356
  }),
2933
- z && /* @__PURE__ */ $("div", {
3357
+ I && /* @__PURE__ */ $("div", {
2934
3358
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col",
2935
3359
  style: { zIndex: "var(--kol-z-modal)" },
2936
3360
  children: [/* @__PURE__ */ Q("div", {
2937
3361
  className: "flex-1 min-h-0",
2938
- children: /* @__PURE__ */ Q(Pr, { layer: R })
3362
+ children: /* @__PURE__ */ Q(Zr, { layer: F })
2939
3363
  }), /* @__PURE__ */ Q("div", {
2940
3364
  className: "flex justify-center pb-[max(0.75rem,env(safe-area-inset-bottom))]",
2941
3365
  children: /* @__PURE__ */ Q(K, {
2942
3366
  tone: "outline",
2943
3367
  size: "lg",
2944
- onClick: re,
3368
+ onClick: z,
2945
3369
  children: "Back"
2946
3370
  })
2947
3371
  })]
@@ -2949,11 +3373,11 @@ function Ci() {
2949
3373
  ]
2950
3374
  });
2951
3375
  }
2952
- function wi() {
2953
- return /* @__PURE__ */ $(dn, {
3376
+ function Vi() {
3377
+ return /* @__PURE__ */ $(mn, {
2954
3378
  persistDraft: !1,
2955
- children: [/* @__PURE__ */ Q(Ci, {}), /* @__PURE__ */ Q(tn, {})]
3379
+ children: [/* @__PURE__ */ Q(Bi, {}), /* @__PURE__ */ Q(on, {})]
2956
3380
  });
2957
3381
  }
2958
3382
  //#endregion
2959
- export { ft as AppSettingsSections, pt as BRAND, vn as DesignEditor, vn as default, dt as DisplaySettingsDrawer, dn as EditorProviders, xt as FilesDialog, Ce as GeneratorLibraryProvider, ai as LABS_DRAFT_KEY, ve as LIBRARY_SLOT_KEYS, oi as LabsView, Zt as MODES, wi as MobileView, bn as OutputCanvas, Ut as OutputStage, Kt as OutputView, gn as RAIL_EXTRA_PREFIX, Se as UnauthorizedError, Yt as VIEW_PATHS, st as closeFiles, yt as comboLabel, sn as copyStored, It as currentView, mn as duplicateStored, xe as getLibraryApi, _e as inviteFromRequest, rn as isMobileDevice, fe as listInviteRequests, me as loadLibrary, we as mintInvite, en as openFiles, be as readLibraryRaw, s as registerPack, Qt as removeStored, Lt as renameStored, De as requestInvite, pe as setLibraryApi, On as setMediaClient, zt as setMediaProxyBase, Dn as setMode, ut as setNavigator, Vt as setRailExtras, k as setSettingsStore, ln as setThumbStored, Wt as setWantsDesktop, An as shortcutsBySection, Ee as signInLibrary, ue as signOutLibrary, W as signUpLibrary, he as subscribeLibrary, Te as updateAccount, de as useAccount, bt as useFilesDialog, ge as useGeneratorLibrary, ce as useLibrarySession, nn as useRailExtras, St as useSettingsSections, on as wantsDesktop, Tn as withView };
3383
+ export { xt as AppSettingsSections, St as BRAND, bn as DesignEditor, bn as default, bt as DisplaySettingsDrawer, mn as EditorProviders, At as FilesDialog, Be as GeneratorLibraryProvider, Si as LABS_DRAFT_KEY, Fe as LIBRARY_SLOT_KEYS, Ci as LabsView, dn as MODES, Vi as MobileView, Sn as OutputCanvas, Yt as OutputStage, Qt as OutputView, vn as RAIL_EXTRA_PREFIX, pt as TimelineRail, ze as UnauthorizedError, rn as VIEW_PATHS, _t as closeFiles, Ot as comboLabel, un as copyStored, Gt as currentView, gn as duplicateStored, Le as getLibraryApi, Pe as inviteFromRequest, Bt as isMobileDevice, ke as listInviteRequests, je as loadLibrary, Ve as mintInvite, an as openFiles, Ie as readLibraryRaw, b as registerPack, nn as removeStored, Wt as renameStored, We as requestInvite, Ae as setLibraryApi, Dn as setMediaClient, Kt as setMediaProxyBase, cn as setMode, Xt as setNavigator, qt as setRailExtras, k as setSettingsStore, fn as setThumbStored, Nt as setWantsDesktop, On as shortcutsBySection, Ue as signInLibrary, De as signOutLibrary, Te as signUpLibrary, Me as subscribeLibrary, mt as timelineView, He as updateAccount, Oe as useAccount, kt as useFilesDialog, Ne as useGeneratorLibrary, Ee as useLibrarySession, sn as useRailExtras, jt as useSettingsSections, xn as wantsDesktop, $t as withView };