@kolkrabbi/design-editor 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,34 @@
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-CeoqVj9I.js";
11
- import { n as pt, r as mt, t as ht } from "./Timeline-BxVRu-R0.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, pt as hn, q as gn, r as _n, rt as vn, s as yn, st as bn, t as xn, tt as Sn, u as Cn, ut as wn, v as Tn, w as En, x as Dn, y as On, z as kn } from "./core-CLlanqLg.js";
13
- import { Button as K, Divider as An, Dropdown as jn, LabeledControlSection as q, MultiSelect as Mn, SegmentedToggle as J, SettingsRow as Nn, StepList as Pn, Tag as Fn, ToggleSwitch as In, Tooltip as Ln, useGrabEdge as Rn, useModal as zn } from "@kolkrabbi/kol-component";
14
- import { createContext as Bn, useContext as Vn, useEffect as Y, useRef as X, useState as Z, useSyncExternalStore as Hn } from "react";
15
- import { Fragment as Un, jsx as Q, jsxs as $ } from "react/jsx-runtime";
16
- import { Icon as Wn } from "@kolkrabbi/kol-icons";
17
- import { useDragResize as Gn, useTheme as Kn } from "@kolkrabbi/kol-framework";
18
- import { createPortal as qn } from "react-dom";
1
+ import { An as e, B as t, Bn as n, D as r, F as i, I as a, J as o, L as s, Lt as c, Mn as l, P as u, Vn as d, _n as f, a as p, d as m, f as h, ft as g, gt as _, ht as v, i as y, j as b, jn as x, kn as S, mn as C, n as w, nn as T, o as E, p as D, pn as O, r as ee, vn as k } from "./rolls-CEQmdcp3.js";
2
+ import { n as A, r as j, t as te } from "./useLayerEdit-BF9wI5pX.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-BGIW_dEc.js";
4
+ import { r as ue } from "./TreePicker-1_NZG8GB.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-BnuRmK-x.js";
6
+ import { A as Te, C as Ee, D as De, E as Oe, M as ke, O as Ae, S as je, T as Me, _ as Ne, b as Pe, c as Fe, h as Ie, j as Le, k as Re, l as ze, m as Be, u as Ve, v as He, w as Ue, y as We } from "./store-D6Si8cRD.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-B5081ohW.js";
8
+ import { n as rt, r as it, t as at } from "./BindDot-Don6fG00.js";
9
+ import { n as ot, r as st } from "./effects-RqPdJrRb.js";
10
+ import { a as ct, i as lt, n as ut, o as dt, r as ft } from "./motion-DKZGyk14.js";
11
+ import { n as pt, r as mt, t as ht } from "./Timeline-BKYyRqYg.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, _t as Wt, a as Gt, at as Kt, b as qt, c as Jt, ct as Yt, d as Xt, dt as Zt, et as Qt, f as $t, ft as en, g as tn, gt as nn, h as rn, ht as an, i as on, it as sn, j as cn, k as ln, l as un, lt as dn, m as fn, mt as pn, n as mn, nt as hn, o as gn, ot as _n, p as vn, pt as yn, q as bn, r as xn, rt as Sn, s as Cn, st as wn, t as Tn, tt as En, u as Dn, ut as On, v as kn, vt as An, w as jn, x as Mn, y as Nn, z as Pn } from "./core-DBXPNsjJ.js";
13
+ import { Button as K, Divider as Fn, Dropdown as In, LabeledControlSection as q, MultiSelect as Ln, NavRail as Rn, SegmentedToggle as J, SettingsRow as zn, StepList as Bn, Tag as Vn, ToggleSwitch as Hn, Tooltip as Un, useGrabEdge as Wn, useMediaQuery as Gn, useModal as Kn } from "@kolkrabbi/kol-component";
14
+ import { createContext as qn, useContext as Jn, useEffect as Y, useRef as X, useState as Z, useSyncExternalStore as Yn } from "react";
15
+ import { Fragment as Xn, jsx as Q, jsxs as $ } from "react/jsx-runtime";
16
+ import { Icon as Zn } from "@kolkrabbi/kol-icons";
17
+ import { AppFloatNav as Qn, Breadcrumb as $n, DocumentCapsule as er, GlobalActions as tr, MenuBar as nr, PropertyRail as rr, RailFlyout as ir } from "@kolkrabbi/kol-shell";
18
+ import { useDragResize as ar, useTheme as or } from "@kolkrabbi/kol-framework";
19
+ import { createPortal as sr } from "react-dom";
19
20
  //#region src/phoneFloats.js
20
- var Jn = (e) => {
21
+ var cr = (e) => {
21
22
  let t = e, n = /* @__PURE__ */ new Set(), r = (e) => (n.add(e), () => n.delete(e));
22
23
  return {
23
24
  set: (e) => {
24
25
  e !== t && (t = e, n.forEach((e) => e()));
25
26
  },
26
- use: () => Hn(r, () => t, () => t)
27
+ use: () => Yn(r, () => t, () => t)
27
28
  };
28
- }, Yn = Jn(null), Xn = Jn(null), Zn = Yn.set;
29
- Yn.use, Xn.set;
30
- var Qn = Xn.use, $n = [
29
+ }, lr = cr(null), ur = cr(null), dr = lr.set;
30
+ lr.use, ur.set;
31
+ var fr = ur.use, pr = [
31
32
  {
32
33
  id: "shape",
33
34
  label: "Shape",
@@ -43,7 +44,7 @@ var Qn = Xn.use, $n = [
43
44
  label: "Crossfade",
44
45
  icon: "dashed-circle"
45
46
  }
46
- ], er = {
47
+ ], mr = {
47
48
  shape: [
48
49
  ["Loops", ["morph-circle", "star-morph"]],
49
50
  ["Loops", [
@@ -117,21 +118,21 @@ var Qn = Xn.use, $n = [
117
118
  2
118
119
  ]
119
120
  ]
120
- }, tr = null;
121
- function nr(e) {
122
- if (!tr) {
123
- tr = /* @__PURE__ */ new Map();
121
+ }, hr = null;
122
+ function gr(e) {
123
+ if (!hr) {
124
+ hr = /* @__PURE__ */ new Map();
124
125
  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), tr.has(n.loop) || tr.set(n.loop, []), tr.get(n.loop).push(n));
126
+ for (let t of z) for (let n of N(t.id)) e.has(n.id) || le(n) || (e.add(n.id), hr.has(n.loop) || hr.set(n.loop, []), hr.get(n.loop).push(n));
126
127
  }
127
- return tr.get(e) ?? [];
128
+ return hr.get(e) ?? [];
128
129
  }
129
- var rr = (e, t) => e.length < t ? null : Array.from({ length: t }, (n, r) => e[Math.round(r * (e.length - 1) / (t - 1))]), ir = null;
130
- function ar() {
131
- if (ir) return ir;
130
+ var _r = (e, t) => e.length < t ? null : Array.from({ length: t }, (n, r) => e[Math.round(r * (e.length - 1) / (t - 1))]), vr = null;
131
+ function yr() {
132
+ if (vr) return vr;
132
133
  let e = [];
133
- for (let t of $n) for (let n of er[t.id]) {
134
- let [r] = n, i = t.id === "blend" ? rr(nr(n[1]), n[2]) : n[1].map((e) => nr(e)[0]);
134
+ for (let t of pr) for (let n of mr[t.id]) {
135
+ let [r] = n, i = t.id === "blend" ? _r(gr(n[1]), n[2]) : n[1].map((e) => gr(e)[0]);
135
136
  if (!i || i.some((e) => !e) || new Set(i.map((e) => e.id)).size < i.length) continue;
136
137
  let a = i.map((e) => e.label).join(" → "), o = `ship:morph:${t.id}:${i.map((e) => e.id).join("--")}`;
137
138
  e.push({
@@ -154,24 +155,24 @@ function ar() {
154
155
  }
155
156
  });
156
157
  }
157
- return ir = e;
158
+ return vr = e;
158
159
  }
159
- var or = () => $n.map((e) => ({
160
+ var br = () => pr.map((e) => ({
160
161
  label: e.label,
161
- subs: [...new Set(ar().filter((t) => t.type === e.id).map((e) => e.sub))]
162
- })), sr = (e, t) => ar().find((n) => n.type === e && (!t || n.category === t)), cr = (e) => ar().find((t) => t.id === e);
163
- function lr(e) {
162
+ subs: [...new Set(yr().filter((t) => t.type === e.id).map((e) => e.sub))]
163
+ })), xr = (e, t) => yr().find((n) => n.type === e && (!t || n.category === t)), Sr = (e) => yr().find((t) => t.id === e);
164
+ function Cr(e) {
164
165
  e && (Qe({
165
166
  active: !0,
166
167
  ...e.morph,
167
168
  fileId: null,
168
169
  fileName: e.label,
169
170
  presetId: e.id
170
- }), O.setLoopSeconds(e.morph.seconds), /\/morph\/?$/.test(window.location.pathname) || cn("/morph"));
171
+ }), O.setLoopSeconds(e.morph.seconds), /\/morph\/?$/.test(window.location.pathname) || pn("/morph"));
171
172
  }
172
173
  //#endregion
173
174
  //#region src/editor/labs/catalog.js
174
- var ur = {
175
+ var wr = {
175
176
  "fx:halftone": "ptrn-dot",
176
177
  "fx:scanline": "grid-horizontal",
177
178
  "fx:crt": "desktop",
@@ -195,19 +196,19 @@ var ur = {
195
196
  "misc:Para Type": "aa",
196
197
  "vec:Distressor": "scribble",
197
198
  "vec:Modulator": "dashed-circle"
198
- }, dr = {
199
+ }, Tr = {
199
200
  effects: "filter",
200
201
  generative: "layers",
201
202
  vector: "pen-nib",
202
203
  composition: "type",
203
204
  morph: "swap",
204
205
  mode: "mode-toggle-01"
205
- }, fr = [
206
+ }, Er = [
206
207
  "Moiré",
207
208
  "Mesh Gradient",
208
209
  "Reaction",
209
210
  "Halftone"
210
- ], pr = [
211
+ ], Dr = [
211
212
  {
212
213
  label: "Spaced",
213
214
  patch: {
@@ -239,11 +240,11 @@ var ur = {
239
240
  label: "Spiral",
240
241
  patch: { geometry: "spiral" }
241
242
  }
242
- ], mr = (e = {}) => {
243
+ ], Or = (e = {}) => {
243
244
  let t = e.geometry ?? "rows";
244
245
  return t === "radial" ? "Vortex" : t === "rings" ? "Rings" : t === "spiral" ? "Spiral" : e.mark === "glyph" ? "Glyph" : e.mark === "lattice" ? "Lattice" : "Spaced";
245
246
  };
246
- function hr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource: i }) {
247
+ function kr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource: i }) {
247
248
  let a = () => e?.type === "photo" ? (e.filters ?? []).filter((e) => e?.id === "fx-media") : [], o = (e, o) => {
248
249
  let s = a(), c = t("photo", {
249
250
  ...i(),
@@ -290,7 +291,7 @@ function hr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
290
291
  id: "color",
291
292
  label: "Color",
292
293
  icon: "clr-tri",
293
- onSelect: Re,
294
+ onSelect: Fe,
294
295
  pages: []
295
296
  },
296
297
  {
@@ -300,19 +301,19 @@ function hr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
300
301
  ...oe(L).map((t) => ({
301
302
  id: `fx:${t.id}`,
302
303
  label: t.label,
303
- icon: ur[`fx:${t.id}`] ?? "square",
304
+ icon: wr[`fx:${t.id}`] ?? "square",
304
305
  pages: t.rack ? se.map((t) => ({
305
306
  label: t.label,
306
307
  onSelect: () => s(t.id),
307
308
  active: e?.fxGroup === t.id
308
- })) : t.id === "pattern" ? fr.map((t) => ({
309
+ })) : t.id === "pattern" ? Er.map((t) => ({
309
310
  label: t,
310
311
  onSelect: () => c(ne("optic", t)[0], "optic"),
311
312
  active: e?.loopGroup === "optic" && f?.sub === t
312
- })) : t.id === "scanline" ? pr.map((t) => ({
313
+ })) : t.id === "scanline" ? Dr.map((t) => ({
313
314
  label: t.label,
314
315
  onSelect: () => o("scanline", t.patch),
315
- active: !e?.fxGroup && d === "scanline" && mr((e?.filters ?? []).find((e) => e?.id === "scanline")?.params) === t.label
316
+ active: !e?.fxGroup && d === "scanline" && Or((e?.filters ?? []).find((e) => e?.id === "scanline")?.params) === t.label
316
317
  })) : t.filters.map((t) => ({
317
318
  label: t.label ?? t.id,
318
319
  onSelect: () => o(t.id),
@@ -326,22 +327,22 @@ function hr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
326
327
  ...we.map((e) => ({
327
328
  id: `gen:${e.label}`,
328
329
  label: e.label,
329
- icon: ur[`gen:${e.label}`] ?? "square",
330
+ icon: wr[`gen:${e.label}`] ?? "square",
330
331
  pages: m(e)
331
332
  })),
332
333
  {
333
334
  id: "sec:morph",
334
335
  label: "Morph"
335
336
  },
336
- ...$n.map((e) => ({
337
+ ...pr.map((e) => ({
337
338
  id: `morph:${e.id}`,
338
339
  label: e.label,
339
340
  icon: e.icon,
340
- pages: [...new Set(ar().filter((t) => t.type === e.id).map((e) => e.category))].map((t) => ({
341
+ pages: [...new Set(yr().filter((t) => t.type === e.id).map((e) => e.category))].map((t) => ({
341
342
  label: t,
342
- onSelect: () => lr(sr(e.id, t)),
343
+ onSelect: () => Cr(xr(e.id, t)),
343
344
  active: (() => {
344
- let n = ar().find((e) => e.id === Ze().presetId);
345
+ let n = yr().find((e) => e.id === Ze().presetId);
345
346
  return n?.type === e.id && n.category === t;
346
347
  })()
347
348
  }))
@@ -353,13 +354,13 @@ function hr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
353
354
  {
354
355
  id: "vec:Distressor",
355
356
  label: "Distressor",
356
- icon: ur["vec:Distressor"] ?? "square",
357
+ icon: wr["vec:Distressor"] ?? "square",
357
358
  pages: p("distress")
358
359
  },
359
360
  {
360
361
  id: "vec:Modulator",
361
362
  label: "Modulator",
362
- icon: ur["vec:Modulator"] ?? "square",
363
+ icon: wr["vec:Modulator"] ?? "square",
363
364
  pages: p("modulator")
364
365
  },
365
366
  {
@@ -369,7 +370,7 @@ function hr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
369
370
  ...ct.map((t) => ({
370
371
  id: `kin:${t.label}`,
371
372
  label: t.label,
372
- icon: ur[`kin:${t.label}`] ?? "square",
373
+ icon: wr[`kin:${t.label}`] ?? "square",
373
374
  pages: t.subs.map((t) => ({
374
375
  label: t,
375
376
  onSelect: () => l(lt.find((e) => e.sub === t)),
@@ -379,17 +380,17 @@ function hr({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
379
380
  ...fe.map((e) => ({
380
381
  id: `misc:${e.label}`,
381
382
  label: e.label,
382
- icon: ur[`misc:${e.label}`] ?? "square",
383
+ icon: wr[`misc:${e.label}`] ?? "square",
383
384
  pages: e.groups.flatMap((e) => p(e, "misc"))
384
385
  }))
385
386
  ];
386
387
  }
387
388
  //#endregion
388
389
  //#region src/editor/labs/LabsNav.jsx
389
- function gr() {
390
- let { addFilter: e, patchFilter: t } = i(), { layer: n, setOnly: r } = W(), a = X(null);
390
+ function Ar() {
391
+ let { addFilter: e, patchFilter: t } = o(), { layer: n, setOnly: r } = W(), i = X(null);
391
392
  Y(() => {
392
- n?.type === "photo" && n.src && (a.current = {
393
+ n?.type === "photo" && n.src && (i.current = {
393
394
  src: n.src,
394
395
  srcType: n.srcType,
395
396
  fit: n.fit
@@ -400,7 +401,7 @@ function gr() {
400
401
  n?.srcType,
401
402
  n?.fit
402
403
  ]);
403
- let o = hr({
404
+ let a = kr({
404
405
  layer: n,
405
406
  setOnly: r,
406
407
  addFilter: e,
@@ -409,22 +410,22 @@ function gr() {
409
410
  src: n.src,
410
411
  srcType: n.srcType,
411
412
  fit: n.fit
412
- } : a.current ?? {}
413
+ } : i.current ?? {}
413
414
  });
414
415
  return Y(() => {
415
416
  let e = /* @__PURE__ */ new Map(), t = [];
416
- return o.forEach((n) => {
417
+ return a.forEach((n) => {
417
418
  if (n.id.startsWith("sec:")) {
418
419
  let e = n.id.slice(4);
419
420
  t.push({
420
- icon: dr[e] ?? "square",
421
- path: `${qt}${n.id}`,
421
+ icon: Tr[e] ?? "square",
422
+ path: `${Jt}${n.id}`,
422
423
  label: n.label,
423
424
  sub: []
424
425
  });
425
426
  return;
426
427
  }
427
- let r = `${qt}${n.id}`, i = n.pages ?? [], a = n.onSelect ?? i[0]?.onSelect ?? i[0]?.children?.[0]?.onSelect;
428
+ let r = `${Jt}${n.id}`, i = n.pages ?? [], a = n.onSelect ?? i[0]?.onSelect ?? i[0]?.children?.[0]?.onSelect;
428
429
  a && e.set(r, a);
429
430
  let o = t[t.length - 1], s = {
430
431
  icon: n.icon,
@@ -432,18 +433,18 @@ function gr() {
432
433
  label: n.label
433
434
  };
434
435
  o?.sub ? o.sub.push(s) : t.push(s);
435
- }), sn({
436
+ }), un({
436
437
  items: t,
437
438
  dispatch: (t) => {
438
439
  let n = e.get(t);
439
440
  return n ? (n(), !0) : !1;
440
441
  }
441
- }), () => sn(null);
442
+ }), () => un(null);
442
443
  }), null;
443
444
  }
444
445
  //#endregion
445
446
  //#region src/editor/morph/MorphTab.jsx
446
- var _r = (e, t) => JSON.stringify(e) === JSON.stringify(t), vr = [
447
+ var jr = (e, t) => JSON.stringify(e) === JSON.stringify(t), Mr = [
447
448
  {
448
449
  key: "curve",
449
450
  label: "Curve",
@@ -476,8 +477,8 @@ var _r = (e, t) => JSON.stringify(e) === JSON.stringify(t), vr = [
476
477
  when: (e) => e.mode === "shape"
477
478
  }
478
479
  ];
479
- function yr({ 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 } = Lt(), { addItem: w, updateItem: T } = Ne(), E = zn(), 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) => !Ct(U(e.loopId)) || !zt(U(e.loopId))), P = N.length === 0, F = {
480
+ function Nr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
481
+ let r = s(), i = nt(), { steps: c, curve: l, cycle: u, mode: d, resolution: p, editing: m, fileId: h, editRequest: g } = i, { updateLayer: _, removeLayer: v, setCurrentPresetId: y, setCurrentPresetName: b, palette: x } = o(), { setOnly: S } = W(), { buildSavedSpec: C } = Et(), { addItem: w, updateItem: T } = He(), E = Kn(), 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) => !Bt(U(e.loopId)) || !Vt(U(e.loopId))), P = N.length === 0, F = {
481
482
  blend: ne ? null : "Blend tweens one generator — these steps are different generators",
482
483
  shape: P ? null : `No outline to morph: ${N.map((e) => Ke(e, c.indexOf(e))).join(", ")} (GL)`,
483
484
  crossfade: P ? null : `Cannot fade: ${N.map((e) => Ke(e, c.indexOf(e))).join(", ")} (GL)`
@@ -556,9 +557,9 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
556
557
  cycle: u,
557
558
  curve: l,
558
559
  resolution: p,
559
- syncLoop: s.syncLoop,
560
- name: s.fileName
561
- }, i = d === "blend" ? {
560
+ syncLoop: i.syncLoop,
561
+ name: i.fileName
562
+ }, a = d === "blend" ? {
562
563
  ...n,
563
564
  ...$e({
564
565
  snapshots: c.map((e) => e.params),
@@ -574,10 +575,10 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
574
575
  morph: r,
575
576
  morphT: {
576
577
  bind: "track",
577
- keys: Dt(c.length, u, l)
578
+ keys: Ht(c.length, u, l)
578
579
  }
579
580
  };
580
- e ? _(e.id, i) : S("loop", i);
581
+ e ? _(e.id, a) : S("loop", a);
581
582
  }, R = X(L);
582
583
  R.current = L;
583
584
  let ie = JSON.stringify([
@@ -586,7 +587,7 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
586
587
  l,
587
588
  u,
588
589
  p,
589
- s.syncLoop
590
+ i.syncLoop
590
591
  ]), ae = X(null);
591
592
  Y(() => {
592
593
  t || m != null || ie === ae.current || c.length >= 2 && F[d] || (ae.current = ie, R.current());
@@ -598,7 +599,7 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
598
599
  ]), Y(() => {
599
600
  if (t || m == null || !e) return;
600
601
  let n = et(e, U(e.loopId)?.params ?? []);
601
- _r(n, c[m]?.params) || Xe(m, n);
602
+ jr(n, c[m]?.params) || Xe(m, n);
602
603
  }, [e]), Y(() => {
603
604
  t || !D || m == null || (G({ editing: null }), ae.current = null);
604
605
  }, [
@@ -606,7 +607,7 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
606
607
  m,
607
608
  t
608
609
  ]), Y(() => () => {
609
- !t && s.editing != null && (G({ editing: null }), R.current());
610
+ !t && i.editing != null && (G({ editing: null }), R.current());
610
611
  }, []);
611
612
  let z = (e) => {
612
613
  let t = c[e];
@@ -630,23 +631,23 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
630
631
  value: d,
631
632
  onChange: (e) => !t && G({ mode: e }),
632
633
  options: I,
633
- size: o,
634
- className: r(o)
634
+ size: r,
635
+ className: a(r)
635
636
  }),
636
637
  !t && /* @__PURE__ */ Q(q, {
637
638
  divided: !0,
638
639
  children: /* @__PURE__ */ Q(ue, {
639
- tree: or(),
640
- presets: ar(),
641
- current: cr(s.presetId) ?? { typeLabel: $n.find((e) => e.id === d)?.label },
640
+ tree: br(),
641
+ presets: yr(),
642
+ current: Sr(i.presetId) ?? { typeLabel: pr.find((e) => e.id === d)?.label },
642
643
  subLabel: (e) => e.split(" · ").pop(),
643
- onPick: lr
644
+ onPick: Cr
644
645
  })
645
646
  }),
646
647
  /* @__PURE__ */ $(q, {
647
648
  divided: !0,
648
649
  children: [
649
- /* @__PURE__ */ Q(Pn, {
650
+ /* @__PURE__ */ Q(Bn, {
650
651
  items: c.map((e, t) => ({
651
652
  id: t,
652
653
  label: Ke(e, t)
@@ -654,7 +655,7 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
654
655
  activeIndex: m,
655
656
  reorder: "grab",
656
657
  readOnly: t,
657
- size: o,
658
+ size: r,
658
659
  onSelect: z,
659
660
  onRemove: Ye,
660
661
  onMove: Ge,
@@ -683,8 +684,8 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
683
684
  value: k,
684
685
  onChange: j,
685
686
  options: n,
686
- size: o,
687
- className: r(o)
687
+ size: r,
688
+ className: a(r)
688
689
  }),
689
690
  /* @__PURE__ */ Q(ye, {
690
691
  layer: e,
@@ -708,8 +709,8 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
708
709
  ]
709
710
  }),
710
711
  /* @__PURE__ */ Q(A, {
711
- schema: vr,
712
- layer: s,
712
+ schema: Mr,
713
+ layer: i,
713
714
  setProp: (e, n) => {
714
715
  !t && (typeof n != "object" || !n) && G({ [e]: n });
715
716
  },
@@ -719,11 +720,11 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
719
720
  divided: !0,
720
721
  children: /* @__PURE__ */ Q(K, {
721
722
  tone: "primary",
722
- size: o,
723
+ size: r,
723
724
  className: "w-full",
724
725
  onClick: async () => {
725
726
  if (c.length < 2) return;
726
- let e = s.fileName;
727
+ let e = i.fileName;
727
728
  if (!h && (e = await E.prompt("Name this morph:", ""), e === null)) return;
728
729
  m != null && (G({ editing: null }), R.current());
729
730
  let t = {
@@ -731,12 +732,12 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
731
732
  mode: "morph",
732
733
  morph: {
733
734
  mode: d,
734
- loopId: s.loopId,
735
+ loopId: i.loopId,
735
736
  steps: c,
736
737
  curve: l,
737
738
  cycle: u,
738
739
  resolution: p,
739
- syncLoop: s.syncLoop,
740
+ syncLoop: i.syncLoop,
740
741
  seconds: O.getLoopSeconds()
741
742
  }
742
743
  };
@@ -758,7 +759,7 @@ function yr({ layer: e, readOnly: t = !1, editTabs: n = null }) {
758
759
  }
759
760
  //#endregion
760
761
  //#region src/editor/params/QuickMotion.jsx
761
- var br = [
762
+ var Pr = [
762
763
  {
763
764
  value: "breathe",
764
765
  label: "Breathe",
@@ -777,27 +778,27 @@ var br = [
777
778
  source: "lfo-square",
778
779
  rate: 8
779
780
  }
780
- ], xr = .2;
781
- function Sr(e) {
782
- if (!t(e)) return "off";
781
+ ], Fr = .2;
782
+ function Ir(e) {
783
+ if (!r(e)) return "off";
783
784
  if (e.bind !== "mod") return "custom";
784
- let n = br.find((t) => t.source === e.source && (e.transform?.rate ?? 1) === t.rate);
785
- return n ? n.value : "custom";
785
+ let t = Pr.find((t) => t.source === e.source && (e.transform?.rate ?? 1) === t.rate);
786
+ return t ? t.value : "custom";
786
787
  }
787
- function Cr({ 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));
789
- if (!s.length) return null;
790
- let c = (e, n) => {
788
+ function Lr({ schema: e, layer: t, setProp: n, label: r = "Modulate" }) {
789
+ let a = s(), o = _(e ?? [], t).filter((e) => e.type === "range" && e.animatable !== !1 && v(e) !== "anim" && e.min != null && e.max != null && !/seed/i.test(e.key));
790
+ if (!o.length) return null;
791
+ let c = (e, r) => {
791
792
  let i = t[e.key];
792
- if (n === "off") {
793
- let n = i?.transform?.range;
794
- r(e.key, Array.isArray(n) ? (n[0] + n[1]) / 2 : y(i, O.getCtx(), t) ?? e.default ?? e.min);
793
+ if (r === "off") {
794
+ let r = i?.transform?.range;
795
+ n(e.key, Array.isArray(r) ? (r[0] + r[1]) / 2 : b(i, O.getCtx(), t) ?? e.default ?? e.min);
795
796
  return;
796
797
  }
797
- let a = br.find((e) => e.value === n);
798
+ let a = Pr.find((e) => e.value === r);
798
799
  if (!a) return;
799
- let o = Number(y(i, O.getCtx(), t) ?? e.default ?? e.min), s = (e.max - e.min) * xr, c = Math.max(e.min, o - s), l = Math.min(e.max, o + s);
800
- r(e.key, {
800
+ let o = Number(b(i, O.getCtx(), t) ?? e.default ?? e.min), s = (e.max - e.min) * Fr, c = Math.max(e.min, o - s), l = Math.min(e.max, o + s);
801
+ n(e.key, {
801
802
  bind: "mod",
802
803
  source: a.source,
803
804
  transform: {
@@ -807,33 +808,33 @@ function Cr({ schema: e, layer: t, setProp: r, label: i = "Modulate" }) {
807
808
  });
808
809
  };
809
810
  return /* @__PURE__ */ Q(q, {
810
- label: i,
811
+ label: r,
811
812
  divided: !0,
812
- children: s.map((e) => {
813
- let r = Sr(t[e.key]), i = [
813
+ children: o.map((e) => {
814
+ let n = Ir(t[e.key]), r = [
814
815
  {
815
816
  value: "off",
816
817
  label: "Off"
817
818
  },
818
- ...br.map(({ value: e, label: t }) => ({
819
+ ...Pr.map(({ value: e, label: t }) => ({
819
820
  value: e,
820
821
  label: t
821
822
  })),
822
- ...r === "custom" ? [{
823
+ ...n === "custom" ? [{
823
824
  value: "custom",
824
825
  label: "Custom"
825
826
  }] : []
826
827
  ];
827
- return /* @__PURE__ */ Q(Nn, {
828
+ return /* @__PURE__ */ Q(zn, {
828
829
  label: e.label,
829
830
  align: "fill",
830
- labelWidth: n,
831
- children: /* @__PURE__ */ Q(jn, {
832
- size: o,
831
+ labelWidth: i,
832
+ children: /* @__PURE__ */ Q(In, {
833
+ size: a,
833
834
  variant: "subtle",
834
835
  className: "w-full",
835
- options: i,
836
- value: r,
836
+ options: r,
837
+ value: n,
837
838
  onChange: (t) => t !== "custom" && c(e, t)
838
839
  })
839
840
  }, e.key);
@@ -842,7 +843,7 @@ function Cr({ schema: e, layer: t, setProp: r, label: i = "Modulate" }) {
842
843
  }
843
844
  //#endregion
844
845
  //#region src/editor/params/InputRows.jsx
845
- var wr = [
846
+ var Rr = [
846
847
  {
847
848
  value: "off",
848
849
  label: "Off"
@@ -867,19 +868,19 @@ var wr = [
867
868
  value: "lfo-sine",
868
869
  label: "LFO"
869
870
  }
870
- ], Tr = new Set(wr.map((e) => e.value));
871
- function Er({ 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));
873
- if (!s.length) return null;
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) => {
875
- let r = n[e];
876
- return t(r) && r.bind === "mod" && Tr.has(r.source);
871
+ ], zr = new Set(Rr.map((e) => e.value));
872
+ function Br({ schema: e, layer: t, setProp: n, inputs: i = null }) {
873
+ let a = s(), o = _(e ?? [], t).filter((e) => e.type === "range" && e.animatable !== !1 && e.min != null && e.max != null && !/seed/i.test(e.key));
874
+ if (!o.length) return null;
875
+ let c = new Map(o.map((e) => [e.key, e])), l = (i ?? []).filter((e) => c.has(e)), u = [...l, ...o.map((e) => e.key).filter((e) => !l.includes(e))], d = l.length ? l : u.slice(0, 3), f = (e) => {
876
+ let n = t[e];
877
+ return r(n) && n.bind === "mod" && zr.has(n.source);
877
878
  }, p = u.filter(f), m = (e) => {
878
- let t = c.get(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)) => {
879
+ let n = c.get(e);
880
+ return Number(b(t[e], O.getCtx(), t) ?? n.default ?? n.min);
881
+ }, h = (e, i, a = r(t[e]) ? t[e].transform?.base ?? m(e) : m(e)) => {
881
882
  let o = c.get(e);
882
- w(i)?.ensure?.().catch(() => {}), r(e, {
883
+ k(i)?.ensure?.().catch(() => {}), n(e, {
883
884
  bind: "mod",
884
885
  source: i,
885
886
  transform: {
@@ -888,17 +889,17 @@ function Er({ schema: e, layer: n, setProp: r, inputs: i = null }) {
888
889
  ...i.startsWith("lfo") ? { rate: 1 } : {}
889
890
  }
890
891
  });
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));
892
+ }, g = (e) => n(e, r(t[e]) ? t[e].transform?.base ?? m(e) : m(e)), v = d.find((e) => !f(e)) ?? u.find((e) => !f(e));
892
893
  return /* @__PURE__ */ $(q, {
893
894
  label: "Inputs",
894
895
  divided: !0,
895
- children: [p.map((e) => /* @__PURE__ */ Q(Mn, {
896
- size: o,
896
+ children: [p.map((e) => /* @__PURE__ */ Q(Ln, {
897
+ size: a,
897
898
  className: "w-full [&>button]:w-full",
898
899
  groups: [{
899
900
  id: "source",
900
901
  label: "Source",
901
- options: wr
902
+ options: Rr
902
903
  }, {
903
904
  id: "drives",
904
905
  label: "Drives",
@@ -908,33 +909,33 @@ function Er({ schema: e, layer: n, setProp: r, inputs: i = null }) {
908
909
  }))
909
910
  }],
910
911
  value: {
911
- source: n[e].source,
912
+ source: t[e].source,
912
913
  drives: e
913
914
  },
914
- label: `${wr.find((t) => t.value === n[e].source)?.label} → ${c.get(e).label}`,
915
- onChange: (t, r) => {
916
- if (t === "source") {
915
+ label: `${Rr.find((n) => n.value === t[e].source)?.label} → ${c.get(e).label}`,
916
+ onChange: (n, r) => {
917
+ if (n === "source") {
917
918
  r === "off" ? g(e) : h(e, r);
918
919
  return;
919
920
  }
920
921
  if (r === e || f(r)) return;
921
- let i = n[e].source;
922
+ let i = t[e].source;
922
923
  g(e), h(r, i);
923
924
  }
924
- }, e)), _ && /* @__PURE__ */ Q(K, {
925
- size: o,
925
+ }, e)), v && /* @__PURE__ */ Q(K, {
926
+ size: a,
926
927
  iconLeft: "plus",
927
928
  className: "w-full",
928
- onClick: () => h(_, "mouseX"),
929
+ onClick: () => h(v, "mouseX"),
929
930
  children: "Add input"
930
931
  })]
931
932
  });
932
933
  }
933
934
  //#endregion
934
935
  //#region src/editor/labs/ModelSource.jsx
935
- var Dr = /\.(obj|glb|gltf|stl)$/i, Or = (e) => Dr.test(e.key ?? e.name ?? ""), kr = (e) => (e.match(Dr)?.[1] ?? "obj").toLowerCase(), Ar = (e) => e?.startsWith("data:") ? "Local file" : decodeURIComponent(String(e ?? "").split("/").pop() || "—");
936
- function jr({ layer: e, setProp: t }) {
937
- let n = a(), [r, i] = Z(!1), o = X(null), s = (e, n) => {
936
+ var Vr = /\.(obj|glb|gltf|stl)$/i, Hr = (e) => Vr.test(e.key ?? e.name ?? ""), Ur = (e) => (e.match(Vr)?.[1] ?? "obj").toLowerCase(), Wr = (e) => e?.startsWith("data:") ? "Local file" : decodeURIComponent(String(e ?? "").split("/").pop() || "—");
937
+ function Gr({ layer: e, setProp: t }) {
938
+ let n = s(), [r, i] = Z(!1), a = X(null), o = (e, n) => {
938
939
  t("meshSrc", e), t("meshType", n);
939
940
  };
940
941
  return /* @__PURE__ */ $(q, {
@@ -943,7 +944,7 @@ function jr({ layer: e, setProp: t }) {
943
944
  children: [
944
945
  /* @__PURE__ */ Q("span", {
945
946
  className: "kol-mono-12 text-meta truncate",
946
- children: Ar(e.meshSrc)
947
+ children: Wr(e.meshSrc)
947
948
  }),
948
949
  /* @__PURE__ */ $("div", {
949
950
  className: "grid grid-cols-2 gap-2",
@@ -955,12 +956,12 @@ function jr({ layer: e, setProp: t }) {
955
956
  }), /* @__PURE__ */ Q(K, {
956
957
  tone: "primary",
957
958
  size: n,
958
- onClick: () => o.current?.click(),
959
+ onClick: () => a.current?.click(),
959
960
  children: "Upload"
960
961
  })]
961
962
  }),
962
963
  /* @__PURE__ */ Q("input", {
963
- ref: o,
964
+ ref: a,
964
965
  type: "file",
965
966
  accept: ".obj,.glb,.gltf,.stl",
966
967
  className: "hidden",
@@ -968,15 +969,15 @@ function jr({ layer: e, setProp: t }) {
968
969
  let t = e.target.files?.[0];
969
970
  if (e.target.value = "", !t) return;
970
971
  let n = new FileReader();
971
- n.onload = () => s(n.result, kr(t.name)), n.readAsDataURL(t);
972
+ n.onload = () => o(n.result, Ur(t.name)), n.readAsDataURL(t);
972
973
  }
973
974
  }),
974
- /* @__PURE__ */ Q(Ut, {
975
+ /* @__PURE__ */ Q(Ft, {
975
976
  open: r,
976
- accept: Or,
977
+ accept: Hr,
977
978
  onClose: () => i(!1),
978
979
  onSelect: (e) => {
979
- i(!1), s(On(e), kr(e));
980
+ i(!1), o(jn(e), Ur(e));
980
981
  }
981
982
  })
982
983
  ]
@@ -984,23 +985,23 @@ function jr({ layer: e, setProp: t }) {
984
985
  }
985
986
  //#endregion
986
987
  //#region src/editor/labs/useLabsKeys.js
987
- function Mr(e, t) {
988
+ function Kr(e, t) {
988
989
  Y(() => {
989
990
  let n = (n) => {
990
- n.key !== "r" && n.key !== "R" || n.metaKey || n.ctrlKey || n.altKey || kn(n) || (n.preventDefault(), n.shiftKey ? t?.() : e?.());
991
+ n.key !== "r" && n.key !== "R" || n.metaKey || n.ctrlKey || n.altKey || zt(n) || (n.preventDefault(), n.shiftKey ? t?.() : e?.());
991
992
  };
992
993
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
993
994
  });
994
995
  }
995
996
  //#endregion
996
997
  //#region src/editor/labs/LabsParams.jsx
997
- var Nr = [{
998
+ var qr = [{
998
999
  value: "effect",
999
1000
  label: "Effect"
1000
1001
  }, {
1001
1002
  value: "anim",
1002
1003
  label: "Motion"
1003
- }], Pr = [
1004
+ }], Jr = [
1004
1005
  {
1005
1006
  value: "generate",
1006
1007
  label: "Generate"
@@ -1013,7 +1014,7 @@ var Nr = [{
1013
1014
  value: "anim",
1014
1015
  label: "Animation"
1015
1016
  }
1016
- ], Fr = [
1017
+ ], Yr = [
1017
1018
  {
1018
1019
  value: "generate",
1019
1020
  label: "Gen"
@@ -1027,11 +1028,11 @@ var Nr = [{
1027
1028
  label: "Anim"
1028
1029
  }
1029
1030
  ];
1030
- function Ir({ options: e, active: t, onPick: n, spread: i = !1, pills: o = !1 }) {
1031
- let s = a();
1032
- return e?.length ? o ? /* @__PURE__ */ Q("div", {
1031
+ function Xr({ options: e, active: t, onPick: n, spread: r = !1, pills: i = !1 }) {
1032
+ let o = s();
1033
+ return e?.length ? i ? /* @__PURE__ */ Q("div", {
1033
1034
  className: "flex items-center gap-1 flex-wrap",
1034
- children: e.map((e) => /* @__PURE__ */ Q(Fn, {
1035
+ children: e.map((e) => /* @__PURE__ */ Q(Vn, {
1035
1036
  size: "xs",
1036
1037
  hash: !1,
1037
1038
  active: e.value === t,
@@ -1043,32 +1044,32 @@ function Ir({ options: e, active: t, onPick: n, spread: i = !1, pills: o = !1 })
1043
1044
  value: t ?? null,
1044
1045
  onChange: n,
1045
1046
  options: e,
1046
- size: s,
1047
+ size: o,
1047
1048
  ariaLabel: "Siblings",
1048
- className: r(s)
1049
+ className: a(o)
1049
1050
  }) : null;
1050
1051
  }
1051
- function Lr() {
1052
- let { undo: e, redo: t, canUndo: n, canRedo: r } = i(), o = a(), s = (e, t) => e ? t : /* @__PURE__ */ Q("span", {
1052
+ function Zr() {
1053
+ let { undo: e, redo: t, canUndo: n, canRedo: r } = o(), i = s(), a = (e, t) => e ? t : /* @__PURE__ */ Q("span", {
1053
1054
  "aria-hidden": "true",
1054
1055
  className: "invisible pointer-events-none",
1055
1056
  children: t
1056
1057
  });
1057
- return /* @__PURE__ */ $(Un, { children: [s(n, /* @__PURE__ */ Q(Ln, {
1058
+ return /* @__PURE__ */ $(Xn, { children: [a(n, /* @__PURE__ */ Q(Un, {
1058
1059
  label: "Undo",
1059
1060
  shortcut: "⌘Z",
1060
1061
  children: /* @__PURE__ */ Q(K, {
1061
- size: o,
1062
+ size: i,
1062
1063
  iconOnly: "arrow-left",
1063
1064
  "aria-label": "Undo",
1064
1065
  tabIndex: n ? void 0 : -1,
1065
1066
  onClick: e
1066
1067
  })
1067
- })), s(r, /* @__PURE__ */ Q(Ln, {
1068
+ })), a(r, /* @__PURE__ */ Q(Un, {
1068
1069
  label: "Redo",
1069
1070
  shortcut: "⇧⌘Z",
1070
1071
  children: /* @__PURE__ */ Q(K, {
1071
- size: o,
1072
+ size: i,
1072
1073
  iconOnly: "arrow-right",
1073
1074
  "aria-label": "Redo",
1074
1075
  tabIndex: r ? void 0 : -1,
@@ -1076,25 +1077,25 @@ function Lr() {
1076
1077
  })
1077
1078
  }))] });
1078
1079
  }
1079
- function Rr({ 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";
1080
+ function Qr({ chips: e, active: t, onPick: n, spread: r, pills: a, title: o, tabStrip: c, preStrip: l, fx: u = !1, scope: d, ghostLabels: f, children: p }) {
1081
+ let m = s() === "sm";
1081
1082
  return /* @__PURE__ */ $("div", {
1082
1083
  className: `flex flex-col gap-5${u ? " kol-labs-fx" : ""}`,
1083
1084
  "data-label-scope": d,
1084
1085
  children: [
1085
- s && m && /* @__PURE__ */ $("div", {
1086
+ o && m && /* @__PURE__ */ $("div", {
1086
1087
  className: "flex items-center gap-1",
1087
1088
  children: [/* @__PURE__ */ Q("p", {
1088
1089
  className: "kol-eyebrow text-fg-96 flex-1 min-w-0",
1089
- children: s
1090
- }), /* @__PURE__ */ Q(Lr, {})]
1090
+ children: o
1091
+ }), /* @__PURE__ */ Q(Zr, {})]
1091
1092
  }),
1092
- e && /* @__PURE__ */ Q(Ir, {
1093
+ e && /* @__PURE__ */ Q(Xr, {
1093
1094
  options: e,
1094
1095
  active: t,
1095
- onPick: r,
1096
- spread: i,
1097
- pills: o
1096
+ onPick: n,
1097
+ spread: r,
1098
+ pills: a
1098
1099
  }),
1099
1100
  l,
1100
1101
  c,
@@ -1104,33 +1105,33 @@ function Rr({ chips: e, active: t, onPick: r, spread: i, pills: o, title: s, tab
1104
1105
  className: "invisible h-0 overflow-hidden flex flex-col",
1105
1106
  children: f.map((e, t) => /* @__PURE__ */ Q("span", {
1106
1107
  className: "kol-helper-10 tracking-widest whitespace-nowrap",
1107
- style: { width: n },
1108
+ style: { width: i },
1108
1109
  children: String(e).toUpperCase()
1109
1110
  }, t))
1110
1111
  })
1111
1112
  ]
1112
1113
  });
1113
1114
  }
1114
- function zr({ layer: e, showMod: t }) {
1115
- let o = p(), s = a(), [c, l] = Z("effect");
1115
+ function $r({ layer: t, showMod: n }) {
1116
+ let r = l(), c = s(), [u, d] = Z("effect");
1116
1117
  Y(() => {
1117
- let e = () => l("effect");
1118
+ let e = () => d("effect");
1118
1119
  return window.addEventListener("kol:open-effects", e), () => window.removeEventListener("kol:open-effects", e);
1119
1120
  }, []);
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) => ({
1121
+ let { addFilter: f, replaceFilter: m, removeFilter: _, toggleFilter: y, updateLayer: b, palette: x } = o(), S = te(t.id, { history: "coalesce" }), C = g(t), T = C.findIndex((e) => !e.def?.first), E = T < 0 ? C.length : T, O = T < 0 ? null : C[T], ee = oe(L).find((e) => e.id === B(O?.id)), k = ee?.id === "halftone", M = k ? (ee?.filters ?? []).map((e) => ({
1121
1122
  value: e.id,
1122
1123
  label: e.label
1123
- })) : null, ne = !k && E ? E.def.label : null, N = (t) => {
1124
- if (!E) {
1125
- u(e.id, t);
1124
+ })) : null, ne = !k && O ? O.def.label : null, N = (e) => {
1125
+ if (!O) {
1126
+ f(t.id, e);
1126
1127
  return;
1127
1128
  }
1128
- t !== E.id && f(e.id, w, t);
1129
- }, P = S.map(({ def: e, ...t }) => t), F = E ? {
1130
- ...e,
1131
- ...E.params,
1132
- id: e.id
1133
- } : e, I = (e) => (t, n) => {
1129
+ e !== O.id && m(t.id, E, e);
1130
+ }, P = C.map(({ def: e, ...t }) => t), F = O ? {
1131
+ ...t,
1132
+ ...O.params,
1133
+ id: t.id
1134
+ } : t, I = (e) => (t, n) => {
1134
1135
  let r = P.map((r, i) => i === e ? {
1135
1136
  ...r,
1136
1137
  params: {
@@ -1138,93 +1139,93 @@ function zr({ layer: e, showMod: t }) {
1138
1139
  [t]: n
1139
1140
  }
1140
1141
  } : r);
1141
- b.patch({ filters: r });
1142
- }, R = I(w), ie = t ? (e) => /* @__PURE__ */ Q(at, {
1142
+ S.patch({ filters: r });
1143
+ }, R = I(E), ie = n ? (e) => /* @__PURE__ */ Q(at, {
1143
1144
  layer: F,
1144
1145
  param: e,
1145
1146
  setProp: R
1146
- }) : void 0, z = (t) => {
1147
- let n = P.map((e, n) => n === w ? {
1148
- ...e,
1147
+ }) : void 0, z = (e) => {
1148
+ let n = P.map((t, n) => n === E ? {
1149
+ ...t,
1149
1150
  params: {
1150
- ...e.params,
1151
- ...t
1151
+ ...t.params,
1152
+ ...e
1152
1153
  }
1153
- } : e);
1154
- v(e.id, { filters: n });
1154
+ } : t);
1155
+ b(t.id, { filters: n });
1155
1156
  };
1156
- Mr(() => {
1157
- E && v(e.id, { filters: P.map((e, t) => t === 0 ? {
1157
+ Kr(() => {
1158
+ O && b(t.id, { filters: P.map((e, t) => t === 0 ? {
1158
1159
  ...e,
1159
1160
  params: {}
1160
1161
  } : e) });
1161
1162
  }, () => {
1162
- E && z(d(F, x(E.def.params, F), T()));
1163
+ O && z(p(F, w(O.def.params, F), D()));
1163
1164
  });
1164
- let V = e.fxGroup ? se.find((t) => t.id === e.fxGroup) : null;
1165
+ let V = t.fxGroup ? se.find((e) => e.id === t.fxGroup) : null;
1165
1166
  if (V) {
1166
- let n = {
1167
- chain: S,
1168
- layer: e,
1167
+ let e = {
1168
+ chain: C,
1169
+ layer: t,
1169
1170
  hostView: F,
1170
- toggleFilter: _,
1171
- removeFilter: m,
1171
+ toggleFilter: y,
1172
+ removeFilter: _,
1172
1173
  setStagePropAt: I,
1173
- palette: y,
1174
- showMod: t
1175
- }, i = [{
1174
+ palette: x,
1175
+ showMod: n
1176
+ }, r = [{
1176
1177
  value: "",
1177
1178
  label: "Add effect…"
1178
1179
  }, ...re(V, L).map((e) => ({
1179
1180
  value: e.id,
1180
1181
  label: `${e.label ?? e.id}${e.kind === "pixi" ? " · GPU" : ""}`
1181
1182
  }))];
1182
- return /* @__PURE__ */ $(Rr, {
1183
+ return /* @__PURE__ */ $(Qr, {
1183
1184
  title: "Effects",
1184
1185
  fx: !0,
1185
1186
  tabStrip: /* @__PURE__ */ Q(J, {
1186
1187
  tone: "sunken",
1187
- value: c,
1188
- onChange: l,
1189
- options: Nr,
1190
- size: s,
1191
- className: r(s)
1188
+ value: u,
1189
+ onChange: d,
1190
+ options: qr,
1191
+ size: c,
1192
+ className: a(c)
1192
1193
  }),
1193
- children: [c === "effect" && /* @__PURE__ */ $(Un, { children: [
1194
+ children: [u === "effect" && /* @__PURE__ */ $(Xn, { children: [
1194
1195
  /* @__PURE__ */ $(q, {
1195
1196
  label: "Effect stack",
1196
1197
  divided: !0,
1197
- children: [S.length === 0 && /* @__PURE__ */ Q(j, {
1198
+ children: [C.length === 0 && /* @__PURE__ */ Q(j, {
1198
1199
  className: "kol-mono-10 text-meta",
1199
1200
  children: "No effects yet — add one below."
1200
- }), /* @__PURE__ */ Q(Ur, {
1201
- ...n,
1201
+ }), /* @__PURE__ */ Q(ri, {
1202
+ ...e,
1202
1203
  from: 0
1203
1204
  })]
1204
1205
  }),
1205
- /* @__PURE__ */ Q(An, {}),
1206
- S.length < 8 && /* @__PURE__ */ Q(q, {
1206
+ /* @__PURE__ */ Q(Fn, {}),
1207
+ C.length < 8 && /* @__PURE__ */ Q(q, {
1207
1208
  label: V.label,
1208
1209
  divided: !0,
1209
- children: /* @__PURE__ */ Q(jn, {
1210
+ children: /* @__PURE__ */ Q(In, {
1210
1211
  variant: "subtle",
1211
- size: s,
1212
+ size: c,
1212
1213
  className: "w-full",
1213
- options: i,
1214
+ options: r,
1214
1215
  value: "",
1215
- onChange: (t) => {
1216
- t && u(e.id, t);
1216
+ onChange: (e) => {
1217
+ e && f(t.id, e);
1217
1218
  }
1218
1219
  })
1219
1220
  })
1220
- ] }), c === "anim" && E?.def?.sweeps && /* @__PURE__ */ Q(st, {
1221
- sweeps: Array.isArray(E.params.sweeps) ? E.params.sweeps : [],
1221
+ ] }), u === "anim" && O?.def?.sweeps && /* @__PURE__ */ Q(st, {
1222
+ sweeps: Array.isArray(O.params.sweeps) ? O.params.sweeps : [],
1222
1223
  onChange: (e) => R("sweeps", e),
1223
1224
  inline: !0
1224
1225
  })]
1225
1226
  });
1226
1227
  }
1227
- if (!E) return /* @__PURE__ */ Q(Rr, {
1228
+ if (!O) return /* @__PURE__ */ Q(Qr, {
1228
1229
  chips: M,
1229
1230
  active: null,
1230
1231
  onPick: N,
@@ -1232,27 +1233,27 @@ function zr({ layer: e, showMod: t }) {
1232
1233
  fx: !0,
1233
1234
  tabStrip: /* @__PURE__ */ Q(J, {
1234
1235
  tone: "sunken",
1235
- value: c,
1236
- onChange: l,
1237
- options: Nr,
1238
- size: s,
1239
- className: r(s)
1236
+ value: u,
1237
+ onChange: d,
1238
+ options: qr,
1239
+ size: c,
1240
+ className: a(c)
1240
1241
  }),
1241
1242
  children: /* @__PURE__ */ Q(A, {
1242
- schema: en,
1243
- layer: e,
1244
- setProp: b.setProp,
1245
- palette: y,
1246
- renderAnimate: (t) => /* @__PURE__ */ Q(at, {
1247
- layer: e,
1248
- param: t,
1249
- setProp: b.setProp
1243
+ schema: Mn,
1244
+ layer: t,
1245
+ setProp: S.setProp,
1246
+ palette: x,
1247
+ renderAnimate: (e) => /* @__PURE__ */ Q(at, {
1248
+ layer: t,
1249
+ param: e,
1250
+ setProp: S.setProp
1250
1251
  }),
1251
- tab: c === "anim" ? "anim" : "style",
1252
+ tab: u === "anim" ? "anim" : "style",
1252
1253
  emptyHint: "Pick an effect from the nav."
1253
1254
  })
1254
1255
  });
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
+ let H = O.def.params.filter((e) => v(e) !== "anim"), U = ae(O.def.id), le = U ? H.findIndex((e) => e.key === U) : -1, ue = H.length;
1256
1257
  if (le >= 0) {
1257
1258
  let e = le;
1258
1259
  for (; e + 1 < H.length && H[e + 1].type === "select";) e++;
@@ -1264,28 +1265,28 @@ function zr({ layer: e, showMod: t }) {
1264
1265
  })) : H, pe = {
1265
1266
  layer: F,
1266
1267
  setProp: R,
1267
- palette: y,
1268
+ palette: x,
1268
1269
  renderAnimate: ie,
1269
1270
  inline: !0
1270
1271
  };
1271
- return /* @__PURE__ */ $(Rr, {
1272
+ return /* @__PURE__ */ $(Qr, {
1272
1273
  chips: M,
1273
- active: E.id,
1274
+ active: O.id,
1274
1275
  onPick: N,
1275
1276
  spread: k,
1276
1277
  title: ne,
1277
1278
  fx: !0,
1278
- scope: E.id,
1279
- ghostLabels: E.def.params.map((e) => e.label).filter(Boolean),
1279
+ scope: O.id,
1280
+ ghostLabels: O.def.params.map((e) => e.label).filter(Boolean),
1280
1281
  tabStrip: /* @__PURE__ */ Q(J, {
1281
1282
  tone: "sunken",
1282
- value: c,
1283
- onChange: l,
1284
- options: Nr,
1285
- size: s,
1286
- className: r(s)
1283
+ value: u,
1284
+ onChange: d,
1285
+ options: qr,
1286
+ size: c,
1287
+ className: a(c)
1287
1288
  }),
1288
- children: [c === "effect" && /* @__PURE__ */ $(Un, { children: [
1289
+ children: [u === "effect" && /* @__PURE__ */ $(Xn, { children: [
1289
1290
  W.length > 0 && /* @__PURE__ */ Q(A, {
1290
1291
  schema: W,
1291
1292
  ...pe
@@ -1297,90 +1298,90 @@ function zr({ layer: e, showMod: t }) {
1297
1298
  ...pe
1298
1299
  }), /* @__PURE__ */ Q(ot, {
1299
1300
  inline: !0,
1300
- def: E.def,
1301
+ def: O.def,
1301
1302
  view: F,
1302
1303
  tab: "effect",
1303
1304
  onPatch: z,
1304
- levels: /* @__PURE__ */ $(Un, { children: [
1305
+ levels: /* @__PURE__ */ $(Xn, { children: [
1305
1306
  [
1306
1307
  ["type", "Type"],
1307
1308
  ["category", "Category"],
1308
1309
  ["preset", "Preset"]
1309
- ].filter(([e]) => _e(E.def, e)).map(([t, n]) => /* @__PURE__ */ Q(K, {
1310
+ ].filter(([e]) => _e(O.def, e)).map(([e, n]) => /* @__PURE__ */ Q(K, {
1310
1311
  tone: "primary",
1311
- size: s,
1312
+ size: c,
1312
1313
  className: "flex-1 min-w-0",
1313
1314
  "aria-label": `Randomize ${n.toLowerCase()}`,
1314
1315
  onClick: () => {
1315
- let n = g(T() >>> 0);
1316
- if (t === "preset") {
1317
- let e = de(E.def, F, n);
1318
- e != null && z(ce(E.def, e));
1316
+ let n = h(D() >>> 0);
1317
+ if (e === "preset") {
1318
+ let e = de(O.def, F, n);
1319
+ e != null && z(ce(O.def, e));
1319
1320
  return;
1320
1321
  }
1321
- let r = me(E.id, t, n);
1322
- r && f(e.id, w, r);
1322
+ let r = me(O.id, e, n);
1323
+ r && m(t.id, E, r);
1323
1324
  },
1324
1325
  children: n
1325
- }, t)),
1326
+ }, e)),
1326
1327
  /* @__PURE__ */ Q(K, {
1327
1328
  tone: "primary",
1328
- size: s,
1329
+ size: c,
1329
1330
  className: "flex-1 min-w-0",
1330
1331
  "aria-label": "Randomize settings",
1331
1332
  onClick: () => {
1332
- z(he(F, x(E.def.params.filter((e) => D(e) !== "anim"), F), g(T() >>> 0)));
1333
+ z(he(F, w(O.def.params.filter((e) => v(e) !== "anim"), F), h(D() >>> 0)));
1333
1334
  },
1334
1335
  children: "Settings"
1335
1336
  }),
1336
1337
  /* @__PURE__ */ Q(Se, {
1337
- def: E.def,
1338
+ def: O.def,
1338
1339
  isFilter: !0
1339
1340
  })
1340
1341
  ] })
1341
1342
  })]
1342
1343
  }),
1343
- /* @__PURE__ */ Q(An, {}),
1344
- ue < H.length && /* @__PURE__ */ $(Un, { children: [/* @__PURE__ */ Q(A, {
1344
+ /* @__PURE__ */ Q(Fn, {}),
1345
+ ue < H.length && /* @__PURE__ */ $(Xn, { children: [/* @__PURE__ */ Q(A, {
1345
1346
  schema: H.slice(ue),
1346
1347
  ...pe
1347
- }), /* @__PURE__ */ Q(An, {})] }),
1348
- /* @__PURE__ */ Q(Wr, {
1349
- chain: S,
1350
- from: w + 1,
1351
- layer: e,
1348
+ }), /* @__PURE__ */ Q(Fn, {})] }),
1349
+ /* @__PURE__ */ Q(ii, {
1350
+ chain: C,
1351
+ from: E + 1,
1352
+ layer: t,
1352
1353
  hostView: F,
1353
- addFilter: u,
1354
- removeFilter: m,
1355
- toggleFilter: _,
1354
+ addFilter: f,
1355
+ removeFilter: _,
1356
+ toggleFilter: y,
1356
1357
  setStagePropAt: I,
1357
- palette: y,
1358
- showMod: t
1358
+ palette: x,
1359
+ showMod: n
1359
1360
  })
1360
- ] }), c === "anim" && /* @__PURE__ */ $(Un, { children: [
1361
- /* @__PURE__ */ Q(Er, {
1362
- schema: E.def.params,
1361
+ ] }), u === "anim" && /* @__PURE__ */ $(Xn, { children: [
1362
+ /* @__PURE__ */ Q(Br, {
1363
+ schema: O.def.params,
1363
1364
  layer: F,
1364
1365
  setProp: R,
1365
- inputs: E.def.inputs
1366
+ inputs: O.def.inputs
1366
1367
  }),
1367
1368
  /* @__PURE__ */ Q(A, {
1368
- schema: E.def.params,
1369
+ schema: O.def.params,
1369
1370
  ...pe,
1370
1371
  tab: "anim"
1371
1372
  }),
1372
- E.def.orbit && /* @__PURE__ */ Q(q, {
1373
+ O.def.orbit && /* @__PURE__ */ Q(q, {
1373
1374
  label: "Interaction",
1374
1375
  divided: !0,
1375
- children: /* @__PURE__ */ Q(Nn, {
1376
+ children: /* @__PURE__ */ Q(zn, {
1376
1377
  label: "ORBIT (C)",
1377
1378
  align: "fill",
1378
- labelWidth: n,
1379
+ labelWidth: i,
1379
1380
  children: /* @__PURE__ */ Q(J, {
1380
1381
  tone: "sunken",
1381
- size: s,
1382
+ size: c,
1382
1383
  className: "w-full",
1383
- value: o.grab && F.orbit !== !1 ? "on" : "off",
1384
+ value: r.grab && F.orbit !== !1 ? "on" : "off",
1384
1385
  options: [{
1385
1386
  value: "off",
1386
1387
  label: "Off"
@@ -1388,8 +1389,8 @@ function zr({ layer: e, showMod: t }) {
1388
1389
  value: "on",
1389
1390
  label: "On"
1390
1391
  }],
1391
- onChange: (e) => {
1392
- R("orbit", e === "on"), e === "on" && !o.grab && ee("grab", !0);
1392
+ onChange: (t) => {
1393
+ R("orbit", t === "on"), t === "on" && !r.grab && e("grab", !0);
1393
1394
  }
1394
1395
  })
1395
1396
  })
@@ -1398,46 +1399,46 @@ function zr({ layer: e, showMod: t }) {
1398
1399
  divided: !0,
1399
1400
  children: /* @__PURE__ */ Q(ot, {
1400
1401
  inline: !0,
1401
- def: E.def,
1402
+ def: O.def,
1402
1403
  view: F,
1403
1404
  tab: "anim",
1404
1405
  onPatch: z
1405
1406
  })
1406
1407
  }),
1407
- E.def.sweeps && /* @__PURE__ */ Q(st, {
1408
- sweeps: Array.isArray(E.params.sweeps) ? E.params.sweeps : [],
1408
+ O.def.sweeps && /* @__PURE__ */ Q(st, {
1409
+ sweeps: Array.isArray(O.params.sweeps) ? O.params.sweeps : [],
1409
1410
  onChange: (e) => R("sweeps", e),
1410
1411
  inline: !0
1411
1412
  }),
1412
- /* @__PURE__ */ Q(Cr, {
1413
- schema: E.def.params,
1413
+ /* @__PURE__ */ Q(Lr, {
1414
+ schema: O.def.params,
1414
1415
  layer: F,
1415
1416
  setProp: R
1416
1417
  }),
1417
- /* @__PURE__ */ Q(Hr, {
1418
- chain: S,
1419
- layer: e,
1418
+ /* @__PURE__ */ Q(ni, {
1419
+ chain: C,
1420
+ layer: t,
1420
1421
  hostView: F,
1421
- addFilter: u,
1422
- removeFilter: m,
1422
+ addFilter: f,
1423
+ removeFilter: _,
1423
1424
  setStagePropAt: I,
1424
- palette: y,
1425
- showMod: t
1425
+ palette: x,
1426
+ showMod: n
1426
1427
  })
1427
1428
  ] })]
1428
1429
  });
1429
1430
  }
1430
- var Br = L.filter((e) => !e.kind && !e.first);
1431
- function Vr({ 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(Wr, {
1431
+ var ei = L.filter((e) => !e.kind && !e.first);
1432
+ function ti({ layer: e, edit: t, palette: n, showMod: r }) {
1433
+ let { addFilter: i, removeFilter: a, toggleFilter: s } = o(), c = g(e), l = c.map(({ def: e, ...t }) => t);
1434
+ return /* @__PURE__ */ Q(ii, {
1434
1435
  chain: c,
1435
1436
  from: 0,
1436
- filters: Br,
1437
+ filters: ei,
1437
1438
  layer: e,
1438
1439
  hostView: e,
1439
- addFilter: a,
1440
- removeFilter: o,
1440
+ addFilter: i,
1441
+ removeFilter: a,
1441
1442
  toggleFilter: s,
1442
1443
  setStagePropAt: (e) => (n, r) => t.patch({ filters: l.map((t, i) => i === e ? {
1443
1444
  ...t,
@@ -1450,20 +1451,20 @@ function Vr({ layer: e, edit: t, palette: n, showMod: r }) {
1450
1451
  showMod: r
1451
1452
  });
1452
1453
  }
1453
- function Hr({ 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 ? {
1454
+ function ni({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: i, setStagePropAt: a, palette: o, showMod: c }) {
1455
+ let l = s(), u = e.findIndex((e) => e.id === "fx-media"), d = u < 0 ? null : e[u], f = d ? {
1455
1456
  ...n,
1456
1457
  ...d.params,
1457
1458
  id: t.id
1458
- } : null, p = d ? o(u) : null;
1459
+ } : null, p = d ? a(u) : null;
1459
1460
  return /* @__PURE__ */ Q(q, {
1460
1461
  label: "Media",
1461
1462
  divided: !0,
1462
- children: d?.def ? /* @__PURE__ */ $(Un, { children: [/* @__PURE__ */ Q(A, {
1463
+ children: d?.def ? /* @__PURE__ */ $(Xn, { children: [/* @__PURE__ */ Q(A, {
1463
1464
  schema: d.def.params,
1464
1465
  layer: f,
1465
1466
  setProp: p,
1466
- palette: s,
1467
+ palette: o,
1467
1468
  inline: !0,
1468
1469
  renderAnimate: c ? (e) => /* @__PURE__ */ Q(at, {
1469
1470
  layer: f,
@@ -1489,24 +1490,24 @@ function Hr({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: i, se
1489
1490
  })
1490
1491
  });
1491
1492
  }
1492
- function Ur({ 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 = {
1493
+ function ri({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, removeFilter: a, setStagePropAt: o, palette: c, showMod: l }) {
1494
+ let u = s();
1495
+ return e.slice(t).map((e, s) => {
1496
+ let d = s + t, f = e.enabled !== !1, p = {
1496
1497
  ...r,
1497
1498
  ...e.params,
1498
1499
  id: n.id
1499
- }, m = s(d);
1500
+ }, m = o(d);
1500
1501
  return /* @__PURE__ */ $("div", {
1501
1502
  className: "flex flex-col gap-2 p-2 rounded bg-oq-04",
1502
1503
  children: [/* @__PURE__ */ $("div", {
1503
1504
  className: "flex items-center gap-2",
1504
- children: [/* @__PURE__ */ Q(In, {
1505
+ children: [/* @__PURE__ */ Q(Hn, {
1505
1506
  size: u,
1506
1507
  checked: f,
1507
1508
  onChange: () => i(n.id, d),
1508
1509
  label: e.def?.label ?? e.id
1509
- }), /* @__PURE__ */ Q(Ln, {
1510
+ }), /* @__PURE__ */ Q(Un, {
1510
1511
  asChild: !0,
1511
1512
  label: "Delete effect",
1512
1513
  children: /* @__PURE__ */ Q(K, {
@@ -1516,11 +1517,11 @@ function Ur({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, rem
1516
1517
  iconOnly: "x",
1517
1518
  "aria-label": "Delete effect",
1518
1519
  className: "ml-auto shrink-0",
1519
- onClick: () => o(n.id, d)
1520
+ onClick: () => a(n.id, d)
1520
1521
  })
1521
1522
  })]
1522
1523
  }), f && e.def && /* @__PURE__ */ Q(A, {
1523
- schema: e.def.params.filter((e) => D(e) !== "anim"),
1524
+ schema: e.def.params.filter((e) => v(e) !== "anim"),
1524
1525
  layer: p,
1525
1526
  setProp: m,
1526
1527
  palette: c,
@@ -1534,8 +1535,8 @@ function Ur({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, rem
1534
1535
  }, e.key ?? d);
1535
1536
  });
1536
1537
  }
1537
- function Wr({ 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 = [{
1538
+ function ii({ chain: e, from: t = 1, filters: n = null, layer: r, hostView: i, addFilter: a, removeFilter: o, toggleFilter: c, setStagePropAt: l, palette: u, showMod: d }) {
1539
+ let f = s(), p = [{
1539
1540
  value: "",
1540
1541
  label: "Add FX…"
1541
1542
  }, ...(n ?? I(L)).map((e) => ({
@@ -1545,124 +1546,124 @@ function Wr({ chain: e, from: t = 1, filters: n = null, layer: r, hostView: i, a
1545
1546
  return /* @__PURE__ */ $(q, {
1546
1547
  label: "Post-Processing",
1547
1548
  divided: !0,
1548
- children: [/* @__PURE__ */ Q(Ur, {
1549
+ children: [/* @__PURE__ */ Q(ri, {
1549
1550
  chain: e,
1550
1551
  from: t,
1551
1552
  layer: r,
1552
1553
  hostView: i,
1553
1554
  toggleFilter: c,
1554
- removeFilter: s,
1555
+ removeFilter: o,
1555
1556
  setStagePropAt: l,
1556
1557
  palette: u,
1557
1558
  showMod: d
1558
- }), e.length < 8 && /* @__PURE__ */ Q(jn, {
1559
+ }), e.length < 8 && /* @__PURE__ */ Q(In, {
1559
1560
  variant: "subtle",
1560
1561
  size: f,
1561
1562
  className: "w-full",
1562
1563
  options: p,
1563
1564
  value: "",
1564
1565
  onChange: (e) => {
1565
- e && o(r.id, e);
1566
+ e && a(r.id, e);
1566
1567
  }
1567
1568
  })]
1568
1569
  });
1569
1570
  }
1570
- function Gr({ 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) => ({
1571
+ function ai({ layer: e, showMod: t, tree: n }) {
1572
+ let r = s(), [i, c] = Z("generate"), { updateLayer: l, palette: u } = o(), { setOnly: d } = W(), f = 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) => ({
1572
1573
  value: e.id,
1573
1574
  label: e.label
1574
- })) : null, S = (t) => {
1575
+ })) : null, x = (t) => {
1575
1576
  let n = y?.find((e) => e.id === t);
1576
- n && t !== e.presetId && f(e.type, H(n, e.loopGroup));
1577
- }, C = () => {
1578
- m && f(e.type, H(m, e.loopGroup));
1577
+ n && t !== e.presetId && d(e.type, H(n, e.loopGroup));
1578
+ }, S = () => {
1579
+ m && d(e.type, H(m, e.loopGroup));
1579
1580
  };
1580
- return Mr(C, () => {
1581
+ return Kr(S, () => {
1581
1582
  let t = U(e.loopId)?.params ?? [];
1582
- l(e.id, d(e, x(t, e), T(), { withFilters: !0 }));
1583
- }), /* @__PURE__ */ $(Rr, {
1583
+ l(e.id, p(e, w(t, e), D(), { withFilters: !0 }));
1584
+ }), /* @__PURE__ */ $(Qr, {
1584
1585
  title: v,
1585
1586
  chips: b,
1586
1587
  active: e.presetId,
1587
- onPick: S,
1588
+ onPick: x,
1588
1589
  pills: !0,
1589
1590
  scope: e.loopId,
1590
1591
  ghostLabels: (U(e.loopId)?.params ?? []).filter((e) => e.type !== "color" && e.label).map((e) => e.label),
1591
1592
  tabStrip: /* @__PURE__ */ Q(J, {
1592
1593
  tone: "sunken",
1593
- value: s,
1594
+ value: i,
1594
1595
  onChange: c,
1595
- options: o === "sm" ? Pr : Fr,
1596
- size: o,
1597
- className: r(o)
1596
+ options: r === "sm" ? Jr : Yr,
1597
+ size: r,
1598
+ className: a(r)
1598
1599
  }),
1599
1600
  children: [
1600
- s === "anim" && /* @__PURE__ */ Q(Er, {
1601
+ i === "anim" && /* @__PURE__ */ Q(Br, {
1601
1602
  schema: U(e.loopId)?.params ?? [],
1602
1603
  layer: e,
1603
- setProp: p.setProp,
1604
+ setProp: f.setProp,
1604
1605
  inputs: U(e.loopId)?.inputs
1605
1606
  }),
1606
1607
  /* @__PURE__ */ Q(ye, {
1607
1608
  layer: e,
1608
- setProp: p.setProp,
1609
- patch: p.patch,
1609
+ setProp: f.setProp,
1610
+ patch: f.patch,
1610
1611
  updateLayer: l,
1611
1612
  palette: u,
1612
1613
  renderAnimate: t ? (t) => /* @__PURE__ */ Q(at, {
1613
1614
  layer: e,
1614
1615
  param: t,
1615
- setProp: p.setProp
1616
+ setProp: f.setProp
1616
1617
  }) : void 0,
1617
- tab: s,
1618
+ tab: i,
1618
1619
  tabStrip: null,
1619
1620
  tree: n,
1620
1621
  inline: !0,
1621
- onReset: C
1622
+ onReset: S
1622
1623
  }),
1623
- s === "generate" && e.loopId === "scene3d" && e.primitive === "mesh" && /* @__PURE__ */ Q(jr, {
1624
+ i === "generate" && e.loopId === "scene3d" && e.primitive === "mesh" && /* @__PURE__ */ Q(Gr, {
1624
1625
  layer: e,
1625
- setProp: p.setProp
1626
+ setProp: f.setProp
1626
1627
  }),
1627
- s === "style" && /* @__PURE__ */ Q(Vr, {
1628
+ i === "style" && /* @__PURE__ */ Q(ti, {
1628
1629
  layer: e,
1629
- edit: p,
1630
+ edit: f,
1630
1631
  palette: u,
1631
1632
  showMod: t
1632
1633
  }),
1633
- s === "anim" && /* @__PURE__ */ Q(Cr, {
1634
+ i === "anim" && /* @__PURE__ */ Q(Lr, {
1634
1635
  schema: U(e.loopId)?.params ?? [],
1635
1636
  layer: e,
1636
- setProp: p.setProp
1637
+ setProp: f.setProp
1637
1638
  })
1638
1639
  ]
1639
1640
  });
1640
1641
  }
1641
- function Kr({ 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 Mr(() => {
1642
+ function oi({ layer: e, showMod: t }) {
1643
+ let n = s(), [r, i] = Z("generate"), { updateLayer: c, palette: l } = o(), { 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";
1644
+ return Kr(() => {
1644
1645
  f && u("kinetic", {
1645
1646
  presetId: f.id,
1646
1647
  presetLabel: f.label,
1647
1648
  comp: dt(f)
1648
1649
  });
1649
1650
  }, () => {
1650
- let t = T(), n = g(t >>> 0), r = e.comp ?? { instances: [] };
1651
+ let t = D(), n = h(t >>> 0), r = e.comp ?? { instances: [] };
1651
1652
  (r.instances ?? []).forEach((e, t) => {
1652
1653
  r = ft(r, t, n);
1653
1654
  }), c(e.id, {
1654
1655
  comp: r,
1655
1656
  _rollSeed: t
1656
1657
  });
1657
- }), /* @__PURE__ */ Q(Rr, {
1658
+ }), /* @__PURE__ */ Q(Qr, {
1658
1659
  title: p,
1659
1660
  tabStrip: /* @__PURE__ */ Q(J, {
1660
1661
  tone: "sunken",
1661
- value: o,
1662
- onChange: s,
1663
- options: n === "sm" ? Pr : Fr,
1662
+ value: r,
1663
+ onChange: i,
1664
+ options: n === "sm" ? Jr : Yr,
1664
1665
  size: n,
1665
- className: r(n)
1666
+ className: a(n)
1666
1667
  }),
1667
1668
  children: /* @__PURE__ */ Q(ut, {
1668
1669
  layer: e,
@@ -1674,42 +1675,42 @@ function Kr({ layer: e, showMod: t }) {
1674
1675
  param: t,
1675
1676
  setProp: d.setProp
1676
1677
  }) : () => null,
1677
- tab: o,
1678
+ tab: r,
1678
1679
  tabStrip: null
1679
1680
  })
1680
1681
  });
1681
1682
  }
1682
- function qr() {
1683
- let { layer: e } = W(), t = nt(), n = a(), r = it();
1683
+ function si() {
1684
+ let { layer: e } = W(), t = nt(), n = s(), r = it();
1684
1685
  return Y(() => {
1685
1686
  let e = (e) => {
1686
- e.key !== "m" && e.key !== "M" || e.metaKey || e.ctrlKey || e.altKey || kn(e) || rt();
1687
+ e.key !== "m" && e.key !== "M" || e.metaKey || e.ctrlKey || e.altKey || zt(e) || rt();
1687
1688
  };
1688
1689
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1689
- }, []), t.active ? /* @__PURE__ */ Q(Rr, {
1690
+ }, []), t.active ? /* @__PURE__ */ Q(Qr, {
1690
1691
  title: "Morph",
1691
- children: /* @__PURE__ */ Q(yr, {
1692
+ children: /* @__PURE__ */ Q(Nr, {
1692
1693
  layer: e,
1693
- editTabs: n === "sm" ? Pr : Fr
1694
+ editTabs: n === "sm" ? Jr : Yr
1694
1695
  })
1695
- }) : e ? e.type === "photo" ? /* @__PURE__ */ Q(zr, {
1696
+ }) : e ? e.type === "photo" ? /* @__PURE__ */ Q($r, {
1696
1697
  layer: e,
1697
1698
  showMod: r
1698
- }, e.id) : e.type === "loop" ? /* @__PURE__ */ Q(Gr, {
1699
+ }, e.id) : e.type === "loop" ? /* @__PURE__ */ Q(ai, {
1699
1700
  layer: e,
1700
1701
  showMod: r
1701
- }, e.id) : e.type === "misc" ? /* @__PURE__ */ Q(Gr, {
1702
+ }, e.id) : e.type === "misc" ? /* @__PURE__ */ Q(ai, {
1702
1703
  layer: e,
1703
1704
  showMod: r,
1704
1705
  tree: fe
1705
- }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Q(Kr, {
1706
+ }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Q(oi, {
1706
1707
  layer: e,
1707
1708
  showMod: r
1708
1709
  }, 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
  }
1710
1711
  //#endregion
1711
1712
  //#region src/editor/mobile/CategoryScreen.jsx
1712
- function Jr(e) {
1713
+ function ci(e) {
1713
1714
  Y(() => {
1714
1715
  let t = (t) => {
1715
1716
  t.key === "Escape" && e?.();
@@ -1722,8 +1723,8 @@ function Jr(e) {
1722
1723
  };
1723
1724
  }, []);
1724
1725
  }
1725
- function Yr({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1726
- return Jr(r ?? n), /* @__PURE__ */ Q("div", {
1726
+ function li({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1727
+ return ci(r ?? n), /* @__PURE__ */ Q("div", {
1727
1728
  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
1729
  style: { zIndex: "var(--kol-z-modal)" },
1729
1730
  children: /* @__PURE__ */ $("div", {
@@ -1737,11 +1738,11 @@ function Yr({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1737
1738
  /* @__PURE__ */ Q("div", {
1738
1739
  className: "flex flex-col gap-2",
1739
1740
  children: we.map((t) => {
1740
- let n = ur[`gen:${t.label}`] ?? "square";
1741
+ let n = wr[`gen:${t.label}`] ?? "square";
1741
1742
  return /* @__PURE__ */ Q(K, {
1742
1743
  tone: "primary",
1743
1744
  size: "lg",
1744
- className: Vt,
1745
+ className: Qt,
1745
1746
  iconLeft: n,
1746
1747
  iconRight: n,
1747
1748
  onClick: () => e(t),
@@ -1775,11 +1776,11 @@ function Yr({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1775
1776
  }
1776
1777
  //#endregion
1777
1778
  //#region src/editor/labs/LabsSourcePicker.jsx
1778
- var Xr = (e) => /\.svg$/i.test(e.key) || /svg/i.test(e.contentType || "");
1779
- function Zr(e) {
1779
+ var ui = (e) => /\.svg$/i.test(e.key) || /svg/i.test(e.contentType || "");
1780
+ function di(e) {
1780
1781
  let { patch: t } = te(e.id), n = X(null), [r, i] = Z(!1), a = e.type === "loop" && e.loopGroup === "distress";
1781
1782
  return {
1782
- nodes: /* @__PURE__ */ $(Un, { children: [/* @__PURE__ */ Q("input", {
1783
+ nodes: /* @__PURE__ */ $(Xn, { children: [/* @__PURE__ */ Q("input", {
1783
1784
  ref: n,
1784
1785
  type: "file",
1785
1786
  accept: a ? ".svg,image/svg+xml" : "image/*,video/*",
@@ -1799,24 +1800,24 @@ function Zr(e) {
1799
1800
  });
1800
1801
  return;
1801
1802
  }
1802
- Ft(r).then((e) => t({
1803
+ bt(r).then((e) => t({
1803
1804
  src: e,
1804
1805
  srcType: "image"
1805
1806
  }));
1806
1807
  }
1807
1808
  }
1808
- }), /* @__PURE__ */ Q(Ut, {
1809
+ }), /* @__PURE__ */ Q(Ft, {
1809
1810
  open: r,
1810
- accept: a ? Xr : ["image", "video"],
1811
+ accept: a ? ui : ["image", "video"],
1811
1812
  onClose: () => i(!1),
1812
1813
  onSelect: (e, { contentType: n } = {}) => {
1813
1814
  if (a) {
1814
- t({ svgSrc: On(e) });
1815
+ t({ svgSrc: jn(e) });
1815
1816
  return;
1816
1817
  }
1817
1818
  t({
1818
- src: On(e),
1819
- srcType: Tn(n) ? "video" : "image"
1819
+ src: jn(e),
1820
+ srcType: yt(n) ? "video" : "image"
1820
1821
  });
1821
1822
  }
1822
1823
  })] }),
@@ -1824,7 +1825,7 @@ function Zr(e) {
1824
1825
  openLibrary: () => i(!0),
1825
1826
  openUpload: () => n.current?.click(),
1826
1827
  openCamera: () => {
1827
- En(e.id).then(() => t({
1828
+ ln(e.id).then(() => t({
1828
1829
  src: null,
1829
1830
  srcType: "webcam"
1830
1831
  })).catch(() => {});
@@ -1845,15 +1846,15 @@ function Zr(e) {
1845
1846
  label: "Camera"
1846
1847
  }
1847
1848
  ].slice(0, 2);
1848
- function Qr({ layer: e }) {
1849
- let t = Zr(e);
1849
+ function fi({ layer: e }) {
1850
+ let t = di(e);
1850
1851
  return /* @__PURE__ */ $("div", {
1851
1852
  className: "flex flex-col gap-2",
1852
1853
  children: [
1853
1854
  /* @__PURE__ */ Q(K, {
1854
1855
  tone: "primary",
1855
1856
  size: "lg",
1856
- className: Vt,
1857
+ className: Qt,
1857
1858
  iconLeft: "image",
1858
1859
  iconRight: "image",
1859
1860
  onClick: t.openLibrary,
@@ -1862,7 +1863,7 @@ function Qr({ layer: e }) {
1862
1863
  /* @__PURE__ */ Q(K, {
1863
1864
  tone: "primary",
1864
1865
  size: "lg",
1865
- className: Vt,
1866
+ className: Qt,
1866
1867
  iconLeft: "upload",
1867
1868
  iconRight: "upload",
1868
1869
  onClick: t.openUpload,
@@ -1881,8 +1882,8 @@ function Qr({ layer: e }) {
1881
1882
  ]
1882
1883
  });
1883
1884
  }
1884
- function $r({ layer: e, title: t, onBack: n }) {
1885
- return Jr(n), /* @__PURE__ */ Q("div", {
1885
+ function pi({ layer: e, title: t, onBack: n }) {
1886
+ return ci(n), /* @__PURE__ */ Q("div", {
1886
1887
  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",
1887
1888
  style: { zIndex: "calc(var(--kol-z-sticky) - 2)" },
1888
1889
  children: /* @__PURE__ */ $("div", {
@@ -1899,11 +1900,11 @@ function $r({ layer: e, title: t, onBack: n }) {
1899
1900
  children: "Pick the media it works on."
1900
1901
  })]
1901
1902
  }),
1902
- /* @__PURE__ */ Q(Qr, { layer: e }),
1903
+ /* @__PURE__ */ Q(fi, { layer: e }),
1903
1904
  /* @__PURE__ */ Q(K, {
1904
1905
  tone: "grey",
1905
1906
  size: "lg",
1906
- className: Vt,
1907
+ className: Qt,
1907
1908
  iconLeft: "arrow-left",
1908
1909
  iconRight: "arrow-left",
1909
1910
  onClick: n,
@@ -1915,13 +1916,13 @@ function $r({ layer: e, title: t, onBack: n }) {
1915
1916
  }
1916
1917
  //#endregion
1917
1918
  //#region src/editor/components/PanelHeader.jsx
1918
- function ei({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1919
+ function mi({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1919
1920
  return /* @__PURE__ */ $("div", {
1920
1921
  className: `flex w-full shrink-0 items-center ${r}`,
1921
1922
  children: [/* @__PURE__ */ $("button", {
1922
1923
  className: "kol-helper-12 text-meta flex flex-1 items-center gap-2 py-2.5",
1923
1924
  onClick: t,
1924
- children: [/* @__PURE__ */ Q("span", { children: e }), /* @__PURE__ */ Q(Wn, {
1925
+ children: [/* @__PURE__ */ Q("span", { children: e }), /* @__PURE__ */ Q(Zn, {
1925
1926
  name: "chevron-down",
1926
1927
  size: 16,
1927
1928
  className: "text-oq-48"
@@ -1929,7 +1930,7 @@ function ei({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1929
1930
  }), n]
1930
1931
  });
1931
1932
  }
1932
- function ti({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children: i }) {
1933
+ function hi({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children: i }) {
1933
1934
  return /* @__PURE__ */ $("div", {
1934
1935
  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",
1935
1936
  children: [/* @__PURE__ */ Q(K, {
@@ -1942,7 +1943,7 @@ function ti({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children
1942
1943
  children: [/* @__PURE__ */ Q("span", {
1943
1944
  className: "truncate",
1944
1945
  children: e
1945
- }), /* @__PURE__ */ Q(Wn, {
1946
+ }), /* @__PURE__ */ Q(Zn, {
1946
1947
  name: "chevron-down",
1947
1948
  size: 16,
1948
1949
  className: "rotate-180 shrink-0"
@@ -1951,13 +1952,13 @@ function ti({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children
1951
1952
  }), i]
1952
1953
  });
1953
1954
  }
1954
- var ni = {
1955
+ var gi = {
1955
1956
  half: "50dvh",
1956
1957
  tall: "85dvh"
1957
- }, ri = 4;
1958
- function ii({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1958
+ }, _i = 4;
1959
+ function vi({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1959
1960
  let a = X(null);
1960
- Rn(a, { axis: "x" });
1961
+ Wn(a, { axis: "x" });
1961
1962
  let o = X({
1962
1963
  y: null,
1963
1964
  h0: 0,
@@ -1977,7 +1978,7 @@ function ii({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1977
1978
  onPointerMove: (e) => {
1978
1979
  if (o.y === null) return;
1979
1980
  let t = e.clientY - o.y;
1980
- Math.abs(t) > ri && (o.moved = !0), o.moved && r && (o.last = o.h0 - t, r(o.last));
1981
+ Math.abs(t) > _i && (o.moved = !0), o.moved && r && (o.last = o.h0 - t, r(o.last));
1981
1982
  },
1982
1983
  onPointerUp: (e) => {
1983
1984
  if (o.y === null) return;
@@ -1999,10 +2000,10 @@ function ii({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1999
2000
  }
2000
2001
  //#endregion
2001
2002
  //#region src/editor/labs/LabsCatalogCard.jsx
2002
- var ai = new Set(["#rail/sec:effects"]);
2003
- function oi({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0, onNeedMedia: i }) {
2004
- let { items: a, dispatch: o } = Cn(), [s, c] = Z(n);
2005
- Jr(t);
2003
+ var yi = new Set(["#rail/sec:effects"]);
2004
+ function bi({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0, onNeedMedia: i }) {
2005
+ let { items: a, dispatch: o } = Dn(), [s, c] = Z(n);
2006
+ ci(t);
2006
2007
  let l = a.find((e) => e.path === s) ?? null, u = l ? l.sub : a;
2007
2008
  return /* @__PURE__ */ Q("div", {
2008
2009
  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",
@@ -2021,11 +2022,11 @@ function oi({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0,
2021
2022
  children: [u.map((t) => /* @__PURE__ */ Q(K, {
2022
2023
  tone: "primary",
2023
2024
  size: "lg",
2024
- className: Vt,
2025
+ className: Qt,
2025
2026
  iconLeft: t.icon,
2026
2027
  iconRight: t.icon,
2027
2028
  onClick: () => {
2028
- if (!l && ai.has(t.path) && !r && i) {
2029
+ if (!l && yi.has(t.path) && !r && i) {
2029
2030
  i(t.path);
2030
2031
  return;
2031
2032
  }
@@ -2051,7 +2052,7 @@ function oi({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0,
2051
2052
  }
2052
2053
  //#endregion
2053
2054
  //#region src/editor/labs/sheetLabels.js
2054
- function si(e) {
2055
+ function xi(e) {
2055
2056
  if (Ze().active) return {
2056
2057
  title: "Morph",
2057
2058
  pill: "Morph"
@@ -2065,7 +2066,7 @@ function si(e) {
2065
2066
  pill: e.presetLabel
2066
2067
  };
2067
2068
  if (e.type === "photo") {
2068
- let t = h(e)[0]?.def?.label ?? "Media";
2069
+ let t = g(e)[0]?.def?.label ?? "Media";
2069
2070
  return {
2070
2071
  title: t,
2071
2072
  pill: t
@@ -2079,15 +2080,15 @@ function si(e) {
2079
2080
  }
2080
2081
  //#endregion
2081
2082
  //#region src/editor/labs/LabsView.jsx
2082
- var ci = .85, li = .3, ui = 2.5, di = {
2083
+ var Si = .85, Ci = .3, wi = 2.5, Ti = {
2083
2084
  0: 1,
2084
2085
  1: .5,
2085
2086
  2: 1,
2086
2087
  3: 1.5,
2087
2088
  4: 2
2088
- }, fi = "px-2 py-1 rounded border border-oq-08 bg-surface-secondary kol-mono-12 text-emphasis tabular-nums";
2089
- function pi() {
2090
- let { layer: e } = W(), { removeLayer: t, layers: n, updateLayer: r, beginTransaction: a, commitTransaction: o, select: s } = i(), [c, l] = Z(null);
2089
+ }, Ei = "px-2 py-1 rounded border border-oq-08 bg-surface-secondary kol-mono-12 text-emphasis tabular-nums";
2090
+ function Di() {
2091
+ let { layer: e } = W(), { removeLayer: t, layers: n, updateLayer: r, beginTransaction: i, commitTransaction: a, select: s } = o(), [c, l] = Z(null);
2091
2092
  Y(() => {
2092
2093
  let e = (e) => {
2093
2094
  let { id: t, index: r } = e.detail || {};
@@ -2106,31 +2107,31 @@ function pi() {
2106
2107
  c,
2107
2108
  s
2108
2109
  ]);
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), _ = St(h), v = X(null), y = (e) => Math.min(ui, Math.max(li, e)), b = (e) => m((t) => y(t * (e > 0 ? 1.25 : .8))), { tool: x } = gn(), S = x === "orbit", C = X(S);
2110
- C.current = S, Y(() => {
2111
- let e = v.current;
2110
+ 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, h] = Z(!1), g = vt(m), _ = X(null), v = (e) => Math.min(wi, Math.max(Ci, e)), y = (e) => p((t) => v(t * (e > 0 ? 1.25 : .8))), { tool: b } = Nt(), x = b === "orbit", C = X(x);
2111
+ C.current = x, Y(() => {
2112
+ let e = _.current;
2112
2113
  if (!e) return;
2113
2114
  let t = (e) => {
2114
- C.current || (e.preventDefault(), !u().zoomLock && m((t) => y(t * (e.deltaY > 0 ? .94 : 1.06))));
2115
+ C.current || (e.preventDefault(), !S().zoomLock && p((t) => v(t * (e.deltaY > 0 ? .94 : 1.06))));
2115
2116
  };
2116
2117
  return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
2117
2118
  }, []), Y(() => {
2118
2119
  let e = (e) => {
2119
- if (!(e.metaKey || e.ctrlKey || e.altKey) && !kn(e)) {
2120
+ if (!(e.metaKey || e.ctrlKey || e.altKey) && !zt(e)) {
2120
2121
  if (e.key === "f" || e.key === "F") {
2121
- g((e) => !e);
2122
+ h((e) => !e);
2122
2123
  return;
2123
2124
  }
2124
- if (!(u().zoomLock && (e.key === "-" || e.key === "_" || e.key === "+" || e.key === "=" || di[e.key] !== void 0))) {
2125
+ if (!(S().zoomLock && (e.key === "-" || e.key === "_" || e.key === "+" || e.key === "=" || Ti[e.key] !== void 0))) {
2125
2126
  if (e.key === "-" || e.key === "_") {
2126
- b(-1);
2127
+ y(-1);
2127
2128
  return;
2128
2129
  }
2129
2130
  if (e.key === "+" || e.key === "=") {
2130
- b(1);
2131
+ y(1);
2131
2132
  return;
2132
2133
  }
2133
- di[e.key] !== void 0 && m(di[e.key]);
2134
+ Ti[e.key] !== void 0 && p(Ti[e.key]);
2134
2135
  }
2135
2136
  }
2136
2137
  };
@@ -2144,11 +2145,11 @@ function pi() {
2144
2145
  start: null,
2145
2146
  tap: null
2146
2147
  }), D = X({
2147
- zoom: p,
2148
+ zoom: f,
2148
2149
  pan: w
2149
2150
  });
2150
2151
  D.current = {
2151
- zoom: p,
2152
+ zoom: f,
2152
2153
  pan: w
2153
2154
  };
2154
2155
  let ee = (e) => {
@@ -2163,7 +2164,7 @@ function pi() {
2163
2164
  y: e.clientY,
2164
2165
  at: performance.now()
2165
2166
  } : null, t.pts.size === 2) {
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;
2167
+ let [n, r] = [...t.pts.values()], i = _.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;
2167
2168
  t.start = {
2168
2169
  d: Math.hypot(n.x - r.x, n.y - r.y),
2169
2170
  cx: a,
@@ -2180,8 +2181,8 @@ function pi() {
2180
2181
  y: e.clientY
2181
2182
  }), t.pts.size >= 2 && t.start)) {
2182
2183
  e.stopPropagation();
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({
2184
+ let [n, r] = [...t.pts.values()], i = t.start, a = S().zoomLock ? i.z0 : v(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;
2185
+ p(a), T({
2185
2186
  x: o - i.cx - a * i.qx,
2186
2187
  y: s - i.cy - a * i.qy
2187
2188
  });
@@ -2193,11 +2194,11 @@ function pi() {
2193
2194
  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);
2194
2195
  };
2195
2196
  return /* @__PURE__ */ $("div", {
2196
- ref: v,
2197
+ ref: _,
2197
2198
  className: "relative w-full h-full flex items-center justify-center overflow-hidden touch-none",
2198
2199
  style: { background: "var(--kol-surface-secondary)" },
2199
2200
  onDoubleClick: () => {
2200
- m(1), T({
2201
+ p(1), T({
2201
2202
  x: 0,
2202
2203
  y: 0
2203
2204
  });
@@ -2210,40 +2211,40 @@ function pi() {
2210
2211
  /* @__PURE__ */ Q("div", {
2211
2212
  style: {
2212
2213
  flex: "none",
2213
- width: `${p * ci * 100}%`,
2214
- height: `${p * ci * 100}%`,
2214
+ width: `${f * Si * 100}%`,
2215
+ height: `${f * Si * 100}%`,
2215
2216
  transform: `translate(${w.x}px, ${w.y}px)`
2216
2217
  },
2217
- children: /* @__PURE__ */ Q(Yt, { overlay: d ? (e) => /* @__PURE__ */ Q(yt, {
2218
- layer: d,
2218
+ children: /* @__PURE__ */ Q(Xt, { overlay: u ? (e) => /* @__PURE__ */ Q(jt, {
2219
+ layer: u,
2219
2220
  initialIndex: c.index,
2220
2221
  toVirtual: e,
2221
2222
  updateLayer: r,
2222
- beginTransaction: a,
2223
- commitTransaction: o,
2223
+ beginTransaction: i,
2224
+ commitTransaction: a,
2224
2225
  onExit: () => l(null)
2225
2226
  }) : void 0 })
2226
2227
  }),
2227
- f && /* @__PURE__ */ Q($r, {
2228
+ d && /* @__PURE__ */ Q(pi, {
2228
2229
  layer: e,
2229
- title: si(e).title,
2230
+ title: xi(e).title,
2230
2231
  onBack: () => t(e.id)
2231
2232
  }),
2232
- h && /* @__PURE__ */ Q("div", {
2233
+ m && /* @__PURE__ */ Q("div", {
2233
2234
  className: "absolute bottom-3 right-3 z-[var(--kol-z-base)] flex items-center gap-2 [@media(pointer:coarse)]:bottom-1",
2234
- children: /* @__PURE__ */ Q(Ln, {
2235
+ children: /* @__PURE__ */ Q(Un, {
2235
2236
  label: "Framerate — press F to hide",
2236
2237
  children: /* @__PURE__ */ $("span", {
2237
- className: fi,
2238
- children: [_, " fps"]
2238
+ className: Ei,
2239
+ children: [g, " fps"]
2239
2240
  })
2240
2241
  })
2241
2242
  })
2242
2243
  ]
2243
2244
  });
2244
2245
  }
2245
- function mi() {
2246
- let e = X(null), { grabProps: t } = Gn(e, {
2246
+ function Oi() {
2247
+ let e = X(null), { grabProps: t } = ar(e, {
2247
2248
  token: "kol-rail",
2248
2249
  side: "right"
2249
2250
  });
@@ -2289,14 +2290,14 @@ function mi() {
2289
2290
  className: "kol-compose-rail kol-compose-rail--inspector",
2290
2291
  children: [/* @__PURE__ */ Q("div", { ...t }), /* @__PURE__ */ Q("div", {
2291
2292
  className: "kol-compose-inspector-body",
2292
- children: /* @__PURE__ */ Q(qr, {})
2293
+ children: /* @__PURE__ */ Q(si, {})
2293
2294
  })]
2294
2295
  });
2295
2296
  }
2296
- var hi = Bn(null);
2297
- function gi() {
2298
- let { tall: e, setTall: t, collapseParams: n, setSheetPx: r } = Vn(hi);
2299
- return /* @__PURE__ */ Q(ii, {
2297
+ var ki = qn(null);
2298
+ function Ai() {
2299
+ let { tall: e, setTall: t, collapseParams: n, setSheetPx: r } = Jn(ki);
2300
+ return /* @__PURE__ */ Q(vi, {
2300
2301
  tall: e,
2301
2302
  onToggle: () => {
2302
2303
  r(null), t((e) => !e);
@@ -2307,20 +2308,20 @@ function gi() {
2307
2308
  }
2308
2309
  });
2309
2310
  }
2310
- var _i = [
2311
+ var ji = [
2311
2312
  2,
2312
2313
  4,
2313
2314
  8,
2314
2315
  12,
2315
2316
  16
2316
2317
  ];
2317
- function vi({ 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 = [
2318
+ function Mi({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, railHeight: i }) {
2319
+ let { playing: a, loopSeconds: o, play: s, pause: c, stop: l, rewind: u, setLoopSeconds: d } = C(), [f, p] = Z(!0), m = [
2319
2320
  {
2320
2321
  icon: "home-01",
2321
2322
  path: "#home",
2322
2323
  label: "Home",
2323
- onPress: () => cn("/")
2324
+ onPress: () => pn("/")
2324
2325
  },
2325
2326
  {
2326
2327
  icon: "grid",
@@ -2347,13 +2348,13 @@ function vi({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, rai
2347
2348
  icon: "download",
2348
2349
  label: "Output",
2349
2350
  onPress: () => {
2350
- t(!0), xt("Output");
2351
+ t(!0), cn("Output");
2351
2352
  }
2352
2353
  }, {
2353
2354
  icon: "file",
2354
2355
  label: "File",
2355
2356
  onPress: () => {
2356
- t(!0), xt("File");
2357
+ t(!0), cn("File");
2357
2358
  }
2358
2359
  }], g = f ? {
2359
2360
  items: [
@@ -2389,14 +2390,14 @@ function vi({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, rai
2389
2390
  onPress: u
2390
2391
  }
2391
2392
  ],
2392
- sheetFor: { loop: _i.map((e) => ({
2393
+ sheetFor: { loop: ji.map((e) => ({
2393
2394
  label: `${e} s`,
2394
2395
  checked: o === e,
2395
2396
  onPress: () => d(e)
2396
2397
  })) }
2397
2398
  } : void 0;
2398
2399
  return Y(() => {
2399
- Zn({
2400
+ dr({
2400
2401
  items: m,
2401
2402
  actions: h,
2402
2403
  transport: g,
@@ -2410,20 +2411,20 @@ function vi({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, rai
2410
2411
  a,
2411
2412
  o,
2412
2413
  i
2413
- ]), Y(() => () => Zn(null), []), null;
2414
+ ]), Y(() => () => dr(null), []), null;
2414
2415
  }
2415
- function yi() {
2416
+ function Ni() {
2416
2417
  return /* @__PURE__ */ Q("div", {
2417
2418
  className: "kol-compose-rail kol-compose-rail--inspector",
2418
2419
  children: /* @__PURE__ */ Q("div", {
2419
2420
  className: "kol-compose-inspector-body",
2420
- children: /* @__PURE__ */ Q(qr, {})
2421
+ children: /* @__PURE__ */ Q(si, {})
2421
2422
  })
2422
2423
  });
2423
2424
  }
2424
- var bi = {
2425
+ var Pi = {
2425
2426
  topbar: () => null,
2426
- canvas: pi,
2427
+ canvas: Di,
2427
2428
  panels: [
2428
2429
  {
2429
2430
  slot: "canvas.footer",
@@ -2433,87 +2434,87 @@ var bi = {
2433
2434
  {
2434
2435
  slot: "right.body",
2435
2436
  order: 0,
2436
- Component: mi
2437
+ Component: Oi
2437
2438
  },
2438
2439
  {
2439
2440
  slot: "right.footer",
2440
2441
  order: 0,
2441
- Component: tn
2442
+ Component: qt
2442
2443
  }
2443
2444
  ]
2444
- }, xi = {
2445
- ...bi,
2445
+ }, Fi = {
2446
+ ...Pi,
2446
2447
  panels: [{
2447
2448
  slot: "right.header",
2448
2449
  order: 0,
2449
- Component: gi
2450
- }, ...bi.panels.map((e) => e.Component === mi ? {
2450
+ Component: Ai
2451
+ }, ...Pi.panels.map((e) => e.Component === Oi ? {
2451
2452
  ...e,
2452
- Component: yi
2453
+ Component: Ni
2453
2454
  } : e)]
2454
2455
  };
2455
- function Si() {
2456
- let { setAspect: e, selectedId: t, select: n } = i(), { layer: r, setOnly: a } = W(), o = X(!1), c = Zt(Et), l = Ht() && !dn() || c;
2456
+ function Ii() {
2457
+ let { setAspect: t, selectedId: n, select: r } = o(), { layer: i, setOnly: a } = W(), s = X(!1), c = Kt(gt), d = hn() && !wn() || c;
2457
2458
  Y(() => {
2458
- l && document.documentElement.removeAttribute("data-rail");
2459
- }, [l]);
2460
- let [d, f] = Z(!0), [m, h] = Z(!1), [g, _] = Z(null), v = g ? `${g}px` : m ? ni.tall : ni.half, y = { "--kol-sheet-h": v }, b = Qn(), x = nt(), [S, C] = Z(() => !r);
2459
+ d && document.documentElement.removeAttribute("data-rail");
2460
+ }, [d]);
2461
+ let [f, p] = Z(!0), [m, h] = Z(!1), [g, _] = Z(null), v = g ? `${g}px` : m ? gi.tall : gi.half, y = { "--kol-sheet-h": v }, b = fr(), x = nt(), [C, w] = Z(() => !i);
2461
2462
  Y(() => {
2462
- C(!r);
2463
- }, [r?.id]);
2464
- let [w, T] = Z(null), E = r?.type === "photo" && (!!r.src || r.srcType === "webcam");
2463
+ w(!i);
2464
+ }, [i?.id]);
2465
+ let [T, E] = Z(null), D = i?.type === "photo" && (!!i.src || i.srcType === "webcam");
2465
2466
  Y(() => {
2466
- w && E && C(!0);
2467
- }, [w, E]), Y(() => {
2468
- r || T(null);
2469
- }, [r]), Y(() => {
2470
- if (!r || l) return;
2467
+ T && D && w(!0);
2468
+ }, [T, D]), Y(() => {
2469
+ i || E(null);
2470
+ }, [i]), Y(() => {
2471
+ if (!i || d) return;
2471
2472
  let e = 0, t = 0;
2472
2473
  return e = requestAnimationFrame(() => {
2473
2474
  t = requestAnimationFrame(() => document.documentElement.removeAttribute("data-rail"));
2474
2475
  }), () => {
2475
2476
  cancelAnimationFrame(e), cancelAnimationFrame(t);
2476
2477
  };
2477
- }, [r?.id]), Y(() => {
2478
- if (!x.active || l) return;
2478
+ }, [i?.id]), Y(() => {
2479
+ if (!x.active || d) return;
2479
2480
  let e = 0, t = 0;
2480
2481
  return e = requestAnimationFrame(() => {
2481
2482
  t = requestAnimationFrame(() => document.documentElement.removeAttribute("data-rail"));
2482
2483
  }), () => {
2483
2484
  cancelAnimationFrame(e), cancelAnimationFrame(t);
2484
2485
  };
2485
- }, [x.active, l]), Y(() => Rt((e) => a("photo", {
2486
+ }, [x.active, d]), Y(() => Dt((e) => a("photo", {
2486
2487
  src: e.url,
2487
2488
  srcType: e.srcType
2488
2489
  })), [a]), Y(() => {
2489
- if (!l) return;
2490
- let e = () => f(!0);
2490
+ if (!d) return;
2491
+ let e = () => p(!0);
2491
2492
  return window.addEventListener("kol:open-params", e), window.addEventListener("kol:open-effects", e), () => {
2492
2493
  window.removeEventListener("kol:open-params", e), window.removeEventListener("kol:open-effects", e);
2493
2494
  };
2494
- }, [l]), Ot(), Y(() => (Xt("labs"), () => Xt(null)), []), Y(() => {
2495
- if (o.current) return;
2496
- o.current = !0;
2497
- let t = u();
2498
- t.defaultAspect && t.defaultAspect !== "custom" && e(t.defaultAspect), t.defaultLoopSeconds && O.setLoopSeconds(t.defaultLoopSeconds);
2495
+ }, [d]), wt(), Y(() => (nn("labs"), () => nn(null)), []), Y(() => {
2496
+ if (s.current) return;
2497
+ s.current = !0;
2498
+ let e = S();
2499
+ e.defaultAspect && e.defaultAspect !== "custom" && t(e.defaultAspect), e.defaultLoopSeconds && O.setLoopSeconds(e.defaultLoopSeconds);
2499
2500
  }, []);
2500
- let D = X(!1);
2501
+ let ee = X(!1);
2501
2502
  Y(() => {
2502
- if (D.current) return;
2503
- D.current = !0;
2504
- let e = wt();
2503
+ if (ee.current) return;
2504
+ ee.current = !0;
2505
+ let e = bn();
2505
2506
  if (e.open || e.fresh) return;
2506
2507
  let t = new URLSearchParams(window.location.search).get("preset"), n = t ? V(t) : null;
2507
2508
  n && a("loop", H(M(t), n));
2508
2509
  }, [a]);
2509
- let { clearHistory: k } = i();
2510
+ let { clearHistory: k } = o();
2510
2511
  Y(() => {
2511
2512
  let e = setTimeout(k, 800);
2512
2513
  return () => clearTimeout(e);
2513
2514
  }, [k]);
2514
- let { tool: A, setTool: j } = gn(), te = X(A);
2515
+ let { tool: A, setTool: j } = Nt(), te = X(A);
2515
2516
  te.current = A;
2516
- let { updateLayer: ne, undo: N, redo: P } = i(), F = X({
2517
+ let { updateLayer: ne, undo: N, redo: P } = o(), F = X({
2517
2518
  undo: N,
2518
2519
  redo: P
2519
2520
  });
@@ -2521,75 +2522,75 @@ function Si() {
2521
2522
  undo: N,
2522
2523
  redo: P
2523
2524
  };
2524
- let I = !!p().grab;
2525
+ let I = !!l().grab;
2525
2526
  Y(() => {
2526
2527
  j(I ? "orbit" : "select");
2527
2528
  }, [I, j]);
2528
- let re = X(r);
2529
- re.current = r;
2529
+ let re = X(i);
2530
+ re.current = i;
2530
2531
  let L = X(ne);
2531
2532
  return L.current = ne, Y(() => {
2532
- let e = (e) => {
2533
- if (kn(e)) return;
2534
- if ((e.metaKey || e.ctrlKey) && (e.key === "z" || e.key === "Z")) {
2535
- e.preventDefault(), e.shiftKey ? F.current.redo() : F.current.undo();
2533
+ let t = (t) => {
2534
+ if (zt(t)) return;
2535
+ if ((t.metaKey || t.ctrlKey) && (t.key === "z" || t.key === "Z")) {
2536
+ t.preventDefault(), t.shiftKey ? F.current.redo() : F.current.undo();
2536
2537
  return;
2537
2538
  }
2538
- if (e.code === "Space") {
2539
- e.preventDefault(), O.toggle();
2539
+ if (t.code === "Space") {
2540
+ t.preventDefault(), O.toggle();
2540
2541
  return;
2541
2542
  }
2542
- if ((e.key === "s" || e.key === "S") && !e.metaKey && !e.ctrlKey && !e.altKey) {
2543
+ if ((t.key === "s" || t.key === "S") && !t.metaKey && !t.ctrlKey && !t.altKey) {
2543
2544
  window.dispatchEvent(new CustomEvent("kol:show-shortcuts"));
2544
2545
  return;
2545
2546
  }
2546
- if ((e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey) {
2547
- ee("grab", !u().grab);
2547
+ if ((t.key === "c" || t.key === "C") && !t.metaKey && !t.ctrlKey && !t.altKey) {
2548
+ e("grab", !S().grab);
2548
2549
  return;
2549
2550
  }
2550
- if ((e.key === "z" || e.key === "Z") && !e.metaKey && !e.ctrlKey && !e.altKey) {
2551
- ee("zoomLock", !u().zoomLock);
2551
+ if ((t.key === "z" || t.key === "Z") && !t.metaKey && !t.ctrlKey && !t.altKey) {
2552
+ e("zoomLock", !S().zoomLock);
2552
2553
  return;
2553
2554
  }
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));
2555
+ let n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && be[t.key.length === 1 ? t.key.toLowerCase() : t.key];
2556
+ if (n && re.current) {
2557
+ let e = Ce(re.current, n[1], n[0]);
2558
+ e && (t.preventDefault(), L.current(re.current.id, e));
2558
2559
  }
2559
2560
  };
2560
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2561
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
2561
2562
  }, [j]), Y(() => {
2562
- if (!r?.presetId) return;
2563
+ if (!i?.presetId) return;
2563
2564
  let e = new URLSearchParams(window.location.search);
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}`));
2565
- }, [r?.presetId, r?.loopGroup]), Y(() => {
2566
- r && t !== r.id && n(r.id);
2565
+ e.get("preset") !== i.presetId && (e.delete("view"), e.set("preset", i.presetId), i.loopGroup ? e.set("cat", i.loopGroup) : e.delete("cat"), window.history.replaceState(null, "", `${window.location.pathname}?${e}`));
2566
+ }, [i?.presetId, i?.loopGroup]), Y(() => {
2567
+ i && n !== i.id && r(i.id);
2567
2568
  }, [
2568
- r,
2569
- t,
2570
- n
2569
+ i,
2570
+ n,
2571
+ r
2571
2572
  ]), /* @__PURE__ */ $("div", {
2572
2573
  className: "kol-editor-labs contents",
2573
- "data-touch": l || void 0,
2574
- "data-params": d ? "open" : void 0,
2575
- "data-empty": r || x.active ? void 0 : "",
2574
+ "data-touch": d || void 0,
2575
+ "data-params": f ? "open" : void 0,
2576
+ "data-empty": i || x.active ? void 0 : "",
2576
2577
  style: y,
2577
2578
  children: [
2578
- /* @__PURE__ */ Q(gr, {}),
2579
- l ? /* @__PURE__ */ $(hi.Provider, {
2579
+ /* @__PURE__ */ Q(Ar, {}),
2580
+ d ? /* @__PURE__ */ $(ki.Provider, {
2580
2581
  value: {
2581
- collapseParams: () => f(!1),
2582
+ collapseParams: () => p(!1),
2582
2583
  tall: m,
2583
2584
  setTall: h,
2584
2585
  setSheetPx: _,
2585
- catalog: S,
2586
- toggleCatalog: () => C((e) => !e)
2586
+ catalog: C,
2587
+ toggleCatalog: () => w((e) => !e)
2587
2588
  },
2588
- children: [/* @__PURE__ */ Q(s.Provider, {
2589
+ children: [/* @__PURE__ */ Q(u.Provider, {
2589
2590
  value: "md",
2590
- children: /* @__PURE__ */ Q(It, {
2591
- registry: xi,
2592
- rightIn: (e) => b ? qn(/* @__PURE__ */ Q("div", {
2591
+ children: /* @__PURE__ */ Q(_t, {
2592
+ registry: Fi,
2593
+ rightIn: (e) => b ? sr(/* @__PURE__ */ Q("div", {
2593
2594
  className: "kol-editor-labs flex flex-col h-full",
2594
2595
  "data-touch": "",
2595
2596
  "data-params": "open",
@@ -2597,35 +2598,35 @@ function Si() {
2597
2598
  children: e
2598
2599
  }), b) : null
2599
2600
  })
2600
- }), /* @__PURE__ */ Q(vi, {
2601
- paramsOpen: d,
2602
- setParamsOpen: f,
2603
- catalog: S,
2604
- toggleCatalog: () => C((e) => !e),
2601
+ }), /* @__PURE__ */ Q(Mi, {
2602
+ paramsOpen: f,
2603
+ setParamsOpen: p,
2604
+ catalog: C,
2605
+ toggleCatalog: () => w((e) => !e),
2605
2606
  railHeight: v
2606
2607
  })]
2607
- }) : /* @__PURE__ */ Q(It, { registry: bi }),
2608
- S && !x.picker && !(x.active && !r) && /* @__PURE__ */ Q(oi, {
2609
- initialOpen: w,
2610
- hasMedia: E,
2608
+ }) : /* @__PURE__ */ Q(_t, { registry: Pi }),
2609
+ C && !x.picker && !(x.active && !i) && /* @__PURE__ */ Q(bi, {
2610
+ initialOpen: T,
2611
+ hasMedia: D,
2611
2612
  onNeedMedia: (e) => {
2612
- T(e), a("photo", {
2613
+ E(e), a("photo", {
2613
2614
  filters: [],
2614
2615
  fxGroup: null
2615
2616
  });
2616
2617
  },
2617
2618
  onPicked: () => {
2618
- T(null), C(!1);
2619
+ E(null), w(!1);
2619
2620
  },
2620
2621
  onClose: () => {
2621
- T(null), C(!1);
2622
+ E(null), w(!1);
2622
2623
  }
2623
2624
  })
2624
2625
  ]
2625
2626
  });
2626
2627
  }
2627
- var Ci = "kol.editor.labs-draft";
2628
- function wi() {
2628
+ var Li = "kol.editor.labs-draft";
2629
+ function Ri() {
2629
2630
  let e = /\/morph\/?$/.test(typeof window > "u" ? "" : window.location.pathname);
2630
2631
  return Y(() => (G(e ? { active: !0 } : {
2631
2632
  active: !1,
@@ -2633,20 +2634,20 @@ function wi() {
2633
2634
  }), () => G({
2634
2635
  active: !1,
2635
2636
  editing: null
2636
- })), [e]), /* @__PURE__ */ $(ln, {
2637
- draftKey: Ci,
2637
+ })), [e]), /* @__PURE__ */ $(fn, {
2638
+ draftKey: Li,
2638
2639
  children: [
2639
- /* @__PURE__ */ Q(Si, {}),
2640
- /* @__PURE__ */ Q(_t, {}),
2640
+ /* @__PURE__ */ Q(Ii, {}),
2641
+ /* @__PURE__ */ Q(St, {}),
2641
2642
  /* @__PURE__ */ Q(ve, {})
2642
2643
  ]
2643
2644
  });
2644
2645
  }
2645
2646
  //#endregion
2646
2647
  //#region src/editor/mobile/EffectScreen.jsx
2647
- function Ti({ layer: e, chain: t, onPick: n, onBack: r }) {
2648
+ function zi({ layer: e, chain: t, onPick: n, onBack: r }) {
2648
2649
  let [i, a] = Z(null);
2649
- Jr(r);
2650
+ ci(r);
2650
2651
  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;
2651
2652
  return /* @__PURE__ */ Q("div", {
2652
2653
  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",
@@ -2664,7 +2665,7 @@ function Ti({ layer: e, chain: t, onPick: n, onBack: r }) {
2664
2665
  children: (l ? l.filters : c).map((e) => /* @__PURE__ */ Q(K, {
2665
2666
  tone: "primary",
2666
2667
  size: "lg",
2667
- className: Vt,
2668
+ className: Qt,
2668
2669
  iconLeft: l ? "filter" : "chevron-right",
2669
2670
  iconRight: l ? "filter" : "chevron-right",
2670
2671
  onClick: () => l ? n(e.id) : a(e.id),
@@ -2674,7 +2675,7 @@ function Ti({ layer: e, chain: t, onPick: n, onBack: r }) {
2674
2675
  /* @__PURE__ */ Q(K, {
2675
2676
  tone: "grey",
2676
2677
  size: "lg",
2677
- className: Vt,
2678
+ className: Qt,
2678
2679
  iconLeft: "arrow-left",
2679
2680
  iconRight: "arrow-left",
2680
2681
  onClick: () => l ? a(null) : r(),
@@ -2686,7 +2687,7 @@ function Ti({ layer: e, chain: t, onPick: n, onBack: r }) {
2686
2687
  }
2687
2688
  //#endregion
2688
2689
  //#region src/editor/mobile/MobileOverlay.jsx
2689
- var Ei = { background: "var(--kol-surface-primary)" }, Di = [
2690
+ var Bi = { background: "var(--kol-surface-primary)" }, Vi = [
2690
2691
  {
2691
2692
  value: "generate",
2692
2693
  label: "Generate"
@@ -2703,29 +2704,29 @@ var Ei = { background: "var(--kol-surface-primary)" }, Di = [
2703
2704
  value: "output",
2704
2705
  label: "Output"
2705
2706
  }
2706
- ], Oi = Di.filter((e) => e.value !== "generate"), ki = "[&_.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)]", Ai = {
2707
+ ], Hi = Vi.filter((e) => e.value !== "generate"), Ui = "[&_.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)]", Wi = {
2707
2708
  lg: 9.6,
2708
2709
  sm: 7.2
2709
- }, ji = 10, Mi = 232;
2710
- function Ni(e, t) {
2711
- let n = t === "sm" ? Mi : Math.min(window.innerWidth, 480) - 24, r = [], i = [], a = 0;
2710
+ }, Gi = 10, Ki = 232;
2711
+ function qi(e, t) {
2712
+ let n = t === "sm" ? Ki : Math.min(window.innerWidth, 480) - 24, r = [], i = [], a = 0;
2712
2713
  for (let o of e) {
2713
- let e = o.label.length * Ai[t] + ji, s = Math.max(a, e);
2714
+ let e = o.label.length * Wi[t] + Gi, s = Math.max(a, e);
2714
2715
  i.length && (i.length + 1) * s > n ? (r.push(i), i = [o], a = e) : (i.push(o), a = s);
2715
2716
  }
2716
2717
  return i.length && r.push(i), r;
2717
2718
  }
2718
- function Pi({ cells: e, size: t }) {
2719
- return Ni(e, t).map((e, n) => /* @__PURE__ */ Q(J, {
2719
+ function Ji({ cells: e, size: t }) {
2720
+ return qi(e, t).map((e, n) => /* @__PURE__ */ Q(J, {
2720
2721
  value: null,
2721
2722
  onChange: (t) => e.find((e) => e.value === t)?.run(),
2722
2723
  options: e,
2723
2724
  size: t,
2724
2725
  ariaLabel: "Randomize scope",
2725
- className: ki
2726
+ className: Ui
2726
2727
  }, n));
2727
2728
  }
2728
- var Fi = [
2729
+ var Yi = [
2729
2730
  2,
2730
2731
  4,
2731
2732
  8,
@@ -2734,17 +2735,17 @@ var Fi = [
2734
2735
  value: String(e),
2735
2736
  label: `${e}s`
2736
2737
  }));
2737
- function Ii({ size: e }) {
2738
- let { loopSeconds: t, setLoopSeconds: n } = S();
2738
+ function Xi({ size: e }) {
2739
+ let { loopSeconds: t, setLoopSeconds: n } = C();
2739
2740
  return /* @__PURE__ */ Q(J, {
2740
2741
  value: String(t),
2741
2742
  onChange: (e) => n(Number(e)),
2742
- options: Fi,
2743
+ options: Yi,
2743
2744
  size: e,
2744
2745
  ariaLabel: "Loop length"
2745
2746
  });
2746
2747
  }
2747
- var Li = [
2748
+ var Zi = [
2748
2749
  {
2749
2750
  value: "9:16",
2750
2751
  label: "9:16"
@@ -2761,7 +2762,7 @@ var Li = [
2761
2762
  value: "1:1",
2762
2763
  label: "1:1"
2763
2764
  }
2764
- ], Ri = [
2765
+ ], Qi = [
2765
2766
  {
2766
2767
  value: "5:4",
2767
2768
  label: "5:4"
@@ -2779,40 +2780,40 @@ var Li = [
2779
2780
  label: "Fill"
2780
2781
  }
2781
2782
  ];
2782
- function zi({ 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 } = Lt(), [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);
2783
+ function $i({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: i, aspectValue: a, onAspect: s, openEffects: c = !1, rail: l = !1, onRail: u, onSheet: d }) {
2784
+ let f = nt(), { updateLayer: h, addFilter: _, removeFilter: v } = o(), { onExportPng: b } = Et(), [x, S] = Z(!1), [C, T] = Z(!0), [D, k] = Z(!1), [A, j] = Z(!1), [te, M] = Z("generate"), [ne, F] = Z(!1), [I, re] = Z(!1), { aspect: L } = o(), [R, ae] = Z(null), z = m(e);
2784
2785
  Y(() => {
2785
- c && (D(!0), j(!0));
2786
+ c && (T(!0), j(!0));
2786
2787
  }, [c]);
2787
- let B = l ? "sm" : "lg", oe = l && !!e && T && !S;
2788
+ let B = l ? "sm" : "lg", oe = l && !!e && C && !x;
2788
2789
  Y(() => (u?.(oe), () => u?.(!1)), [oe]);
2789
- let se = !l && e && T && !S ? R ? `${R}px` : ne ? ni.tall : ni.half : null;
2790
- Y(() => (f?.(se), () => f?.(null)), [se]);
2790
+ let se = !l && e && C && !x ? R ? `${R}px` : ne ? gi.tall : gi.half : null;
2791
+ Y(() => (d?.(se), () => d?.(null)), [se]);
2791
2792
  let ce = () => {
2792
2793
  let t = e?.type === "loop" && N(e.loopGroup).find((t) => t.id === e.presetId);
2793
- t && g(e.id, H(t, e.loopGroup));
2794
+ t && h(e.id, H(t, e.loopGroup));
2794
2795
  };
2795
- if (Mr(ce, () => {
2796
- e?.type === "loop" && g(e.id, d(e, x(U(e.loopId)?.params ?? [], e), z.take(), { withFilters: !0 }));
2796
+ if (Kr(ce, () => {
2797
+ e?.type === "loop" && h(e.id, p(e, w(U(e.loopId)?.params ?? [], e), z.take(), { withFilters: !0 }));
2797
2798
  }), !e) return null;
2798
- if (S) return /* @__PURE__ */ Q("button", {
2799
+ if (x) return /* @__PURE__ */ Q("button", {
2799
2800
  "aria-label": "Show controls",
2800
2801
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] z-20",
2801
- onClick: () => w(!1)
2802
+ onClick: () => S(!1)
2802
2803
  });
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 });
2804
+ let V = e.type === "loop", le = V ? `${P(e.loopGroup).label} · ${e.presetLabel}` : "Media", ue = V ? U(e.loopId)?.params ?? [] : [], de = V ? E(ue, e) : [], W = () => h(e.id, p(e, w(ue, e), z.take(), { withFilters: !0 })), fe = (t) => h(e.id, p(e, t.params, z.take(), { stripNoRandom: !!t.motion })), me = () => {
2805
+ let t = y(e, z.take());
2806
+ t && h(e.id, t);
2807
+ }, he = g(e), { effectable: ge } = ie(e), _e = () => {
2808
+ let t = ee(e, z.take());
2809
+ t && h(e.id, { filters: t });
2809
2810
  };
2810
- if (!T) return /* @__PURE__ */ $(ti, {
2811
+ if (!C) return /* @__PURE__ */ $(hi, {
2811
2812
  label: V ? e.presetLabel : "Media",
2812
- onOpen: () => D(!0),
2813
+ onOpen: () => T(!0),
2813
2814
  size: B,
2814
2815
  children: [
2815
- (V || he.length > 0) && /* @__PURE__ */ Q(Ln, {
2816
+ (V || he.length > 0) && /* @__PURE__ */ Q(Un, {
2816
2817
  label: "Randomize all",
2817
2818
  children: /* @__PURE__ */ Q(K, {
2818
2819
  tone: "primary",
@@ -2823,7 +2824,7 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2823
2824
  className: "shrink-0"
2824
2825
  })
2825
2826
  }),
2826
- /* @__PURE__ */ Q(Ln, {
2827
+ /* @__PURE__ */ Q(Un, {
2827
2828
  label: "Download",
2828
2829
  children: /* @__PURE__ */ Q(K, {
2829
2830
  tone: "primary",
@@ -2834,18 +2835,18 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2834
2835
  className: "shrink-0"
2835
2836
  })
2836
2837
  }),
2837
- /* @__PURE__ */ Q(Ln, {
2838
+ /* @__PURE__ */ Q(Un, {
2838
2839
  label: "Hide UI",
2839
2840
  children: /* @__PURE__ */ Q(K, {
2840
2841
  tone: "primary",
2841
2842
  size: B,
2842
2843
  iconOnly: "eye-off",
2843
2844
  "aria-label": "Hide UI",
2844
- onClick: () => w(!0),
2845
+ onClick: () => S(!0),
2845
2846
  className: "shrink-0"
2846
2847
  })
2847
2848
  }),
2848
- /* @__PURE__ */ Q(Ln, {
2849
+ /* @__PURE__ */ Q(Un, {
2849
2850
  label: a === "fill" ? "Back to the frame" : "Fill the screen",
2850
2851
  children: /* @__PURE__ */ Q(K, {
2851
2852
  tone: "primary",
@@ -2859,11 +2860,11 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2859
2860
  })
2860
2861
  ]
2861
2862
  });
2862
- let ve = [...V ? Di : Oi, ...V && p.steps.length >= 2 ? [{
2863
+ let ve = [...V ? Vi : Hi, ...V && f.steps.length >= 2 ? [{
2863
2864
  value: "morph",
2864
2865
  label: "Morph"
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__ */ $(Un, { children: [
2866
+ }] : []].filter((e) => (e.value !== "effects" || ge) && (e.value !== "transport" || n("motion"))), ye = ve.some((e) => e.value === te) ? te : ve[0].value;
2867
+ return /* @__PURE__ */ $(Xn, { children: [
2867
2868
  /* @__PURE__ */ Q(pe, {
2868
2869
  open: I,
2869
2870
  onClose: () => re(!1),
@@ -2871,52 +2872,52 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2871
2872
  layer: e,
2872
2873
  size: B
2873
2874
  }),
2874
- ee && /* @__PURE__ */ Q(Yr, {
2875
+ D && /* @__PURE__ */ Q(li, {
2875
2876
  onPick: (e) => {
2876
2877
  t(e), k(!1);
2877
2878
  },
2878
2879
  onInsert: () => {
2879
- k(!1), n();
2880
+ k(!1), r();
2880
2881
  },
2881
2882
  onBack: () => {
2882
- k(!1), r();
2883
+ k(!1), i();
2883
2884
  },
2884
2885
  onDismiss: () => k(!1)
2885
2886
  }),
2886
- A && /* @__PURE__ */ Q(Ti, {
2887
+ A && /* @__PURE__ */ Q(zi, {
2887
2888
  layer: e,
2888
2889
  chain: he,
2889
2890
  onPick: (t) => {
2890
- v(e.id, t), j(!1);
2891
+ _(e.id, t), j(!1);
2891
2892
  },
2892
2893
  onBack: () => j(!1)
2893
2894
  }),
2894
2895
  /* @__PURE__ */ $("div", {
2895
2896
  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)]",
2896
- style: l ? Ei : {
2897
- ...Ei,
2898
- top: `calc(100dvh - ${se ?? ni.half})`
2897
+ style: l ? Bi : {
2898
+ ...Bi,
2899
+ top: `calc(100dvh - ${se ?? gi.half})`
2899
2900
  },
2900
2901
  children: [
2901
- !l && /* @__PURE__ */ Q(ii, {
2902
+ !l && /* @__PURE__ */ Q(vi, {
2902
2903
  tall: ne,
2903
2904
  onToggle: () => {
2904
2905
  ae(null), F((e) => !e);
2905
2906
  },
2906
2907
  onResize: (e) => ae(Math.max(96, Math.min(window.innerHeight * .92, e))),
2907
2908
  onResizeEnd: (e) => {
2908
- e < 96 && (ae(null), D(!1));
2909
+ e < 96 && (ae(null), T(!1));
2909
2910
  }
2910
2911
  }),
2911
- /* @__PURE__ */ Q(ei, {
2912
+ /* @__PURE__ */ Q(mi, {
2912
2913
  title: le,
2913
- onCollapse: () => D(!1),
2914
+ onCollapse: () => T(!1),
2914
2915
  className: l ? "px-4 pt-2.5 pb-1.5" : "px-3",
2915
2916
  action: /* @__PURE__ */ Q(K, {
2916
2917
  tone: "ghost",
2917
2918
  quiet: !0,
2918
2919
  size: "sm",
2919
- onClick: r,
2920
+ onClick: i,
2920
2921
  children: "Start over"
2921
2922
  })
2922
2923
  }),
@@ -2928,9 +2929,9 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2928
2929
  onChange: M,
2929
2930
  options: ve,
2930
2931
  size: B,
2931
- className: l ? ki : "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-2 [&_.kol-seg-cell]:overflow-hidden"
2932
+ className: l ? Ui : "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-2 [&_.kol-seg-cell]:overflow-hidden"
2932
2933
  }),
2933
- ye === "morph" && V && /* @__PURE__ */ Q(yr, {
2934
+ ye === "morph" && V && /* @__PURE__ */ Q(Nr, {
2934
2935
  layer: e,
2935
2936
  readOnly: !0
2936
2937
  }),
@@ -2962,7 +2963,7 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2962
2963
  onClick: W,
2963
2964
  children: "Randomize all"
2964
2965
  }),
2965
- /* @__PURE__ */ Q(Ln, {
2966
+ /* @__PURE__ */ Q(Un, {
2966
2967
  label: "What Randomize all rolls",
2967
2968
  children: /* @__PURE__ */ Q(K, {
2968
2969
  tone: "primary",
@@ -2973,7 +2974,7 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2973
2974
  className: "shrink-0"
2974
2975
  })
2975
2976
  }),
2976
- /* @__PURE__ */ Q(Ln, {
2977
+ /* @__PURE__ */ Q(Un, {
2977
2978
  label: "Reset to defaults",
2978
2979
  shortcut: "R",
2979
2980
  children: /* @__PURE__ */ Q(K, {
@@ -2987,7 +2988,7 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
2987
2988
  })
2988
2989
  ]
2989
2990
  }),
2990
- de.length > 0 && /* @__PURE__ */ Q(Pi, {
2991
+ de.length > 0 && /* @__PURE__ */ Q(Ji, {
2991
2992
  size: B,
2992
2993
  cells: [...de.map((e) => ({
2993
2994
  value: e.id,
@@ -3025,9 +3026,9 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
3025
3026
  ...e,
3026
3027
  ...t.params,
3027
3028
  id: e.id
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 ? {
3029
+ }, i = t.def ? E(t.def.params, r) : [], a = (t) => {
3030
+ let i = p(r, t.params, z.take(), { stripNoRandom: !!t.motion }), a = he.map(({ def: e, ...t }) => t);
3031
+ h(e.id, { filters: a.map((e, t) => t === n ? {
3031
3032
  ...e,
3032
3033
  params: {
3033
3034
  ...e.params,
@@ -3043,9 +3044,9 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
3043
3044
  className: "w-full [&>span]:w-full [&>span]:justify-between",
3044
3045
  iconLeft: "trash",
3045
3046
  iconRight: "trash",
3046
- onClick: () => y(e.id, n),
3047
+ onClick: () => v(e.id, n),
3047
3048
  children: `${n + 1}. ${t.def?.label ?? t.id}`
3048
- }), i.length > 0 && /* @__PURE__ */ Q(Pi, {
3049
+ }), i.length > 0 && /* @__PURE__ */ Q(Ji, {
3049
3050
  size: B,
3050
3051
  cells: i.map((e) => ({
3051
3052
  value: e.id,
@@ -3056,12 +3057,12 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
3056
3057
  }, t.key);
3057
3058
  })]
3058
3059
  }),
3059
- ye === "transport" && o("motion") && /* @__PURE__ */ $("div", {
3060
+ ye === "transport" && n("motion") && /* @__PURE__ */ $("div", {
3060
3061
  className: "flex flex-col gap-2 pt-3",
3061
3062
  children: [(() => {
3062
- let e = o("motion").TransportBar;
3063
+ let e = n("motion").TransportBar;
3063
3064
  return /* @__PURE__ */ Q(e, { size: B });
3064
- })(), /* @__PURE__ */ Q(Ii, { size: B })]
3065
+ })(), /* @__PURE__ */ Q(Xi, { size: B })]
3065
3066
  }),
3066
3067
  ye === "output" && /* @__PURE__ */ $("div", {
3067
3068
  className: "flex flex-col gap-2 pt-3",
@@ -3069,14 +3070,14 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
3069
3070
  /* @__PURE__ */ Q(J, {
3070
3071
  value: a,
3071
3072
  onChange: s,
3072
- options: Li,
3073
+ options: Zi,
3073
3074
  size: B,
3074
3075
  ariaLabel: "Aspect"
3075
3076
  }),
3076
3077
  /* @__PURE__ */ Q(J, {
3077
3078
  value: a,
3078
3079
  onChange: s,
3079
- options: Ri,
3080
+ options: Qi,
3080
3081
  size: B,
3081
3082
  ariaLabel: "Aspect (landscape) and fill"
3082
3083
  }),
@@ -3086,7 +3087,7 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
3086
3087
  /* @__PURE__ */ Q(K, {
3087
3088
  tone: "primary",
3088
3089
  size: B,
3089
- onClick: () => kt({ focusName: !0 }),
3090
+ onClick: () => Ot({ focusName: !0 }),
3090
3091
  children: "Save…"
3091
3092
  }),
3092
3093
  /* @__PURE__ */ Q(K, {
@@ -3098,13 +3099,13 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
3098
3099
  /* @__PURE__ */ Q(K, {
3099
3100
  tone: "primary",
3100
3101
  size: B,
3101
- onClick: () => w(!0),
3102
+ onClick: () => S(!0),
3102
3103
  children: "Hide UI"
3103
3104
  }),
3104
3105
  /* @__PURE__ */ Q(K, {
3105
3106
  tone: "primary",
3106
3107
  size: B,
3107
- onClick: r,
3108
+ onClick: i,
3108
3109
  children: "Start over"
3109
3110
  })
3110
3111
  ]
@@ -3119,7 +3120,7 @@ function zi({ layer: e, onSwitchCategory: t, onInsert: n, onRestart: r, aspectVa
3119
3120
  }
3120
3121
  //#endregion
3121
3122
  //#region src/editor/mobile/MobileView.jsx
3122
- function Bi({ onGenerate: e, onEffects: t, chromes: n }) {
3123
+ function ea({ onGenerate: e, onEffects: t, chromes: n }) {
3123
3124
  return /* @__PURE__ */ Q("div", {
3124
3125
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center justify-center p-6",
3125
3126
  style: { zIndex: "var(--kol-z-modal)" },
@@ -3137,45 +3138,45 @@ function Bi({ onGenerate: e, onEffects: t, chromes: n }) {
3137
3138
  })]
3138
3139
  }) : /* @__PURE__ */ Q("span", {
3139
3140
  className: "kol-eyebrow text-body",
3140
- children: Jt("randomiser").label
3141
+ children: yn("randomiser").label
3141
3142
  }), /* @__PURE__ */ $("div", {
3142
3143
  className: "flex flex-col gap-2",
3143
3144
  children: [
3144
3145
  /* @__PURE__ */ Q(K, {
3145
3146
  tone: "primary",
3146
3147
  size: "lg",
3147
- className: Vt,
3148
- iconLeft: rn.randomiser,
3149
- iconRight: rn.randomiser,
3148
+ className: Qt,
3149
+ iconLeft: dn.randomiser,
3150
+ iconRight: dn.randomiser,
3150
3151
  onClick: e,
3151
3152
  children: "Generate"
3152
3153
  }),
3153
3154
  /* @__PURE__ */ Q(K, {
3154
3155
  tone: "primary",
3155
3156
  size: "lg",
3156
- className: Vt,
3157
+ className: Qt,
3157
3158
  iconLeft: "filter",
3158
3159
  iconRight: "filter",
3159
3160
  onClick: t,
3160
3161
  children: "Effects"
3161
3162
  }),
3162
- n && Nt() && /* @__PURE__ */ Q(K, {
3163
+ n && Sn() && /* @__PURE__ */ Q(K, {
3163
3164
  tone: "primary",
3164
3165
  size: "lg",
3165
3166
  className: "w-full [&>span]:w-full [&>span]:justify-between",
3166
- iconLeft: rn.editor,
3167
- iconRight: rn.editor,
3168
- onClick: Bt,
3169
- children: Jt("editor").label
3167
+ iconLeft: dn.editor,
3168
+ iconRight: dn.editor,
3169
+ onClick: En,
3170
+ children: yn("editor").label
3170
3171
  }),
3171
3172
  n && /* @__PURE__ */ Q(K, {
3172
3173
  tone: "primary",
3173
3174
  size: "lg",
3174
3175
  className: "w-full [&>span]:w-full [&>span]:justify-between",
3175
- iconLeft: rn.labs,
3176
- iconRight: rn.labs,
3177
- onClick: bn,
3178
- children: Jt("labs").label
3176
+ iconLeft: dn.labs,
3177
+ iconRight: dn.labs,
3178
+ onClick: en,
3179
+ children: yn("labs").label
3179
3180
  }),
3180
3181
  n && /* @__PURE__ */ Q(K, {
3181
3182
  tone: "primary",
@@ -3183,7 +3184,7 @@ function Bi({ onGenerate: e, onEffects: t, chromes: n }) {
3183
3184
  className: "w-full [&>span]:w-full [&>span]:justify-between",
3184
3185
  iconLeft: "swap",
3185
3186
  iconRight: "swap",
3186
- onClick: () => cn("/morph"),
3187
+ onClick: () => pn("/morph"),
3187
3188
  children: "Morph"
3188
3189
  })
3189
3190
  ]
@@ -3191,11 +3192,11 @@ function Bi({ onGenerate: e, onEffects: t, chromes: n }) {
3191
3192
  })
3192
3193
  });
3193
3194
  }
3194
- function Vi() {
3195
- let { layers: t, addLayer: n, removeLayer: r, updateLayer: a, canvasW: o, canvasH: s, aspect: c, setAspect: u } = i(), { setTool: d } = gn(), f = Ht() && !dn(), p = Sn(), m = () => {
3195
+ function ta() {
3196
+ let { layers: e, addLayer: n, removeLayer: r, updateLayer: i, canvasW: a, canvasH: s, aspect: c, setAspect: l } = o(), { setTool: u } = Nt(), d = hn() && !wn(), f = _n(), p = () => {
3196
3197
  let e = new URLSearchParams(window.location.search);
3197
3198
  return e.get("open") ? "live" : e.get("start") === "category" ? "category" : "entry";
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({
3199
+ }, [m, h] = Z(p), [g, _] = Z(!1), [v, y] = Z(null), [b, x] = Z("contain"), [S, C] = Z(!1), [w, E] = Z(null), [D, ee] = Z({
3199
3200
  s: 1,
3200
3201
  x: 0,
3201
3202
  y: 0
@@ -3250,12 +3251,12 @@ function Vi() {
3250
3251
  }
3251
3252
  }, P = (e) => {
3252
3253
  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));
3254
+ t && t.id === e.pointerId && e.type === "pointerup" && m === "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));
3254
3255
  };
3255
- Kn(), Y(() => (Xt("randomiser"), () => Xt(null)), []), Y(() => {
3256
- u("4:5"), d("orbit");
3256
+ or(), Y(() => (nn("randomiser"), () => nn(null)), []), Y(() => {
3257
+ l("4:5"), u("orbit");
3257
3258
  }, []);
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";
3259
+ let F = e.find((e) => e.id === v) ?? (e.length === 1 ? e[0] : null), I = m === "live" && F?.type === "photo" && !F.src && F.srcType !== "webcam";
3259
3260
  Y(() => {
3260
3261
  if (!I) return;
3261
3262
  let e = (e) => {
@@ -3271,43 +3272,43 @@ function Vi() {
3271
3272
  }, [I]);
3272
3273
  let re = (e) => {
3273
3274
  let t = R(e);
3274
- t && (b(n("loop", t)), g("live"));
3275
+ t && (y(n("loop", t)), h("live"));
3275
3276
  }, L = (e) => {
3276
3277
  let t = R(e);
3277
- t && y && a(y, t);
3278
+ t && v && i(v, t);
3278
3279
  }, ie = () => {
3279
- b(n("photo", {
3280
+ y(n("photo", {
3280
3281
  fit: "cover",
3281
3282
  x: 0,
3282
3283
  y: 0,
3283
- w: e,
3284
- h: Math.round(e * s / o)
3285
- })), g("live");
3284
+ w: t,
3285
+ h: Math.round(t * s / a)
3286
+ })), h("live");
3286
3287
  };
3287
3288
  Y(() => {
3288
3289
  let e = new URL(window.location.href), t = e.searchParams.get("start");
3289
- t && (t === "effects" && (v(!0), ie()), e.searchParams.delete("start"), window.history.replaceState(window.history.state, "", e));
3290
+ t && (t === "effects" && (_(!0), ie()), e.searchParams.delete("start"), window.history.replaceState(window.history.state, "", e));
3290
3291
  }, []);
3291
- let ae = (t) => {
3292
- if (t === "fill") {
3293
- S("cover");
3292
+ let ae = (e) => {
3293
+ if (e === "fill") {
3294
+ x("cover");
3294
3295
  return;
3295
3296
  }
3296
- S("contain"), u(t);
3297
- let n = l[t];
3298
- y && n && a(y, {
3297
+ x("contain"), l(e);
3298
+ let n = T[e];
3299
+ v && n && i(v, {
3299
3300
  x: 0,
3300
3301
  y: 0,
3301
- w: e,
3302
- h: Math.round(e * n.h / n.w)
3302
+ w: t,
3303
+ h: Math.round(t * n.h / n.w)
3303
3304
  });
3304
3305
  }, z = () => {
3305
- for (let e of [...t]) r(e.id);
3306
- b(null), ee({
3306
+ for (let t of [...e]) r(t.id);
3307
+ y(null), ee({
3307
3308
  s: 1,
3308
3309
  x: 0,
3309
3310
  y: 0
3310
- }), v(!1), g(m());
3311
+ }), _(!1), h(p());
3311
3312
  };
3312
3313
  return /* @__PURE__ */ $("div", {
3313
3314
  className: "kol-editor-randomiser relative h-dvh bg-black",
@@ -3318,40 +3319,40 @@ function Vi() {
3318
3319
  style: {
3319
3320
  transform: M(D),
3320
3321
  transformOrigin: "0 0",
3321
- right: C ? "var(--kol-sidenav-w, 320px)" : 0,
3322
- bottom: T ?? 0
3322
+ right: S ? "var(--kol-sidenav-w, 320px)" : 0,
3323
+ bottom: w ?? 0
3323
3324
  },
3324
3325
  onPointerDownCapture: ne,
3325
3326
  onPointerMoveCapture: N,
3326
3327
  onPointerUpCapture: P,
3327
3328
  onPointerCancelCapture: P,
3328
3329
  onPointerLeave: P,
3329
- children: /* @__PURE__ */ Q(Qt, { fit: x })
3330
+ children: /* @__PURE__ */ Q($t, { fit: b })
3330
3331
  }),
3331
- h === "entry" && /* @__PURE__ */ Q(Bi, {
3332
- chromes: f,
3333
- onGenerate: () => g("category"),
3332
+ m === "entry" && /* @__PURE__ */ Q(ea, {
3333
+ chromes: d,
3334
+ onGenerate: () => h("category"),
3334
3335
  onEffects: () => {
3335
- v(!0), ie();
3336
+ _(!0), ie();
3336
3337
  }
3337
3338
  }),
3338
- h === "category" && /* @__PURE__ */ Q(Yr, {
3339
+ m === "category" && /* @__PURE__ */ Q(li, {
3339
3340
  onPick: re,
3340
3341
  onInsert: ie,
3341
- onBack: () => g("entry")
3342
+ onBack: () => h("entry")
3342
3343
  }),
3343
- h === "live" && !I && /* @__PURE__ */ Q(zi, {
3344
+ m === "live" && !I && /* @__PURE__ */ Q($i, {
3344
3345
  layer: F,
3345
3346
  onSwitchCategory: L,
3346
3347
  onInsert: () => {
3347
3348
  z(), ie();
3348
3349
  },
3349
3350
  onRestart: z,
3350
- aspectValue: x === "cover" ? "fill" : c,
3351
- openEffects: _ && !I,
3351
+ aspectValue: b === "cover" ? "fill" : c,
3352
+ openEffects: g && !I,
3352
3353
  onAspect: ae,
3353
- rail: !f && !p,
3354
- onRail: w,
3354
+ rail: !d && !f,
3355
+ onRail: C,
3355
3356
  onSheet: E
3356
3357
  }),
3357
3358
  I && /* @__PURE__ */ $("div", {
@@ -3359,7 +3360,7 @@ function Vi() {
3359
3360
  style: { zIndex: "var(--kol-z-modal)" },
3360
3361
  children: [/* @__PURE__ */ Q("div", {
3361
3362
  className: "flex-1 min-h-0",
3362
- children: /* @__PURE__ */ Q(Qr, { layer: F })
3363
+ children: /* @__PURE__ */ Q(fi, { layer: F })
3363
3364
  }), /* @__PURE__ */ Q("div", {
3364
3365
  className: "flex justify-center pb-[max(0.75rem,env(safe-area-inset-bottom))]",
3365
3366
  children: /* @__PURE__ */ Q(K, {
@@ -3373,11 +3374,356 @@ function Vi() {
3373
3374
  ]
3374
3375
  });
3375
3376
  }
3376
- function Hi() {
3377
- return /* @__PURE__ */ $(ln, {
3377
+ function na() {
3378
+ return /* @__PURE__ */ $(fn, {
3378
3379
  persistDraft: !1,
3379
- children: [/* @__PURE__ */ Q(Vi, {}), /* @__PURE__ */ Q(_t, {})]
3380
+ children: [/* @__PURE__ */ Q(ta, {}), /* @__PURE__ */ Q(St, {})]
3381
+ });
3382
+ }
3383
+ //#endregion
3384
+ //#region src/editor/labs/FloatLabs.jsx
3385
+ function ra() {
3386
+ let { undo: e, redo: t, canUndo: n, canRedo: r } = o(), i = (e) => () => e(), a = (e) => () => window.dispatchEvent(new CustomEvent(e));
3387
+ return {
3388
+ app: {
3389
+ label: "FXR",
3390
+ items: [{
3391
+ label: "Home",
3392
+ onClick: () => pn("/")
3393
+ }, {
3394
+ label: "Settings",
3395
+ onClick: () => pn("/settings")
3396
+ }]
3397
+ },
3398
+ menus: [
3399
+ {
3400
+ label: "File",
3401
+ width: 240,
3402
+ items: [
3403
+ {
3404
+ label: "Files…",
3405
+ kbd: "⌘O",
3406
+ onClick: i(() => Ot())
3407
+ },
3408
+ {
3409
+ label: "Save patch",
3410
+ kbd: "⌘S",
3411
+ onClick: () => cn("File")
3412
+ },
3413
+ { divider: !0 },
3414
+ {
3415
+ label: "Output…",
3416
+ onClick: () => cn("Output")
3417
+ },
3418
+ {
3419
+ label: "File…",
3420
+ onClick: () => cn("File")
3421
+ }
3422
+ ]
3423
+ },
3424
+ {
3425
+ label: "Edit",
3426
+ width: 220,
3427
+ items: [{
3428
+ label: "Undo",
3429
+ kbd: "⌘Z",
3430
+ disabled: !n,
3431
+ onClick: e
3432
+ }, {
3433
+ label: "Redo",
3434
+ kbd: "⇧⌘Z",
3435
+ disabled: !r,
3436
+ onClick: t
3437
+ }]
3438
+ },
3439
+ {
3440
+ label: "View",
3441
+ width: 240,
3442
+ items: [
3443
+ {
3444
+ label: "Play / pause",
3445
+ kbd: "Space",
3446
+ onClick: () => O.toggle()
3447
+ },
3448
+ {
3449
+ label: "Rewind",
3450
+ onClick: () => O.rewind()
3451
+ },
3452
+ { divider: !0 },
3453
+ {
3454
+ label: "Transport",
3455
+ onClick: () => cn("Transport")
3456
+ },
3457
+ {
3458
+ label: "Shortcuts",
3459
+ kbd: "S",
3460
+ onClick: a("kol:show-shortcuts")
3461
+ }
3462
+ ]
3463
+ }
3464
+ ],
3465
+ end: [{
3466
+ label: "Help",
3467
+ items: [{
3468
+ label: "Keyboard shortcuts",
3469
+ kbd: "S",
3470
+ onClick: a("kol:show-shortcuts")
3471
+ }]
3472
+ }]
3473
+ };
3474
+ }
3475
+ function ia() {
3476
+ let { addFilter: e, patchFilter: t } = o(), { layer: n, setOnly: r } = W(), i = X(null);
3477
+ Y(() => {
3478
+ n?.type === "photo" && n.src && (i.current = {
3479
+ src: n.src,
3480
+ srcType: n.srcType,
3481
+ fit: n.fit
3482
+ });
3483
+ }, [
3484
+ n?.type,
3485
+ n?.src,
3486
+ n?.srcType,
3487
+ n?.fit
3488
+ ]);
3489
+ let a = kr({
3490
+ layer: n,
3491
+ setOnly: r,
3492
+ addFilter: e,
3493
+ patchFilter: t,
3494
+ carriedSource: () => n?.type === "photo" ? {
3495
+ src: n.src,
3496
+ srcType: n.srcType,
3497
+ fit: n.fit
3498
+ } : i.current ?? {}
3499
+ }), s = [], c = /* @__PURE__ */ new Map(), l = null;
3500
+ return a.forEach((e) => {
3501
+ if (e.id.startsWith("sec:")) {
3502
+ s.push({
3503
+ icon: Tr[e.id.slice(4)] ?? "square",
3504
+ label: e.label,
3505
+ path: e.id,
3506
+ sub: []
3507
+ });
3508
+ return;
3509
+ }
3510
+ let t = e.pages ?? [], n = e.onSelect ?? t[0]?.onSelect ?? t[0]?.children?.[0]?.onSelect;
3511
+ n && c.set(e.id, n), (e.active || t.some((e) => e.active || e.children?.some((e) => e.active))) && (l = e.id);
3512
+ let r = {
3513
+ icon: e.icon,
3514
+ label: e.label,
3515
+ path: e.id
3516
+ }, i = s[s.length - 1];
3517
+ i?.sub ? i.sub.push(r) : s.push(r);
3518
+ }), {
3519
+ items: s,
3520
+ active: l,
3521
+ pick: (e) => c.get(e)?.()
3522
+ };
3523
+ }
3524
+ function aa() {
3525
+ let { layer: e } = W(), { removeLayer: t } = o(), n = e?.type === "photo" && !e.src && e.srcType !== "webcam";
3526
+ return /* @__PURE__ */ $("div", {
3527
+ className: "kol-float-labs-stage absolute inset-0 flex items-center justify-center overflow-hidden",
3528
+ style: { background: "var(--kol-surface-secondary)" },
3529
+ children: [/* @__PURE__ */ Q("div", {
3530
+ style: {
3531
+ flex: "none",
3532
+ width: "85%",
3533
+ height: "85%"
3534
+ },
3535
+ children: /* @__PURE__ */ Q(Xt, {})
3536
+ }), n && /* @__PURE__ */ Q(pi, {
3537
+ layer: e,
3538
+ title: xi(e).title,
3539
+ onBack: () => t(e.id)
3540
+ })]
3541
+ });
3542
+ }
3543
+ function oa({ items: e, active: t, onPick: n, className: r }) {
3544
+ let [i, a] = Z(null), o = X(0), s = () => clearTimeout(o.current), c = () => {
3545
+ s(), o.current = setTimeout(() => a(null), 160);
3546
+ };
3547
+ return /* @__PURE__ */ $(Xn, { children: [/* @__PURE__ */ Q(Rn, {
3548
+ variant: "float",
3549
+ collapsed: !0,
3550
+ items: e,
3551
+ currentPath: t ?? "",
3552
+ title: "Labs",
3553
+ icon: "globe",
3554
+ onNavigate: (e) => n(e),
3555
+ onItemHover: (e, t) => {
3556
+ if (!e) return c();
3557
+ s(), a(e.sub?.length ? {
3558
+ item: e,
3559
+ el: t
3560
+ } : null);
3561
+ },
3562
+ className: r
3563
+ }), i && /* @__PURE__ */ Q("span", {
3564
+ className: "contents",
3565
+ onMouseEnter: s,
3566
+ onMouseLeave: c,
3567
+ children: /* @__PURE__ */ Q(ir, {
3568
+ icon: i.item.icon,
3569
+ title: i.item.label,
3570
+ items: i.item.sub,
3571
+ active: t,
3572
+ anchor: i.el,
3573
+ open: !0,
3574
+ onOpenChange: (e) => {
3575
+ e || a(null);
3576
+ },
3577
+ onPick: (e) => {
3578
+ a(null), n(e.path);
3579
+ }
3580
+ })
3581
+ })] });
3582
+ }
3583
+ function sa({ variant: e }) {
3584
+ wt();
3585
+ let t = Gn("(max-width: 767px)"), { layer: n } = W(), { undo: r, redo: i, canUndo: a, canRedo: s, selectedId: c, select: l } = o();
3586
+ Y(() => {
3587
+ n && c !== n.id && l(n.id);
3588
+ }, [
3589
+ n,
3590
+ c,
3591
+ l
3592
+ ]);
3593
+ let { app: u, menus: d, end: f } = ra(), p = ia(), m = n ? xi(n).title : "Labs", h = e === "float", g = p.items.filter((e) => e.sub?.length).map((e) => e.path), _ = /* @__PURE__ */ Q(er, {
3594
+ name: m || "Untitled",
3595
+ status: "Labs",
3596
+ onBack: () => pn("/"),
3597
+ menuItems: h ? Nn([...d, ...f].map((e) => ({
3598
+ label: e.label,
3599
+ items: e.items
3600
+ }))) : void 0
3601
+ }), v = /* @__PURE__ */ Q(tr, {
3602
+ onUndo: () => a && r(),
3603
+ onRedo: () => s && i(),
3604
+ onAction: () => cn("Output"),
3605
+ onAccount: () => pn("/settings")
3606
+ }), y = /* @__PURE__ */ Q(Qn, {
3607
+ variant: "mobile",
3608
+ shape: "pill",
3609
+ labels: !t,
3610
+ items: rn,
3611
+ sheetItems: tn,
3612
+ currentPath: "/labs",
3613
+ onNavigate: kn
3614
+ }), b = /* @__PURE__ */ Q(rr, {
3615
+ title: m || "Parameters",
3616
+ width: t ? "100%" : 352,
3617
+ density: "compact",
3618
+ surface: "solid",
3619
+ sections: [{
3620
+ id: "labs-params",
3621
+ label: "Parameters",
3622
+ rows: [{
3623
+ id: "body",
3624
+ render: () => /* @__PURE__ */ Q("div", {
3625
+ className: "kol-editor-labs kol-float-labs-params",
3626
+ children: /* @__PURE__ */ Q("div", {
3627
+ className: "kol-compose-inspector-body",
3628
+ children: /* @__PURE__ */ Q(si, {})
3629
+ })
3630
+ })
3631
+ }]
3632
+ }],
3633
+ footer: /* @__PURE__ */ Q("div", {
3634
+ className: "kol-editor-labs",
3635
+ children: /* @__PURE__ */ Q(qt, {})
3636
+ }),
3637
+ className: "kol-float-labs-rail max-h-full overflow-y-auto scrollbar-none"
3638
+ });
3639
+ return /* @__PURE__ */ $("div", {
3640
+ className: "kol-float-labs kol-editor-shell flex flex-col h-full w-full overflow-hidden bg-surface-primary",
3641
+ "data-variant": e,
3642
+ "data-editor-keep-selection": !0,
3643
+ children: [!h && !t && /* @__PURE__ */ Q(nr, {
3644
+ app: u,
3645
+ menus: d,
3646
+ end: f
3647
+ }), /* @__PURE__ */ $("div", {
3648
+ className: "relative flex-1 min-h-0",
3649
+ children: [/* @__PURE__ */ Q(aa, {}), t ? /* @__PURE__ */ $("div", {
3650
+ className: "absolute inset-0 z-[1] pointer-events-none [&>*]:pointer-events-auto",
3651
+ children: [
3652
+ /* @__PURE__ */ Q("div", {
3653
+ className: "absolute left-4 top-5",
3654
+ children: _
3655
+ }),
3656
+ /* @__PURE__ */ Q("div", {
3657
+ className: "absolute right-4 top-[82px] [&_.kol-global-actions]:gap-2",
3658
+ children: v
3659
+ }),
3660
+ h ? /* @__PURE__ */ Q(oa, {
3661
+ items: p.items,
3662
+ active: p.active,
3663
+ onPick: p.pick,
3664
+ className: "absolute! left-4 top-[140px] !h-auto"
3665
+ }) : /* @__PURE__ */ Q(Rn, {
3666
+ variant: "float",
3667
+ items: p.items,
3668
+ currentPath: p.active ?? "",
3669
+ onNavigate: p.pick,
3670
+ title: "Labs",
3671
+ icon: "globe",
3672
+ defaultExpanded: g,
3673
+ className: "absolute! left-4 right-4 top-[140px] h-[180px]! w-auto!"
3674
+ }),
3675
+ /* @__PURE__ */ Q("div", {
3676
+ className: `absolute right-4 ${h ? "left-[100px] top-[140px]" : "left-4 top-[336px]"} bottom-[204px] flex flex-col overflow-y-auto scrollbar-none`,
3677
+ children: b
3678
+ }),
3679
+ y
3680
+ ]
3681
+ }) : /* @__PURE__ */ $(Xn, { children: [
3682
+ /* @__PURE__ */ $("div", {
3683
+ className: `absolute top-6 flex flex-col items-start gap-10 ${h ? "left-[120px]" : "left-6"}`,
3684
+ children: [_, !h && /* @__PURE__ */ Q($n, { items: [
3685
+ "FXR",
3686
+ "Labs",
3687
+ m || "Untitled"
3688
+ ] })]
3689
+ }),
3690
+ /* @__PURE__ */ Q(Ut, { className: "absolute! left-1/2 -translate-x-1/2 top-6" }),
3691
+ /* @__PURE__ */ Q("div", {
3692
+ className: "absolute right-6 top-9",
3693
+ children: v
3694
+ }),
3695
+ h ? /* @__PURE__ */ Q(oa, {
3696
+ items: p.items,
3697
+ active: p.active,
3698
+ onPick: p.pick,
3699
+ className: "absolute! left-6 top-6 bottom-[120px] !h-auto"
3700
+ }) : /* @__PURE__ */ Q(Rn, {
3701
+ variant: "float",
3702
+ items: p.items,
3703
+ currentPath: p.active ?? "",
3704
+ onNavigate: p.pick,
3705
+ title: "Labs",
3706
+ icon: "globe",
3707
+ defaultExpanded: g,
3708
+ className: "absolute! left-6 top-[188px] bottom-[124px] !h-auto"
3709
+ }),
3710
+ /* @__PURE__ */ Q("div", {
3711
+ className: "absolute right-6 top-[108px] bottom-6 flex flex-col",
3712
+ children: b
3713
+ }),
3714
+ /* @__PURE__ */ Q("div", {
3715
+ className: "absolute left-6 bottom-[35px] w-[418px] h-[66px] [transform:translateZ(0)] [&_.kol-mobile-tabbar]:!flex",
3716
+ children: y
3717
+ })
3718
+ ] })]
3719
+ })]
3720
+ });
3721
+ }
3722
+ function ca({ variant: e = "editor" }) {
3723
+ return /* @__PURE__ */ $(fn, {
3724
+ draftKey: Li,
3725
+ children: [/* @__PURE__ */ Q(sa, { variant: e }), /* @__PURE__ */ Q(St, {})]
3380
3726
  });
3381
3727
  }
3382
3728
  //#endregion
3383
- export { bt as AppSettingsSections, Tt as BRAND, xn as DesignEditor, xn as default, jt as DisplaySettingsDrawer, ln as EditorProviders, Mt as FilesDialog, un as FloatDesignEditor, Be as GeneratorLibraryProvider, Ci as LABS_DRAFT_KEY, Fe as LIBRARY_SLOT_KEYS, wi as LabsView, vn as MODES, Hi as MobileView, Yt as OutputCanvas, Qt as OutputStage, mn as OutputView, qt as RAIL_EXTRA_PREFIX, pt as TimelineRail, ze as UnauthorizedError, Gt as VIEW_PATHS, an as closeFiles, Pt as comboLabel, _n as copyStored, pn as currentView, nn as duplicateStored, Le as getLibraryApi, Pe as inviteFromRequest, Ht as isMobileDevice, ke as listInviteRequests, je as loadLibrary, Ve as mintInvite, kt as openFiles, Ie as readLibraryRaw, b as registerPack, Wt as removeStored, fn as renameStored, We as requestInvite, Ae as setLibraryApi, Kt as setMediaClient, Dn as setMediaProxyBase, wn as setMode, $t as setNavigator, sn as setRailExtras, k as setSettingsStore, yn as setThumbStored, gt as setWantsDesktop, vt as shortcutsBySection, Ue as signInLibrary, De as signOutLibrary, Te as signUpLibrary, Me as subscribeLibrary, mt as timelineView, He as updateAccount, Oe as useAccount, At as useFilesDialog, Ne as useGeneratorLibrary, Ee as useLibrarySession, Cn as useRailExtras, on as useSettingsSections, dn as wantsDesktop, hn as withView };
3729
+ export { kt as AppSettingsSections, Rt as BRAND, Tn as DesignEditor, Tn as default, At as DisplaySettingsDrawer, fn as EditorProviders, Pn as FilesDialog, mn as FloatDesignEditor, ca as FloatLabsView, ze as GeneratorLibraryProvider, Li as LABS_DRAFT_KEY, Ve as LIBRARY_SLOT_KEYS, Ri as LabsView, Yt as MODES, na as MobileView, Xt as OutputCanvas, $t as OutputStage, vn as OutputView, Jt as RAIL_EXTRA_PREFIX, pt as TimelineRail, We as UnauthorizedError, On as VIEW_PATHS, Tt as closeFiles, Lt as comboLabel, xn as copyStored, Zt as currentView, on as duplicateStored, Pe as getLibraryApi, je as inviteFromRequest, hn as isMobileDevice, Ee as listInviteRequests, Be as loadLibrary, Ue as mintInvite, Ot as openFiles, Ie as readLibraryRaw, d as registerPack, Gt as removeStored, gn as renameStored, Me as requestInvite, Oe as setLibraryApi, It as setMediaClient, xt as setMediaProxyBase, an as setMode, Wt as setNavigator, un as setRailExtras, x as setSettingsStore, Cn as setThumbStored, sn as setWantsDesktop, Ct as shortcutsBySection, De as signInLibrary, Ae as signOutLibrary, Re as signUpLibrary, Ne as subscribeLibrary, mt as timelineView, Te as updateAccount, Le as useAccount, Pt as useFilesDialog, He as useGeneratorLibrary, ke as useLibrarySession, Dn as useRailExtras, Mt as useSettingsSections, wn as wantsDesktop, An as withView };