@pixerate/editor 0.117.0 → 0.118.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.
@@ -2167,7 +2167,24 @@ function renderText(node, defs, filters, idPrefix) {
2167
2167
  spans
2168
2168
  };
2169
2169
  }
2170
+ var renderCache = /* @__PURE__ */ new WeakMap();
2170
2171
  function renderNode(stored, defs, filters, idPrefix) {
2172
+ const gen = _chunkFODKPD44cjs.vectorTextShaperGeneration.call(void 0, );
2173
+ let byPrefix = renderCache.get(stored);
2174
+ const hit = _optionalChain([byPrefix, 'optionalAccess', _62 => _62.get, 'call', _63 => _63(idPrefix)]);
2175
+ if (hit && hit.gen === gen) {
2176
+ defs.push(...hit.defs);
2177
+ filters.push(...hit.filters);
2178
+ return hit.node;
2179
+ }
2180
+ const d0 = defs.length;
2181
+ const f0 = filters.length;
2182
+ const node = renderNodeFresh(stored, defs, filters, idPrefix);
2183
+ if (!byPrefix) renderCache.set(stored, byPrefix = /* @__PURE__ */ new Map());
2184
+ byPrefix.set(idPrefix, { gen, node, defs: defs.slice(d0), filters: filters.slice(f0) });
2185
+ return node;
2186
+ }
2187
+ function renderNodeFresh(stored, defs, filters, idPrefix) {
2171
2188
  if (stored.visible === false) return null;
2172
2189
  if (stored.type === "text" && !_chunkFODKPD44cjs.vectorTextHasOutlines.call(void 0, )) return renderText(stored, defs, filters, idPrefix);
2173
2190
  const node = _chunkFODKPD44cjs.expandVectorAppearance.call(void 0, stored);
@@ -2202,13 +2219,13 @@ function renderNode(stored, defs, filters, idPrefix) {
2202
2219
  const stroke2 = layers.filter((l) => l.kind === "stroke").at(-1);
2203
2220
  return {
2204
2221
  ...common,
2205
- fill: _nullishCoalesce(_optionalChain([fill2, 'optionalAccess', _62 => _62.fill]), () => ( "none")),
2206
- stroke: _nullishCoalesce(_optionalChain([stroke2, 'optionalAccess', _63 => _63.stroke]), () => ( "none")),
2207
- strokeWidth: _nullishCoalesce(_nullishCoalesce(_optionalChain([stroke2, 'optionalAccess', _64 => _64.strokeWidth]), () => ( node.strokeWidth)), () => ( 1)),
2208
- ..._optionalChain([stroke2, 'optionalAccess', _65 => _65.strokeLinecap]) ? { strokeLinecap: stroke2.strokeLinecap } : {},
2209
- ..._optionalChain([stroke2, 'optionalAccess', _66 => _66.strokeLinejoin]) ? { strokeLinejoin: stroke2.strokeLinejoin } : {},
2210
- ..._optionalChain([stroke2, 'optionalAccess', _67 => _67.strokeDasharray]) ? { strokeDasharray: stroke2.strokeDasharray } : {},
2211
- ..._optionalChain([stroke2, 'optionalAccess', _68 => _68.strokeParts]) ? { strokeParts: stroke2.strokeParts } : {},
2222
+ fill: _nullishCoalesce(_optionalChain([fill2, 'optionalAccess', _64 => _64.fill]), () => ( "none")),
2223
+ stroke: _nullishCoalesce(_optionalChain([stroke2, 'optionalAccess', _65 => _65.stroke]), () => ( "none")),
2224
+ strokeWidth: _nullishCoalesce(_nullishCoalesce(_optionalChain([stroke2, 'optionalAccess', _66 => _66.strokeWidth]), () => ( node.strokeWidth)), () => ( 1)),
2225
+ ..._optionalChain([stroke2, 'optionalAccess', _67 => _67.strokeLinecap]) ? { strokeLinecap: stroke2.strokeLinecap } : {},
2226
+ ..._optionalChain([stroke2, 'optionalAccess', _68 => _68.strokeLinejoin]) ? { strokeLinejoin: stroke2.strokeLinejoin } : {},
2227
+ ..._optionalChain([stroke2, 'optionalAccess', _69 => _69.strokeDasharray]) ? { strokeDasharray: stroke2.strokeDasharray } : {},
2228
+ ..._optionalChain([stroke2, 'optionalAccess', _70 => _70.strokeParts]) ? { strokeParts: stroke2.strokeParts } : {},
2212
2229
  layers
2213
2230
  };
2214
2231
  }
@@ -2234,13 +2251,64 @@ function renderMask(group, defs, filters, idPrefix) {
2234
2251
  const source = renderNode(group.children[0], defs, filters, idPrefix);
2235
2252
  return { ...mask, nodes: source ? [source] : [] };
2236
2253
  }
2254
+ var collapsedCache = /* @__PURE__ */ new WeakMap();
2255
+ function collapsedNode(node, box, prefix) {
2256
+ let byPrefix = collapsedCache.get(node);
2257
+ if (_optionalChain([byPrefix, 'optionalAccess', _71 => _71.has, 'call', _72 => _72(prefix)])) return byPrefix.get(prefix);
2258
+ let fill = null;
2259
+ const look = (n2) => {
2260
+ if (fill || n2.visible === false) return;
2261
+ if (n2.type === "path" || n2.type === "text") {
2262
+ const f = n2.fill;
2263
+ if (typeof f === "string" && f !== "none") fill = f;
2264
+ else if (_chunkFODKPD44cjs.isVectorGradient.call(void 0, f)) fill = _nullishCoalesce(_optionalChain([f, 'access', _73 => _73.stops, 'access', _74 => _74[0], 'optionalAccess', _75 => _75.color]), () => ( null));
2265
+ } else if (n2.type === "group") n2.children.forEach(look);
2266
+ else if (n2.type === "instance") (_nullishCoalesce(n2.art, () => ( []))).forEach(look);
2267
+ };
2268
+ look(node);
2269
+ const out = fill ? { kind: "path", id: node.id, d: `M${fmt2(box.minX)} ${fmt2(box.minY)}H${fmt2(box.maxX)}V${fmt2(box.maxY)}H${fmt2(box.minX)}Z`, fill, stroke: "none", strokeWidth: 0, fillRule: "nonzero", opacity: _nullishCoalesce(node.opacity, () => ( 1)) } : null;
2270
+ if (!byPrefix) collapsedCache.set(node, byPrefix = /* @__PURE__ */ new Map());
2271
+ byPrefix.set(prefix, out);
2272
+ return out;
2273
+ }
2237
2274
  function getVectorSceneRenderData(state, options = {}) {
2238
2275
  const defs = [];
2239
2276
  const filters = [];
2240
2277
  const prefix = _nullishCoalesce(options.idPrefix, () => ( "ve-"));
2241
- const nodes = state.document.nodes.map((n2) => renderNode(n2, defs, filters, prefix)).filter((n2) => !!n2);
2242
2278
  const v = state.viewport;
2279
+ const all = state.document.nodes;
2280
+ const stats = { nodes: all.length, culled: 0, collapsed: 0 };
2281
+ let nodes;
2282
+ const size = options.viewportSize;
2283
+ if (size && size.width > 0 && size.height > 0 && v.zoom > 0) {
2284
+ const z = v.zoom;
2285
+ const pad = 2 / z;
2286
+ const view = { minX: -v.x / z - pad, minY: -v.y / z - pad, maxX: (size.width - v.x) / z + pad, maxY: (size.height - v.y) / z + pad };
2287
+ const lod = _nullishCoalesce(options.lod, () => ( 2));
2288
+ const near = _chunkFODKPD44cjs.vectorNodesNear.call(void 0, all, { x: view.minX, y: view.minY, width: view.maxX - view.minX, height: view.maxY - view.minY });
2289
+ stats.culled = all.length - near.length;
2290
+ nodes = [];
2291
+ for (const i of near) {
2292
+ const n2 = all[i];
2293
+ const box = _chunkFODKPD44cjs.vectorNodePaintBox.call(void 0, n2);
2294
+ if (box && (box.maxX < view.minX || box.minX > view.maxX || box.maxY < view.minY || box.minY > view.maxY)) {
2295
+ stats.culled++;
2296
+ continue;
2297
+ }
2298
+ if (box && lod > 0 && n2.type !== "path" && n2.visible !== false && Math.max(box.maxX - box.minX, box.maxY - box.minY) * z < lod) {
2299
+ const c = collapsedNode(n2, box, prefix);
2300
+ if (c) {
2301
+ stats.collapsed++;
2302
+ nodes.push(c);
2303
+ continue;
2304
+ }
2305
+ }
2306
+ const r = renderNode(n2, defs, filters, prefix);
2307
+ if (r) nodes.push(r);
2308
+ }
2309
+ } else nodes = all.map((n2) => renderNode(n2, defs, filters, prefix)).filter((n2) => !!n2);
2243
2310
  return {
2311
+ stats,
2244
2312
  transform: `translate(${fmt2(v.x)} ${fmt2(v.y)}) scale(${v.zoom})`,
2245
2313
  width: state.document.width,
2246
2314
  height: state.document.height,
@@ -2305,13 +2373,13 @@ function shadingOverlay(state) {
2305
2373
  }
2306
2374
  function connectorSiteOverlay(state) {
2307
2375
  if (state.tool !== "connector" || !state.pointer) return [];
2308
- const drawing = _optionalChain([state, 'access', _69 => _69.interaction, 'optionalAccess', _70 => _70.type]) === "draw" && state.interaction.tool === "connector" ? state.interaction.nodeId : void 0;
2376
+ const drawing = _optionalChain([state, 'access', _76 => _76.interaction, 'optionalAccess', _77 => _77.type]) === "draw" && state.interaction.tool === "connector" ? state.interaction.nodeId : void 0;
2309
2377
  const nodes = state.document.nodes;
2310
2378
  const target = _chunkFODKPD44cjs.vectorConnectorTargetAt.call(void 0, nodes, state.pointer, 12 / state.viewport.zoom, drawing);
2311
2379
  if (!target) return [];
2312
2380
  return _chunkFODKPD44cjs.vectorConnectionSites.call(void 0, nodes, target.nodeId).map((site) => {
2313
2381
  const p = toScreen(state, site);
2314
- return { nodeId: target.nodeId, side: site.side, x: p.x, y: p.y, active: _optionalChain([target, 'access', _71 => _71.site, 'optionalAccess', _72 => _72.side]) === site.side };
2382
+ return { nodeId: target.nodeId, side: site.side, x: p.x, y: p.y, active: _optionalChain([target, 'access', _78 => _78.site, 'optionalAccess', _79 => _79.side]) === site.side };
2315
2383
  });
2316
2384
  }
2317
2385
  function frameLabels(state) {
@@ -2325,14 +2393,14 @@ function frameLabels(state) {
2325
2393
  return out;
2326
2394
  }
2327
2395
  function constraintOverlay(state) {
2328
- if (!_optionalChain([state, 'access', _73 => _73.document, 'access', _74 => _74.constraints, 'optionalAccess', _75 => _75.length])) return [];
2396
+ if (!_optionalChain([state, 'access', _80 => _80.document, 'access', _81 => _81.constraints, 'optionalAccess', _82 => _82.length])) return [];
2329
2397
  const ids = /* @__PURE__ */ new Set([...state.selection, ...state.editingId ? [state.editingId] : [], ...state.selectedAnchors.map((a) => a.nodeId)]);
2330
2398
  for (const id of [...ids]) {
2331
2399
  const n2 = _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id);
2332
- if (_optionalChain([n2, 'optionalAccess', _76 => _76.type]) === "group") _chunkFODKPD44cjs.walkVectorNodes.call(void 0, n2.children, (c) => ids.add(c.id));
2400
+ if (_optionalChain([n2, 'optionalAccess', _83 => _83.type]) === "group") _chunkFODKPD44cjs.walkVectorNodes.call(void 0, n2.children, (c) => ids.add(c.id));
2333
2401
  }
2334
2402
  if (!ids.size) return [];
2335
- const conflicts = new Set(_nullishCoalesce(_optionalChain([state, 'access', _77 => _77.constraintIssues, 'optionalAccess', _78 => _78.conflicts]), () => ( [])));
2403
+ const conflicts = new Set(_nullishCoalesce(_optionalChain([state, 'access', _84 => _84.constraintIssues, 'optionalAccess', _85 => _85.conflicts]), () => ( [])));
2336
2404
  return vectorConstraintGlyphs(state.document, ids).map((g) => {
2337
2405
  const at = toScreen(state, g.at);
2338
2406
  const d = g.dimension ? { a: toScreen(state, g.dimension.a), b: toScreen(state, g.dimension.b) } : null;
@@ -2341,10 +2409,10 @@ function constraintOverlay(state) {
2341
2409
  }
2342
2410
  function textOverlay(state) {
2343
2411
  const edit = state.textEdit;
2344
- const id = _nullishCoalesce(_optionalChain([edit, 'optionalAccess', _79 => _79.nodeId]), () => ( (state.tool === "type" || state.tool === "typePath" ? state.selection.find((s) => _optionalChain([_chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, s), 'optionalAccess', _80 => _80.type]) === "text") : void 0)));
2412
+ const id = _nullishCoalesce(_optionalChain([edit, 'optionalAccess', _86 => _86.nodeId]), () => ( (state.tool === "type" || state.tool === "typePath" ? state.selection.find((s) => _optionalChain([_chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, s), 'optionalAccess', _87 => _87.type]) === "text") : void 0)));
2345
2413
  if (!id) return null;
2346
2414
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id);
2347
- if (_optionalChain([node, 'optionalAccess', _81 => _81.type]) !== "text") return null;
2415
+ if (_optionalChain([node, 'optionalAccess', _88 => _88.type]) !== "text") return null;
2348
2416
  const world = _nullishCoalesce(_chunkFODKPD44cjs.vectorWorldMatrix.call(void 0, state.document.nodes, id), () => ( _chunkFODKPD44cjs.IDENTITY_MATRIX));
2349
2417
  const v = state.viewport;
2350
2418
  const m = _chunkFODKPD44cjs.multiplyMatrices.call(void 0, world, [v.zoom, 0, 0, v.zoom, v.x, v.y]);
@@ -2394,9 +2462,9 @@ function getVectorOverlayRenderData(state) {
2394
2462
  };
2395
2463
  for (const id of state.selection) outline(id, true);
2396
2464
  if (state.editingId) outline(state.editingId, true);
2397
- if (_optionalChain([state, 'access', _82 => _82.hover, 'optionalAccess', _83 => _83.nodeId]) && !state.interaction) outline(state.hover.nodeId, false);
2465
+ if (_optionalChain([state, 'access', _89 => _89.hover, 'optionalAccess', _90 => _90.nodeId]) && !state.interaction) outline(state.hover.nodeId, false);
2398
2466
  let selectionBox = null;
2399
- if (state.tool === "select" && state.selectionFrame && _optionalChain([state, 'access', _84 => _84.interaction, 'optionalAccess', _85 => _85.type]) !== "marquee" && _optionalChain([state, 'access', _86 => _86.interaction, 'optionalAccess', _87 => _87.type]) !== "distort") {
2467
+ if (state.tool === "select" && state.selectionFrame && _optionalChain([state, 'access', _91 => _91.interaction, 'optionalAccess', _92 => _92.type]) !== "marquee" && _optionalChain([state, 'access', _93 => _93.interaction, 'optionalAccess', _94 => _94.type]) !== "distort") {
2400
2468
  const g = getVectorSelectionBoxGeometry(state.selectionFrame, state.viewport);
2401
2469
  selectionBox = { ...g.box, angle: g.angle, transform: g.transform, corners: g.corners, handles: g.handles, freeDistort: state.freeDistort };
2402
2470
  }
@@ -2406,9 +2474,9 @@ function getVectorOverlayRenderData(state) {
2406
2474
  const a = getAnchorWorld(doc, ref);
2407
2475
  const s = toScreen(state, a);
2408
2476
  const closes = !!state.pen && state.pen.nodeId === ref.nodeId && state.pen.subpath === ref.subpath && ref.index === 0;
2409
- return { ref, x: s.x, y: s.y, type: _nullishCoalesce(a.type, () => ( _chunkFODKPD44cjs.inferAnchorType.call(void 0, a))), selected: selected(ref), hovered: sameAnchor(_optionalChain([state, 'access', _88 => _88.hover, 'optionalAccess', _89 => _89.anchor]), ref), closes };
2477
+ return { ref, x: s.x, y: s.y, type: _nullishCoalesce(a.type, () => ( _chunkFODKPD44cjs.inferAnchorType.call(void 0, a))), selected: selected(ref), hovered: sameAnchor(_optionalChain([state, 'access', _95 => _95.hover, 'optionalAccess', _96 => _96.anchor]), ref), closes };
2410
2478
  });
2411
- if (state.tool === "pen" && !state.pen && _optionalChain([state, 'access', _90 => _90.hover, 'optionalAccess', _91 => _91.anchor])) {
2479
+ if (state.tool === "pen" && !state.pen && _optionalChain([state, 'access', _97 => _97.hover, 'optionalAccess', _98 => _98.anchor])) {
2412
2480
  const a = getAnchorWorld(doc, state.hover.anchor);
2413
2481
  if (a) {
2414
2482
  const s = toScreen(state, a);
@@ -2417,15 +2485,15 @@ function getVectorOverlayRenderData(state) {
2417
2485
  }
2418
2486
  const handles = getVisibleHandles(state).flatMap((ref) => {
2419
2487
  const a = getAnchorWorld(doc, ref);
2420
- const h = _optionalChain([a, 'optionalAccess', _92 => _92[ref.handle]]);
2488
+ const h = _optionalChain([a, 'optionalAccess', _99 => _99[ref.handle]]);
2421
2489
  if (!a || !h) return [];
2422
2490
  const s = toScreen(state, h);
2423
2491
  const sa = toScreen(state, a);
2424
- const hovered = !!_optionalChain([state, 'access', _93 => _93.hover, 'optionalAccess', _94 => _94.handle]) && sameAnchor(state.hover.handle, ref) && state.hover.handle.handle === ref.handle;
2492
+ const hovered = !!_optionalChain([state, 'access', _100 => _100.hover, 'optionalAccess', _101 => _101.handle]) && sameAnchor(state.hover.handle, ref) && state.hover.handle.handle === ref.handle;
2425
2493
  return [{ ref, x: s.x, y: s.y, anchorX: sa.x, anchorY: sa.y, hovered }];
2426
2494
  });
2427
2495
  let marquee = null;
2428
- if (_optionalChain([state, 'access', _95 => _95.interaction, 'optionalAccess', _96 => _96.type]) === "marquee") {
2496
+ if (_optionalChain([state, 'access', _102 => _102.interaction, 'optionalAccess', _103 => _103.type]) === "marquee") {
2429
2497
  const b = state.interaction.bounds;
2430
2498
  const tl = toScreen(state, b);
2431
2499
  marquee = { x: tl.x, y: tl.y, width: b.width * z, height: b.height * z };
@@ -2433,7 +2501,7 @@ function getVectorOverlayRenderData(state) {
2433
2501
  let penPreview = null;
2434
2502
  if (state.tool === "pen" && state.pen && state.pointer && !state.interaction) {
2435
2503
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, state.pen.nodeId);
2436
- const sp = _optionalChain([node, 'optionalAccess', _97 => _97.type]) === "path" ? node.subpaths[state.pen.subpath] : void 0;
2504
+ const sp = _optionalChain([node, 'optionalAccess', _104 => _104.type]) === "path" ? node.subpaths[state.pen.subpath] : void 0;
2437
2505
  const last = sp ? getAnchorWorld(doc, { nodeId: state.pen.nodeId, subpath: state.pen.subpath, index: sp.anchors.length - 1 }) : void 0;
2438
2506
  if (last) {
2439
2507
  const a = toScreen(state, last);
@@ -2454,9 +2522,9 @@ function getVectorOverlayRenderData(state) {
2454
2522
  }
2455
2523
  let status = null;
2456
2524
  const it = state.interaction;
2457
- if (_optionalChain([it, 'optionalAccess', _98 => _98.type]) === "rotate") status = `${Math.round(it.angle)}\xB0`;
2458
- else if (_optionalChain([it, 'optionalAccess', _99 => _99.type]) === "move" || _optionalChain([it, 'optionalAccess', _100 => _100.type]) === "anchors") status = `\u0394 ${fmt2(it.dx)}, ${fmt2(it.dy)}`;
2459
- else if (_optionalChain([it, 'optionalAccess', _101 => _101.type]) === "scale" || _optionalChain([it, 'optionalAccess', _102 => _102.type]) === "draw") {
2525
+ if (_optionalChain([it, 'optionalAccess', _105 => _105.type]) === "rotate") status = `${Math.round(it.angle)}\xB0`;
2526
+ else if (_optionalChain([it, 'optionalAccess', _106 => _106.type]) === "move" || _optionalChain([it, 'optionalAccess', _107 => _107.type]) === "anchors") status = `\u0394 ${fmt2(it.dx)}, ${fmt2(it.dy)}`;
2527
+ else if (_optionalChain([it, 'optionalAccess', _108 => _108.type]) === "scale" || _optionalChain([it, 'optionalAccess', _109 => _109.type]) === "draw") {
2460
2528
  const b = it.type === "draw" ? _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, it.nodeId) ? _chunkFODKPD44cjs.vectorNodeBounds.call(void 0, _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, it.nodeId)) : null : state.selectionFrame;
2461
2529
  if (b) status = `W ${fmt2(b.width)} \xD7 H ${fmt2(b.height)}`;
2462
2530
  }
@@ -2473,24 +2541,24 @@ function getVectorOverlayRenderData(state) {
2473
2541
  }
2474
2542
  }
2475
2543
  let toolStroke = null;
2476
- if (_optionalChain([it, 'optionalAccess', _103 => _103.type]) === "stroke") {
2544
+ if (_optionalChain([it, 'optionalAccess', _110 => _110.type]) === "stroke") {
2477
2545
  const pts = it.points.map((q) => toScreen(state, q));
2478
2546
  const d = pts.map((q, i) => `${i ? "L" : "M"}${fmt2(q.x)} ${fmt2(q.y)}`).join("") + (pts.length === 1 ? `L${fmt2(pts[0].x)} ${fmt2(pts[0].y)}` : "");
2479
2547
  toolStroke = { tool: it.tool, d, width: fmt2(it.width * z) };
2480
2548
  }
2481
2549
  let pencilString = null;
2482
- if (_optionalChain([it, 'optionalAccess', _104 => _104.type]) === "draw" && it.string) {
2550
+ if (_optionalChain([it, 'optionalAccess', _111 => _111.type]) === "draw" && it.string) {
2483
2551
  const a = toScreen(state, it.string[0]);
2484
2552
  const b = toScreen(state, it.string[1]);
2485
2553
  pencilString = { x1: fmt2(a.x), y1: fmt2(a.y), x2: fmt2(b.x), y2: fmt2(b.y) };
2486
2554
  }
2487
- const dragged = _optionalChain([it, 'optionalAccess', _105 => _105.type]) === "corner" ? it.ref : null;
2555
+ const dragged = _optionalChain([it, 'optionalAccess', _112 => _112.type]) === "corner" ? it.ref : null;
2488
2556
  const cornerWidgets = getVectorCornerWidgets(state).map((w) => {
2489
2557
  const s = toScreen(state, w);
2490
- return { ref: w.ref, x: fmt2(s.x), y: fmt2(s.y), radius: w.radius, kind: w.kind, hovered: sameAnchor(_optionalChain([state, 'access', _106 => _106.hover, 'optionalAccess', _107 => _107.corner]), w.ref), active: !!dragged };
2558
+ return { ref: w.ref, x: fmt2(s.x), y: fmt2(s.y), radius: w.radius, kind: w.kind, hovered: sameAnchor(_optionalChain([state, 'access', _113 => _113.hover, 'optionalAccess', _114 => _114.corner]), w.ref), active: !!dragged };
2491
2559
  });
2492
- if (_optionalChain([it, 'optionalAccess', _108 => _108.type]) === "corner") status = `R ${fmt2(it.radius)}`;
2493
- const cutPoint = state.tool === "scissors" && _optionalChain([state, 'access', _109 => _109.hover, 'optionalAccess', _110 => _110.segment]) && !it ? (({ x, y }) => ({ x: fmt2(x), y: fmt2(y) }))(toScreen(state, state.hover.segment.point)) : null;
2560
+ if (_optionalChain([it, 'optionalAccess', _115 => _115.type]) === "corner") status = `R ${fmt2(it.radius)}`;
2561
+ const cutPoint = state.tool === "scissors" && _optionalChain([state, 'access', _116 => _116.hover, 'optionalAccess', _117 => _117.segment]) && !it ? (({ x, y }) => ({ x: fmt2(x), y: fmt2(y) }))(toScreen(state, state.hover.segment.point)) : null;
2494
2562
  const sc = (p) => {
2495
2563
  const q = toScreen(state, p);
2496
2564
  return { x: fmt2(q.x), y: fmt2(q.y) };
@@ -2498,13 +2566,13 @@ function getVectorOverlayRenderData(state) {
2498
2566
  const sameWidth = (a, b) => !!a && a.nodeId === b.nodeId && a.index === b.index;
2499
2567
  const widthPoints = getVectorWidthHandles(state).map((h) => {
2500
2568
  const c = sc(h);
2501
- const hw = _optionalChain([state, 'access', _111 => _111.hover, 'optionalAccess', _112 => _112.widthPoint]);
2569
+ const hw = _optionalChain([state, 'access', _118 => _118.hover, 'optionalAccess', _119 => _119.widthPoint]);
2502
2570
  const hovered = hw && sameWidth(hw, h.ref) && hw.subpath === h.ref.subpath ? hw.part : null;
2503
- return { ref: h.ref, x: c.x, y: c.y, left: sc(h.left), right: sc(h.right), selected: h.selected, hovered, active: _optionalChain([it, 'optionalAccess', _113 => _113.type]) === "width" && sameWidth(it.ref, h.ref) };
2571
+ return { ref: h.ref, x: c.x, y: c.y, left: sc(h.left), right: sc(h.right), selected: h.selected, hovered, active: _optionalChain([it, 'optionalAccess', _120 => _120.type]) === "width" && sameWidth(it.ref, h.ref) };
2504
2572
  });
2505
- const spot = state.tool === "width" && !it ? _optionalChain([state, 'access', _114 => _114.hover, 'optionalAccess', _115 => _115.strokeSpot]) : null;
2573
+ const spot = state.tool === "width" && !it ? _optionalChain([state, 'access', _121 => _121.hover, 'optionalAccess', _122 => _122.strokeSpot]) : null;
2506
2574
  const widthSpot = spot ? { ...sc(spot.point), left: sc(spot.left), right: sc(spot.right) } : null;
2507
- if (_optionalChain([it, 'optionalAccess', _116 => _116.type]) === "width") status = it.mode === "move" ? "Move width point" : it.mode === "copy" ? "Copy width point" : `W ${fmt2(it.width)}`;
2575
+ if (_optionalChain([it, 'optionalAccess', _123 => _123.type]) === "width") status = it.mode === "move" ? "Move width point" : it.mode === "copy" ? "Copy width point" : `W ${fmt2(it.width)}`;
2508
2576
  let builder = null;
2509
2577
  if (state.builder) {
2510
2578
  const v = state.viewport;
@@ -2520,7 +2588,7 @@ function getVectorOverlayRenderData(state) {
2520
2588
  lines: state.builder.lines.map((l) => svg(_chunkXGD3FSNCcjs.transformBezierPath.call(void 0, l, view))),
2521
2589
  trail
2522
2590
  };
2523
- if (state.builder.mode !== "fill" && _optionalChain([it, 'optionalAccess', _117 => _117.type]) === "builder") {
2591
+ if (state.builder.mode !== "fill" && _optionalChain([it, 'optionalAccess', _124 => _124.type]) === "builder") {
2524
2592
  const n2 = state.builder.faces.length;
2525
2593
  status = state.builder.mode === "erase" ? `Delete ${n2} ${n2 === 1 ? "face" : "faces"}` : `Merge ${n2} ${n2 === 1 ? "face" : "faces"}`;
2526
2594
  }
@@ -2531,10 +2599,10 @@ function getVectorOverlayRenderData(state) {
2531
2599
  if (state.tool === "gradient") {
2532
2600
  gradient = gradientOverlay(state);
2533
2601
  if (!gradient && !it) status = "Drag across a shape to set a gradient";
2534
- else if (_optionalChain([it, 'optionalAccess', _118 => _118.type]) === "gradient" && it.removing) status = "Release to delete the stop";
2602
+ else if (_optionalChain([it, 'optionalAccess', _125 => _125.type]) === "gradient" && it.removing) status = "Release to delete the stop";
2535
2603
  }
2536
2604
  let distort = null;
2537
- if (_optionalChain([it, 'optionalAccess', _119 => _119.type]) === "distort") {
2605
+ if (_optionalChain([it, 'optionalAccess', _126 => _126.type]) === "distort") {
2538
2606
  const corners2 = it.corners.map(sc);
2539
2607
  distort = { mode: it.mode, corners: corners2, d: corners2.map((c, i) => `${i ? "L" : "M"}${c.x} ${c.y}`).join("") + "Z" };
2540
2608
  status = it.mode === "skew" ? "Skew" : it.mode === "perspective" ? "Perspective" : "Distort";
@@ -2542,7 +2610,7 @@ function getVectorOverlayRenderData(state) {
2542
2610
  const envelope = state.tool === "envelope" ? envelopeOverlay(state) : null;
2543
2611
  if (state.tool === "envelope" && !envelope && !it) status = "Select an object with an envelope to edit its mesh";
2544
2612
  let textBox = null;
2545
- if (_optionalChain([state, 'access', _120 => _120.interaction, 'optionalAccess', _121 => _121.type]) === "textBox") {
2613
+ if (_optionalChain([state, 'access', _127 => _127.interaction, 'optionalAccess', _128 => _128.type]) === "textBox") {
2546
2614
  const b = state.interaction.bounds;
2547
2615
  const tl = toScreen(state, b);
2548
2616
  textBox = { x: tl.x, y: tl.y, width: b.width * z, height: b.height * z };
@@ -2618,9 +2686,9 @@ function envelopeOverlay(state) {
2618
2686
  const [a, b, cc, d] = c.map(sc);
2619
2687
  return `M${a.x} ${a.y}C${b.x} ${b.y} ${cc.x} ${cc.y} ${d.x} ${d.y}`;
2620
2688
  }).join("");
2621
- const hover = _optionalChain([state, 'access', _122 => _122.hover, 'optionalAccess', _123 => _123.envelope, 'optionalAccess', _124 => _124.nodeId]) === target.node.id ? state.hover.envelope.index : void 0;
2689
+ const hover = _optionalChain([state, 'access', _129 => _129.hover, 'optionalAccess', _130 => _130.envelope, 'optionalAccess', _131 => _131.nodeId]) === target.node.id ? state.hover.envelope.index : void 0;
2622
2690
  const it = state.interaction;
2623
- const active = _optionalChain([it, 'optionalAccess', _125 => _125.type]) === "envelope" && it.nodeId === target.node.id ? it.index : void 0;
2691
+ const active = _optionalChain([it, 'optionalAccess', _132 => _132.type]) === "envelope" && it.nodeId === target.node.id ? it.index : void 0;
2624
2692
  const pts = _chunkFODKPD44cjs.warpMeshEditPoints.call(void 0, mesh);
2625
2693
  return {
2626
2694
  nodeId: target.node.id,
@@ -2640,27 +2708,27 @@ function getVectorEnvelopePanel(state) {
2640
2708
  const nodes = state.selection.map((id) => _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id)).filter((n2) => !!n2 && !n2.blendStep);
2641
2709
  if (!nodes.length) return null;
2642
2710
  const one = nodes.length === 1 ? nodes[0] : null;
2643
- const first = _optionalChain([one, 'optionalAccess', _126 => _126.effects, 'optionalAccess', _127 => _127.find, 'call', _128 => _128((e) => e.type === "envelope")]);
2711
+ const first = _optionalChain([one, 'optionalAccess', _133 => _133.effects, 'optionalAccess', _134 => _134.find, 'call', _135 => _135((e) => e.type === "envelope")]);
2644
2712
  const order = /* @__PURE__ */ new Map();
2645
2713
  _chunkFODKPD44cjs.walkVectorNodes.call(void 0, state.document.nodes, (n2) => order.set(n2.id, order.size));
2646
2714
  const top = nodes.length > 1 ? nodes.slice().sort((a, b) => (_nullishCoalesce(order.get(a.id), () => ( 0))) - (_nullishCoalesce(order.get(b.id), () => ( 0))))[nodes.length - 1] : null;
2647
2715
  return {
2648
- nodeId: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _129 => _129.id]), () => ( null)),
2716
+ nodeId: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _136 => _136.id]), () => ( null)),
2649
2717
  count: nodes.length,
2650
- envelope: _optionalChain([first, 'optionalAccess', _130 => _130.type]) === "envelope" ? { effectId: first.id, enabled: first.enabled !== false, params: first.params } : null,
2718
+ envelope: _optionalChain([first, 'optionalAccess', _137 => _137.type]) === "envelope" ? { effectId: first.id, enabled: first.enabled !== false, params: first.params } : null,
2651
2719
  canMake: nodes.some((n2) => !n2.locked),
2652
- canMakeWithTopObject: _optionalChain([top, 'optionalAccess', _131 => _131.type]) === "path" && top.subpaths.some((sp) => sp.closed && sp.anchors.length > 1),
2653
- canRelease: nodes.some((n2) => !n2.locked && !!_optionalChain([n2, 'access', _132 => _132.effects, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((e) => e.type === "envelope")]))
2720
+ canMakeWithTopObject: _optionalChain([top, 'optionalAccess', _138 => _138.type]) === "path" && top.subpaths.some((sp) => sp.closed && sp.anchors.length > 1),
2721
+ canRelease: nodes.some((n2) => !n2.locked && !!_optionalChain([n2, 'access', _139 => _139.effects, 'optionalAccess', _140 => _140.some, 'call', _141 => _141((e) => e.type === "envelope")]))
2654
2722
  };
2655
2723
  }
2656
2724
  function gradientOverlay(state) {
2657
2725
  const a = getVectorGradientAnnotator(state.document, state.selection, state.viewport, state.gradientEdit.target, _nullishCoalesce(state.gradientEdit.layer, () => ( null)));
2658
2726
  if (!a) return null;
2659
- const hover = state.interaction ? null : _optionalChain([state, 'access', _135 => _135.hover, 'optionalAccess', _136 => _136.gradient]);
2660
- const handleHovered = (h) => _optionalChain([hover, 'optionalAccess', _137 => _137.kind]) === "handle" && hover.handle === h;
2727
+ const hover = state.interaction ? null : _optionalChain([state, 'access', _142 => _142.hover, 'optionalAccess', _143 => _143.gradient]);
2728
+ const handleHovered = (h) => _optionalChain([hover, 'optionalAccess', _144 => _144.kind]) === "handle" && hover.handle === h;
2661
2729
  const pt2 = (p) => ({ x: fmt2(p.x), y: fmt2(p.y) });
2662
2730
  const centred = _chunkFODKPD44cjs.isCentredVectorGradient.call(void 0, a.gradient.type);
2663
- const removing = _optionalChain([state, 'access', _138 => _138.interaction, 'optionalAccess', _139 => _139.type]) === "gradient" && !!state.interaction.removing;
2731
+ const removing = _optionalChain([state, 'access', _145 => _145.interaction, 'optionalAccess', _146 => _146.type]) === "gradient" && !!state.interaction.removing;
2664
2732
  return {
2665
2733
  nodeId: a.nodeId,
2666
2734
  type: a.gradient.type,
@@ -2676,9 +2744,9 @@ function gradientOverlay(state) {
2676
2744
  color: s.color,
2677
2745
  opacity: _nullishCoalesce(s.opacity, () => ( 1)),
2678
2746
  selected: state.gradientEdit.stop === s.index,
2679
- hovered: _optionalChain([hover, 'optionalAccess', _140 => _140.kind]) === "stop" && hover.index === s.index
2747
+ hovered: _optionalChain([hover, 'optionalAccess', _147 => _147.kind]) === "stop" && hover.index === s.index
2680
2748
  })),
2681
- midpoints: a.midpoints.map((m) => ({ index: m.index, ...pt2(m), hovered: _optionalChain([hover, 'optionalAccess', _141 => _141.kind]) === "midpoint" && hover.index === m.index })),
2749
+ midpoints: a.midpoints.map((m) => ({ index: m.index, ...pt2(m), hovered: _optionalChain([hover, 'optionalAccess', _148 => _148.kind]) === "midpoint" && hover.index === m.index })),
2682
2750
  extent: a.extent,
2683
2751
  removing
2684
2752
  };
@@ -2687,7 +2755,7 @@ function selectedBlends(state) {
2687
2755
  const out = /* @__PURE__ */ new Map();
2688
2756
  for (const id of state.selection) {
2689
2757
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id);
2690
- const group = isVectorBlendGroup(node) ? node : _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, state.document.nodes, id), 'optionalAccess', _142 => _142.parent]);
2758
+ const group = isVectorBlendGroup(node) ? node : _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, state.document.nodes, id), 'optionalAccess', _149 => _149.parent]);
2691
2759
  if (isVectorBlendGroup(group)) out.set(group.id, group);
2692
2760
  }
2693
2761
  return [...out.values()];
@@ -2719,11 +2787,11 @@ function blendOverlay(state) {
2719
2787
  const a = state.blendStart.anchor === null ? void 0 : getAnchorWorld(doc, { nodeId: from.id, subpath: 0, index: state.blendStart.anchor });
2720
2788
  start = { d: screenOutline(state, from, /* @__PURE__ */ new Set()), anchor: a ? sc(a, view) : null };
2721
2789
  }
2722
- const hovered = _optionalChain([state, 'access', _143 => _143.hover, 'optionalAccess', _144 => _144.nodeId]) ? _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, state.hover.nodeId) : void 0;
2723
- if (_optionalChain([hovered, 'optionalAccess', _145 => _145.type]) === "path" && hovered.subpaths[0]) {
2790
+ const hovered = _optionalChain([state, 'access', _150 => _150.hover, 'optionalAccess', _151 => _151.nodeId]) ? _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, state.hover.nodeId) : void 0;
2791
+ if (_optionalChain([hovered, 'optionalAccess', _152 => _152.type]) === "path" && hovered.subpaths[0]) {
2724
2792
  hovered.subpaths[0].anchors.forEach((_, index) => {
2725
2793
  const a = getAnchorWorld(doc, { nodeId: hovered.id, subpath: 0, index });
2726
- if (a) anchors.push({ ...sc(a, view), hovered: _optionalChain([state, 'access', _146 => _146.hover, 'optionalAccess', _147 => _147.anchor, 'optionalAccess', _148 => _148.index]) === index });
2794
+ if (a) anchors.push({ ...sc(a, view), hovered: _optionalChain([state, 'access', _153 => _153.hover, 'optionalAccess', _154 => _154.anchor, 'optionalAccess', _155 => _155.index]) === index });
2727
2795
  });
2728
2796
  }
2729
2797
  }
@@ -2734,17 +2802,17 @@ function getVectorBlendControls(state) {
2734
2802
  const doc = state.document;
2735
2803
  const roots = state.selection.filter((id) => {
2736
2804
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, id);
2737
- return !!node && !node.blendStep && !node.locked && !state.selection.includes(_nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, doc.nodes, id), 'optionalAccess', _149 => _149.parent, 'optionalAccess', _150 => _150.id]), () => ( "")));
2805
+ return !!node && !node.blendStep && !node.locked && !state.selection.includes(_nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, doc.nodes, id), 'optionalAccess', _156 => _156.parent, 'optionalAccess', _157 => _157.id]), () => ( "")));
2738
2806
  });
2739
- const parents = new Set(roots.map((id) => _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, doc.nodes, id), 'optionalAccess', _151 => _151.parent, 'optionalAccess', _152 => _152.id]), () => ( null))));
2740
- const paths = roots.filter((id) => _optionalChain([_chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, id), 'optionalAccess', _153 => _153.type]) === "path" && !isVectorBlendGroup(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, doc.nodes, id), 'optionalAccess', _154 => _154.parent])));
2807
+ const parents = new Set(roots.map((id) => _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, doc.nodes, id), 'optionalAccess', _158 => _158.parent, 'optionalAccess', _159 => _159.id]), () => ( null))));
2808
+ const paths = roots.filter((id) => _optionalChain([_chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, id), 'optionalAccess', _160 => _160.type]) === "path" && !isVectorBlendGroup(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, doc.nodes, id), 'optionalAccess', _161 => _161.parent])));
2741
2809
  const first = blends[0];
2742
2810
  return {
2743
2811
  ids: blends.map((g) => g.id),
2744
2812
  options: resolveVectorBlendOptions(first ? first.blend : state.blendDefaults),
2745
2813
  canBlend: roots.length >= 2 && parents.size === 1,
2746
2814
  canReplaceSpine: blends.length === 1 && paths.length === 1,
2747
- hasSpine: !!_optionalChain([first, 'optionalAccess', _155 => _155.blend, 'optionalAccess', _156 => _156.spine])
2815
+ hasSpine: !!_optionalChain([first, 'optionalAccess', _162 => _162.blend, 'optionalAccess', _163 => _163.spine])
2748
2816
  };
2749
2817
  }
2750
2818
  function applyVectorBlendOptions(controller, patch) {
@@ -2800,7 +2868,7 @@ function isVectorTextTarget(target) {
2800
2868
  if (!el || typeof el !== "object") return false;
2801
2869
  const tag = (_nullishCoalesce(el.tagName, () => ( ""))).toUpperCase();
2802
2870
  if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
2803
- return !!el.isContentEditable || _optionalChain([el, 'access', _157 => _157.getAttribute, 'optionalCall', _158 => _158("contenteditable")]) === "true";
2871
+ return !!el.isContentEditable || _optionalChain([el, 'access', _164 => _164.getAttribute, 'optionalCall', _165 => _165("contenteditable")]) === "true";
2804
2872
  }
2805
2873
  function getVectorSelectionStyle(state) {
2806
2874
  const paths = [];
@@ -2808,12 +2876,12 @@ function getVectorSelectionStyle(state) {
2808
2876
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id);
2809
2877
  if (node) paths.push(...collect(node));
2810
2878
  }
2811
- const anchorMode = state.tool === "direct" && !!_optionalChain([state, 'access', _159 => _159.selectedAnchors, 'optionalAccess', _160 => _160.length]);
2879
+ const anchorMode = state.tool === "direct" && !!_optionalChain([state, 'access', _166 => _166.selectedAnchors, 'optionalAccess', _167 => _167.length]);
2812
2880
  if (anchorMode) {
2813
2881
  for (const r of state.selectedAnchors) {
2814
2882
  if (paths.some((p) => p.id === r.nodeId)) continue;
2815
2883
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, r.nodeId);
2816
- if (_optionalChain([node, 'optionalAccess', _161 => _161.type]) === "path") paths.push(node);
2884
+ if (_optionalChain([node, 'optionalAccess', _168 => _168.type]) === "path") paths.push(node);
2817
2885
  }
2818
2886
  }
2819
2887
  if (!paths.length) return null;
@@ -2824,7 +2892,7 @@ function getVectorSelectionStyle(state) {
2824
2892
  for (const c of _chunkFODKPD44cjs.vectorCorners.call(void 0, p.subpaths)) {
2825
2893
  if (anchorMode && !state.selectedAnchors.some((r) => r.nodeId === p.id && r.subpath === c.subpath && r.index === c.index)) continue;
2826
2894
  const corner = p.subpaths[c.subpath].anchors[c.index].corner;
2827
- corners2.push({ radius: _nullishCoalesce(_optionalChain([corner, 'optionalAccess', _162 => _162.radius]), () => ( 0)), kind: _nullishCoalesce(_optionalChain([corner, 'optionalAccess', _163 => _163.kind]), () => ( "round")), smoothing: _nullishCoalesce(_optionalChain([corner, 'optionalAccess', _164 => _164.smoothing]), () => ( 0)) });
2895
+ corners2.push({ radius: _nullishCoalesce(_optionalChain([corner, 'optionalAccess', _169 => _169.radius]), () => ( 0)), kind: _nullishCoalesce(_optionalChain([corner, 'optionalAccess', _170 => _170.kind]), () => ( "round")), smoothing: _nullishCoalesce(_optionalChain([corner, 'optionalAccess', _171 => _171.smoothing]), () => ( 0)) });
2828
2896
  }
2829
2897
  }
2830
2898
  const c0 = _nullishCoalesce(corners2[0], () => ( { radius: 0, kind: "round", smoothing: 0 }));
@@ -2905,7 +2973,7 @@ function getVectorGradientEditor(state) {
2905
2973
  const sel = stopIndex !== null && sorted[stopIndex] ? { ...sorted[stopIndex], index: stopIndex, last: stopIndex === sorted.length - 1 } : null;
2906
2974
  const preview = gradient ? `linear-gradient(to right, ${_chunkFODKPD44cjs.expandVectorGradientStops.call(void 0, gradient).map((s) => {
2907
2975
  const c = _chunkFODKPD44cjs.parseVectorColor.call(void 0, s.color);
2908
- const a = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _165 => _165[3]]), () => ( 1))) * (_nullishCoalesce(s.opacity, () => ( 1)));
2976
+ const a = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _172 => _172[3]]), () => ( 1))) * (_nullishCoalesce(s.opacity, () => ( 1)));
2909
2977
  const color = c ? `rgba(${Math.round(c[0] * 255)}, ${Math.round(c[1] * 255)}, ${Math.round(c[2] * 255)}, ${Math.round(a * 1e3) / 1e3})` : s.color;
2910
2978
  return `${color} ${Math.round(s.offset * 1e4) / 100}%`;
2911
2979
  }).join(", ")})` : null;
@@ -2917,11 +2985,11 @@ function getVectorGradientEditor(state) {
2917
2985
  stops,
2918
2986
  selected: sel,
2919
2987
  preview,
2920
- type: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _166 => _166.type]), () => ( null)),
2921
- spread: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _167 => _167.spread]), () => ( "pad")),
2922
- interpolation: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _168 => _168.interpolation]), () => ( "srgb")),
2923
- smoothness: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _169 => _169.smoothness]), () => ( 0)),
2924
- strokeMode: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _170 => _170.strokeMode]), () => ( "within")),
2988
+ type: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _173 => _173.type]), () => ( null)),
2989
+ spread: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _174 => _174.spread]), () => ( "pad")),
2990
+ interpolation: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _175 => _175.interpolation]), () => ( "srgb")),
2991
+ smoothness: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _176 => _176.smoothness]), () => ( 0)),
2992
+ strokeMode: _nullishCoalesce(_optionalChain([gradient, 'optionalAccess', _177 => _177.strokeMode]), () => ( "within")),
2925
2993
  mixed: paths.some((p) => JSON.stringify(_nullishCoalesce(_chunkFODKPD44cjs.vectorTargetPaint.call(void 0, p, target, _nullishCoalesce(layer, () => ( null))), () => ( null))) !== JSON.stringify(_nullishCoalesce(paint, () => ( null))))
2926
2994
  };
2927
2995
  }
@@ -2952,9 +3020,9 @@ function getVectorEffectsPanel(state) {
2952
3020
  if (!nodes.length) return null;
2953
3021
  const one = nodes.length === 1 ? nodes[0] : null;
2954
3022
  return {
2955
- nodeId: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _171 => _171.id]), () => ( null)),
3023
+ nodeId: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _178 => _178.id]), () => ( null)),
2956
3024
  count: nodes.length,
2957
- effects: (_nullishCoalesce(_optionalChain([one, 'optionalAccess', _172 => _172.effects]), () => ( []))).map((e) => ({
3025
+ effects: (_nullishCoalesce(_optionalChain([one, 'optionalAccess', _179 => _179.effects]), () => ( []))).map((e) => ({
2958
3026
  id: e.id,
2959
3027
  type: e.type,
2960
3028
  label: _nullishCoalesce(_chunkFODKPD44cjs.VECTOR_EFFECT_LABELS[e.type], () => ( e.type)),
@@ -2971,7 +3039,7 @@ function vectorPaintSwatch(paint) {
2971
3039
  if (_chunkFODKPD44cjs.isVectorGradient.call(void 0, paint)) {
2972
3040
  return `linear-gradient(to right, ${_chunkFODKPD44cjs.expandVectorGradientStops.call(void 0, paint).map((s) => {
2973
3041
  const c = _chunkFODKPD44cjs.parseVectorColor.call(void 0, s.color);
2974
- const a = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _173 => _173[3]]), () => ( 1))) * (_nullishCoalesce(s.opacity, () => ( 1)));
3042
+ const a = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _180 => _180[3]]), () => ( 1))) * (_nullishCoalesce(s.opacity, () => ( 1)));
2975
3043
  const color = c ? `rgba(${Math.round(c[0] * 255)}, ${Math.round(c[1] * 255)}, ${Math.round(c[2] * 255)}, ${Math.round(a * 1e3) / 1e3})` : s.color;
2976
3044
  return `${color} ${Math.round(s.offset * 1e4) / 100}%`;
2977
3045
  }).join(", ")})`;
@@ -3014,8 +3082,8 @@ function getVectorAppearancePanel(state) {
3014
3082
  strokes: !!first && !same(_chunkFODKPD44cjs.vectorStrokes),
3015
3083
  blendMode: nodes.some((n2) => (_nullishCoalesce(n2.blendMode, () => ( "normal"))) !== (_nullishCoalesce(nodes[0].blendMode, () => ( "normal"))))
3016
3084
  },
3017
- filterNodeId: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _174 => _174.id]), () => ( null)),
3018
- filters: (_nullishCoalesce(_optionalChain([one, 'optionalAccess', _175 => _175.filters]), () => ( []))).map((f) => ({
3085
+ filterNodeId: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _181 => _181.id]), () => ( null)),
3086
+ filters: (_nullishCoalesce(_optionalChain([one, 'optionalAccess', _182 => _182.filters]), () => ( []))).map((f) => ({
3019
3087
  id: f.id,
3020
3088
  type: f.type,
3021
3089
  label: _nullishCoalesce(_chunkFODKPD44cjs.VECTOR_FILTER_LABELS[f.type], () => ( f.type)),
@@ -3040,11 +3108,11 @@ function getVectorMaskPanel(state) {
3040
3108
  if (state.selection.length < 2) makeHint = "Select two or more objects: the topmost becomes the mask.";
3041
3109
  else if (locs.some((l) => !l)) makeHint = "Select objects in the document.";
3042
3110
  else if (locs.some((l) => l.list[l.index].locked || l.list[l.index].blendStep)) makeHint = "Unlock the selected objects first.";
3043
- else if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _176 => _176.parent, 'optionalAccess', _177 => _177.id]), () => ( null))) !== (_nullishCoalesce(_optionalChain([locs, 'access', _178 => _178[0], 'access', _179 => _179.parent, 'optionalAccess', _180 => _180.id]), () => ( null))))) makeHint = "Select objects at one level (sharing a parent).";
3111
+ else if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _183 => _183.parent, 'optionalAccess', _184 => _184.id]), () => ( null))) !== (_nullishCoalesce(_optionalChain([locs, 'access', _185 => _185[0], 'access', _186 => _186.parent, 'optionalAccess', _187 => _187.id]), () => ( null))))) makeHint = "Select objects at one level (sharing a parent).";
3044
3112
  let group = null;
3045
3113
  const first = locs[0];
3046
3114
  const node = first ? first.list[first.index] : null;
3047
- const owner = _chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, node) ? node : _chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, _optionalChain([first, 'optionalAccess', _181 => _181.parent])) ? first.parent : null;
3115
+ const owner = _chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, node) ? node : _chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, _optionalChain([first, 'optionalAccess', _188 => _188.parent])) ? first.parent : null;
3048
3116
  if (owner && state.selection.every((id) => id === owner.id || owner.children.some((c) => c.id === id))) {
3049
3117
  const summary = _chunkFODKPD44cjs.vectorMaskSummary.call(void 0, owner);
3050
3118
  const editing = state.selection.includes(owner.id) ? "group" : state.selection.includes(summary.maskId) ? "mask" : "contents";
@@ -3246,8 +3314,8 @@ var Page = (_class3 = class {
3246
3314
  const { ops } = pathOps(d);
3247
3315
  this.content.push("q");
3248
3316
  let p = this.paint(paint, true);
3249
- if (_optionalChain([p, 'optionalAccess', _182 => _182.def])) {
3250
- const first = p.def.type === "pattern" ? _optionalChain([p, 'access', _183 => _183.def, 'access', _184 => _184.tiles, 'access', _185 => _185[0], 'optionalAccess', _186 => _186.fill]) : _optionalChain([p, 'access', _187 => _187.def, 'access', _188 => _188.stops, 'access', _189 => _189[0], 'optionalAccess', _190 => _190.stopColor]);
3317
+ if (_optionalChain([p, 'optionalAccess', _189 => _189.def])) {
3318
+ const first = p.def.type === "pattern" ? _optionalChain([p, 'access', _190 => _190.def, 'access', _191 => _191.tiles, 'access', _192 => _192[0], 'optionalAccess', _193 => _193.fill]) : _optionalChain([p, 'access', _194 => _194.def, 'access', _195 => _195.stops, 'access', _196 => _196[0], 'optionalAccess', _197 => _197.stopColor]);
3251
3319
  this.notes.add("Gradient strokes are drawn in their first colour.");
3252
3320
  p = first ? this.paint(first, true) : null;
3253
3321
  }
@@ -3289,7 +3357,7 @@ var Page = (_class3 = class {
3289
3357
  if (node.opacity < 1 && node.children.length > 1) this.notes.add("Group opacity is applied to each object in the group.");
3290
3358
  if (node.blendMode && node.blendMode !== "normal") this.notes.add("Group blend modes are applied to each object in the group.");
3291
3359
  if (node.mask) {
3292
- if (node.mask.type === "clip" && _optionalChain([node, 'access', _191 => _191.mask, 'access', _192 => _192.clip, 'optionalAccess', _193 => _193.length])) {
3360
+ if (node.mask.type === "clip" && _optionalChain([node, 'access', _198 => _198.mask, 'access', _199 => _199.clip, 'optionalAccess', _200 => _200.length])) {
3293
3361
  const evenodd = node.mask.clip.some((c) => c.clipRule === "evenodd");
3294
3362
  this.content.push(node.mask.clip.map((c) => pathOps(c.d).ops).join("\n"), evenodd ? "W* n" : "W n");
3295
3363
  } else this.notes.add("Opacity masks are left out (the contents are drawn whole).");
@@ -3477,7 +3545,7 @@ function paintItem(kind, layer, node, notes) {
3477
3545
  base.lj = JOIN[_nullishCoalesce(_nullishCoalesce(s.strokeLinejoin, () => ( node.strokeLinejoin)), () => ( "miter"))];
3478
3546
  base.ml = 4;
3479
3547
  const dash = _nullishCoalesce(s.strokeDasharray, () => ( node.strokeDasharray));
3480
- if (_optionalChain([dash, 'optionalAccess', _194 => _194.length])) base.d = dash.map((v, k) => ({ n: k % 2 === 0 ? "d" : "g", nm: k % 2 === 0 ? "dash" : "gap", v: st(round(v)) }));
3548
+ if (_optionalChain([dash, 'optionalAccess', _201 => _201.length])) base.d = dash.map((v, k) => ({ n: k % 2 === 0 ? "d" : "g", nm: k % 2 === 0 ? "dash" : "gap", v: st(round(v)) }));
3481
3549
  }
3482
3550
  const blend = layer.blendMode && layer.blendMode !== "normal" ? BLEND2[layer.blendMode] : void 0;
3483
3551
  if (layer.blendMode && layer.blendMode !== "normal" && blend === void 0) notes.push(`${label(node)}: blend mode ${layer.blendMode} has no Lottie equivalent (normal used).`);
@@ -3490,7 +3558,7 @@ function paintItem(kind, layer, node, notes) {
3490
3558
  }
3491
3559
  if (_chunkFODKPD44cjs.isVectorShadedPaint.call(void 0, paint)) {
3492
3560
  notes.push(`${label(node)}: mesh and freeform gradients have no Lottie equivalent (their first colour used).`);
3493
- const first = paint.type === "mesh" ? paint.colors[0] : _optionalChain([paint, 'access', _195 => _195.points, 'access', _196 => _196[0], 'optionalAccess', _197 => _197.color]);
3561
+ const first = paint.type === "mesh" ? paint.colors[0] : _optionalChain([paint, 'access', _202 => _202.points, 'access', _203 => _203[0], 'optionalAccess', _204 => _204.color]);
3494
3562
  return first ? { ty: kind === "fill" ? "fl" : "st", ...base, c: st(colorOf(first)), o: st(round(100 * (_nullishCoalesce(layer.opacity, () => ( 1))))), r: 1, ...extra } : null;
3495
3563
  }
3496
3564
  if (!_chunkFODKPD44cjs.isVectorGradient.call(void 0, paint)) return null;
@@ -3592,15 +3660,15 @@ function pathItems(node, notes) {
3592
3660
  }
3593
3661
  function nodeGroup(node, notes) {
3594
3662
  if (node.visible === false) return null;
3595
- if (_optionalChain([node, 'access', _198 => _198.filters, 'optionalAccess', _199 => _199.length])) notes.push(`${label(node)}: filters (shadows, glows, blurs) are not part of Lottie (left out).`);
3663
+ if (_optionalChain([node, 'access', _205 => _205.filters, 'optionalAccess', _206 => _206.length])) notes.push(`${label(node)}: filters (shadows, glows, blurs) are not part of Lottie (left out).`);
3596
3664
  const m = _chunkFODKPD44cjs.nodeMatrix.call(void 0, node);
3597
3665
  let items = [];
3598
3666
  const live = (_nullishCoalesce(node.effects, () => ( []))).some((e) => e.enabled !== false && (e.type === "wiggle" || e.type === "envelope"));
3599
3667
  if (node.type === "text" || node.type === "instance" || live || _chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, node) || _chunkFODKPD44cjs.isVectorFrame.call(void 0, node)) {
3600
3668
  if (live) notes.push(`${label(node)}: wiggle and envelope effects have no Lottie equivalent (exported as drawn).`);
3601
- if (_chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, node) && _optionalChain([node, 'access', _200 => _200.mask, 'optionalAccess', _201 => _201.type]) !== "clip") notes.push(`${label(node)}: opacity masks are not exported (the contents are drawn whole).`);
3669
+ if (_chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, node) && _optionalChain([node, 'access', _207 => _207.mask, 'optionalAccess', _208 => _208.type]) !== "clip") notes.push(`${label(node)}: opacity masks are not exported (the contents are drawn whole).`);
3602
3670
  const drawn = _chunkFODKPD44cjs.isVectorFrame.call(void 0, node) ? _chunkFODKPD44cjs.vectorFrameDrawn.call(void 0, node) : node;
3603
- const shapes = _chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, drawn) && _optionalChain([drawn, 'access', _202 => _202.mask, 'optionalAccess', _203 => _203.type]) === "clip" ? _chunkFODKPD44cjs.vectorAppearanceShapes.call(void 0, { ...drawn, transform: void 0 }) : null;
3671
+ const shapes = _chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, drawn) && _optionalChain([drawn, 'access', _209 => _209.mask, 'optionalAccess', _210 => _210.type]) === "clip" ? _chunkFODKPD44cjs.vectorAppearanceShapes.call(void 0, { ...drawn, transform: void 0 }) : null;
3604
3672
  if (shapes) {
3605
3673
  for (const s of [...shapes].reverse()) {
3606
3674
  const source = { ...s.source, subpaths: _chunkFODKPD44cjs.bezierToSubpaths.call(void 0, s.path), effects: null, opacity: s.opacity };
@@ -3700,7 +3768,7 @@ function lottieValueAt(prop, frame) {
3700
3768
  return from.map((v, d) => v + ((_nullishCoalesce(to[d], () => ( v))) - v) * y);
3701
3769
  }
3702
3770
  const last = keys[keys.length - 1];
3703
- return last.s !== void 0 ? nums(last.s) : nums(_optionalChain([keys, 'access', _204 => _204[keys.length - 2], 'optionalAccess', _205 => _205.e]));
3771
+ return last.s !== void 0 ? nums(last.s) : nums(_optionalChain([keys, 'access', _211 => _211[keys.length - 2], 'optionalAccess', _212 => _212.e]));
3704
3772
  }
3705
3773
  function subpathOf(prop, frame) {
3706
3774
  const p = prop;
@@ -3893,8 +3961,8 @@ function painted(node, paints, s) {
3893
3961
  return {
3894
3962
  ...node,
3895
3963
  ...evenodd ? { fillRule: "evenodd" } : {},
3896
- fill: _nullishCoalesce(_optionalChain([fill, 'optionalAccess', _206 => _206.paint]), () => ( null)),
3897
- stroke: _nullishCoalesce(_optionalChain([stroke, 'optionalAccess', _207 => _207.paint]), () => ( null)),
3964
+ fill: _nullishCoalesce(_optionalChain([fill, 'optionalAccess', _213 => _213.paint]), () => ( null)),
3965
+ stroke: _nullishCoalesce(_optionalChain([stroke, 'optionalAccess', _214 => _214.paint]), () => ( null)),
3898
3966
  ...stroke ? { strokeWidth: stroke.strokeWidth, strokeLinecap: stroke.strokeLinecap, strokeLinejoin: stroke.strokeLinejoin, ...stroke.strokeDasharray ? { strokeDasharray: stroke.strokeDasharray } : {} } : {},
3899
3967
  ...fills.length > 1 || fill && (fill.opacity !== void 0 || fill.blendMode) ? { fills } : {},
3900
3968
  ...strokes.length > 1 || stroke && (stroke.opacity !== void 0 || stroke.blendMode) ? { strokes } : {}
@@ -4504,7 +4572,7 @@ function vectorSkewMatrix(ax, ay, origin = { x: 0, y: 0 }) {
4504
4572
  return _chunkFODKPD44cjs.skewMatrix.call(void 0, ax, ay, origin);
4505
4573
  }
4506
4574
  function mapEffects(node, f) {
4507
- if (!_optionalChain([node, 'access', _208 => _208.effects, 'optionalAccess', _209 => _209.length])) return void 0;
4575
+ if (!_optionalChain([node, 'access', _215 => _215.effects, 'optionalAccess', _216 => _216.length])) return void 0;
4508
4576
  return node.effects.map((e) => {
4509
4577
  if (e.type !== "envelope") return e;
4510
4578
  if (e.params.style === "mesh") return e.params.mesh ? { ...e, params: { ...e.params, mesh: _chunkFODKPD44cjs.mapWarpMeshPoints.call(void 0, e.params.mesh, f) } } : e;
@@ -4521,7 +4589,7 @@ function distortVectorNode(node, parentToDoc, f, tolerance = VECTOR_DISTORT_TOLE
4521
4589
  if (node.type === "group") {
4522
4590
  const group = node;
4523
4591
  const children = group.children.map((c) => distortVectorNode(c, toDoc, f, tolerance));
4524
- const spine = _optionalChain([group, 'access', _210 => _210.blend, 'optionalAccess', _211 => _211.spine]);
4592
+ const spine = _optionalChain([group, 'access', _217 => _217.blend, 'optionalAccess', _218 => _218.spine]);
4525
4593
  return {
4526
4594
  ...group,
4527
4595
  children,
@@ -4581,7 +4649,7 @@ function vectorTrackingPaths(points, angles = [0, 90, 180, 270]) {
4581
4649
  }
4582
4650
  var VECTOR_CONSTRUCTION_ANGLES = [0, 45, 90, 135];
4583
4651
  function constrainToLeave(leave, p) {
4584
- if (!_optionalChain([leave, 'optionalAccess', _212 => _212.constrain])) return p;
4652
+ if (!_optionalChain([leave, 'optionalAccess', _219 => _219.constrain])) return p;
4585
4653
  const dx = p.x - leave.at.x;
4586
4654
  const dy = p.y - leave.at.y;
4587
4655
  switch (leave.constrain) {
@@ -4694,7 +4762,7 @@ var VectorSnapTargets = (_class5 = class _VectorSnapTargets {
4694
4762
  moving.set(r.nodeId, set);
4695
4763
  }
4696
4764
  const t = _VectorSnapTargets.collect(doc, new Set(moving.keys()), "segments", false);
4697
- t.pushPaths(doc, new Set(moving.keys()), (id, s, i) => !!_optionalChain([moving, 'access', _213 => _213.get, 'call', _214 => _214(id), 'optionalAccess', _215 => _215.has, 'call', _216 => _216(`${s}:${i}`)]), true);
4765
+ t.pushPaths(doc, new Set(moving.keys()), (id, s, i) => !!_optionalChain([moving, 'access', _220 => _220.get, 'call', _221 => _221(id), 'optionalAccess', _222 => _222.has, 'call', _223 => _223(`${s}:${i}`)]), true);
4698
4766
  return t.index();
4699
4767
  }
4700
4768
  /**
@@ -4818,7 +4886,7 @@ var VectorSnapTargets = (_class5 = class _VectorSnapTargets {
4818
4886
  }
4819
4887
  const b = _chunkFODKPD44cjs.vectorNodeBounds.call(void 0, n2, parent);
4820
4888
  const f = nodeFrame(n2, parent, b);
4821
- if (b) self.pushRect(b, "edge", _nullishCoalesce(_optionalChain([f, 'optionalAccess', _217 => _217.centre]), () => ( null)));
4889
+ if (b) self.pushRect(b, "edge", _nullishCoalesce(_optionalChain([f, 'optionalAccess', _224 => _224.centre]), () => ( null)));
4822
4890
  }
4823
4891
  };
4824
4892
  visit(doc.nodes, _chunkFODKPD44cjs.IDENTITY_MATRIX);
@@ -4863,7 +4931,7 @@ var VectorSnapTargets = (_class5 = class _VectorSnapTargets {
4863
4931
  lines: lines2,
4864
4932
  labels: [this.label(q, kind)]
4865
4933
  });
4866
- if (_optionalChain([leave, 'optionalAccess', _218 => _218.constrain])) {
4934
+ if (_optionalChain([leave, 'optionalAccess', _225 => _225.constrain])) {
4867
4935
  const q = constrainToLeave(leave, p);
4868
4936
  const hit = this.slide(leave.at, { x: q.x - leave.at.x, y: q.y - leave.at.y }, q, tol, true);
4869
4937
  return hit ? { point: hit.point, x: true, y: true, ...this.linedUp(hit.point, hit.from) } : none(q);
@@ -4888,7 +4956,7 @@ var VectorSnapTargets = (_class5 = class _VectorSnapTargets {
4888
4956
  if (on) return at(on, "path");
4889
4957
  const slide = paths.filter((t) => t.path.kind !== "polar").sort((a, b) => a.d - b.d)[0];
4890
4958
  if (slide) return { ...at(slide.foot, "tracking", [line("construction", slide.path.origin, slide.foot)]), labels: [this.label(slide.foot, "tracking", slide.path.kind === "extension" ? "extension" : "tracking")] };
4891
- if (_optionalChain([leave, 'optionalAccess', _219 => _219.angles, 'optionalAccess', _220 => _220.length])) {
4959
+ if (_optionalChain([leave, 'optionalAccess', _226 => _226.angles, 'optionalAccess', _227 => _227.length])) {
4892
4960
  const c = construction(leave, p, tol);
4893
4961
  if (c) {
4894
4962
  const hit = this.slide(leave.at, c.dir, c.point, tol, false);
@@ -5019,7 +5087,7 @@ var VectorSnapTargets = (_class5 = class _VectorSnapTargets {
5019
5087
  * with nothing spaces the box evenly in its row or column. Returns the correction and guides.
5020
5088
  */
5021
5089
  snapRect(r, tol, options = {}) {
5022
- const axes = { x: _optionalChain([options, 'access', _221 => _221.axes, 'optionalAccess', _222 => _222.x]) !== false, y: _optionalChain([options, 'access', _223 => _223.axes, 'optionalAccess', _224 => _224.y]) !== false };
5090
+ const axes = { x: _optionalChain([options, 'access', _228 => _228.axes, 'optionalAccess', _229 => _229.x]) !== false, y: _optionalChain([options, 'access', _230 => _230.axes, 'optionalAccess', _231 => _231.y]) !== false };
5023
5091
  const nearest = (lines, values) => {
5024
5092
  let best = null;
5025
5093
  for (const v of values) for (const l of linesNear(lines, v, tol)) if (!best || Math.abs(l.v - v) < Math.abs(best.d)) best = { d: l.v - v, from: l.from };
@@ -5027,7 +5095,7 @@ var VectorSnapTargets = (_class5 = class _VectorSnapTargets {
5027
5095
  };
5028
5096
  const bx = axes.x ? nearest(this.xs, [r.x, r.x + r.width / 2, r.x + r.width]) : null;
5029
5097
  const by = axes.y ? nearest(this.ys, [r.y, r.y + r.height / 2, r.y + r.height]) : null;
5030
- const out = { dx: _nullishCoalesce(_optionalChain([bx, 'optionalAccess', _225 => _225.d]), () => ( 0)), dy: _nullishCoalesce(_optionalChain([by, 'optionalAccess', _226 => _226.d]), () => ( 0)), x: !!bx, y: !!by, lines: [], labels: [] };
5098
+ const out = { dx: _nullishCoalesce(_optionalChain([bx, 'optionalAccess', _232 => _232.d]), () => ( 0)), dy: _nullishCoalesce(_optionalChain([by, 'optionalAccess', _233 => _233.d]), () => ( 0)), x: !!bx, y: !!by, lines: [], labels: [] };
5031
5099
  const done = { ...r, x: r.x + out.dx, y: r.y + out.dy };
5032
5100
  if (bx) {
5033
5101
  const x = bx.from.x;
@@ -5150,9 +5218,9 @@ var VectorSnapTargets = (_class5 = class _VectorSnapTargets {
5150
5218
  const on = this.nearestPoint(p, tol);
5151
5219
  const tries = [];
5152
5220
  if (on) tries.push({ tx: on.p.x, ty: on.p.y, s: { hx: null, hy: null, on } });
5153
- tries.push({ tx: _nullishCoalesce(_optionalChain([hx, 'optionalAccess', _227 => _227.v]), () => ( null)), ty: _nullishCoalesce(_optionalChain([hy, 'optionalAccess', _228 => _228.v]), () => ( null)), s: { hx, hy, on: null } });
5154
- tries.push({ tx: _nullishCoalesce(_optionalChain([hx, 'optionalAccess', _229 => _229.v]), () => ( null)), ty: null, s: { hx, hy: null, on: null } });
5155
- tries.push({ tx: null, ty: _nullishCoalesce(_optionalChain([hy, 'optionalAccess', _230 => _230.v]), () => ( null)), s: { hx: null, hy, on: null } });
5221
+ tries.push({ tx: _nullishCoalesce(_optionalChain([hx, 'optionalAccess', _234 => _234.v]), () => ( null)), ty: _nullishCoalesce(_optionalChain([hy, 'optionalAccess', _235 => _235.v]), () => ( null)), s: { hx, hy, on: null } });
5222
+ tries.push({ tx: _nullishCoalesce(_optionalChain([hx, 'optionalAccess', _236 => _236.v]), () => ( null)), ty: null, s: { hx, hy: null, on: null } });
5223
+ tries.push({ tx: null, ty: _nullishCoalesce(_optionalChain([hy, 'optionalAccess', _237 => _237.v]), () => ( null)), s: { hx: null, hy, on: null } });
5156
5224
  for (const { tx, ty, s } of tries) {
5157
5225
  if (tx === null && ty === null) continue;
5158
5226
  const q = _chunkFODKPD44cjs.applyMatrix.call(void 0, toLocal, { x: _nullishCoalesce(tx, () => ( p.x)), y: _nullishCoalesce(ty, () => ( p.y)) });
@@ -5283,7 +5351,7 @@ function line(kind, a, b) {
5283
5351
  return { kind, x1: a.x, y1: a.y, x2: b.x, y2: b.y };
5284
5352
  }
5285
5353
  function polarPaths(leave) {
5286
- if (!_optionalChain([leave, 'optionalAccess', _231 => _231.angles, 'optionalAccess', _232 => _232.length]) || leave.constrain) return [];
5354
+ if (!_optionalChain([leave, 'optionalAccess', _238 => _238.angles, 'optionalAccess', _239 => _239.length]) || leave.constrain) return [];
5287
5355
  const out = [];
5288
5356
  for (const a of leave.angles) {
5289
5357
  const dir = vectorAngleDirection(a);
@@ -6309,7 +6377,7 @@ function getEditablePathIds(state) {
6309
6377
  }
6310
6378
  }
6311
6379
  }
6312
- return [...ids].filter((id) => _optionalChain([_chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id), 'optionalAccess', _233 => _233.type]) === "path");
6380
+ return [...ids].filter((id) => _optionalChain([_chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id), 'optionalAccess', _240 => _240.type]) === "path");
6313
6381
  }
6314
6382
  function getVisibleAnchors(state) {
6315
6383
  const out = [];
@@ -6324,7 +6392,7 @@ function getVisibleHandles(state) {
6324
6392
  const seen = /* @__PURE__ */ new Set();
6325
6393
  const push = (node, s, i, handle) => {
6326
6394
  const sp = node.subpaths[s];
6327
- const a = _optionalChain([sp, 'optionalAccess', _234 => _234.anchors, 'access', _235 => _235[i]]);
6395
+ const a = _optionalChain([sp, 'optionalAccess', _241 => _241.anchors, 'access', _242 => _242[i]]);
6328
6396
  if (!a || !a[handle]) return;
6329
6397
  const key = `${node.id}:${s}:${i}:${handle}`;
6330
6398
  if (seen.has(key)) return;
@@ -6333,8 +6401,8 @@ function getVisibleHandles(state) {
6333
6401
  };
6334
6402
  if (state.tool === "pen" && state.pen) {
6335
6403
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, state.pen.nodeId);
6336
- const sp = _optionalChain([node, 'optionalAccess', _236 => _236.type]) === "path" ? node.subpaths[state.pen.subpath] : void 0;
6337
- if (_optionalChain([node, 'optionalAccess', _237 => _237.type]) === "path" && sp) {
6404
+ const sp = _optionalChain([node, 'optionalAccess', _243 => _243.type]) === "path" ? node.subpaths[state.pen.subpath] : void 0;
6405
+ if (_optionalChain([node, 'optionalAccess', _244 => _244.type]) === "path" && sp) {
6338
6406
  const last = sp.anchors.length - 1;
6339
6407
  push(node, state.pen.subpath, last, "in");
6340
6408
  push(node, state.pen.subpath, last, "out");
@@ -6372,11 +6440,11 @@ function getVectorCornerWidgets(state) {
6372
6440
  const side = Math.min(c.lu, c.lv);
6373
6441
  if (side * zoom < 3 * VECTOR_CORNER_WIDGET_INSET) continue;
6374
6442
  const a = node.subpaths[c.subpath].anchors[c.index];
6375
- const radius = _nullishCoalesce(_optionalChain([a, 'access', _238 => _238.corner, 'optionalAccess', _239 => _239.radius]), () => ( 0));
6443
+ const radius = _nullishCoalesce(_optionalChain([a, 'access', _245 => _245.corner, 'optionalAccess', _246 => _246.radius]), () => ( 0));
6376
6444
  const drawn = _chunkFODKPD44cjs.fitCornerRadius.call(void 0, c, radius);
6377
6445
  const k = Math.min(Math.max(drawn / c.sin, VECTOR_CORNER_WIDGET_INSET / (zoom * Math.sqrt(1 + c.cos))), side / 2);
6378
6446
  const p = _chunkFODKPD44cjs.applyMatrix.call(void 0, m, _chunkFODKPD44cjs.cornerBisectorPoint.call(void 0, c, k));
6379
- out.push({ ref: { nodeId: id, subpath: c.subpath, index: c.index }, x: p.x, y: p.y, radius, drawnRadius: drawn, kind: _nullishCoalesce(_optionalChain([a, 'access', _240 => _240.corner, 'optionalAccess', _241 => _241.kind]), () => ( "round")), corner: c });
6447
+ out.push({ ref: { nodeId: id, subpath: c.subpath, index: c.index }, x: p.x, y: p.y, radius, drawnRadius: drawn, kind: _nullishCoalesce(_optionalChain([a, 'access', _247 => _247.corner, 'optionalAccess', _248 => _248.kind]), () => ( "round")), corner: c });
6380
6448
  }
6381
6449
  }
6382
6450
  return out;
@@ -6399,13 +6467,13 @@ function getVectorWidthHandles(state) {
6399
6467
  const n2 = _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id);
6400
6468
  if (n2) for (const p of _chunkFODKPD44cjs.collectPathNodes.call(void 0, n2)) ids.add(p.id);
6401
6469
  }
6402
- if (_optionalChain([state, 'access', _242 => _242.hover, 'optionalAccess', _243 => _243.nodeId])) ids.add(state.hover.nodeId);
6403
- if (_optionalChain([state, 'access', _244 => _244.interaction, 'optionalAccess', _245 => _245.type]) === "width") ids.add(state.interaction.ref.nodeId);
6470
+ if (_optionalChain([state, 'access', _249 => _249.hover, 'optionalAccess', _250 => _250.nodeId])) ids.add(state.hover.nodeId);
6471
+ if (_optionalChain([state, 'access', _251 => _251.interaction, 'optionalAccess', _252 => _252.type]) === "width") ids.add(state.interaction.ref.nodeId);
6404
6472
  for (const r of state.selectedWidthPoints) ids.add(r.nodeId);
6405
6473
  const out = [];
6406
6474
  for (const id of ids) {
6407
6475
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, id);
6408
- if (_optionalChain([node, 'optionalAccess', _246 => _246.type]) !== "path" || node.visible === false || !_optionalChain([node, 'access', _247 => _247.strokeWidthProfile, 'optionalAccess', _248 => _248.length])) continue;
6476
+ if (_optionalChain([node, 'optionalAccess', _253 => _253.type]) !== "path" || node.visible === false || !_optionalChain([node, 'access', _254 => _254.strokeWidthProfile, 'optionalAccess', _255 => _255.length])) continue;
6409
6477
  const g = vectorStrokeWidthGeometry(node);
6410
6478
  if (!g) continue;
6411
6479
  const profile = _chunkFODKPD44cjs.sanitizeWidthProfile.call(void 0, node.strokeWidthProfile);
@@ -6438,7 +6506,7 @@ function getVectorWidthHandles(state) {
6438
6506
  }
6439
6507
  function getAnchor(doc, ref) {
6440
6508
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, ref.nodeId);
6441
- return _optionalChain([node, 'optionalAccess', _249 => _249.type]) === "path" ? _optionalChain([node, 'access', _250 => _250.subpaths, 'access', _251 => _251[ref.subpath], 'optionalAccess', _252 => _252.anchors, 'access', _253 => _253[ref.index]]) : void 0;
6509
+ return _optionalChain([node, 'optionalAccess', _256 => _256.type]) === "path" ? _optionalChain([node, 'access', _257 => _257.subpaths, 'access', _258 => _258[ref.subpath], 'optionalAccess', _259 => _259.anchors, 'access', _260 => _260[ref.index]]) : void 0;
6442
6510
  }
6443
6511
  function getAnchorWorld(doc, ref) {
6444
6512
  const a = getAnchor(doc, ref);
@@ -6632,7 +6700,7 @@ function normalizeVectorTree(nodes, prefer) {
6632
6700
  function loadedDocument(doc) {
6633
6701
  const copy = _chunkFODKPD44cjs.cloneVectorDocument.call(void 0, _chunkFODKPD44cjs.stripVectorSymbolArt.call(void 0, doc));
6634
6702
  const nodes = normalizeVectorTree(copy.nodes, "stack");
6635
- const symbols = _optionalChain([copy, 'access', _254 => _254.symbols, 'optionalAccess', _255 => _255.map, 'call', _256 => _256((s) => ({ ...s, nodes: normalizeVectorTree(s.nodes, "stack") }))]);
6703
+ const symbols = _optionalChain([copy, 'access', _261 => _261.symbols, 'optionalAccess', _262 => _262.map, 'call', _263 => _263((s) => ({ ...s, nodes: normalizeVectorTree(s.nodes, "stack") }))]);
6636
6704
  return _chunkFODKPD44cjs.resolveVectorSymbols.call(void 0, { ...copy, nodes, ...symbols ? { symbols } : {} });
6637
6705
  }
6638
6706
  function mapTree(nodes, fn) {
@@ -6843,7 +6911,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
6843
6911
  const nodes = refreshVectorBlends(normalizeVectorTree(doc.nodes, "shorthand"));
6844
6912
  let out = nodes === doc.nodes ? doc : { ...doc, nodes };
6845
6913
  const edit = this.symbolEdit;
6846
- if (edit && _optionalChain([out, 'access', _257 => _257.symbols, 'optionalAccess', _258 => _258.some, 'call', _259 => _259((s) => s.id === edit.symbolId && s.nodes !== out.nodes)])) {
6914
+ if (edit && _optionalChain([out, 'access', _264 => _264.symbols, 'optionalAccess', _265 => _265.some, 'call', _266 => _266((s) => s.id === edit.symbolId && s.nodes !== out.nodes)])) {
6847
6915
  out = { ...out, symbols: out.symbols.map((s) => s.id === edit.symbolId ? { ...s, nodes: out.nodes } : s) };
6848
6916
  }
6849
6917
  out = _chunkFODKPD44cjs.resolveVectorSymbols.call(void 0, out);
@@ -6854,7 +6922,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
6854
6922
  * constraints on deleted anchors removed; the same object when nothing changes.
6855
6923
  */
6856
6924
  solved(doc) {
6857
- if (!_optionalChain([doc, 'access', _260 => _260.constraints, 'optionalAccess', _261 => _261.length])) {
6925
+ if (!_optionalChain([doc, 'access', _267 => _267.constraints, 'optionalAccess', _268 => _268.length])) {
6858
6926
  this.constraintIssues = null;
6859
6927
  this.lastSolved = doc;
6860
6928
  return doc;
@@ -6872,7 +6940,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
6872
6940
  if (this.blendStart && !this.getNode(this.blendStart.nodeId)) this.blendStart = null;
6873
6941
  this.revision++;
6874
6942
  this.state = this.computeState();
6875
- if (docChanged) _optionalChain([this, 'access', _262 => _262.onChange, 'optionalCall', _263 => _263(this.storedDocument())]);
6943
+ if (docChanged) _optionalChain([this, 'access', _269 => _269.onChange, 'optionalCall', _270 => _270(this.storedDocument())]);
6876
6944
  const state = this.state;
6877
6945
  this.listeners.forEach((listener) => {
6878
6946
  try {
@@ -6902,42 +6970,42 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
6902
6970
  return _chunkFODKPD44cjs.applyMatrix.call(void 0, _chunkFODKPD44cjs.invertMatrix.call(void 0, this.worldOf(id, doc)), p);
6903
6971
  }
6904
6972
  cursorFor() {
6905
- if (_optionalChain([this, 'access', _264 => _264.drag, 'optionalAccess', _265 => _265.kind]) === "pan" || this.spaceHeld) return this.drag ? "grabbing" : "grab";
6906
- if (_optionalChain([this, 'access', _266 => _266.drag, 'optionalAccess', _267 => _267.kind]) === "rotate") return "grabbing";
6907
- if (_optionalChain([this, 'access', _268 => _268.drag, 'optionalAccess', _269 => _269.kind]) === "move") return "move";
6973
+ if (_optionalChain([this, 'access', _271 => _271.drag, 'optionalAccess', _272 => _272.kind]) === "pan" || this.spaceHeld) return this.drag ? "grabbing" : "grab";
6974
+ if (_optionalChain([this, 'access', _273 => _273.drag, 'optionalAccess', _274 => _274.kind]) === "rotate") return "grabbing";
6975
+ if (_optionalChain([this, 'access', _275 => _275.drag, 'optionalAccess', _276 => _276.kind]) === "move") return "move";
6908
6976
  const h = this.hover;
6909
6977
  switch (this.tool) {
6910
6978
  case "select":
6911
- if (_optionalChain([h, 'optionalAccess', _270 => _270.transformHandle]) && this.freeDistort && h.transformHandle !== "rotate") return "crosshair";
6912
- if (_optionalChain([h, 'optionalAccess', _271 => _271.transformHandle])) return vectorResizeCursor(h.transformHandle, _nullishCoalesce(_optionalChain([this, 'access', _272 => _272.frameOf, 'call', _273 => _273(this.selectedRoots()), 'optionalAccess', _274 => _274.angle]), () => ( 0)));
6913
- return _optionalChain([h, 'optionalAccess', _275 => _275.nodeId]) ? "move" : "default";
6979
+ if (_optionalChain([h, 'optionalAccess', _277 => _277.transformHandle]) && this.freeDistort && h.transformHandle !== "rotate") return "crosshair";
6980
+ if (_optionalChain([h, 'optionalAccess', _278 => _278.transformHandle])) return vectorResizeCursor(h.transformHandle, _nullishCoalesce(_optionalChain([this, 'access', _279 => _279.frameOf, 'call', _280 => _280(this.selectedRoots()), 'optionalAccess', _281 => _281.angle]), () => ( 0)));
6981
+ return _optionalChain([h, 'optionalAccess', _282 => _282.nodeId]) ? "move" : "default";
6914
6982
  case "type":
6915
6983
  return "text";
6916
6984
  case "typePath":
6917
- return _optionalChain([h, 'optionalAccess', _276 => _276.nodeId]) ? "text" : "crosshair";
6985
+ return _optionalChain([h, 'optionalAccess', _283 => _283.nodeId]) ? "text" : "crosshair";
6918
6986
  case "envelope":
6919
- if (_optionalChain([this, 'access', _277 => _277.drag, 'optionalAccess', _278 => _278.kind]) === "envelope") return "grabbing";
6920
- if (_optionalChain([h, 'optionalAccess', _279 => _279.envelope])) return h.envelope.index === null ? "grab" : "pointer";
6921
- return _optionalChain([h, 'optionalAccess', _280 => _280.nodeId]) ? "pointer" : "default";
6987
+ if (_optionalChain([this, 'access', _284 => _284.drag, 'optionalAccess', _285 => _285.kind]) === "envelope") return "grabbing";
6988
+ if (_optionalChain([h, 'optionalAccess', _286 => _286.envelope])) return h.envelope.index === null ? "grab" : "pointer";
6989
+ return _optionalChain([h, 'optionalAccess', _287 => _287.nodeId]) ? "pointer" : "default";
6922
6990
  case "direct":
6923
- if (_optionalChain([h, 'optionalAccess', _281 => _281.anchor]) || _optionalChain([h, 'optionalAccess', _282 => _282.handle]) || _optionalChain([h, 'optionalAccess', _283 => _283.corner])) return "pointer";
6924
- if (_optionalChain([h, 'optionalAccess', _284 => _284.segment])) return "copy";
6925
- return _optionalChain([h, 'optionalAccess', _285 => _285.nodeId]) ? "move" : "default";
6991
+ if (_optionalChain([h, 'optionalAccess', _288 => _288.anchor]) || _optionalChain([h, 'optionalAccess', _289 => _289.handle]) || _optionalChain([h, 'optionalAccess', _290 => _290.corner])) return "pointer";
6992
+ if (_optionalChain([h, 'optionalAccess', _291 => _291.segment])) return "copy";
6993
+ return _optionalChain([h, 'optionalAccess', _292 => _292.nodeId]) ? "move" : "default";
6926
6994
  case "pen":
6927
- return _optionalChain([h, 'optionalAccess', _286 => _286.anchor]) ? "pointer" : "crosshair";
6995
+ return _optionalChain([h, 'optionalAccess', _293 => _293.anchor]) ? "pointer" : "crosshair";
6928
6996
  case "width":
6929
- if (_optionalChain([this, 'access', _287 => _287.drag, 'optionalAccess', _288 => _288.kind]) === "width") return this.drag.mode === "width" ? "ew-resize" : "grabbing";
6930
- if (_optionalChain([h, 'optionalAccess', _289 => _289.widthPoint])) return h.widthPoint.part === "center" ? "grab" : "ew-resize";
6931
- return _optionalChain([h, 'optionalAccess', _290 => _290.strokeSpot]) ? "copy" : "default";
6997
+ if (_optionalChain([this, 'access', _294 => _294.drag, 'optionalAccess', _295 => _295.kind]) === "width") return this.drag.mode === "width" ? "ew-resize" : "grabbing";
6998
+ if (_optionalChain([h, 'optionalAccess', _296 => _296.widthPoint])) return h.widthPoint.part === "center" ? "grab" : "ew-resize";
6999
+ return _optionalChain([h, 'optionalAccess', _297 => _297.strokeSpot]) ? "copy" : "default";
6932
7000
  case "shapeBuilder":
6933
- if (!_optionalChain([this, 'access', _291 => _291.builderPreview, 'optionalAccess', _292 => _292.faces, 'access', _293 => _293.length]) && !_optionalChain([this, 'access', _294 => _294.builderPreview, 'optionalAccess', _295 => _295.lines, 'access', _296 => _296.length])) return "crosshair";
7001
+ if (!_optionalChain([this, 'access', _298 => _298.builderPreview, 'optionalAccess', _299 => _299.faces, 'access', _300 => _300.length]) && !_optionalChain([this, 'access', _301 => _301.builderPreview, 'optionalAccess', _302 => _302.lines, 'access', _303 => _303.length])) return "crosshair";
6934
7002
  return this.builderPreview.mode === "erase" ? "not-allowed" : "cell";
6935
7003
  case "paintBucket":
6936
7004
  return this.builderPreview ? "cell" : "crosshair";
6937
7005
  case "blend":
6938
- return _optionalChain([h, 'optionalAccess', _297 => _297.nodeId]) ? this.blendStart && this.blendStart.nodeId !== h.nodeId ? "copy" : "pointer" : "crosshair";
7006
+ return _optionalChain([h, 'optionalAccess', _304 => _304.nodeId]) ? this.blendStart && this.blendStart.nodeId !== h.nodeId ? "copy" : "pointer" : "crosshair";
6939
7007
  case "gradient": {
6940
- const part = _optionalChain([this, 'access', _298 => _298.drag, 'optionalAccess', _299 => _299.kind]) === "gradient" ? this.drag.part : _optionalChain([h, 'optionalAccess', _300 => _300.gradient]);
7008
+ const part = _optionalChain([this, 'access', _305 => _305.drag, 'optionalAccess', _306 => _306.kind]) === "gradient" ? this.drag.part : _optionalChain([h, 'optionalAccess', _307 => _307.gradient]);
6941
7009
  if (!part) return "crosshair";
6942
7010
  if (part.kind === "bar") return this.drag ? "grabbing" : "copy";
6943
7011
  if (part.kind === "handle" && part.handle === "start") return this.drag ? "grabbing" : "move";
@@ -6963,16 +7031,16 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
6963
7031
  const was = this.symbolEdit;
6964
7032
  this.symbolEdit = _nullishCoalesce(s.symbolEdit, () => ( null));
6965
7033
  if (was !== this.symbolEdit) {
6966
- if (_optionalChain([was, 'optionalAccess', _301 => _301.origin])) this.viewport = this.viewOutOf(was);
6967
- if (_optionalChain([this, 'access', _302 => _302.symbolEdit, 'optionalAccess', _303 => _303.origin])) this.viewport = this.viewInto(this.symbolEdit);
7034
+ if (_optionalChain([was, 'optionalAccess', _308 => _308.origin])) this.viewport = this.viewOutOf(was);
7035
+ if (_optionalChain([this, 'access', _309 => _309.symbolEdit, 'optionalAccess', _310 => _310.origin])) this.viewport = this.viewInto(this.symbolEdit);
6968
7036
  }
6969
7037
  this.selection = s.selection.filter((id) => this.getNode(id));
6970
7038
  this.anchors = s.anchors.filter((r) => getAnchor(this.doc, r));
6971
7039
  this.editingId = s.editingId && this.getNode(s.editingId) ? s.editingId : null;
6972
- this.pen = s.pen && _optionalChain([this, 'access', _304 => _304.getNode, 'call', _305 => _305(s.pen.nodeId), 'optionalAccess', _306 => _306.subpaths, 'optionalAccess', _307 => _307[s.pen.subpath]]) ? s.pen : null;
7040
+ this.pen = s.pen && _optionalChain([this, 'access', _311 => _311.getNode, 'call', _312 => _312(s.pen.nodeId), 'optionalAccess', _313 => _313.subpaths, 'optionalAccess', _314 => _314[s.pen.subpath]]) ? s.pen : null;
6973
7041
  if (this.textEdit) {
6974
7042
  const t = this.getNode(this.textEdit.nodeId);
6975
- if (_optionalChain([t, 'optionalAccess', _308 => _308.type]) !== "text") this.textEdit = null;
7043
+ if (_optionalChain([t, 'optionalAccess', _315 => _315.type]) !== "text") this.textEdit = null;
6976
7044
  else {
6977
7045
  const n2 = t.text.length;
6978
7046
  this.textEdit = { ...this.textEdit, anchor: Math.min(this.textEdit.anchor, n2), focus: Math.min(this.textEdit.focus, n2), before: null };
@@ -6981,7 +7049,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
6981
7049
  if (this.widthPoints.length) {
6982
7050
  const kept = this.widthPoints.filter((r) => {
6983
7051
  const n2 = this.getNode(r.nodeId);
6984
- return _optionalChain([n2, 'optionalAccess', _309 => _309.type]) === "path" && !!_optionalChain([n2, 'access', _310 => _310.strokeWidthProfile, 'optionalAccess', _311 => _311[r.index]]);
7052
+ return _optionalChain([n2, 'optionalAccess', _316 => _316.type]) === "path" && !!_optionalChain([n2, 'access', _317 => _317.strokeWidthProfile, 'optionalAccess', _318 => _318[r.index]]);
6985
7053
  });
6986
7054
  if (kept.length !== this.widthPoints.length) this.widthPoints = kept;
6987
7055
  }
@@ -7168,7 +7236,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7168
7236
  if (res.kind) {
7169
7237
  this.snappedToObject = true;
7170
7238
  this.setGuides(res);
7171
- return _optionalChain([leave, 'optionalAccess', _312 => _312.constrain]) ? res.point : { x: res.x ? res.point.x : this.gridValue(res.point.x), y: res.y ? res.point.y : this.gridValue(res.point.y) };
7239
+ return _optionalChain([leave, 'optionalAccess', _319 => _319.constrain]) ? res.point : { x: res.x ? res.point.x : this.gridValue(res.point.x), y: res.y ? res.point.y : this.gridValue(res.point.y) };
7172
7240
  }
7173
7241
  }
7174
7242
  this.setGuides(null);
@@ -7186,14 +7254,14 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7186
7254
  /** Where the pointer at `p` would place a point with the pen or a shape tool (and the guides showing why). */
7187
7255
  hoverSnap(p, input) {
7188
7256
  if (this.tool === "pen") {
7189
- const sp = this.pen ? _optionalChain([this, 'access', _313 => _313.getNode, 'call', _314 => _314(this.pen.nodeId), 'optionalAccess', _315 => _315.subpaths, 'access', _316 => _316[this.pen.subpath]]) : void 0;
7190
- if (this.pen && sp && _optionalChain([this, 'access', _317 => _317.hover, 'optionalAccess', _318 => _318.anchor])) {
7257
+ const sp = this.pen ? _optionalChain([this, 'access', _320 => _320.getNode, 'call', _321 => _321(this.pen.nodeId), 'optionalAccess', _322 => _322.subpaths, 'access', _323 => _323[this.pen.subpath]]) : void 0;
7258
+ if (this.pen && sp && _optionalChain([this, 'access', _324 => _324.hover, 'optionalAccess', _325 => _325.anchor])) {
7191
7259
  this.setGuides(null);
7192
7260
  return p;
7193
7261
  }
7194
7262
  const last = this.pen && sp ? getAnchorWorld(this.doc, { nodeId: this.pen.nodeId, subpath: this.pen.subpath, index: sp.anchors.length - 1 }) : void 0;
7195
7263
  const leave = last ? { at: { x: last.x, y: last.y }, constrain: input.shift ? "angle" : null, ...this.penAngles() } : null;
7196
- const q = this.snapDrawn(p, leave, input, () => this.drawingTargets(_nullishCoalesce(_optionalChain([this, 'access', _319 => _319.pen, 'optionalAccess', _320 => _320.nodeId]), () => ( null))));
7264
+ const q = this.snapDrawn(p, leave, input, () => this.drawingTargets(_nullishCoalesce(_optionalChain([this, 'access', _326 => _326.pen, 'optionalAccess', _327 => _327.nodeId]), () => ( null))));
7197
7265
  this.dwell();
7198
7266
  return q;
7199
7267
  }
@@ -7348,7 +7416,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7348
7416
  if (d.fillRule) out.fillRule = d.fillRule;
7349
7417
  if (d.strokeAlign && d.strokeAlign !== "center") out.strokeAlign = d.strokeAlign;
7350
7418
  for (const key of ["startArrow", "endArrow", "arrowAlign", "startArrowScale", "endArrowScale"]) if (d[key]) out[key] = d[key];
7351
- if (_optionalChain([d, 'access', _321 => _321.strokeWidthProfile, 'optionalAccess', _322 => _322.length])) out.strokeWidthProfile = d.strokeWidthProfile.map((p) => ({ ...p }));
7419
+ if (_optionalChain([d, 'access', _328 => _328.strokeWidthProfile, 'optionalAccess', _329 => _329.length])) out.strokeWidthProfile = d.strokeWidthProfile.map((p) => ({ ...p }));
7352
7420
  let styled = out;
7353
7421
  if (Array.isArray(d.fills)) styled = _chunkFODKPD44cjs.withVectorFills.call(void 0, styled, open ? [] : d.fills);
7354
7422
  if (Array.isArray(d.strokes)) styled = _chunkFODKPD44cjs.withVectorStrokes.call(void 0, styled, d.strokes);
@@ -7448,7 +7516,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7448
7516
  next.set(path.id, _chunkFODKPD44cjs.withVectorTargetPaint.call(void 0, path, target, layer, g));
7449
7517
  }
7450
7518
  this.change(_nullishCoalesce(options.label, () => ( "Gradient")), () => this.setDoc(mapTree(this.doc.nodes, (n2) => _nullishCoalesce(next.get(n2.id), () => ( n2)))), options.merge);
7451
- const stops = _nullishCoalesce(_optionalChain([first, 'optionalAccess', _323 => _323.stops, 'access', _324 => _324.length]), () => ( 0));
7519
+ const stops = _nullishCoalesce(_optionalChain([first, 'optionalAccess', _330 => _330.stops, 'access', _331 => _331.length]), () => ( 0));
7452
7520
  if (this.gradientEdit.stop !== null && this.gradientEdit.stop >= stops) this.gradientEdit = { ...this.gradientEdit, stop: null };
7453
7521
  return { ok: true };
7454
7522
  }
@@ -7626,7 +7694,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7626
7694
  upGradient(drag) {
7627
7695
  const part = drag.part;
7628
7696
  if (!drag.moved) {
7629
- if (_optionalChain([part, 'optionalAccess', _325 => _325.kind]) === "bar") {
7697
+ if (_optionalChain([part, 'optionalAccess', _332 => _332.kind]) === "bar") {
7630
7698
  this.addGradientStop(part.offset);
7631
7699
  return;
7632
7700
  }
@@ -7645,7 +7713,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7645
7713
  const byNode = /* @__PURE__ */ new Map();
7646
7714
  for (const r of refs) {
7647
7715
  const node = this.getNode(r.nodeId);
7648
- if (_optionalChain([node, 'optionalAccess', _326 => _326.type]) !== "path" || !_optionalChain([node, 'access', _327 => _327.strokeWidthProfile, 'optionalAccess', _328 => _328[r.index]])) continue;
7716
+ if (_optionalChain([node, 'optionalAccess', _333 => _333.type]) !== "path" || !_optionalChain([node, 'access', _334 => _334.strokeWidthProfile, 'optionalAccess', _335 => _335[r.index]])) continue;
7649
7717
  byNode.set(r.nodeId, [..._nullishCoalesce(byNode.get(r.nodeId), () => ( [])), r.index]);
7650
7718
  }
7651
7719
  if (!byNode.size) return { ok: false, message: "There is no such width point." };
@@ -7663,12 +7731,12 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7663
7731
  }
7664
7732
  /** Selects width points (width tool); points on other paths than the first are dropped. */
7665
7733
  selectWidthPoints(refs) {
7666
- const first = _optionalChain([refs, 'access', _329 => _329[0], 'optionalAccess', _330 => _330.nodeId]);
7734
+ const first = _optionalChain([refs, 'access', _336 => _336[0], 'optionalAccess', _337 => _337.nodeId]);
7667
7735
  const next = [];
7668
7736
  for (const r of refs) {
7669
7737
  if (r.nodeId !== first || next.some((q) => q.index === r.index)) continue;
7670
7738
  const n2 = this.getNode(r.nodeId);
7671
- if (_optionalChain([n2, 'optionalAccess', _331 => _331.type]) === "path" && _optionalChain([n2, 'access', _332 => _332.strokeWidthProfile, 'optionalAccess', _333 => _333[r.index]])) next.push({ nodeId: r.nodeId, index: r.index, subpath: _nullishCoalesce(r.subpath, () => ( 0)) });
7739
+ if (_optionalChain([n2, 'optionalAccess', _338 => _338.type]) === "path" && _optionalChain([n2, 'access', _339 => _339.strokeWidthProfile, 'optionalAccess', _340 => _340[r.index]])) next.push({ nodeId: r.nodeId, index: r.index, subpath: _nullishCoalesce(r.subpath, () => ( 0)) });
7672
7740
  }
7673
7741
  this.widthPoints = next;
7674
7742
  this.notify();
@@ -7683,7 +7751,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7683
7751
  */
7684
7752
  setWidthPoint(target, values) {
7685
7753
  const node = this.getNode(target.nodeId);
7686
- if (_optionalChain([node, 'optionalAccess', _334 => _334.type]) !== "path") return { ok: false, message: "There is no such path." };
7754
+ if (_optionalChain([node, 'optionalAccess', _341 => _341.type]) !== "path") return { ok: false, message: "There is no such path." };
7687
7755
  const g = vectorStrokeWidthGeometry(node);
7688
7756
  if (!g || !(g.unit > 0)) return { ok: false, message: "The path has no visible stroke." };
7689
7757
  const num = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
@@ -7716,11 +7784,11 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7716
7784
  }
7717
7785
  }
7718
7786
  }
7719
- const subpath = _optionalChain([this, 'access', _335 => _335.widthEdit, 'optionalAccess', _336 => _336.nodeId]) === node.id ? this.widthEdit.subpath : _nullishCoalesce(_optionalChain([this, 'access', _337 => _337.widthPoints, 'access', _338 => _338.find, 'call', _339 => _339((r) => r.nodeId === node.id), 'optionalAccess', _340 => _340.subpath]), () => ( 0));
7787
+ const subpath = _optionalChain([this, 'access', _342 => _342.widthEdit, 'optionalAccess', _343 => _343.nodeId]) === node.id ? this.widthEdit.subpath : _nullishCoalesce(_optionalChain([this, 'access', _344 => _344.widthPoints, 'access', _345 => _345.find, 'call', _346 => _346((r) => r.nodeId === node.id), 'optionalAccess', _347 => _347.subpath]), () => ( 0));
7720
7788
  const edit = this.widthEdit;
7721
7789
  this.change("Width Point", () => this.replaceNode(node.id, withStyle(node, { strokeWidthProfile: points })));
7722
7790
  this.widthPoints = [{ nodeId: node.id, index, subpath }];
7723
- if (_optionalChain([edit, 'optionalAccess', _341 => _341.nodeId]) === node.id && (edit.index === existing || existing === null)) this.widthEdit = this.widthEditFor(node.id, subpath, index, null);
7791
+ if (_optionalChain([edit, 'optionalAccess', _348 => _348.nodeId]) === node.id && (edit.index === existing || existing === null)) this.widthEdit = this.widthEditFor(node.id, subpath, index, null);
7724
7792
  this.notify();
7725
7793
  return { ok: true };
7726
7794
  }
@@ -7754,7 +7822,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7754
7822
  /** The editor's view of point `index` (or of the stroke at `t` when index is null) of `nodeId`. */
7755
7823
  widthEditFor(nodeId, subpath, index, t) {
7756
7824
  const node = this.getNode(nodeId);
7757
- if (_optionalChain([node, 'optionalAccess', _342 => _342.type]) !== "path") return null;
7825
+ if (_optionalChain([node, 'optionalAccess', _349 => _349.type]) !== "path") return null;
7758
7826
  const g = vectorStrokeWidthGeometry(node);
7759
7827
  if (!g) return null;
7760
7828
  const profile = _chunkFODKPD44cjs.sanitizeWidthProfile.call(void 0, node.strokeWidthProfile);
@@ -7787,12 +7855,12 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7787
7855
  /** Sets corner smoothing (squircle, 0–1) of the same anchors as `setCornerRadius`, keeping their radii. */
7788
7856
  setCornerSmoothing(smoothing, options = {}) {
7789
7857
  if (!(smoothing >= 0 && smoothing <= 1)) return { ok: false, message: "Corner smoothing must be from 0 to 1." };
7790
- const refs = this.cornerTargets(options).filter((r) => (_nullishCoalesce(_optionalChain([getAnchor, 'call', _343 => _343(this.doc, r), 'optionalAccess', _344 => _344.corner, 'optionalAccess', _345 => _345.radius]), () => ( 0))) > 0);
7858
+ const refs = this.cornerTargets(options).filter((r) => (_nullishCoalesce(_optionalChain([getAnchor, 'call', _350 => _350(this.doc, r), 'optionalAccess', _351 => _351.corner, 'optionalAccess', _352 => _352.radius]), () => ( 0))) > 0);
7791
7859
  if (!refs.length) return { ok: false, message: "Give the corners a radius first: smoothing shapes rounded corners." };
7792
7860
  this.change(
7793
7861
  "Corner Smoothing",
7794
7862
  () => {
7795
- this.doc = this.updateAnchors(this.doc, refs, (a) => _chunkFODKPD44cjs.setAnchorCorner.call(void 0, a, _nullishCoalesce(_optionalChain([a, 'access', _346 => _346.corner, 'optionalAccess', _347 => _347.radius]), () => ( 0)), void 0, smoothing));
7863
+ this.doc = this.updateAnchors(this.doc, refs, (a) => _chunkFODKPD44cjs.setAnchorCorner.call(void 0, a, _nullishCoalesce(_optionalChain([a, 'access', _353 => _353.corner, 'optionalAccess', _354 => _354.radius]), () => ( 0)), void 0, smoothing));
7796
7864
  },
7797
7865
  options.merge
7798
7866
  );
@@ -7803,7 +7871,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
7803
7871
  const refs = this.cornerTargets(options);
7804
7872
  if (!refs.length) return { ok: false, message: "Nothing is selected." };
7805
7873
  this.change("Corner Kind", () => {
7806
- this.doc = this.updateAnchors(this.doc, refs, (a) => _chunkFODKPD44cjs.setAnchorCorner.call(void 0, a, _nullishCoalesce(_optionalChain([a, 'access', _348 => _348.corner, 'optionalAccess', _349 => _349.radius]), () => ( 0)), kind));
7874
+ this.doc = this.updateAnchors(this.doc, refs, (a) => _chunkFODKPD44cjs.setAnchorCorner.call(void 0, a, _nullishCoalesce(_optionalChain([a, 'access', _355 => _355.corner, 'optionalAccess', _356 => _356.radius]), () => ( 0)), kind));
7807
7875
  });
7808
7876
  return { ok: true };
7809
7877
  }
@@ -8063,7 +8131,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8063
8131
  */
8064
8132
  updateFilter(nodeId, filterId, patch, options = {}) {
8065
8133
  const merge = options.merge === true ? `filter:${nodeId}:${filterId}` : options.merge || void 0;
8066
- const current = _optionalChain([this, 'access', _350 => _350.getNode, 'call', _351 => _351(nodeId), 'optionalAccess', _352 => _352.filters, 'optionalAccess', _353 => _353.find, 'call', _354 => _354((f) => f.id === filterId)]);
8134
+ const current = _optionalChain([this, 'access', _357 => _357.getNode, 'call', _358 => _358(nodeId), 'optionalAccess', _359 => _359.filters, 'optionalAccess', _360 => _360.find, 'call', _361 => _361((f) => f.id === filterId)]);
8067
8135
  return this.editFilters(
8068
8136
  nodeId,
8069
8137
  `Edit ${current ? _chunkFODKPD44cjs.VECTOR_FILTER_LABELS[current.type] : "Filter"}`,
@@ -8144,7 +8212,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8144
8212
  updateEffect(nodeId, effectId, patch, options = {}) {
8145
8213
  const merge = options.merge === true ? `effect:${nodeId}:${effectId}` : options.merge || void 0;
8146
8214
  const node = this.getNode(nodeId);
8147
- const current = _optionalChain([node, 'optionalAccess', _355 => _355.effects, 'optionalAccess', _356 => _356.find, 'call', _357 => _357((e) => e.id === effectId)]);
8215
+ const current = _optionalChain([node, 'optionalAccess', _362 => _362.effects, 'optionalAccess', _363 => _363.find, 'call', _364 => _364((e) => e.id === effectId)]);
8148
8216
  const label2 = current ? _nullishCoalesce(_chunkFODKPD44cjs.VECTOR_EFFECT_LABELS[current.type], () => ( "Effect")) : "Effect";
8149
8217
  return this.editEffects(
8150
8218
  nodeId,
@@ -8278,10 +8346,10 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8278
8346
  return this.selection.filter((id) => {
8279
8347
  let covered = false;
8280
8348
  const loc = _chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id);
8281
- let parent = _nullishCoalesce(_optionalChain([loc, 'optionalAccess', _358 => _358.parent]), () => ( null));
8349
+ let parent = _nullishCoalesce(_optionalChain([loc, 'optionalAccess', _365 => _365.parent]), () => ( null));
8282
8350
  while (parent) {
8283
8351
  if (this.selection.includes(parent.id)) covered = true;
8284
- parent = _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, parent.id), 'optionalAccess', _359 => _359.parent]), () => ( null));
8352
+ parent = _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, parent.id), 'optionalAccess', _366 => _366.parent]), () => ( null));
8285
8353
  }
8286
8354
  return !covered;
8287
8355
  });
@@ -8435,7 +8503,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8435
8503
  out.push({ nodeId: node.id, effectId: effect.id });
8436
8504
  }
8437
8505
  }
8438
- const made = out.some((o) => !_optionalChain([targets, 'access', _360 => _360.find, 'call', _361 => _361((n2) => n2.id === o.nodeId), 'optionalAccess', _362 => _362.effects, 'optionalAccess', _363 => _363.some, 'call', _364 => _364((e) => e.id === o.effectId)]));
8506
+ const made = out.some((o) => !_optionalChain([targets, 'access', _367 => _367.find, 'call', _368 => _368((n2) => n2.id === o.nodeId), 'optionalAccess', _369 => _369.effects, 'optionalAccess', _370 => _370.some, 'call', _371 => _371((e) => e.id === o.effectId)]));
8439
8507
  const merge = options.merge ? `envelope:${out.map((o) => o.nodeId).join(",")}` : void 0;
8440
8508
  this.change(made ? params.style === "mesh" ? "Make Envelope with Mesh" : "Make Envelope with Warp" : "Edit Envelope", () => this.setDoc(mapTree(this.doc.nodes, (n2) => _nullishCoalesce(next.get(n2.id), () => ( n2)))), merge);
8441
8509
  return out;
@@ -8454,11 +8522,11 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8454
8522
  const sorted = ids.filter((id) => order.has(id)).sort((a, b) => order.get(a) - order.get(b));
8455
8523
  const topId = sorted[sorted.length - 1];
8456
8524
  const top = this.getNode(topId);
8457
- const outline = _optionalChain([top, 'optionalAccess', _365 => _365.type]) === "path" ? top.subpaths.find((sp) => sp.closed && sp.anchors.length > 1) : void 0;
8525
+ const outline = _optionalChain([top, 'optionalAccess', _372 => _372.type]) === "path" ? top.subpaths.find((sp) => sp.closed && sp.anchors.length > 1) : void 0;
8458
8526
  if (!top || !outline) return { ok: false, message: "The top object must be a path with a closed outline." };
8459
8527
  const contents = sorted.slice(0, -1).map((id) => this.getNode(id));
8460
8528
  if (contents.some((n2) => n2.locked)) return { ok: false, message: "Locked objects cannot be enveloped." };
8461
- const parents = contents.map((n2) => _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, n2.id), 'optionalAccess', _366 => _366.parent, 'optionalAccess', _367 => _367.id]), () => ( null)));
8529
+ const parents = contents.map((n2) => _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, n2.id), 'optionalAccess', _373 => _373.parent, 'optionalAccess', _374 => _374.id]), () => ( null)));
8462
8530
  if (parents.some((p) => p !== parents[0])) return { ok: false, message: "The objects to envelope must be in the same group." };
8463
8531
  const target = contents.length === 1 ? contents[0] : { id: this.newId(), type: "group", name: "Envelope", children: contents.map((n2) => n2) };
8464
8532
  const parentToDoc = parents[0] ? this.worldOf(parents[0]) : _chunkFODKPD44cjs.IDENTITY_MATRIX;
@@ -8499,7 +8567,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8499
8567
  * comes back as a path above each of them. One undo step; returns the new paths' ids.
8500
8568
  */
8501
8569
  releaseEnvelope(options = {}) {
8502
- const targets = this.envelopeTargets(options.ids).filter((n2) => _optionalChain([n2, 'access', _368 => _368.effects, 'optionalAccess', _369 => _369.some, 'call', _370 => _370((e) => e.type === "envelope")]));
8570
+ const targets = this.envelopeTargets(options.ids).filter((n2) => _optionalChain([n2, 'access', _375 => _375.effects, 'optionalAccess', _376 => _376.some, 'call', _377 => _377((e) => e.type === "envelope")]));
8503
8571
  if (!targets.length) return [];
8504
8572
  const created = [];
8505
8573
  const replace = /* @__PURE__ */ new Map();
@@ -8776,8 +8844,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8776
8844
  if (!ids.length) return null;
8777
8845
  const locs = ids.map((id2) => _chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id2));
8778
8846
  if (locs.some((l) => !l)) return null;
8779
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _371 => _371[0], 'access', _372 => _372.parent, 'optionalAccess', _373 => _373.id]), () => ( null));
8780
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _374 => _374.parent, 'optionalAccess', _375 => _375.id]), () => ( null))) !== parent)) return null;
8847
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _378 => _378[0], 'access', _379 => _379.parent, 'optionalAccess', _380 => _380.id]), () => ( null));
8848
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _381 => _381.parent, 'optionalAccess', _382 => _382.id]), () => ( null))) !== parent)) return null;
8781
8849
  const id = this.newId();
8782
8850
  this.change("Group", () => {
8783
8851
  const set = new Set(ids);
@@ -8800,7 +8868,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8800
8868
  }
8801
8869
  /** Replaces selected groups with their children. */
8802
8870
  ungroup(options = {}) {
8803
- const groups = (_nullishCoalesce(options.ids, () => ( this.selection))).map((id) => this.getNode(id)).filter((n2) => _optionalChain([n2, 'optionalAccess', _376 => _376.type]) === "group");
8871
+ const groups = (_nullishCoalesce(options.ids, () => ( this.selection))).map((id) => this.getNode(id)).filter((n2) => _optionalChain([n2, 'optionalAccess', _383 => _383.type]) === "group");
8804
8872
  if (!groups.length) return { ok: false, message: "Select a group to ungroup." };
8805
8873
  const set = new Set(groups.map((g) => g.id));
8806
8874
  this.change("Ungroup", () => {
@@ -8900,7 +8968,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8900
8968
  this.change(label2, () => this.replaceNode(lone.id, { ...lone, liveBoolean: op, children }));
8901
8969
  return lone.id;
8902
8970
  }
8903
- const parents = roots.map((id2) => _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id2), 'optionalAccess', _377 => _377.parent]), () => ( null)));
8971
+ const parents = roots.map((id2) => _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id2), 'optionalAccess', _384 => _384.parent]), () => ( null)));
8904
8972
  if (parents.every((g) => _chunkFODKPD44cjs.isVectorLiveBoolean.call(void 0, g))) {
8905
8973
  const set = new Set(roots);
8906
8974
  this.change(
@@ -8921,8 +8989,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8921
8989
  return parents[0].id;
8922
8990
  }
8923
8991
  if (nodes.length < 2) return null;
8924
- const parent = _nullishCoalesce(_optionalChain([parents, 'access', _378 => _378[0], 'optionalAccess', _379 => _379.id]), () => ( null));
8925
- if (parents.some((g) => (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _380 => _380.id]), () => ( null))) !== parent)) return null;
8992
+ const parent = _nullishCoalesce(_optionalChain([parents, 'access', _385 => _385[0], 'optionalAccess', _386 => _386.id]), () => ( null));
8993
+ if (parents.some((g) => (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _387 => _387.id]), () => ( null))) !== parent)) return null;
8926
8994
  const id = this.newId();
8927
8995
  this.change(label2, () => {
8928
8996
  const set = new Set(roots);
@@ -8970,7 +9038,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
8970
9038
  }
8971
9039
  /** Splits selected compound paths into one path per subpath. */
8972
9040
  breakApart(options = {}) {
8973
- const paths = (_nullishCoalesce(options.ids, () => ( this.selection))).map((id) => this.getNode(id)).filter((n2) => _optionalChain([n2, 'optionalAccess', _381 => _381.type]) === "path" && n2.subpaths.length > 1);
9041
+ const paths = (_nullishCoalesce(options.ids, () => ( this.selection))).map((id) => this.getNode(id)).filter((n2) => _optionalChain([n2, 'optionalAccess', _388 => _388.type]) === "path" && n2.subpaths.length > 1);
8974
9042
  if (!paths.length) return { ok: false, message: "Select a compound path to break apart." };
8975
9043
  const created = [];
8976
9044
  const set = new Set(paths.map((p) => p.id));
@@ -9038,7 +9106,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9038
9106
  const out = /* @__PURE__ */ new Map();
9039
9107
  for (const id of _nullishCoalesce(ids, () => ( this.selection))) {
9040
9108
  const node = this.getNode(id);
9041
- const group = isVectorBlendGroup(node) ? node : _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _382 => _382.parent]);
9109
+ const group = isVectorBlendGroup(node) ? node : _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _389 => _389.parent]);
9042
9110
  if (isVectorBlendGroup(group)) out.set(group.id, group);
9043
9111
  }
9044
9112
  return [...out.values()];
@@ -9056,8 +9124,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9056
9124
  });
9057
9125
  if (ids.length < 2) return null;
9058
9126
  const locs = ids.map((id2) => _chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id2));
9059
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _383 => _383[0], 'access', _384 => _384.parent, 'optionalAccess', _385 => _385.id]), () => ( null));
9060
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _386 => _386.parent, 'optionalAccess', _387 => _387.id]), () => ( null))) !== parent)) return null;
9127
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _390 => _390[0], 'access', _391 => _391.parent, 'optionalAccess', _392 => _392.id]), () => ( null));
9128
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _393 => _393.parent, 'optionalAccess', _394 => _394.id]), () => ( null))) !== parent)) return null;
9061
9129
  const order = input.keepOrder ? ids : ids.slice().sort((a, b) => locs[ids.indexOf(a)].index - locs[ids.indexOf(b)].index);
9062
9130
  const blend = blendOptionsOf({ ...this.blendDefaults, ...input });
9063
9131
  if (input.starts) {
@@ -9105,8 +9173,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9105
9173
  if (n2.blendStep) return { ok: false, message: `"${id2}" is a blend step; select its blend instead.` };
9106
9174
  }
9107
9175
  const locs = ids.map((id2) => _chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id2));
9108
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _388 => _388[0], 'access', _389 => _389.parent, 'optionalAccess', _390 => _390.id]), () => ( null));
9109
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _391 => _391.parent, 'optionalAccess', _392 => _392.id]), () => ( null))) !== parent)) return { ok: false, message: "The objects must share a parent (group them, or pick objects at one level)." };
9176
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _395 => _395[0], 'access', _396 => _396.parent, 'optionalAccess', _397 => _397.id]), () => ( null));
9177
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _398 => _398.parent, 'optionalAccess', _399 => _399.id]), () => ( null))) !== parent)) return { ok: false, message: "The objects must share a parent (group them, or pick objects at one level)." };
9110
9178
  const order = ids.slice().sort((a, b) => locs[ids.indexOf(a)].index - locs[ids.indexOf(b)].index);
9111
9179
  const maskId = _nullishCoalesce(options.maskId, () => ( order[order.length - 1]));
9112
9180
  if (!order.includes(maskId)) return { ok: false, message: `The mask "${maskId}" must be one of the objects (${order.map((id2) => `"${id2}"`).join(", ")}).` };
@@ -9280,7 +9348,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9280
9348
  getShadingSelection() {
9281
9349
  const sel = this.shadingSel;
9282
9350
  const node = sel ? this.getNode(sel.nodeId) : void 0;
9283
- if (!sel || _optionalChain([node, 'optionalAccess', _393 => _393.type]) !== "path" || !_chunkFODKPD44cjs.isVectorShadedPaint.call(void 0, node.fill) || sel.index >= node.fill.points.length) return null;
9351
+ if (!sel || _optionalChain([node, 'optionalAccess', _400 => _400.type]) !== "path" || !_chunkFODKPD44cjs.isVectorShadedPaint.call(void 0, node.fill) || sel.index >= node.fill.points.length) return null;
9284
9352
  return { ...sel, kind: node.fill.type };
9285
9353
  }
9286
9354
  /** The path `id` (or a message why it cannot take a mesh or freeform fill). */
@@ -9346,17 +9414,17 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9346
9414
  const b = _chunkFODKPD44cjs.vectorPathLocalBounds.call(void 0, t);
9347
9415
  if (!b) return { ok: false, message: `"${id}" has no area to fill.` };
9348
9416
  let f;
9349
- if (_optionalChain([input, 'access', _394 => _394.points, 'optionalAccess', _395 => _395.length])) {
9417
+ if (_optionalChain([input, 'access', _401 => _401.points, 'optionalAccess', _402 => _402.length])) {
9350
9418
  f = _chunkFODKPD44cjs.sanitizeVectorShadedPaint.call(void 0, { type: "freeform", points: input.points.map((q) => ({ ...q, ...this.toLocal(id, q) })), ...input.lines ? { lines: input.lines } : {} });
9351
9419
  if (!f) return { ok: false, message: "Each point needs x, y (numbers) and a colour." };
9352
- if (input.lines && (_nullishCoalesce(_optionalChain([f, 'access', _396 => _396.lines, 'optionalAccess', _397 => _397.length]), () => ( 0))) !== input.lines.length) return { ok: false, message: `Each line needs two or more point indices from 0 to ${input.points.length - 1}, none twice in a row.` };
9420
+ if (input.lines && (_nullishCoalesce(_optionalChain([f, 'access', _403 => _403.lines, 'optionalAccess', _404 => _404.length]), () => ( 0))) !== input.lines.length) return { ok: false, message: `Each line needs two or more point indices from 0 to ${input.points.length - 1}, none twice in a row.` };
9353
9421
  } else {
9354
9422
  const bad = (_nullishCoalesce(input.colors, () => ( []))).find((c) => !_chunkFODKPD44cjs.parseVectorColor.call(void 0, c));
9355
9423
  if (bad !== void 0) return { ok: false, message: `"${bad}" is not a colour.` };
9356
9424
  const outline = _chunkFODKPD44cjs.subpathsToBezier.call(void 0, t.subpaths);
9357
9425
  const inside = (q) => _chunkXGD3FSNCcjs.pointInBezierPath.call(void 0, outline, [q.x, q.y], _nullishCoalesce(t.fillRule, () => ( "nonzero")));
9358
9426
  const base = typeof t.fill === "string" && _chunkFODKPD44cjs.parseVectorColor.call(void 0, t.fill) ? t.fill : "#000000";
9359
- f = _chunkFODKPD44cjs.autoVectorFreeformGradient.call(void 0, b, _optionalChain([input, 'access', _398 => _398.colors, 'optionalAccess', _399 => _399.length]) ? input.colors : [base, "#ffffff"], inside);
9427
+ f = _chunkFODKPD44cjs.autoVectorFreeformGradient.call(void 0, b, _optionalChain([input, 'access', _405 => _405.colors, 'optionalAccess', _406 => _406.length]) ? input.colors : [base, "#ffffff"], inside);
9360
9428
  }
9361
9429
  fills.set(id, f);
9362
9430
  }
@@ -9366,7 +9434,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9366
9434
  /** The mesh or freeform fill of path `id` with its points in document units, or null. */
9367
9435
  getShading(id) {
9368
9436
  const n2 = this.getNode(id);
9369
- if (_optionalChain([n2, 'optionalAccess', _400 => _400.type]) !== "path" || !_chunkFODKPD44cjs.isVectorShadedPaint.call(void 0, n2.fill)) return null;
9437
+ if (_optionalChain([n2, 'optionalAccess', _407 => _407.type]) !== "path" || !_chunkFODKPD44cjs.isVectorShadedPaint.call(void 0, n2.fill)) return null;
9370
9438
  const world = this.worldOf(id);
9371
9439
  return _chunkFODKPD44cjs.mapVectorShadedPaint.call(void 0, n2.fill, (q) => _chunkFODKPD44cjs.applyMatrix.call(void 0, world, q));
9372
9440
  }
@@ -9473,7 +9541,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9473
9541
  if (typeof t === "string") return { ok: false, message: t };
9474
9542
  if (!_chunkFODKPD44cjs.isVectorFreeformGradient.call(void 0, t.fill)) return { ok: false, message: `"${id}" has no freeform gradient fill (add one with vector.setFreeformGradient).` };
9475
9543
  const f = _chunkFODKPD44cjs.sanitizeVectorShadedPaint.call(void 0, { ...t.fill, lines });
9476
- if ((_nullishCoalesce(_optionalChain([f, 'access', _401 => _401.lines, 'optionalAccess', _402 => _402.length]), () => ( 0))) !== lines.length) return { ok: false, message: `Each line needs two or more point indices from 0 to ${t.fill.points.length - 1}, none twice in a row.` };
9544
+ if ((_nullishCoalesce(_optionalChain([f, 'access', _408 => _408.lines, 'optionalAccess', _409 => _409.length]), () => ( 0))) !== lines.length) return { ok: false, message: `Each line needs two or more point indices from 0 to ${t.fill.points.length - 1}, none twice in a row.` };
9477
9545
  const { lines: _l, ...rest } = t.fill;
9478
9546
  this.setFills("Freeform Lines", /* @__PURE__ */ new Map([[id, lines.length ? { ...rest, lines: f.lines } : rest]]));
9479
9547
  return { ok: true };
@@ -9493,7 +9561,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9493
9561
  penAngles() {
9494
9562
  if (!this.snap.polarRelative || !this.pen) return {};
9495
9563
  const node = this.getNode(this.pen.nodeId);
9496
- const sp = _optionalChain([node, 'optionalAccess', _403 => _403.subpaths, 'access', _404 => _404[this.pen.subpath]]);
9564
+ const sp = _optionalChain([node, 'optionalAccess', _410 => _410.subpaths, 'access', _411 => _411[this.pen.subpath]]);
9497
9565
  if (!sp || sp.anchors.length < 2) return {};
9498
9566
  const n2 = sp.anchors.length;
9499
9567
  const a = getAnchorWorld(this.doc, { nodeId: this.pen.nodeId, subpath: this.pen.subpath, index: n2 - 2 });
@@ -9611,7 +9679,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9611
9679
  const pen = this.pen;
9612
9680
  const node = pen ? this.getNode(pen.nodeId) : void 0;
9613
9681
  const sp = pen && node ? node.subpaths[pen.subpath] : void 0;
9614
- if (!pen || !node || !_optionalChain([sp, 'optionalAccess', _405 => _405.anchors, 'access', _406 => _406.length])) return { ok: false, message: "Start a path with the pen first: typed entry places its next point." };
9682
+ if (!pen || !node || !_optionalChain([sp, 'optionalAccess', _412 => _412.anchors, 'access', _413 => _413.length])) return { ok: false, message: "Start a path with the pen first: typed entry places its next point." };
9615
9683
  const last = getAnchorWorld(this.doc, { nodeId: pen.nodeId, subpath: pen.subpath, index: sp.anchors.length - 1 });
9616
9684
  const num = "(-?(?:\\d+\\.?\\d*|\\.\\d+))";
9617
9685
  const t = text.replace(/\s+/g, "");
@@ -9620,7 +9688,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9620
9688
  if (m = t.match(new RegExp(`^@${num},${num}$`))) target = { x: last.x + parseFloat(m[1]), y: last.y + parseFloat(m[2]) };
9621
9689
  else if (m = t.match(new RegExp(`^${num},${num}$`))) target = { x: parseFloat(m[1]), y: parseFloat(m[2]) };
9622
9690
  else if (m = t.match(new RegExp(`^${num}<${num}$`))) {
9623
- const base = this.snap.polarRelative ? (_nullishCoalesce(_nullishCoalesce(_optionalChain([this, 'access', _407 => _407.penAngles, 'call', _408 => _408(), 'access', _409 => _409.angles, 'optionalAccess', _410 => _410[0]]), () => ( this.snap.angles[0])), () => ( 0))) - (_nullishCoalesce(this.snap.angles[0], () => ( 0))) : 0;
9691
+ const base = this.snap.polarRelative ? (_nullishCoalesce(_nullishCoalesce(_optionalChain([this, 'access', _414 => _414.penAngles, 'call', _415 => _415(), 'access', _416 => _416.angles, 'optionalAccess', _417 => _417[0]]), () => ( this.snap.angles[0])), () => ( 0))) - (_nullishCoalesce(this.snap.angles[0], () => ( 0))) : 0;
9624
9692
  const dir = vectorAngleDirection(parseFloat(m[2]) + base);
9625
9693
  const len2 = parseFloat(m[1]);
9626
9694
  target = { x: last.x + dir.x * len2, y: last.y + dir.y * len2 };
@@ -9648,7 +9716,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9648
9716
  */
9649
9717
  addPathByDimensions(input) {
9650
9718
  if (!input.start || !Number.isFinite(input.start.x) || !Number.isFinite(input.start.y)) return { ok: false, message: "start must be { x, y } in document units." };
9651
- if (!_optionalChain([input, 'access', _411 => _411.steps, 'optionalAccess', _412 => _412.length])) return { ok: false, message: "Give at least one step." };
9719
+ if (!_optionalChain([input, 'access', _418 => _418.steps, 'optionalAccess', _419 => _419.length])) return { ok: false, message: "Give at least one step." };
9652
9720
  const pts = [{ x: input.start.x, y: input.start.y }];
9653
9721
  for (const [i, step] of input.steps.entries()) {
9654
9722
  const at = pts[pts.length - 1];
@@ -9682,7 +9750,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9682
9750
  downConnector(p) {
9683
9751
  const before = this.snapshot();
9684
9752
  const target = _chunkFODKPD44cjs.vectorConnectorTargetAt.call(void 0, this.doc.nodes, p, this.connectorRadius());
9685
- const at = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _413 => _413.site]), () => ( p));
9753
+ const at = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _420 => _420.site]), () => ( p));
9686
9754
  const node = {
9687
9755
  id: this.newId(),
9688
9756
  type: "path",
@@ -9827,8 +9895,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9827
9895
  const r = _chunkFODKPD44cjs.routeVectorConnector.call(void 0, this.doc.nodes, n2.id);
9828
9896
  const world = _nullishCoalesce(_chunkFODKPD44cjs.vectorWorldMatrix.call(void 0, this.doc.nodes, n2.id), () => ( _chunkFODKPD44cjs.IDENTITY_MATRIX));
9829
9897
  const sp = n2.subpaths[0];
9830
- const first = _optionalChain([sp, 'optionalAccess', _414 => _414.anchors, 'access', _415 => _415[0]]);
9831
- const last = _optionalChain([sp, 'optionalAccess', _416 => _416.anchors, 'access', _417 => _417[sp.anchors.length - 1]]);
9898
+ const first = _optionalChain([sp, 'optionalAccess', _421 => _421.anchors, 'access', _422 => _422[0]]);
9899
+ const last = _optionalChain([sp, 'optionalAccess', _423 => _423.anchors, 'access', _424 => _424[sp.anchors.length - 1]]);
9832
9900
  const end = (e, side, a) => {
9833
9901
  const at = a ? _chunkFODKPD44cjs.applyMatrix.call(void 0, world, a) : null;
9834
9902
  return { ...e ? { nodeId: e.nodeId, side: _nullishCoalesce(e.side, () => ( "auto")), resolvedSide: side } : {}, ...at ? { x: at.x, y: at.y } : {} };
@@ -9838,8 +9906,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9838
9906
  ...n2.name ? { name: n2.name } : {},
9839
9907
  route: _nullishCoalesce(n2.connector.route, () => ( "straight")),
9840
9908
  ...n2.connector.radius ? { radius: n2.connector.radius } : {},
9841
- start: end(n2.connector.start, _nullishCoalesce(_optionalChain([r, 'optionalAccess', _418 => _418.startSide]), () => ( null)), first),
9842
- end: end(n2.connector.end, _nullishCoalesce(_optionalChain([r, 'optionalAccess', _419 => _419.endSide]), () => ( null)), last)
9909
+ start: end(n2.connector.start, _nullishCoalesce(_optionalChain([r, 'optionalAccess', _425 => _425.startSide]), () => ( null)), first),
9910
+ end: end(n2.connector.end, _nullishCoalesce(_optionalChain([r, 'optionalAccess', _426 => _426.endSide]), () => ( null)), last)
9843
9911
  });
9844
9912
  });
9845
9913
  return out;
@@ -9906,7 +9974,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9906
9974
  }
9907
9975
  const locs = ids.map((id2) => _chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id2));
9908
9976
  const parent = _nullishCoalesce(locs[0].parent, () => ( null));
9909
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _420 => _420.parent, 'optionalAccess', _421 => _421.id]), () => ( null))) !== (_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _422 => _422.id]), () => ( null))))) return { ok: false, message: "The objects must share a parent (pick objects at one level)." };
9977
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _427 => _427.parent, 'optionalAccess', _428 => _428.id]), () => ( null))) !== (_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _429 => _429.id]), () => ( null))))) return { ok: false, message: "The objects must share a parent (pick objects at one level)." };
9910
9978
  const b = _chunkFODKPD44cjs.unionBounds.call(void 0, ids.map((id2) => _chunkFODKPD44cjs.vectorNodeBounds.call(void 0, this.getNode(id2))));
9911
9979
  if (!b) return { ok: false, message: "The objects have no extent to frame." };
9912
9980
  const id = this.newId();
@@ -9946,7 +10014,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
9946
10014
  const n2 = this.getNode(id);
9947
10015
  if (_chunkFODKPD44cjs.isVectorFrame.call(void 0, n2)) out.set(n2.id, n2);
9948
10016
  else if (!ids) {
9949
- const parent = _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _423 => _423.parent]);
10017
+ const parent = _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _430 => _430.parent]);
9950
10018
  if (_chunkFODKPD44cjs.isVectorFrame.call(void 0, parent)) out.set(parent.id, parent);
9951
10019
  }
9952
10020
  }
@@ -10015,7 +10083,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10015
10083
  if (!ids.length) return { ok: false, message: "Select objects inside a frame first." };
10016
10084
  for (const id of ids) {
10017
10085
  if (!this.getNode(id)) return { ok: false, message: `There is no node "${id}".` };
10018
- if (!_chunkFODKPD44cjs.isVectorFrame.call(void 0, _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _424 => _424.parent]))) return { ok: false, message: `"${id}" is not directly inside a frame: resizing constraints only apply to a frame's children.` };
10086
+ if (!_chunkFODKPD44cjs.isVectorFrame.call(void 0, _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _431 => _431.parent]))) return { ok: false, message: `"${id}" is not directly inside a frame: resizing constraints only apply to a frame's children.` };
10019
10087
  }
10020
10088
  const set = new Set(ids);
10021
10089
  this.change("Constraints", () => {
@@ -10036,7 +10104,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10036
10104
  artboard: parent === null,
10037
10105
  frame: n2.frame,
10038
10106
  bounds: _chunkFODKPD44cjs.vectorNodeBounds.call(void 0, n2, _nullishCoalesce(_chunkFODKPD44cjs.vectorParentMatrix.call(void 0, this.doc.nodes, n2.id), () => ( _chunkFODKPD44cjs.IDENTITY_MATRIX))),
10039
- children: n2.children.map((c) => ({ id: c.id, type: c.type, ...c.name ? { name: c.name } : {}, horizontal: _nullishCoalesce(_optionalChain([c, 'access', _425 => _425.resizing, 'optionalAccess', _426 => _426.horizontal]), () => ( "left")), vertical: _nullishCoalesce(_optionalChain([c, 'access', _427 => _427.resizing, 'optionalAccess', _428 => _428.vertical]), () => ( "top")) }))
10107
+ children: n2.children.map((c) => ({ id: c.id, type: c.type, ...c.name ? { name: c.name } : {}, horizontal: _nullishCoalesce(_optionalChain([c, 'access', _432 => _432.resizing, 'optionalAccess', _433 => _433.horizontal]), () => ( "left")), vertical: _nullishCoalesce(_optionalChain([c, 'access', _434 => _434.resizing, 'optionalAccess', _435 => _435.vertical]), () => ( "top")) }))
10040
10108
  });
10041
10109
  }
10042
10110
  if (n2.type === "group") visit(n2.children, n2.id);
@@ -10057,7 +10125,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10057
10125
  const n2 = this.getNode(id);
10058
10126
  if (_chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, n2)) out.set(n2.id, n2);
10059
10127
  else {
10060
- const parent = _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _429 => _429.parent]);
10128
+ const parent = _optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _436 => _436.parent]);
10061
10129
  if (_chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, parent)) out.set(parent.id, parent);
10062
10130
  }
10063
10131
  }
@@ -10079,7 +10147,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10079
10147
  const children = [...contents, mask];
10080
10148
  released.push(...children.map((c) => c.id));
10081
10149
  const { mask: _m, ...rest } = g;
10082
- const keep = !!(_optionalChain([g, 'access', _430 => _430.filters, 'optionalAccess', _431 => _431.length]) || g.blendMode && g.blendMode !== "normal" || _optionalChain([g, 'access', _432 => _432.effects, 'optionalAccess', _433 => _433.length]));
10150
+ const keep = !!(_optionalChain([g, 'access', _437 => _437.filters, 'optionalAccess', _438 => _438.length]) || g.blendMode && g.blendMode !== "normal" || _optionalChain([g, 'access', _439 => _439.effects, 'optionalAccess', _440 => _440.length]));
10083
10151
  if (keep) {
10084
10152
  this.replaceNode(g.id, { ...rest, children });
10085
10153
  continue;
@@ -10163,7 +10231,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10163
10231
  const node = this.getNode(nodeId);
10164
10232
  if (!isVectorBlendGroup(group)) return { ok: false, message: `"${blendId}" is not a blend.` };
10165
10233
  if (!node || node.blendStep || node.locked || node.id === blendId) return { ok: false, message: `"${nodeId}" cannot be a key.` };
10166
- const parentOf = (id) => _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _434 => _434.parent, 'optionalAccess', _435 => _435.id]), () => ( null));
10234
+ const parentOf = (id) => _nullishCoalesce(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id), 'optionalAccess', _441 => _441.parent, 'optionalAccess', _442 => _442.id]), () => ( null));
10167
10235
  if (parentOf(blendId) !== parentOf(nodeId)) return { ok: false, message: "The new key must sit beside the blend (same parent)." };
10168
10236
  const start = options.start;
10169
10237
  this.change("Blend", () => {
@@ -10233,7 +10301,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10233
10301
  replaceBlendSpine(options = {}) {
10234
10302
  const roots = _nullishCoalesce(options.ids, () => ( this.selectedRoots()));
10235
10303
  const groups = this.blendTargets(roots);
10236
- const paths = roots.map((id) => this.getNode(id)).filter((n2) => _optionalChain([n2, 'optionalAccess', _436 => _436.type]) === "path" && !n2.blendStep && !isVectorBlendGroup(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, n2.id), 'optionalAccess', _437 => _437.parent])));
10304
+ const paths = roots.map((id) => this.getNode(id)).filter((n2) => _optionalChain([n2, 'optionalAccess', _443 => _443.type]) === "path" && !n2.blendStep && !isVectorBlendGroup(_optionalChain([_chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, n2.id), 'optionalAccess', _444 => _444.parent])));
10237
10305
  if (groups.length !== 1 || paths.length !== 1) return { ok: false, message: "Select one blend and one path to be its spine." };
10238
10306
  const group = groups[0];
10239
10307
  const path = paths[0];
@@ -10264,7 +10332,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10264
10332
  shapeBuilderMap(ids) {
10265
10333
  const roots = _nullishCoalesce(ids, () => ( this.selectedRoots()));
10266
10334
  const key = roots.join("\0");
10267
- if (_optionalChain([this, 'access', _438 => _438.builderCache, 'optionalAccess', _439 => _439.doc]) === this.doc && this.builderCache.key === key) return this.builderCache.map;
10335
+ if (_optionalChain([this, 'access', _445 => _445.builderCache, 'optionalAccess', _446 => _446.doc]) === this.doc && this.builderCache.key === key) return this.builderCache.map;
10268
10336
  const entries = roots.length ? vectorPathEntries(this.doc, roots, { expand: false }) : [];
10269
10337
  const map = entries.length ? vectorShapeBuilderMap(entries) : null;
10270
10338
  this.builderCache = { doc: this.doc, key, map };
@@ -10324,9 +10392,9 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10324
10392
  const list = [];
10325
10393
  const r = plan.replace.get(i);
10326
10394
  if (r === void 0) list.push(node);
10327
- else if (_optionalChain([r, 'optionalAccess', _440 => _440.kind]) === "fill") list.push({ ...node, fillRule: "nonzero", subpaths: _chunkFODKPD44cjs.bezierToSubpaths.call(void 0, toLocal(r.path)) });
10328
- else if (_optionalChain([r, 'optionalAccess', _441 => _441.kind]) === "outline") list.push({ ...node, subpaths: _chunkFODKPD44cjs.bezierToSubpaths.call(void 0, toLocal(r.path)) });
10329
- else if (_optionalChain([r, 'optionalAccess', _442 => _442.kind]) === "pieces") {
10395
+ else if (_optionalChain([r, 'optionalAccess', _447 => _447.kind]) === "fill") list.push({ ...node, fillRule: "nonzero", subpaths: _chunkFODKPD44cjs.bezierToSubpaths.call(void 0, toLocal(r.path)) });
10396
+ else if (_optionalChain([r, 'optionalAccess', _448 => _448.kind]) === "outline") list.push({ ...node, subpaths: _chunkFODKPD44cjs.bezierToSubpaths.call(void 0, toLocal(r.path)) });
10397
+ else if (_optionalChain([r, 'optionalAccess', _449 => _449.kind]) === "pieces") {
10330
10398
  r.paths.forEach(
10331
10399
  (path, k) => list.push({ ...node, id: k === 0 ? node.id : this.newId(), subpaths: _chunkFODKPD44cjs.bezierToSubpaths.call(void 0, toLocal(path)).map((sp) => ({ ...sp, closed: false })) })
10332
10400
  );
@@ -10360,7 +10428,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10360
10428
  }
10361
10429
  /** The paint bucket's map of the visible outlines, cached per document and gap. */
10362
10430
  fillMap(gap) {
10363
- if (_optionalChain([this, 'access', _443 => _443.fillCache, 'optionalAccess', _444 => _444.doc]) === this.doc && this.fillCache.gap === gap) return this.fillCache.map;
10431
+ if (_optionalChain([this, 'access', _450 => _450.fillCache, 'optionalAccess', _451 => _451.doc]) === this.doc && this.fillCache.gap === gap) return this.fillCache.map;
10364
10432
  const map = vectorFillMap(this.doc, gap);
10365
10433
  this.fillCache = { doc: this.doc, gap, map };
10366
10434
  return map;
@@ -10374,8 +10442,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10374
10442
  */
10375
10443
  fillRegion(point, options = {}) {
10376
10444
  if (!Number.isFinite(point.x) || !Number.isFinite(point.y)) return null;
10377
- const region = _optionalChain([this, 'access', _445 => _445.fillMap, 'call', _446 => _446(_nullishCoalesce(options.gap, () => ( this.editing.fillGap))), 'optionalAccess', _447 => _447.regionAt, 'call', _448 => _448([point.x, point.y])]);
10378
- if (!_optionalChain([region, 'optionalAccess', _449 => _449.length])) return null;
10445
+ const region = _optionalChain([this, 'access', _452 => _452.fillMap, 'call', _453 => _453(_nullishCoalesce(options.gap, () => ( this.editing.fillGap))), 'optionalAccess', _454 => _454.regionAt, 'call', _455 => _455([point.x, point.y])]);
10446
+ if (!_optionalChain([region, 'optionalAccess', _456 => _456.length])) return null;
10379
10447
  let below = null;
10380
10448
  const roots = new Set(this.selectedRoots());
10381
10449
  _chunkFODKPD44cjs.walkVectorNodes.call(void 0, this.doc.nodes, (n2) => {
@@ -10401,7 +10469,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10401
10469
  /** Updates the Shape Builder / paint bucket highlight for the pointer at `p`; true when it changed. */
10402
10470
  hoverBuilder(p, alt) {
10403
10471
  if (this.tool === "paintBucket") {
10404
- const region = _nullishCoalesce(_optionalChain([this, 'access', _450 => _450.fillMap, 'call', _451 => _451(this.editing.fillGap), 'optionalAccess', _452 => _452.regionAt, 'call', _453 => _453([p.x, p.y])]), () => ( null));
10472
+ const region = _nullishCoalesce(_optionalChain([this, 'access', _457 => _457.fillMap, 'call', _458 => _458(this.editing.fillGap), 'optionalAccess', _459 => _459.regionAt, 'call', _460 => _460([p.x, p.y])]), () => ( null));
10405
10473
  const key2 = region ? _chunkXGD3FSNCcjs.bezierPathToSvg.call(void 0, region, { precision: 2 }) : null;
10406
10474
  if (key2 === this.builderHoverKey) return false;
10407
10475
  this.builderHoverKey = key2;
@@ -10509,7 +10577,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10509
10577
  /** `doc` with anchor `ref` moved to document point `to` by a Curvature-tool move. */
10510
10578
  curvatureMoved(doc, ref, to) {
10511
10579
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, ref.nodeId);
10512
- if (_optionalChain([node, 'optionalAccess', _454 => _454.type]) !== "path" || node.locked || !node.subpaths[ref.subpath]) return doc;
10580
+ if (_optionalChain([node, 'optionalAccess', _461 => _461.type]) !== "path" || node.locked || !node.subpaths[ref.subpath]) return doc;
10513
10581
  const q = this.toLocal(ref.nodeId, to, doc);
10514
10582
  const subpaths = node.subpaths.map((sp, i) => i === ref.subpath ? curvatureMoveAnchor(sp, ref.index, q) : sp);
10515
10583
  const nodes = mapTree(doc.nodes, (n2) => n2.id === ref.nodeId ? { ...node, subpaths } : n2);
@@ -10518,7 +10586,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10518
10586
  /** `doc` with segment `ref` bent through document point `p` at parameter `t`. */
10519
10587
  bent(doc, ref, t, p) {
10520
10588
  const node = _chunkFODKPD44cjs.findVectorNode.call(void 0, doc.nodes, ref.nodeId);
10521
- if (_optionalChain([node, 'optionalAccess', _455 => _455.type]) !== "path" || node.locked || !node.subpaths[ref.subpath]) return doc;
10589
+ if (_optionalChain([node, 'optionalAccess', _462 => _462.type]) !== "path" || node.locked || !node.subpaths[ref.subpath]) return doc;
10522
10590
  const q = this.toLocal(ref.nodeId, p, doc);
10523
10591
  const subpaths = node.subpaths.map((sp, i) => i === ref.subpath ? bendSegment(sp, ref.segment, t, q) : sp);
10524
10592
  return { ...doc, nodes: mapTree(doc.nodes, (n2) => n2.id === ref.nodeId ? { ...node, subpaths } : n2) };
@@ -10529,7 +10597,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10529
10597
  */
10530
10598
  bendSegment(ref, to, t = 0.5) {
10531
10599
  const node = this.getNode(ref.nodeId);
10532
- const sp = _optionalChain([node, 'optionalAccess', _456 => _456.type]) === "path" ? node.subpaths[ref.subpath] : void 0;
10600
+ const sp = _optionalChain([node, 'optionalAccess', _463 => _463.type]) === "path" ? node.subpaths[ref.subpath] : void 0;
10533
10601
  if (!sp || ref.segment < 0 || ref.segment >= (sp.closed ? sp.anchors.length : sp.anchors.length - 1) || sp.anchors.length < 2) return { ok: false, message: "There is no such segment." };
10534
10602
  if (node.locked) return { ok: false, message: "The path is locked." };
10535
10603
  this.change("Bend Segment", () => {
@@ -10564,7 +10632,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10564
10632
  /** Adds an anchor on the nearest segment of `nodeId` to document point `point` (shape unchanged). */
10565
10633
  insertAnchorAt(nodeId, point) {
10566
10634
  const node = this.getNode(nodeId);
10567
- if (_optionalChain([node, 'optionalAccess', _457 => _457.type]) !== "path") return null;
10635
+ if (_optionalChain([node, 'optionalAccess', _464 => _464.type]) !== "path") return null;
10568
10636
  const hit = _chunkFODKPD44cjs.nearestSegment.call(void 0, node, this.toLocal(nodeId, point));
10569
10637
  if (!hit) return null;
10570
10638
  const { subpath, index } = _chunkFODKPD44cjs.insertAnchor.call(void 0, node.subpaths[hit.subpath], hit.segment, hit.t);
@@ -10608,7 +10676,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10608
10676
  setClosed(closed, nodeId) {
10609
10677
  const targets = nodeId ? (() => {
10610
10678
  const n2 = this.getNode(nodeId);
10611
- return _optionalChain([n2, 'optionalAccess', _458 => _458.type]) === "path" ? n2.subpaths.map((_, s) => ({ nodeId, subpath: s })) : [];
10679
+ return _optionalChain([n2, 'optionalAccess', _465 => _465.type]) === "path" ? n2.subpaths.map((_, s) => ({ nodeId, subpath: s })) : [];
10612
10680
  })() : this.anchors.map((r) => ({ nodeId: r.nodeId, subpath: r.subpath }));
10613
10681
  if (!targets.length) return { ok: false, message: "Select a path or points." };
10614
10682
  this.change(closed ? "Close Path" : "Open Path", () => {
@@ -10629,7 +10697,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10629
10697
  this.setDoc(
10630
10698
  mapTree(
10631
10699
  this.doc.nodes,
10632
- (n2) => n2.type === "path" && set.has(n2.id) ? { ...n2, subpaths: n2.subpaths.map(_chunkFODKPD44cjs.reverseSubpath), ..._optionalChain([n2, 'access', _459 => _459.strokeWidthProfile, 'optionalAccess', _460 => _460.length]) ? { strokeWidthProfile: _chunkFODKPD44cjs.reverseWidthProfile.call(void 0, n2.strokeWidthProfile) } : {} } : n2
10700
+ (n2) => n2.type === "path" && set.has(n2.id) ? { ...n2, subpaths: n2.subpaths.map(_chunkFODKPD44cjs.reverseSubpath), ..._optionalChain([n2, 'access', _466 => _466.strokeWidthProfile, 'optionalAccess', _467 => _467.length]) ? { strokeWidthProfile: _chunkFODKPD44cjs.reverseWidthProfile.call(void 0, n2.strokeWidthProfile) } : {} } : n2
10633
10701
  )
10634
10702
  );
10635
10703
  this.anchors = [];
@@ -10767,7 +10835,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10767
10835
  */
10768
10836
  cutPathAt(nodeId, point) {
10769
10837
  const node = this.getNode(nodeId);
10770
- if (_optionalChain([node, 'optionalAccess', _461 => _461.type]) !== "path" || node.locked) return null;
10838
+ if (_optionalChain([node, 'optionalAccess', _468 => _468.type]) !== "path" || node.locked) return null;
10771
10839
  const local = this.toLocal(nodeId, point);
10772
10840
  const hit = _chunkFODKPD44cjs.nearestSegment.call(void 0, node, local);
10773
10841
  if (!hit) return null;
@@ -10817,7 +10885,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10817
10885
  if (n2.visible === false || n2.locked || parent && blocked.has(parent.id)) blocked.add(n2.id);
10818
10886
  });
10819
10887
  const visible = (p) => !blocked.has(p.id);
10820
- if (_optionalChain([ids, 'optionalAccess', _462 => _462.length]) || this.selection.length) return this.pathTargets(_nullishCoalesce(ids, () => ( this.selection))).filter(visible);
10888
+ if (_optionalChain([ids, 'optionalAccess', _469 => _469.length]) || this.selection.length) return this.pathTargets(_nullishCoalesce(ids, () => ( this.selection))).filter(visible);
10821
10889
  const box = _chunkFODKPD44cjs.polylineBounds.call(void 0, points.map(toPoint2), pad);
10822
10890
  if (!box) return [];
10823
10891
  const out = [];
@@ -10903,7 +10971,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10903
10971
  finishPath() {
10904
10972
  if (!this.pen) return;
10905
10973
  const node = this.getNode(this.pen.nodeId);
10906
- const sp = _optionalChain([node, 'optionalAccess', _463 => _463.subpaths, 'access', _464 => _464[this.pen.subpath]]);
10974
+ const sp = _optionalChain([node, 'optionalAccess', _470 => _470.subpaths, 'access', _471 => _471[this.pen.subpath]]);
10907
10975
  const pen = this.pen;
10908
10976
  this.pen = null;
10909
10977
  this.pointer = null;
@@ -10947,7 +11015,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10947
11015
  if (trimmed.startsWith("{")) {
10948
11016
  try {
10949
11017
  const data = JSON.parse(trimmed);
10950
- if (_optionalChain([data, 'optionalAccess', _465 => _465.type]) === VECTOR_CLIPBOARD_TYPE && Array.isArray(data.nodes)) nodes = data.nodes;
11018
+ if (_optionalChain([data, 'optionalAccess', _472 => _472.type]) === VECTOR_CLIPBOARD_TYPE && Array.isArray(data.nodes)) nodes = data.nodes;
10951
11019
  } catch (e7) {
10952
11020
  nodes = null;
10953
11021
  }
@@ -10959,7 +11027,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
10959
11027
  }
10960
11028
  }
10961
11029
  } else nodes = this.clipboard;
10962
- if (!_optionalChain([nodes, 'optionalAccess', _466 => _466.length])) return [];
11030
+ if (!_optionalChain([nodes, 'optionalAccess', _473 => _473.length])) return [];
10963
11031
  const offset = _nullishCoalesce(options.offset, () => ( (text && !text.trim().startsWith("{") ? { x: 0, y: 0 } : { x: 10, y: 10 })));
10964
11032
  const copies = nodes.map((n2) => _chunkFODKPD44cjs.transformVectorNode.call(void 0, this.freshIds(n2), _chunkFODKPD44cjs.translateMatrix.call(void 0, offset.x, offset.y)));
10965
11033
  this.change("Paste", () => {
@@ -11010,7 +11078,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11010
11078
  hitHandle(screen) {
11011
11079
  for (const ref of getVisibleHandles(this.view()).reverse()) {
11012
11080
  const a = getAnchorWorld(this.doc, ref);
11013
- const h = _optionalChain([a, 'optionalAccess', _467 => _467[ref.handle]]);
11081
+ const h = _optionalChain([a, 'optionalAccess', _474 => _474[ref.handle]]);
11014
11082
  if (!h) continue;
11015
11083
  const s = this.documentToScreen(h);
11016
11084
  if (Math.hypot(s.x - screen.x, s.y - screen.y) <= this.hitRadius) return ref;
@@ -11163,7 +11231,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11163
11231
  const shown = this.hitWidthHandleIn(screen, this.widthView());
11164
11232
  if (shown) return shown;
11165
11233
  const spot = this.strokeSpotAt(this.screenToDocument(screen));
11166
- return spot && spot.nodeId !== _optionalChain([this, 'access', _468 => _468.hover, 'optionalAccess', _469 => _469.nodeId]) ? this.hitWidthHandleIn(screen, { ...this.widthView(), hover: { nodeId: spot.nodeId } }) : null;
11234
+ return spot && spot.nodeId !== _optionalChain([this, 'access', _475 => _475.hover, 'optionalAccess', _476 => _476.nodeId]) ? this.hitWidthHandleIn(screen, { ...this.widthView(), hover: { nodeId: spot.nodeId } }) : null;
11167
11235
  }
11168
11236
  hitWidthHandleIn(screen, view) {
11169
11237
  let best = null;
@@ -11218,9 +11286,9 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11218
11286
  downWidth(screen, p, input) {
11219
11287
  const hit = this.hitWidthHandle(screen);
11220
11288
  const spot = hit ? null : this.strokeSpotAt(p);
11221
- const nodeId = _nullishCoalesce(_optionalChain([hit, 'optionalAccess', _470 => _470.ref, 'access', _471 => _471.nodeId]), () => ( _optionalChain([spot, 'optionalAccess', _472 => _472.nodeId])));
11289
+ const nodeId = _nullishCoalesce(_optionalChain([hit, 'optionalAccess', _477 => _477.ref, 'access', _478 => _478.nodeId]), () => ( _optionalChain([spot, 'optionalAccess', _479 => _479.nodeId])));
11222
11290
  const node = nodeId ? this.getNode(nodeId) : void 0;
11223
- const g = _optionalChain([node, 'optionalAccess', _473 => _473.type]) === "path" ? vectorStrokeWidthGeometry(node) : null;
11291
+ const g = _optionalChain([node, 'optionalAccess', _480 => _480.type]) === "path" ? vectorStrokeWidthGeometry(node) : null;
11224
11292
  if (this.widthEdit) this.widthEdit = null;
11225
11293
  if (!node || node.type !== "path" || !g) {
11226
11294
  if (!input.shift) this.widthPoints = [];
@@ -11240,7 +11308,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11240
11308
  if (hit) {
11241
11309
  profile = _chunkFODKPD44cjs.sanitizeWidthProfile.call(void 0, node.strokeWidthProfile);
11242
11310
  ref = { nodeId: node.id, index: hit.ref.index, subpath: hit.ref.subpath };
11243
- t = _nullishCoalesce(_optionalChain([profile, 'access', _474 => _474[ref.index], 'optionalAccess', _475 => _475.t]), () => ( 0));
11311
+ t = _nullishCoalesce(_optionalChain([profile, 'access', _481 => _481[ref.index], 'optionalAccess', _482 => _482.t]), () => ( 0));
11244
11312
  subpath = hit.ref.subpath;
11245
11313
  if (hit.ref.part === "center") mode = input.alt && profile.length < _chunkFODKPD44cjs.VECTOR_WIDTH_PROFILE_MAX_POINTS ? "copy" : "move";
11246
11314
  else if (input.alt) side = hit.ref.part;
@@ -11405,7 +11473,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11405
11473
  let anchor = null;
11406
11474
  if (node.type === "path" && node.subpaths[0]) {
11407
11475
  const refs = node.subpaths[0].anchors.map((_, index) => ({ nodeId: node.id, subpath: 0, index }));
11408
- anchor = _nullishCoalesce(_optionalChain([this, 'access', _476 => _476.hitAnchor, 'call', _477 => _477(screen, refs), 'optionalAccess', _478 => _478.index]), () => ( null));
11476
+ anchor = _nullishCoalesce(_optionalChain([this, 'access', _483 => _483.hitAnchor, 'call', _484 => _484(screen, refs), 'optionalAccess', _485 => _485.index]), () => ( null));
11409
11477
  }
11410
11478
  return { nodeId: node.id, anchor };
11411
11479
  }
@@ -11558,7 +11626,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11558
11626
  }
11559
11627
  downPen(screen, p, input) {
11560
11628
  const before = this.snapshot();
11561
- const sp = this.pen ? _optionalChain([this, 'access', _479 => _479.getNode, 'call', _480 => _480(this.pen.nodeId), 'optionalAccess', _481 => _481.subpaths, 'access', _482 => _482[this.pen.subpath]]) : void 0;
11629
+ const sp = this.pen ? _optionalChain([this, 'access', _486 => _486.getNode, 'call', _487 => _487(this.pen.nodeId), 'optionalAccess', _488 => _488.subpaths, 'access', _489 => _489[this.pen.subpath]]) : void 0;
11562
11630
  if (this.pen && sp) {
11563
11631
  const pen = this.pen;
11564
11632
  const first = { nodeId: pen.nodeId, subpath: pen.subpath, index: 0 };
@@ -11683,7 +11751,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11683
11751
  return;
11684
11752
  case "textSelect": {
11685
11753
  const node = this.getNode(drag.nodeId);
11686
- if (_optionalChain([node, 'optionalAccess', _483 => _483.type]) === "text" && this.textEdit) {
11754
+ if (_optionalChain([node, 'optionalAccess', _490 => _490.type]) === "text" && this.textEdit) {
11687
11755
  this.textEdit = { ...this.textEdit, focus: _chunkFODKPD44cjs.vectorTextIndexAt.call(void 0, node, this.toLocal(node.id, p)) };
11688
11756
  this.notify();
11689
11757
  }
@@ -11849,15 +11917,15 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11849
11917
  if (!_chunkFODKPD44cjs.isVectorConnector.call(void 0, node)) return;
11850
11918
  const target = _chunkFODKPD44cjs.vectorConnectorTargetAt.call(void 0, this.doc.nodes, p, this.connectorRadius(), drag.nodeId);
11851
11919
  const startGlue = node.connector.start;
11852
- const end = target && target.nodeId !== _optionalChain([startGlue, 'optionalAccess', _484 => _484.nodeId]) ? { nodeId: target.nodeId, ...target.side && target.side !== "auto" ? { side: target.side } : {} } : null;
11853
- const first = _nullishCoalesce(_optionalChain([node, 'access', _485 => _485.subpaths, 'access', _486 => _486[0], 'optionalAccess', _487 => _487.anchors, 'access', _488 => _488[0]]), () => ( drag.start));
11920
+ const end = target && target.nodeId !== _optionalChain([startGlue, 'optionalAccess', _491 => _491.nodeId]) ? { nodeId: target.nodeId, ...target.side && target.side !== "auto" ? { side: target.side } : {} } : null;
11921
+ const first = _nullishCoalesce(_optionalChain([node, 'access', _492 => _492.subpaths, 'access', _493 => _493[0], 'optionalAccess', _494 => _494.anchors, 'access', _495 => _495[0]]), () => ( drag.start));
11854
11922
  this.replaceNode(drag.nodeId, { ...node, connector: { ...node.connector, end }, subpaths: [{ closed: false, anchors: [{ x: first.x, y: first.y }, { x: p.x, y: p.y }] }] });
11855
11923
  this.notify(true);
11856
11924
  return;
11857
11925
  }
11858
11926
  case "shape": {
11859
11927
  const node = this.getNode(drag.nodeId);
11860
- if (_optionalChain([node, 'optionalAccess', _489 => _489.type]) !== "path") return;
11928
+ if (_optionalChain([node, 'optionalAccess', _496 => _496.type]) !== "path") return;
11861
11929
  const leave = { at: drag.start, constrain: input.shift ? drag.tool === "line" ? "angle" : "square" : null, curves: false };
11862
11930
  let end = this.snapDrawn(p, leave, input, () => drag.targets ??= this.drawingTargets(null));
11863
11931
  if (!this.snappedToObject && drag.tool !== "line" && !input.shift && !input.mod && this.snap.objects && drag.targets) end = this.matchShapeSize(drag.targets, drag.start, end, input.alt);
@@ -11931,14 +11999,14 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11931
11999
  for (const q of drag.lazy.push([p.x, p.y])) {
11932
12000
  if (Math.hypot(q[0] - last[0], q[1] - last[1]) * this.viewport.zoom < 1.5) continue;
11933
12001
  drag.points.push(q);
11934
- _optionalChain([drag, 'access', _490 => _490.pressures, 'optionalAccess', _491 => _491.push, 'call', _492 => _492(drag.pressure)]);
12002
+ _optionalChain([drag, 'access', _497 => _497.pressures, 'optionalAccess', _498 => _498.push, 'call', _499 => _499(drag.pressure)]);
11935
12003
  moved = true;
11936
12004
  }
11937
12005
  const string = drag.lazy.string();
11938
12006
  const node = this.getNode(drag.nodeId);
11939
- if (_optionalChain([node, 'optionalAccess', _493 => _493.type]) !== "path") return;
12007
+ if (_optionalChain([node, 'optionalAccess', _500 => _500.type]) !== "path") return;
11940
12008
  if (!moved) {
11941
- if (string && _optionalChain([this, 'access', _494 => _494.interaction, 'optionalAccess', _495 => _495.type]) === "draw") {
12009
+ if (string && _optionalChain([this, 'access', _501 => _501.interaction, 'optionalAccess', _502 => _502.type]) === "draw") {
11942
12010
  this.interaction = { ...this.interaction, string: [{ x: string[0][0], y: string[0][1] }, { x: string[1][0], y: string[1][1] }] };
11943
12011
  this.notify();
11944
12012
  }
@@ -11974,8 +12042,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
11974
12042
  }
11975
12043
  this.setGuides(res);
11976
12044
  return {
11977
- dx: _optionalChain([res, 'optionalAccess', _496 => _496.x]) ? dx + res.dx : axes.x ? this.gridValue(origin.x + dx) - origin.x : dx,
11978
- dy: _optionalChain([res, 'optionalAccess', _497 => _497.y]) ? dy + res.dy : axes.y ? this.gridValue(origin.y + dy) - origin.y : dy
12045
+ dx: _optionalChain([res, 'optionalAccess', _503 => _503.x]) ? dx + res.dx : axes.x ? this.gridValue(origin.x + dx) - origin.x : dx,
12046
+ dy: _optionalChain([res, 'optionalAccess', _504 => _504.y]) ? dy + res.dy : axes.y ? this.gridValue(origin.y + dy) - origin.y : dy
11979
12047
  };
11980
12048
  }
11981
12049
  /** The anchor a point drag snaps by, where it started: the grabbed one, else the moving one nearest the press. */
@@ -12065,7 +12133,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12065
12133
  if (drag.moved) return this.commit("Corner Radius", drag.before);
12066
12134
  if (drag.alt) {
12067
12135
  const kind = _chunkFODKPD44cjs.nextVectorCornerKind.call(void 0, drag.widget.kind);
12068
- this.doc = this.updateAnchors(drag.base, drag.refs, (a) => _chunkFODKPD44cjs.setAnchorCorner.call(void 0, a, _nullishCoalesce(_optionalChain([a, 'access', _498 => _498.corner, 'optionalAccess', _499 => _499.radius]), () => ( 0)), kind));
12136
+ this.doc = this.updateAnchors(drag.base, drag.refs, (a) => _chunkFODKPD44cjs.setAnchorCorner.call(void 0, a, _nullishCoalesce(_optionalChain([a, 'access', _505 => _505.corner, 'optionalAccess', _506 => _506.radius]), () => ( 0)), kind));
12069
12137
  return this.commit("Corner Kind", drag.before);
12070
12138
  }
12071
12139
  const ref = drag.widget.ref;
@@ -12080,7 +12148,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12080
12148
  const several = drag.group.length > 0;
12081
12149
  if (drag.mode === "copy") this.widthPoints = [drag.ref];
12082
12150
  else if (drag.mode === "move" && several) {
12083
- this.widthPoints = [drag.source, ...drag.group].map((i) => ({ ...drag.ref, index: _nullishCoalesce(_optionalChain([drag, 'access', _500 => _500.renumber, 'optionalAccess', _501 => _501.get, 'call', _502 => _502(i)]), () => ( i)) }));
12151
+ this.widthPoints = [drag.source, ...drag.group].map((i) => ({ ...drag.ref, index: _nullishCoalesce(_optionalChain([drag, 'access', _507 => _507.renumber, 'optionalAccess', _508 => _508.get, 'call', _509 => _509(i)]), () => ( i)) }));
12084
12152
  } else if (!several) this.widthPoints = [drag.ref];
12085
12153
  const label2 = drag.mode === "copy" ? "Copy Width Point" : drag.mode === "move" ? several ? "Move Width Points" : "Move Width Point" : several ? "Width Points" : "Width Point";
12086
12154
  return this.commit(label2, drag.before);
@@ -12147,14 +12215,14 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12147
12215
  }
12148
12216
  case "pencil": {
12149
12217
  const node = this.getNode(drag.nodeId);
12150
- if (_optionalChain([node, 'optionalAccess', _503 => _503.type]) !== "path" || drag.points.length < 2) {
12218
+ if (_optionalChain([node, 'optionalAccess', _510 => _510.type]) !== "path" || drag.points.length < 2) {
12151
12219
  this.doc = drag.before.doc;
12152
12220
  this.notify(true);
12153
12221
  return;
12154
12222
  }
12155
12223
  for (const q of drag.lazy.finish()) {
12156
12224
  drag.points.push(q);
12157
- _optionalChain([drag, 'access', _504 => _504.pressures, 'optionalAccess', _505 => _505.push, 'call', _506 => _506(drag.pressure)]);
12225
+ _optionalChain([drag, 'access', _511 => _511.pressures, 'optionalAccess', _512 => _512.push, 'call', _513 => _513(drag.pressure)]);
12158
12226
  }
12159
12227
  const shape = this.editing.recognizeShapes ? recognizeInkShape(drag.points, { minSize: 6 / this.viewport.zoom }) : null;
12160
12228
  if (shape) {
@@ -12228,7 +12296,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12228
12296
  if (text) {
12229
12297
  if (this.tool === "select") this.setTool("type");
12230
12298
  const index = _chunkFODKPD44cjs.vectorTextIndexAt.call(void 0, text, this.toLocal(text.id, p));
12231
- if (_optionalChain([this, 'access', _507 => _507.textEdit, 'optionalAccess', _508 => _508.nodeId]) === text.id) {
12299
+ if (_optionalChain([this, 'access', _514 => _514.textEdit, 'optionalAccess', _515 => _515.nodeId]) === text.id) {
12232
12300
  const [a, b] = wordAt(text.text, index);
12233
12301
  this.textEdit = { ...this.textEdit, anchor: a, focus: b };
12234
12302
  this.notify();
@@ -12253,7 +12321,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12253
12321
  this.convertAnchors(a.in || a.out ? "corner" : "smooth", [anchor]);
12254
12322
  return;
12255
12323
  }
12256
- const id = _nullishCoalesce(_optionalChain([this, 'access', _509 => _509.hover, 'optionalAccess', _510 => _510.segment, 'optionalAccess', _511 => _511.nodeId]), () => ( this.editingId));
12324
+ const id = _nullishCoalesce(_optionalChain([this, 'access', _516 => _516.hover, 'optionalAccess', _517 => _517.segment, 'optionalAccess', _518 => _518.nodeId]), () => ( this.editingId));
12257
12325
  if (id) {
12258
12326
  const node = this.getNode(id);
12259
12327
  const seg = node ? _chunkFODKPD44cjs.nearestSegment.call(void 0, node, this.toLocal(id, p)) : null;
@@ -12357,7 +12425,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12357
12425
  return { ok: false, message: e instanceof Error ? e.message : String(e) };
12358
12426
  }
12359
12427
  if (next === node) return { ok: true };
12360
- const pending = _optionalChain([this, 'access', _512 => _512.textEdit, 'optionalAccess', _513 => _513.nodeId]) === id ? this.textEdit.before : null;
12428
+ const pending = _optionalChain([this, 'access', _519 => _519.textEdit, 'optionalAccess', _520 => _520.nodeId]) === id ? this.textEdit.before : null;
12361
12429
  const before = _nullishCoalesce(pending, () => ( this.snapshot()));
12362
12430
  if (pending && this.textEdit) this.textEdit.before = null;
12363
12431
  this.replaceNode(id, next);
@@ -12457,10 +12525,10 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12457
12525
  let frame;
12458
12526
  if (kind === "point") {
12459
12527
  const first = layout.lines[0];
12460
- const x = _nullishCoalesce(patch.x, () => ( (cur.kind === "point" ? cur.x : _nullishCoalesce(_optionalChain([first, 'optionalAccess', _514 => _514.x]), () => ( box.x)))));
12461
- const y = _nullishCoalesce(patch.y, () => ( (cur.kind === "point" ? cur.y : _nullishCoalesce(_optionalChain([first, 'optionalAccess', _515 => _515.baseline]), () => ( box.y)))));
12528
+ const x = _nullishCoalesce(patch.x, () => ( (cur.kind === "point" ? cur.x : _nullishCoalesce(_optionalChain([first, 'optionalAccess', _521 => _521.x]), () => ( box.x)))));
12529
+ const y = _nullishCoalesce(patch.y, () => ( (cur.kind === "point" ? cur.y : _nullishCoalesce(_optionalChain([first, 'optionalAccess', _522 => _522.baseline]), () => ( box.y)))));
12462
12530
  frame = _chunkFODKPD44cjs.sanitizeVectorTextFrame.call(void 0, { kind: "point", x, y });
12463
- if (cur.kind !== "point" && first && _optionalChain([n2, 'access', _516 => _516.paragraph, 'optionalAccess', _517 => _517.align]) && n2.paragraph.align !== "left") frame = _chunkFODKPD44cjs.sanitizeVectorTextFrame.call(void 0, { kind: "point", x: box.x, y });
12531
+ if (cur.kind !== "point" && first && _optionalChain([n2, 'access', _523 => _523.paragraph, 'optionalAccess', _524 => _524.align]) && n2.paragraph.align !== "left") frame = _chunkFODKPD44cjs.sanitizeVectorTextFrame.call(void 0, { kind: "point", x: box.x, y });
12464
12532
  } else if (kind === "area") {
12465
12533
  const base = cur.kind === "area" ? cur : { x: box.x, y: box.y, width: Math.max(box.width, n2.font.fontSize), height: Math.max(box.height, n2.font.fontSize * 1.2) };
12466
12534
  frame = _chunkFODKPD44cjs.sanitizeVectorTextFrame.call(void 0, { kind: "area", x: _nullishCoalesce(patch.x, () => ( base.x)), y: _nullishCoalesce(patch.y, () => ( base.y)), width: _nullishCoalesce(patch.width, () => ( base.width)), height: _nullishCoalesce(patch.height, () => ( base.height)) });
@@ -12532,15 +12600,15 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12532
12600
  ...t.locked ? { locked: true } : {},
12533
12601
  ...t.opacity !== void 0 ? { opacity: t.opacity } : {},
12534
12602
  ...t.blendMode ? { blendMode: t.blendMode } : {},
12535
- ..._optionalChain([t, 'access', _518 => _518.filters, 'optionalAccess', _519 => _519.length]) ? { filters: t.filters } : {},
12536
- ..._optionalChain([t, 'access', _520 => _520.effects, 'optionalAccess', _521 => _521.length]) ? { effects: t.effects } : {},
12603
+ ..._optionalChain([t, 'access', _525 => _525.filters, 'optionalAccess', _526 => _526.length]) ? { filters: t.filters } : {},
12604
+ ..._optionalChain([t, 'access', _527 => _527.effects, 'optionalAccess', _528 => _528.length]) ? { effects: t.effects } : {},
12537
12605
  ...t.booleanOperation ? { booleanOperation: t.booleanOperation } : {}
12538
12606
  };
12539
12607
  const pathOf = (fill, path, id) => {
12540
12608
  const { transform: _t, visible: _v, locked: _l, opacity: _o, blendMode: _b, filters: _f, effects: _e, booleanOperation: _bo, name: _n, ...style } = _chunkFODKPD44cjs.vectorTextPaintSource.call(void 0, t, fill, _chunkFODKPD44cjs.bezierToSubpaths.call(void 0, path));
12541
12609
  return { ...style, id };
12542
12610
  };
12543
- if (parts.length <= 1) replaced.set(t.id, { ...pathOf(_optionalChain([parts, 'access', _522 => _522[0], 'optionalAccess', _523 => _523.fill]), _nullishCoalesce(_optionalChain([parts, 'access', _524 => _524[0], 'optionalAccess', _525 => _525.path]), () => ( [])), t.id), ...keep });
12611
+ if (parts.length <= 1) replaced.set(t.id, { ...pathOf(_optionalChain([parts, 'access', _529 => _529[0], 'optionalAccess', _530 => _530.fill]), _nullishCoalesce(_optionalChain([parts, 'access', _531 => _531[0], 'optionalAccess', _532 => _532.path]), () => ( [])), t.id), ...keep });
12544
12612
  else replaced.set(t.id, { id: t.id, type: "group", ...keep, children: parts.map((p) => ({ ...pathOf(p.fill, p.path, this.newId()), name: "Outlines" })) });
12545
12613
  }
12546
12614
  if (this.textEdit && replaced.has(this.textEdit.nodeId)) this.endTextEdit();
@@ -12550,7 +12618,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12550
12618
  /** The layout of text node `id` (lines, glyphs, bounds, overflow), or null. */
12551
12619
  getTextLayout(id) {
12552
12620
  const node = this.getNode(id);
12553
- return _optionalChain([node, 'optionalAccess', _526 => _526.type]) === "text" ? _chunkFODKPD44cjs.layoutVectorText.call(void 0, node) : null;
12621
+ return _optionalChain([node, 'optionalAccess', _533 => _533.type]) === "text" ? _chunkFODKPD44cjs.layoutVectorText.call(void 0, node) : null;
12554
12622
  }
12555
12623
  // --- Editing on the canvas ------------------------------------------------
12556
12624
  /**
@@ -12560,12 +12628,12 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12560
12628
  editText(id, options = {}) {
12561
12629
  const node = this.textNode(id);
12562
12630
  if (typeof node === "string") return { ok: false, message: node };
12563
- if (_optionalChain([this, 'access', _527 => _527.textEdit, 'optionalAccess', _528 => _528.nodeId]) !== id) this.endTextEdit();
12631
+ if (_optionalChain([this, 'access', _534 => _534.textEdit, 'optionalAccess', _535 => _535.nodeId]) !== id) this.endTextEdit();
12564
12632
  const n2 = node.text.length;
12565
12633
  const clamp = (v, d) => Math.max(0, Math.min(n2, _nullishCoalesce(v, () => ( d))));
12566
12634
  const focus = clamp(_nullishCoalesce(options.focus, () => ( options.index)), n2);
12567
12635
  const anchor = clamp(options.anchor, focus);
12568
- this.textEdit = { nodeId: id, anchor, focus, before: _optionalChain([this, 'access', _529 => _529.textEdit, 'optionalAccess', _530 => _530.nodeId]) === id ? this.textEdit.before : null, key: _optionalChain([this, 'access', _531 => _531.textEdit, 'optionalAccess', _532 => _532.nodeId]) === id ? this.textEdit.key : `text-edit:${id}:${++this.textEditCount}`, created: _optionalChain([this, 'access', _533 => _533.textEdit, 'optionalAccess', _534 => _534.nodeId]) === id ? this.textEdit.created : false };
12636
+ this.textEdit = { nodeId: id, anchor, focus, before: _optionalChain([this, 'access', _536 => _536.textEdit, 'optionalAccess', _537 => _537.nodeId]) === id ? this.textEdit.before : null, key: _optionalChain([this, 'access', _538 => _538.textEdit, 'optionalAccess', _539 => _539.nodeId]) === id ? this.textEdit.key : `text-edit:${id}:${++this.textEditCount}`, created: _optionalChain([this, 'access', _540 => _540.textEdit, 'optionalAccess', _541 => _541.nodeId]) === id ? this.textEdit.created : false };
12569
12637
  this.selection = [id];
12570
12638
  this.anchors = [];
12571
12639
  this.notify();
@@ -12575,7 +12643,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12575
12643
  selectText(anchor, focus = anchor) {
12576
12644
  const t = this.textEdit;
12577
12645
  const node = t ? this.getNode(t.nodeId) : null;
12578
- if (!t || _optionalChain([node, 'optionalAccess', _535 => _535.type]) !== "text") return;
12646
+ if (!t || _optionalChain([node, 'optionalAccess', _542 => _542.type]) !== "text") return;
12579
12647
  const n2 = node.text.length;
12580
12648
  this.textEdit = { ...t, anchor: Math.max(0, Math.min(n2, anchor)), focus: Math.max(0, Math.min(n2, focus)) };
12581
12649
  this.notify();
@@ -12590,7 +12658,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12590
12658
  this.textEdit = null;
12591
12659
  this.history.endGesture();
12592
12660
  const node = this.getNode(t.nodeId);
12593
- if (_optionalChain([node, 'optionalAccess', _536 => _536.type]) === "text" && !node.text) {
12661
+ if (_optionalChain([node, 'optionalAccess', _543 => _543.type]) === "text" && !node.text) {
12594
12662
  if (t.before) {
12595
12663
  this.doc = t.before.doc;
12596
12664
  this.selection = t.before.selection.filter((id) => this.getNode(id));
@@ -12625,7 +12693,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12625
12693
  textDelete(forward, word = false) {
12626
12694
  const t = this.textEdit;
12627
12695
  const node = t ? this.getNode(t.nodeId) : null;
12628
- if (!t || _optionalChain([node, 'optionalAccess', _537 => _537.type]) !== "text") return;
12696
+ if (!t || _optionalChain([node, 'optionalAccess', _544 => _544.type]) !== "text") return;
12629
12697
  let a = Math.min(t.anchor, t.focus);
12630
12698
  let b = Math.max(t.anchor, t.focus);
12631
12699
  if (a === b) {
@@ -12642,7 +12710,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12642
12710
  textKey(input) {
12643
12711
  const t = this.textEdit;
12644
12712
  const node = this.getNode(t.nodeId);
12645
- if (_optionalChain([node, 'optionalAccess', _538 => _538.type]) !== "text") {
12713
+ if (_optionalChain([node, 'optionalAccess', _545 => _545.type]) !== "text") {
12646
12714
  this.textEdit = null;
12647
12715
  return false;
12648
12716
  }
@@ -12723,7 +12791,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12723
12791
  getSelectedText() {
12724
12792
  const t = this.textEdit;
12725
12793
  const node = t ? this.getNode(t.nodeId) : null;
12726
- if (!t || _optionalChain([node, 'optionalAccess', _539 => _539.type]) !== "text") return null;
12794
+ if (!t || _optionalChain([node, 'optionalAccess', _546 => _546.type]) !== "text") return null;
12727
12795
  return node.text.slice(Math.min(t.anchor, t.focus), Math.max(t.anchor, t.focus));
12728
12796
  }
12729
12797
  /** Cut while editing text: returns the selected characters and deletes them (null when not editing). */
@@ -12797,7 +12865,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12797
12865
  const text = this.hitText(p);
12798
12866
  if (text) {
12799
12867
  const index = _chunkFODKPD44cjs.vectorTextIndexAt.call(void 0, text, this.toLocal(text.id, p));
12800
- if (_optionalChain([this, 'access', _540 => _540.textEdit, 'optionalAccess', _541 => _541.nodeId]) === text.id) {
12868
+ if (_optionalChain([this, 'access', _547 => _547.textEdit, 'optionalAccess', _548 => _548.nodeId]) === text.id) {
12801
12869
  this.textEdit = { ...this.textEdit, focus: index, anchor: input.shift ? this.textEdit.anchor : index };
12802
12870
  this.notify();
12803
12871
  } else this.editText(text.id, { index });
@@ -12814,7 +12882,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12814
12882
  }
12815
12883
  if (this.tool === "typePath") {
12816
12884
  const path = this.hitPath(p);
12817
- if (!path || _optionalChain([path, 'access', _542 => _542.subpaths, 'access', _543 => _543[0], 'optionalAccess', _544 => _544.anchors, 'access', _545 => _545.length]) < 2 || hiddenOrLocked(this.doc.nodes, path.id)) return;
12885
+ if (!path || _optionalChain([path, 'access', _549 => _549.subpaths, 'access', _550 => _550[0], 'optionalAccess', _551 => _551.anchors, 'access', _552 => _552.length]) < 2 || hiddenOrLocked(this.doc.nodes, path.id)) return;
12818
12886
  let node;
12819
12887
  try {
12820
12888
  node = this.createTextNode({ text: "", path: path.subpaths[0] });
@@ -12842,16 +12910,16 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12842
12910
  storedDocument() {
12843
12911
  const edit = this.symbolEdit;
12844
12912
  if (!edit) return this.doc;
12845
- const symbols = (_nullishCoalesce(edit.host.symbols, () => ( []))).map((s) => s.id === edit.symbolId ? { ...s, nodes: this.doc.nodes } : _nullishCoalesce(_optionalChain([this, 'access', _546 => _546.doc, 'access', _547 => _547.symbols, 'optionalAccess', _548 => _548.find, 'call', _549 => _549((x) => x.id === s.id)]), () => ( s)));
12913
+ const symbols = (_nullishCoalesce(edit.host.symbols, () => ( []))).map((s) => s.id === edit.symbolId ? { ...s, nodes: this.doc.nodes } : _nullishCoalesce(_optionalChain([this, 'access', _553 => _553.doc, 'access', _554 => _554.symbols, 'optionalAccess', _555 => _555.find, 'call', _556 => _556((x) => x.id === s.id)]), () => ( s)));
12846
12914
  return _chunkFODKPD44cjs.resolveVectorSymbols.call(void 0, { ...edit.host, symbols });
12847
12915
  }
12848
12916
  symbolEditState() {
12849
12917
  const edit = this.symbolEdit;
12850
12918
  if (!edit) return null;
12851
12919
  const host = this.storedDocument();
12852
- const sym = _optionalChain([host, 'access', _550 => _550.symbols, 'optionalAccess', _551 => _551.find, 'call', _552 => _552((s) => s.id === edit.symbolId)]);
12920
+ const sym = _optionalChain([host, 'access', _557 => _557.symbols, 'optionalAccess', _558 => _558.find, 'call', _559 => _559((s) => s.id === edit.symbolId)]);
12853
12921
  const hostTransform = edit.origin ? [1 / edit.scale, 0, 0, 1 / edit.scale, -edit.origin.x / edit.scale + 0, -edit.origin.y / edit.scale + 0] : null;
12854
- return { symbolId: edit.symbolId, name: _nullishCoalesce(_optionalChain([sym, 'optionalAccess', _553 => _553.name]), () => ( edit.symbolId)), instanceId: edit.instanceId, host, hostTransform };
12922
+ return { symbolId: edit.symbolId, name: _nullishCoalesce(_optionalChain([sym, 'optionalAccess', _560 => _560.name]), () => ( edit.symbolId)), instanceId: edit.instanceId, host, hostTransform };
12855
12923
  }
12856
12924
  /** The document's symbols (the stored ones, also while one is being edited). */
12857
12925
  getSymbols() {
@@ -12887,8 +12955,8 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12887
12955
  if (!ids.length) return { ok: false, message: "Select the objects to make a symbol from." };
12888
12956
  const locs = ids.map((id) => _chunkFODKPD44cjs.locateVectorNode.call(void 0, this.doc.nodes, id));
12889
12957
  if (locs.some((l) => !l)) return { ok: false, message: `There is no node "${ids[locs.findIndex((l) => !l)]}".` };
12890
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _554 => _554[0], 'access', _555 => _555.parent, 'optionalAccess', _556 => _556.id]), () => ( null));
12891
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _557 => _557.parent, 'optionalAccess', _558 => _558.id]), () => ( null))) !== parent)) return { ok: false, message: "The objects must share a parent (the same group) to make one symbol." };
12958
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _561 => _561[0], 'access', _562 => _562.parent, 'optionalAccess', _563 => _563.id]), () => ( null));
12959
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _564 => _564.parent, 'optionalAccess', _565 => _565.id]), () => ( null))) !== parent)) return { ok: false, message: "The objects must share a parent (the same group) to make one symbol." };
12892
12960
  if (ids.some((id) => hiddenOrLocked(this.doc.nodes, id))) return { ok: false, message: "Unlock and show the objects first." };
12893
12961
  const parentMatrix = parent ? this.worldOf(parent) : _chunkFODKPD44cjs.IDENTITY_MATRIX;
12894
12962
  const box = _chunkFODKPD44cjs.unionBounds.call(void 0, ids.map((id) => _chunkFODKPD44cjs.vectorNodeBounds.call(void 0, this.getNode(id), _chunkFODKPD44cjs.IDENTITY_MATRIX)));
@@ -12898,7 +12966,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12898
12966
  const cy = box.y + box.height / 2;
12899
12967
  const symbolId = this.newSymbolId();
12900
12968
  const instanceId = this.newId();
12901
- const name = _optionalChain([options, 'access', _559 => _559.name, 'optionalAccess', _560 => _560.trim, 'call', _561 => _561()]) || `Symbol ${this.getSymbols().length + 1}`;
12969
+ const name = _optionalChain([options, 'access', _566 => _566.name, 'optionalAccess', _567 => _567.trim, 'call', _568 => _568()]) || `Symbol ${this.getSymbols().length + 1}`;
12902
12970
  const set = new Set(ids);
12903
12971
  this.change("Make Symbol", () => {
12904
12972
  const replace = (list) => {
@@ -12979,7 +13047,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
12979
13047
  mapTree(this.doc.nodes, (n2) => {
12980
13048
  if (!set.has(n2.id) || n2.type !== "instance") return n2;
12981
13049
  const { art: _a, ...rest } = n2;
12982
- const hidden = _optionalChain([n2, 'access', _562 => _562.overrides, 'optionalAccess', _563 => _563.hidden]);
13050
+ const hidden = _optionalChain([n2, 'access', _569 => _569.overrides, 'optionalAccess', _570 => _570.hidden]);
12983
13051
  const overrides = n2.overrides ? { ...n2.overrides } : null;
12984
13052
  if (overrides && hidden) delete overrides.hidden;
12985
13053
  return { ...rest, symbolId, ...overrides && Object.keys(overrides).length ? { overrides } : { overrides: void 0 } };
@@ -13010,7 +13078,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
13010
13078
  else o[key] = patch[key];
13011
13079
  }
13012
13080
  if (patch.hidden !== void 0) {
13013
- if (_optionalChain([patch, 'access', _564 => _564.hidden, 'optionalAccess', _565 => _565.length])) {
13081
+ if (_optionalChain([patch, 'access', _571 => _571.hidden, 'optionalAccess', _572 => _572.length])) {
13014
13082
  const known = /* @__PURE__ */ new Set();
13015
13083
  _chunkFODKPD44cjs.walkVectorNodes.call(void 0, _nullishCoalesce(t.art, () => ( [])), (a) => known.add(a.id));
13016
13084
  const unknown = patch.hidden.filter((id) => !known.has(id));
@@ -13063,9 +13131,9 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
13063
13131
  */
13064
13132
  editSymbol(id) {
13065
13133
  const node = this.getNode(id);
13066
- const symbolId = _optionalChain([node, 'optionalAccess', _566 => _566.type]) === "instance" ? node.symbolId : id;
13134
+ const symbolId = _optionalChain([node, 'optionalAccess', _573 => _573.type]) === "instance" ? node.symbolId : id;
13067
13135
  const host = this.storedDocument();
13068
- const sym = _optionalChain([host, 'access', _567 => _567.symbols, 'optionalAccess', _568 => _568.find, 'call', _569 => _569((s) => s.id === symbolId)]);
13136
+ const sym = _optionalChain([host, 'access', _574 => _574.symbols, 'optionalAccess', _575 => _575.find, 'call', _576 => _576((s) => s.id === symbolId)]);
13069
13137
  if (!sym) return { ok: false, message: node ? `"${id}" is a ${node.type}, not a symbol instance.` : `There is no symbol or instance "${id}".` };
13070
13138
  if (this.symbolEdit) this.exitSymbolEdit();
13071
13139
  this.endTextEdit();
@@ -13073,7 +13141,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
13073
13141
  const fresh = this.storedDocument();
13074
13142
  let origin = null;
13075
13143
  let scale = 1;
13076
- const world = _optionalChain([node, 'optionalAccess', _570 => _570.type]) === "instance" ? _chunkFODKPD44cjs.vectorWorldMatrix.call(void 0, fresh.nodes, node.id) : null;
13144
+ const world = _optionalChain([node, 'optionalAccess', _577 => _577.type]) === "instance" ? _chunkFODKPD44cjs.vectorWorldMatrix.call(void 0, fresh.nodes, node.id) : null;
13077
13145
  if (world) {
13078
13146
  const det = Math.abs(world[0] * world[3] - world[1] * world[2]);
13079
13147
  if (det > 1e-12) {
@@ -13147,7 +13215,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
13147
13215
  if (anchor === void 0) {
13148
13216
  if (r.subpath === void 0 || r.index === void 0) throw new VectorConstraintError(`refs[${i}]: give an anchor (subpath and index, or its id), or circle: true.`);
13149
13217
  const sp = node.subpaths[r.subpath];
13150
- if (!_optionalChain([sp, 'optionalAccess', _571 => _571.anchors, 'access', _572 => _572[r.index]])) throw new VectorConstraintError(`refs[${i}]: "${r.nodeId}" has no anchor ${r.index} on subpath ${r.subpath}.`);
13218
+ if (!_optionalChain([sp, 'optionalAccess', _578 => _578.anchors, 'access', _579 => _579[r.index]])) throw new VectorConstraintError(`refs[${i}]: "${r.nodeId}" has no anchor ${r.index} on subpath ${r.subpath}.`);
13151
13219
  const withIds = withVectorAnchorIds(node);
13152
13220
  nodes.set(node.id, withIds);
13153
13221
  anchor = withIds.subpaths[r.subpath].anchors[r.index].id;
@@ -13361,7 +13429,7 @@ var VectorEditorController = (_class7 = class _VectorEditorController {
13361
13429
  this.finishPath();
13362
13430
  return true;
13363
13431
  }
13364
- if (this.tool === "select" && this.selection.length === 1 && _optionalChain([this, 'access', _573 => _573.getNode, 'call', _574 => _574(this.selection[0]), 'optionalAccess', _575 => _575.type]) === "path") {
13432
+ if (this.tool === "select" && this.selection.length === 1 && _optionalChain([this, 'access', _580 => _580.getNode, 'call', _581 => _581(this.selection[0]), 'optionalAccess', _582 => _582.type]) === "path") {
13365
13433
  this.tool = "direct";
13366
13434
  this.editingId = this.selection[0];
13367
13435
  this.notify();
@@ -13575,9 +13643,9 @@ var BLEND_PROPS = {
13575
13643
  linear: { type: "boolean", description: "Move anchors in straight lines instead of the rotation-aware morph." }
13576
13644
  };
13577
13645
  var checkBlendOptions = (params) => {
13578
- if (_optionalChain([params, 'optionalAccess', _576 => _576.spacing]) !== void 0 && !_chunkFODKPD44cjs.VECTOR_BLEND_SPACINGS.includes(params.spacing)) fail(`Unknown blend spacing "${params.spacing}".`);
13579
- if (_optionalChain([params, 'optionalAccess', _577 => _577.steps]) !== void 0 && !(Number.isFinite(params.steps) && params.steps >= 1)) fail("steps must be at least 1.");
13580
- if (_optionalChain([params, 'optionalAccess', _578 => _578.distance]) !== void 0 && !(Number.isFinite(params.distance) && params.distance > 0)) fail("distance must be positive.");
13646
+ if (_optionalChain([params, 'optionalAccess', _583 => _583.spacing]) !== void 0 && !_chunkFODKPD44cjs.VECTOR_BLEND_SPACINGS.includes(params.spacing)) fail(`Unknown blend spacing "${params.spacing}".`);
13647
+ if (_optionalChain([params, 'optionalAccess', _584 => _584.steps]) !== void 0 && !(Number.isFinite(params.steps) && params.steps >= 1)) fail("steps must be at least 1.");
13648
+ if (_optionalChain([params, 'optionalAccess', _585 => _585.distance]) !== void 0 && !(Number.isFinite(params.distance) && params.distance > 0)) fail("distance must be positive.");
13581
13649
  };
13582
13650
  var POINT = { type: "object", properties: { x: { type: "number" }, y: { type: "number" } }, required: ["x", "y"] };
13583
13651
  var GRADIENT_PROPS = {
@@ -13680,17 +13748,17 @@ function createVectorCommands(controller, options = {}) {
13680
13748
  const base = { group, ...options.scope ? { scope: options.scope } : {} };
13681
13749
  const hasSelection = () => controller.getState().selection.length ? true : "Nothing is selected.";
13682
13750
  const ids = (params) => {
13683
- const list2 = _nullishCoalesce(_optionalChain([params, 'optionalAccess', _579 => _579.ids]), () => ( controller.getState().selection));
13751
+ const list2 = _nullishCoalesce(_optionalChain([params, 'optionalAccess', _586 => _586.ids]), () => ( controller.getState().selection));
13684
13752
  for (const id of list2) if (!controller.getNode(id)) fail(`There is no node "${id}".`);
13685
13753
  if (!list2.length) fail("Nothing is selected; pass ids.");
13686
13754
  return list2;
13687
13755
  };
13688
- const enabledFor = (_, params) => _optionalChain([params, 'optionalAccess', _580 => _580.ids, 'optionalAccess', _581 => _581.length]) ? true : hasSelection();
13756
+ const enabledFor = (_, params) => _optionalChain([params, 'optionalAccess', _587 => _587.ids, 'optionalAccess', _588 => _588.length]) ? true : hasSelection();
13689
13757
  const anchorsOf = (refs) => {
13690
13758
  if (!refs) return [...controller.getState().selectedAnchors];
13691
13759
  for (const r of refs) {
13692
13760
  const node = controller.getNode(r.nodeId);
13693
- if (_optionalChain([node, 'optionalAccess', _582 => _582.type]) !== "path" || !_optionalChain([node, 'access', _583 => _583.subpaths, 'access', _584 => _584[r.subpath], 'optionalAccess', _585 => _585.anchors, 'access', _586 => _586[r.index]])) fail(`There is no anchor ${r.index} on subpath ${r.subpath} of "${r.nodeId}".`);
13761
+ if (_optionalChain([node, 'optionalAccess', _589 => _589.type]) !== "path" || !_optionalChain([node, 'access', _590 => _590.subpaths, 'access', _591 => _591[r.subpath], 'optionalAccess', _592 => _592.anchors, 'access', _593 => _593[r.index]])) fail(`There is no anchor ${r.index} on subpath ${r.subpath} of "${r.nodeId}".`);
13694
13762
  }
13695
13763
  return refs;
13696
13764
  };
@@ -13714,13 +13782,13 @@ function createVectorCommands(controller, options = {}) {
13714
13782
  ...n2.type === "path" ? { fill: _nullishCoalesce(n2.fill, () => ( null)), stroke: _nullishCoalesce(n2.stroke, () => ( null)), strokeWidth: _nullishCoalesce(n2.strokeWidth, () => ( 1)), d: _chunkFODKPD44cjs.vectorPathData.call(void 0, n2, 2) } : n2.type === "text" ? { fill: _nullishCoalesce(n2.fill, () => ( null)), stroke: _nullishCoalesce(n2.stroke, () => ( null)), strokeWidth: _nullishCoalesce(n2.strokeWidth, () => ( 1)), text: n2.text, frame: n2.frame.kind } : n2.type === "instance" ? { symbolId: n2.symbolId, ...n2.transform ? { transform: [...n2.transform] } : {}, ...n2.overrides ? { overrides: n2.overrides } : {} } : { children: n2.children.length },
13715
13783
  ...n2.type === "group" && n2.blend ? { blend: { ...resolveVectorBlendOptions(n2.blend), spine: !!n2.blend.spine, keys: vectorBlendKeys(n2).map((k) => k.id) } } : {},
13716
13784
  ...n2.blendStep ? { blendStep: true } : {},
13717
- ..._optionalChain([n2, 'access', _587 => _587.effects, 'optionalAccess', _588 => _588.length]) ? { effects: n2.effects } : {},
13785
+ ..._optionalChain([n2, 'access', _594 => _594.effects, 'optionalAccess', _595 => _595.length]) ? { effects: n2.effects } : {},
13718
13786
  ...n2.type === "group" && n2.liveBoolean ? { liveBoolean: n2.liveBoolean } : {},
13719
13787
  ...n2.booleanOperation ? { booleanOperation: n2.booleanOperation } : {},
13720
13788
  ...(n2.type === "path" || n2.type === "text") && Array.isArray(n2.fills) ? { fills: n2.fills } : {},
13721
13789
  ...(n2.type === "path" || n2.type === "text") && Array.isArray(n2.strokes) ? { strokes: n2.strokes } : {},
13722
13790
  ...n2.blendMode && n2.blendMode !== "normal" ? { blendMode: n2.blendMode } : {},
13723
- ..._optionalChain([n2, 'access', _589 => _589.filters, 'optionalAccess', _590 => _590.length]) ? { filters: n2.filters } : {},
13791
+ ..._optionalChain([n2, 'access', _596 => _596.filters, 'optionalAccess', _597 => _597.length]) ? { filters: n2.filters } : {},
13724
13792
  ..._chunkFODKPD44cjs.isVectorMaskGroup.call(void 0, n2) ? { mask: _chunkFODKPD44cjs.vectorMaskSummary.call(void 0, n2) } : {},
13725
13793
  ..._chunkFODKPD44cjs.isVectorFrame.call(void 0, n2) ? { frameRect: n2.frame } : {},
13726
13794
  ...n2.resizing ? { resizing: n2.resizing } : {},
@@ -13794,7 +13862,7 @@ function createVectorCommands(controller, options = {}) {
13794
13862
  enabled: enabledFor,
13795
13863
  run: (_ctx, params) => {
13796
13864
  const targets = ids(params);
13797
- check(controller.addPaintLayer(kind, layerPatchOf(_nullishCoalesce(params, () => ( {})), keys), { ids: targets, index: _optionalChain([params, 'optionalAccess', _591 => _591.index]) }));
13865
+ check(controller.addPaintLayer(kind, layerPatchOf(_nullishCoalesce(params, () => ( {})), keys), { ids: targets, index: _optionalChain([params, 'optionalAccess', _598 => _598.index]) }));
13798
13866
  return { nodes: pathsUnder(targets).map((id) => stackResult(id, kind)) };
13799
13867
  }
13800
13868
  },
@@ -13867,17 +13935,17 @@ function createVectorCommands(controller, options = {}) {
13867
13935
  const allowed = _chunkFODKPD44cjs.vectorFilterParamKeys.call(void 0, type);
13868
13936
  for (const key of Object.keys(_nullishCoalesce(params, () => ( {})))) if (!allowed.includes(key)) fail(`${type} has no parameter "${key}"; it takes ${allowed.join(", ")}.`);
13869
13937
  };
13870
- const filtersResult = (id) => ({ id, filters: _nullishCoalesce(_optionalChain([controller, 'access', _592 => _592.getNode, 'call', _593 => _593(id), 'optionalAccess', _594 => _594.filters]), () => ( [])) });
13938
+ const filtersResult = (id) => ({ id, filters: _nullishCoalesce(_optionalChain([controller, 'access', _599 => _599.getNode, 'call', _600 => _600(id), 'optionalAccess', _601 => _601.filters]), () => ( [])) });
13871
13939
  const filterOf = (nodeId, filterId) => {
13872
13940
  const node = _nullishCoalesce(controller.getNode(nodeId), () => ( fail(`There is no node "${nodeId}".`)));
13873
- return _nullishCoalesce(_optionalChain([node, 'access', _595 => _595.filters, 'optionalAccess', _596 => _596.find, 'call', _597 => _597((f) => f.id === filterId)]), () => ( fail(`Node "${nodeId}" has no filter "${filterId}"; it has ${(_nullishCoalesce(node.filters, () => ( []))).map((f) => `"${f.id}" (${f.type})`).join(", ") || "none"}.`)));
13941
+ return _nullishCoalesce(_optionalChain([node, 'access', _602 => _602.filters, 'optionalAccess', _603 => _603.find, 'call', _604 => _604((f) => f.id === filterId)]), () => ( fail(`Node "${nodeId}" has no filter "${filterId}"; it has ${(_nullishCoalesce(node.filters, () => ( []))).map((f) => `"${f.id}" (${f.type})`).join(", ") || "none"}.`)));
13874
13942
  };
13875
13943
  const maskResult = (id) => ({ id, mask: _nullishCoalesce(_chunkFODKPD44cjs.vectorMaskSummary.call(void 0, controller.getNode(id)), () => ( fail(`"${id}" is not a mask group.`))) });
13876
13944
  const maskInputs = (params) => {
13877
13945
  const list2 = [...new Set(ids(params))];
13878
13946
  if (list2.length < 2) fail(`Masking needs at least two objects (the mask and what it masks); got ${list2.length}. Pass ids, or select more.`);
13879
13947
  for (const id of list2) if (controller.getNode(id).locked) fail(`"${id}" is locked; ask the user to unlock it, or leave it out of ids.`);
13880
- if (_optionalChain([params, 'optionalAccess', _598 => _598.maskId]) !== void 0 && !list2.includes(params.maskId)) fail(`maskId "${params.maskId}" must be one of ids (${list2.map((id) => `"${id}"`).join(", ")}).`);
13948
+ if (_optionalChain([params, 'optionalAccess', _605 => _605.maskId]) !== void 0 && !list2.includes(params.maskId)) fail(`maskId "${params.maskId}" must be one of ids (${list2.map((id) => `"${id}"`).join(", ")}).`);
13881
13949
  return list2;
13882
13950
  };
13883
13951
  const maskTargets = (params) => {
@@ -13904,7 +13972,7 @@ function createVectorCommands(controller, options = {}) {
13904
13972
  enabled: enabledFor,
13905
13973
  run: (_ctx, params) => {
13906
13974
  const list2 = maskInputs(params);
13907
- const r = controller.makeMask("clip", { ids: list2, ..._optionalChain([params, 'optionalAccess', _599 => _599.maskId]) ? { maskId: params.maskId } : {}, invert: _optionalChain([params, 'optionalAccess', _600 => _600.invert]) });
13975
+ const r = controller.makeMask("clip", { ids: list2, ..._optionalChain([params, 'optionalAccess', _606 => _606.maskId]) ? { maskId: params.maskId } : {}, invert: _optionalChain([params, 'optionalAccess', _607 => _607.invert]) });
13908
13976
  if (!r.ok) fail(r.message);
13909
13977
  return maskResult(r.id);
13910
13978
  }
@@ -13924,7 +13992,7 @@ function createVectorCommands(controller, options = {}) {
13924
13992
  enabled: enabledFor,
13925
13993
  run: (_ctx, params) => {
13926
13994
  const list2 = maskInputs(params);
13927
- const r = controller.makeMask(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _601 => _601.type]), () => ( "luminance")), { ids: list2, ..._optionalChain([params, 'optionalAccess', _602 => _602.maskId]) ? { maskId: params.maskId } : {}, invert: _optionalChain([params, 'optionalAccess', _603 => _603.invert]) });
13995
+ const r = controller.makeMask(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _608 => _608.type]), () => ( "luminance")), { ids: list2, ..._optionalChain([params, 'optionalAccess', _609 => _609.maskId]) ? { maskId: params.maskId } : {}, invert: _optionalChain([params, 'optionalAccess', _610 => _610.invert]) });
13928
13996
  if (!r.ok) fail(r.message);
13929
13997
  return maskResult(r.id);
13930
13998
  }
@@ -13948,9 +14016,9 @@ function createVectorCommands(controller, options = {}) {
13948
14016
  undoable: true,
13949
14017
  enabled: enabledFor,
13950
14018
  run: (_ctx, params) => {
13951
- if (_optionalChain([params, 'optionalAccess', _604 => _604.type]) === void 0 && _optionalChain([params, 'optionalAccess', _605 => _605.invert]) === void 0 && _optionalChain([params, 'optionalAccess', _606 => _606.enabled]) === void 0) fail("Pass at least one of type, invert, enabled.");
14019
+ if (_optionalChain([params, 'optionalAccess', _611 => _611.type]) === void 0 && _optionalChain([params, 'optionalAccess', _612 => _612.invert]) === void 0 && _optionalChain([params, 'optionalAccess', _613 => _613.enabled]) === void 0) fail("Pass at least one of type, invert, enabled.");
13952
14020
  const groups = maskTargets(params);
13953
- const patch = { ..._optionalChain([params, 'optionalAccess', _607 => _607.type]) ? { type: params.type } : {}, ..._optionalChain([params, 'optionalAccess', _608 => _608.invert]) !== void 0 ? { invert: params.invert } : {}, ..._optionalChain([params, 'optionalAccess', _609 => _609.enabled]) !== void 0 ? { enabled: params.enabled } : {} };
14021
+ const patch = { ..._optionalChain([params, 'optionalAccess', _614 => _614.type]) ? { type: params.type } : {}, ..._optionalChain([params, 'optionalAccess', _615 => _615.invert]) !== void 0 ? { invert: params.invert } : {}, ..._optionalChain([params, 'optionalAccess', _616 => _616.enabled]) !== void 0 ? { enabled: params.enabled } : {} };
13954
14022
  check(controller.setMaskOptions(patch, { ids: groups }));
13955
14023
  return { groups: groups.map(maskResult) };
13956
14024
  }
@@ -14001,7 +14069,7 @@ function createVectorCommands(controller, options = {}) {
14001
14069
  run: (_ctx, params) => {
14002
14070
  const targets = ids(params);
14003
14071
  check(controller.setBlendMode(params.blendMode, { ids: targets }));
14004
- return { nodes: targets.map((id) => ({ id, blendMode: _nullishCoalesce(_optionalChain([controller, 'access', _610 => _610.getNode, 'call', _611 => _611(id), 'optionalAccess', _612 => _612.blendMode]), () => ( "normal")) })) };
14072
+ return { nodes: targets.map((id) => ({ id, blendMode: _nullishCoalesce(_optionalChain([controller, 'access', _617 => _617.getNode, 'call', _618 => _618(id), 'optionalAccess', _619 => _619.blendMode]), () => ( "normal")) })) };
14005
14073
  }
14006
14074
  },
14007
14075
  {
@@ -14407,7 +14475,7 @@ function createVectorCommands(controller, options = {}) {
14407
14475
  keywords: ["symbol", "symbols", "library", "component", "reuse", "instance"],
14408
14476
  description: "Lists the document's symbols: id, name, the art's nodes (ids, types, names; use them for hidden overrides), its bounds in symbol space (around the registration point at 0, 0) and the ids of its instances. Also says which symbol is being edited in isolation, if any.",
14409
14477
  params: { type: "object", properties: {}, additionalProperties: false },
14410
- run: () => ({ symbols: controller.getSymbols().map((x) => symbolSummary(x.id)), editing: _nullishCoalesce(_optionalChain([controller, 'access', _613 => _613.getState, 'call', _614 => _614(), 'access', _615 => _615.symbolEdit, 'optionalAccess', _616 => _616.symbolId]), () => ( null)) })
14478
+ run: () => ({ symbols: controller.getSymbols().map((x) => symbolSummary(x.id)), editing: _nullishCoalesce(_optionalChain([controller, 'access', _620 => _620.getState, 'call', _621 => _621(), 'access', _622 => _622.symbolEdit, 'optionalAccess', _623 => _623.symbolId]), () => ( null)) })
14411
14479
  },
14412
14480
  {
14413
14481
  ...base,
@@ -14420,7 +14488,7 @@ function createVectorCommands(controller, options = {}) {
14420
14488
  undoable: true,
14421
14489
  enabled: enabledFor,
14422
14490
  run: (_ctx, params) => {
14423
- const r = controller.makeSymbol({ ids: ids(params), ..._optionalChain([params, 'optionalAccess', _617 => _617.name]) ? { name: params.name } : {} });
14491
+ const r = controller.makeSymbol({ ids: ids(params), ..._optionalChain([params, 'optionalAccess', _624 => _624.name]) ? { name: params.name } : {} });
14424
14492
  check(r);
14425
14493
  return { symbolId: r.symbolId, instanceId: r.instanceId, symbol: symbolSummary(r.symbolId) };
14426
14494
  }
@@ -14477,10 +14545,10 @@ function createVectorCommands(controller, options = {}) {
14477
14545
  enabled: enabledFor,
14478
14546
  run: (_ctx, params) => {
14479
14547
  const patch = {
14480
- ..._optionalChain([params, 'optionalAccess', _618 => _618.scaleStrokes]) !== void 0 ? { scaleStrokes: params.scaleStrokes } : {},
14481
- ..._optionalChain([params, 'optionalAccess', _619 => _619.fill]) !== void 0 ? { fill: params.fill === null ? null : checkPaint(params.fill, "fill") } : {},
14482
- ..._optionalChain([params, 'optionalAccess', _620 => _620.stroke]) !== void 0 ? { stroke: params.stroke === null ? null : checkPaint(params.stroke, "stroke") } : {},
14483
- ..._optionalChain([params, 'optionalAccess', _621 => _621.hidden]) !== void 0 ? { hidden: params.hidden } : {}
14548
+ ..._optionalChain([params, 'optionalAccess', _625 => _625.scaleStrokes]) !== void 0 ? { scaleStrokes: params.scaleStrokes } : {},
14549
+ ..._optionalChain([params, 'optionalAccess', _626 => _626.fill]) !== void 0 ? { fill: params.fill === null ? null : checkPaint(params.fill, "fill") } : {},
14550
+ ..._optionalChain([params, 'optionalAccess', _627 => _627.stroke]) !== void 0 ? { stroke: params.stroke === null ? null : checkPaint(params.stroke, "stroke") } : {},
14551
+ ..._optionalChain([params, 'optionalAccess', _628 => _628.hidden]) !== void 0 ? { hidden: params.hidden } : {}
14484
14552
  };
14485
14553
  if (!Object.keys(patch).length) fail("Pass at least one of scaleStrokes, fill, stroke, hidden.");
14486
14554
  const targetIds = ids(params);
@@ -14565,7 +14633,7 @@ function createVectorCommands(controller, options = {}) {
14565
14633
  params: { type: "object", properties: {}, additionalProperties: false },
14566
14634
  enabled: () => controller.getState().symbolEdit ? true : "No symbol is being edited.",
14567
14635
  run: () => {
14568
- const id = _nullishCoalesce(_optionalChain([controller, 'access', _622 => _622.getState, 'call', _623 => _623(), 'access', _624 => _624.symbolEdit, 'optionalAccess', _625 => _625.symbolId]), () => ( null));
14636
+ const id = _nullishCoalesce(_optionalChain([controller, 'access', _629 => _629.getState, 'call', _630 => _630(), 'access', _631 => _631.symbolEdit, 'optionalAccess', _632 => _632.symbolId]), () => ( null));
14569
14637
  controller.exitSymbolEdit();
14570
14638
  return { symbolId: id };
14571
14639
  }
@@ -14648,7 +14716,7 @@ function createVectorCommands(controller, options = {}) {
14648
14716
  additionalProperties: false
14649
14717
  },
14650
14718
  run: (_ctx, params) => {
14651
- if (_optionalChain([params, 'optionalAccess', _626 => _626.ids])) {
14719
+ if (_optionalChain([params, 'optionalAccess', _633 => _633.ids])) {
14652
14720
  for (const id of params.ids) if (!controller.getNode(id)) fail(`There is no node "${id}".`);
14653
14721
  }
14654
14722
  return controller.toLottie(_nullishCoalesce(params, () => ( {})));
@@ -14947,7 +15015,7 @@ function createVectorCommands(controller, options = {}) {
14947
15015
  run: (_ctx, params) => {
14948
15016
  const { polarIncrement, additionalAngles, ...rest } = _nullishCoalesce(params, () => ( {}));
14949
15017
  if (!Object.keys(_nullishCoalesce(params, () => ( {}))).length) fail("Pass at least one option.");
14950
- if (_optionalChain([rest, 'access', _627 => _627.angles, 'optionalAccess', _628 => _628.some, 'call', _629 => _629((a) => !Number.isFinite(a))])) fail("angles must be numbers (degrees).");
15018
+ if (_optionalChain([rest, 'access', _634 => _634.angles, 'optionalAccess', _635 => _635.some, 'call', _636 => _636((a) => !Number.isFinite(a))])) fail("angles must be numbers (degrees).");
14951
15019
  if (additionalAngles && polarIncrement === void 0) fail("additionalAngles go with polarIncrement.");
14952
15020
  const angles = _nullishCoalesce(rest.angles, () => ( (polarIncrement !== void 0 ? vectorPolarAngles(polarIncrement, additionalAngles) : void 0)));
14953
15021
  controller.setSnap({ ...rest, ...angles ? { angles } : {} });
@@ -15198,8 +15266,8 @@ function createVectorCommands(controller, options = {}) {
15198
15266
  enabled: enabledFor,
15199
15267
  run: (_ctx, params) => {
15200
15268
  const list2 = ids(params);
15201
- check(controller.setResizing({ ..._optionalChain([params, 'optionalAccess', _630 => _630.horizontal]) ? { horizontal: params.horizontal } : {}, ..._optionalChain([params, 'optionalAccess', _631 => _631.vertical]) ? { vertical: params.vertical } : {} }, { ids: list2 }));
15202
- return { nodes: list2.map((id) => ({ id, horizontal: _nullishCoalesce(_optionalChain([controller, 'access', _632 => _632.getNode, 'call', _633 => _633(id), 'optionalAccess', _634 => _634.resizing, 'optionalAccess', _635 => _635.horizontal]), () => ( "left")), vertical: _nullishCoalesce(_optionalChain([controller, 'access', _636 => _636.getNode, 'call', _637 => _637(id), 'optionalAccess', _638 => _638.resizing, 'optionalAccess', _639 => _639.vertical]), () => ( "top")) })) };
15269
+ check(controller.setResizing({ ..._optionalChain([params, 'optionalAccess', _637 => _637.horizontal]) ? { horizontal: params.horizontal } : {}, ..._optionalChain([params, 'optionalAccess', _638 => _638.vertical]) ? { vertical: params.vertical } : {} }, { ids: list2 }));
15270
+ return { nodes: list2.map((id) => ({ id, horizontal: _nullishCoalesce(_optionalChain([controller, 'access', _639 => _639.getNode, 'call', _640 => _640(id), 'optionalAccess', _641 => _641.resizing, 'optionalAccess', _642 => _642.horizontal]), () => ( "left")), vertical: _nullishCoalesce(_optionalChain([controller, 'access', _643 => _643.getNode, 'call', _644 => _644(id), 'optionalAccess', _645 => _645.resizing, 'optionalAccess', _646 => _646.vertical]), () => ( "top")) })) };
15203
15271
  }
15204
15272
  },
15205
15273
  {
@@ -15381,7 +15449,7 @@ function createVectorCommands(controller, options = {}) {
15381
15449
  run: (_ctx, params) => {
15382
15450
  const id = controller.addPath(params.d, { ...pickStyle(params), ...params.name ? { name: params.name } : {} });
15383
15451
  const node = controller.getNode(id);
15384
- if (_optionalChain([node, 'optionalAccess', _640 => _640.type]) === "path" && !node.subpaths.length) {
15452
+ if (_optionalChain([node, 'optionalAccess', _647 => _647.type]) === "path" && !node.subpaths.length) {
15385
15453
  controller.undo();
15386
15454
  fail("The path data has no points.");
15387
15455
  }
@@ -15420,7 +15488,7 @@ function createVectorCommands(controller, options = {}) {
15420
15488
  check(controller.setGradient(patch, { ids: ids(params), target: _nullishCoalesce(target, () => ( "fill")) }));
15421
15489
  const id = ids(params)[0];
15422
15490
  const node = id ? controller.getNode(id) : void 0;
15423
- const path = _optionalChain([node, 'optionalAccess', _641 => _641.type]) === "path" ? node : void 0;
15491
+ const path = _optionalChain([node, 'optionalAccess', _648 => _648.type]) === "path" ? node : void 0;
15424
15492
  return { ok: true, ...path ? { gradient: path[_nullishCoalesce(target, () => ( "fill"))] } : {} };
15425
15493
  }
15426
15494
  },
@@ -15454,12 +15522,12 @@ function createVectorCommands(controller, options = {}) {
15454
15522
  },
15455
15523
  undoable: true,
15456
15524
  run: (_ctx, params) => {
15457
- const refs = _optionalChain([params, 'optionalAccess', _642 => _642.anchors]) ? anchorsOf(params.anchors) : void 0;
15458
- const target = { refs, ids: _optionalChain([params, 'optionalAccess', _643 => _643.ids]) ? ids(params) : void 0 };
15459
- if (_optionalChain([params, 'optionalAccess', _644 => _644.radius]) !== void 0) check(controller.setCornerRadius(params.radius, { ...target, kind: params.kind, ...params.smoothing !== void 0 ? { smoothing: params.smoothing } : {} }));
15460
- else if (_optionalChain([params, 'optionalAccess', _645 => _645.kind])) check(controller.setCornerKind(params.kind, target));
15461
- if (_optionalChain([params, 'optionalAccess', _646 => _646.radius]) === void 0 && _optionalChain([params, 'optionalAccess', _647 => _647.smoothing]) !== void 0) check(controller.setCornerSmoothing(params.smoothing, target));
15462
- if (_optionalChain([params, 'optionalAccess', _648 => _648.radius]) === void 0 && !_optionalChain([params, 'optionalAccess', _649 => _649.kind]) && _optionalChain([params, 'optionalAccess', _650 => _650.smoothing]) === void 0) fail("Pass `radius`, `kind` and / or `smoothing`.");
15525
+ const refs = _optionalChain([params, 'optionalAccess', _649 => _649.anchors]) ? anchorsOf(params.anchors) : void 0;
15526
+ const target = { refs, ids: _optionalChain([params, 'optionalAccess', _650 => _650.ids]) ? ids(params) : void 0 };
15527
+ if (_optionalChain([params, 'optionalAccess', _651 => _651.radius]) !== void 0) check(controller.setCornerRadius(params.radius, { ...target, kind: params.kind, ...params.smoothing !== void 0 ? { smoothing: params.smoothing } : {} }));
15528
+ else if (_optionalChain([params, 'optionalAccess', _652 => _652.kind])) check(controller.setCornerKind(params.kind, target));
15529
+ if (_optionalChain([params, 'optionalAccess', _653 => _653.radius]) === void 0 && _optionalChain([params, 'optionalAccess', _654 => _654.smoothing]) !== void 0) check(controller.setCornerSmoothing(params.smoothing, target));
15530
+ if (_optionalChain([params, 'optionalAccess', _655 => _655.radius]) === void 0 && !_optionalChain([params, 'optionalAccess', _656 => _656.kind]) && _optionalChain([params, 'optionalAccess', _657 => _657.smoothing]) === void 0) fail("Pass `radius`, `kind` and / or `smoothing`.");
15463
15531
  return { ok: true };
15464
15532
  }
15465
15533
  },
@@ -15493,12 +15561,12 @@ function createVectorCommands(controller, options = {}) {
15493
15561
  undoable: true,
15494
15562
  run: (_ctx, params) => {
15495
15563
  const target = { ids: ids(params) };
15496
- if (_optionalChain([params, 'optionalAccess', _651 => _651.preset])) check(controller.setWidthProfile(params.preset, target));
15497
- else if (_optionalChain([params, 'optionalAccess', _652 => _652.points]) !== void 0) check(controller.setWidthProfile(_nullishCoalesce(params.points, () => ( null)), target));
15498
- else if (_optionalChain([params, 'optionalAccess', _653 => _653.taper]) || _optionalChain([params, 'optionalAccess', _654 => _654.wave])) check(controller.setWidthProfile({ taper: params.taper, wave: params.wave }, target));
15564
+ if (_optionalChain([params, 'optionalAccess', _658 => _658.preset])) check(controller.setWidthProfile(params.preset, target));
15565
+ else if (_optionalChain([params, 'optionalAccess', _659 => _659.points]) !== void 0) check(controller.setWidthProfile(_nullishCoalesce(params.points, () => ( null)), target));
15566
+ else if (_optionalChain([params, 'optionalAccess', _660 => _660.taper]) || _optionalChain([params, 'optionalAccess', _661 => _661.wave])) check(controller.setWidthProfile({ taper: params.taper, wave: params.wave }, target));
15499
15567
  else fail("Pass `preset`, `points`, `taper` or `wave`.");
15500
15568
  const node = controller.getNode(target.ids[0]);
15501
- return { ok: true, points: _optionalChain([node, 'optionalAccess', _655 => _655.type]) === "path" ? _nullishCoalesce(node.strokeWidthProfile, () => ( [])) : [] };
15569
+ return { ok: true, points: _optionalChain([node, 'optionalAccess', _662 => _662.type]) === "path" ? _nullishCoalesce(node.strokeWidthProfile, () => ( [])) : [] };
15502
15570
  }
15503
15571
  },
15504
15572
  {
@@ -15520,10 +15588,10 @@ function createVectorCommands(controller, options = {}) {
15520
15588
  },
15521
15589
  undoable: true,
15522
15590
  run: (_ctx, params) => {
15523
- if (!_optionalChain([params, 'optionalAccess', _656 => _656.id])) fail("Pass the path `id`.");
15591
+ if (!_optionalChain([params, 'optionalAccess', _663 => _663.id])) fail("Pass the path `id`.");
15524
15592
  check(controller.setWidthPoint({ nodeId: params.id, index: _nullishCoalesce(params.index, () => ( null)) }, { t: params.t, left: params.left, right: params.right }));
15525
15593
  const node = controller.getNode(params.id);
15526
- return { ok: true, points: _optionalChain([node, 'optionalAccess', _657 => _657.type]) === "path" ? _nullishCoalesce(node.strokeWidthProfile, () => ( [])) : [] };
15594
+ return { ok: true, points: _optionalChain([node, 'optionalAccess', _664 => _664.type]) === "path" ? _nullishCoalesce(node.strokeWidthProfile, () => ( [])) : [] };
15527
15595
  }
15528
15596
  },
15529
15597
  {
@@ -15536,7 +15604,7 @@ function createVectorCommands(controller, options = {}) {
15536
15604
  enabled: enabledFor,
15537
15605
  undoable: true,
15538
15606
  run: (_ctx, params) => {
15539
- const created = controller.outlineStroke({ ids: _optionalChain([params, 'optionalAccess', _658 => _658.ids]) ? ids(params) : void 0 });
15607
+ const created = controller.outlineStroke({ ids: _optionalChain([params, 'optionalAccess', _665 => _665.ids]) ? ids(params) : void 0 });
15540
15608
  if (!created.length) fail("No selected path has a stroke.");
15541
15609
  return { ids: created };
15542
15610
  }
@@ -15621,7 +15689,7 @@ function createVectorCommands(controller, options = {}) {
15621
15689
  if (params.release) return { released: target, shapes: controller.releaseEnvelope({ ids: target }) };
15622
15690
  if (params.expand) return { expanded: controller.expandAppearance({ ids: target }) };
15623
15691
  if (params.topObject) {
15624
- const r = controller.makeEnvelopeWithTopObject({ ids: target, rows: _optionalChain([params, 'access', _659 => _659.mesh, 'optionalAccess', _660 => _660.rows]), columns: _optionalChain([params, 'access', _661 => _661.mesh, 'optionalAccess', _662 => _662.columns]) });
15692
+ const r = controller.makeEnvelopeWithTopObject({ ids: target, rows: _optionalChain([params, 'access', _666 => _666.mesh, 'optionalAccess', _667 => _667.rows]), columns: _optionalChain([params, 'access', _668 => _668.mesh, 'optionalAccess', _669 => _669.columns]) });
15625
15693
  check(r);
15626
15694
  return { nodeId: r.nodeId };
15627
15695
  }
@@ -15761,7 +15829,7 @@ function createVectorCommands(controller, options = {}) {
15761
15829
  run: (_ctx, params) => {
15762
15830
  if (params.params !== void 0 || params.enabled !== void 0) check(controller.updateEffect(params.nodeId, params.effectId, { params: params.params, enabled: params.enabled }));
15763
15831
  if (params.index !== void 0) check(controller.moveEffect(params.nodeId, params.effectId, params.index));
15764
- return { effects: _nullishCoalesce(_optionalChain([controller, 'access', _663 => _663.getNode, 'call', _664 => _664(params.nodeId), 'optionalAccess', _665 => _665.effects]), () => ( [])) };
15832
+ return { effects: _nullishCoalesce(_optionalChain([controller, 'access', _670 => _670.getNode, 'call', _671 => _671(params.nodeId), 'optionalAccess', _672 => _672.effects]), () => ( [])) };
15765
15833
  }
15766
15834
  },
15767
15835
  {
@@ -15825,7 +15893,7 @@ function createVectorCommands(controller, options = {}) {
15825
15893
  undoable: true,
15826
15894
  run: (_ctx, params) => {
15827
15895
  checkBlendOptions(params);
15828
- const r = controller.setBlendOptions(_nullishCoalesce(params, () => ( {})), { ids: _optionalChain([params, 'optionalAccess', _666 => _666.ids]) });
15896
+ const r = controller.setBlendOptions(_nullishCoalesce(params, () => ( {})), { ids: _optionalChain([params, 'optionalAccess', _673 => _673.ids]) });
15829
15897
  if (!r.ok) fail(r.message);
15830
15898
  return { ok: true };
15831
15899
  }
@@ -15839,7 +15907,7 @@ function createVectorCommands(controller, options = {}) {
15839
15907
  params: { type: "object", properties: { ids: IDS } },
15840
15908
  undoable: true,
15841
15909
  run: (_ctx, params) => {
15842
- const groups = controller.expandBlend({ ids: _optionalChain([params, 'optionalAccess', _667 => _667.ids]) });
15910
+ const groups = controller.expandBlend({ ids: _optionalChain([params, 'optionalAccess', _674 => _674.ids]) });
15843
15911
  if (!groups.length) fail("Select a blend to expand.");
15844
15912
  return { ids: groups };
15845
15913
  }
@@ -15853,7 +15921,7 @@ function createVectorCommands(controller, options = {}) {
15853
15921
  params: { type: "object", properties: { ids: IDS } },
15854
15922
  undoable: true,
15855
15923
  run: (_ctx, params) => {
15856
- const released = controller.releaseBlend({ ids: _optionalChain([params, 'optionalAccess', _668 => _668.ids]) });
15924
+ const released = controller.releaseBlend({ ids: _optionalChain([params, 'optionalAccess', _675 => _675.ids]) });
15857
15925
  if (!released.length) fail("Select a blend to release.");
15858
15926
  return { ids: released };
15859
15927
  }
@@ -15867,7 +15935,7 @@ function createVectorCommands(controller, options = {}) {
15867
15935
  params: { type: "object", properties: { ids: IDS } },
15868
15936
  undoable: true,
15869
15937
  run: (_ctx, params) => {
15870
- const r = controller.replaceBlendSpine({ ids: _optionalChain([params, 'optionalAccess', _669 => _669.ids]) });
15938
+ const r = controller.replaceBlendSpine({ ids: _optionalChain([params, 'optionalAccess', _676 => _676.ids]) });
15871
15939
  if (!r.ok) fail(r.message);
15872
15940
  return { ok: true };
15873
15941
  }
@@ -15981,7 +16049,7 @@ function createVectorCommands(controller, options = {}) {
15981
16049
  enabled: enabledFor,
15982
16050
  undoable: true,
15983
16051
  run: (_ctx, params) => {
15984
- const id = controller.group({ ids: ids(params), name: _optionalChain([params, 'optionalAccess', _670 => _670.name]) });
16052
+ const id = controller.group({ ids: ids(params), name: _optionalChain([params, 'optionalAccess', _677 => _677.name]) });
15985
16053
  if (!id) fail("Only nodes that share a parent can be grouped.");
15986
16054
  return { id };
15987
16055
  }
@@ -16009,7 +16077,7 @@ function createVectorCommands(controller, options = {}) {
16009
16077
  params: { type: "object", properties: { anchors: ANCHORS, keepShape: { type: "boolean" } } },
16010
16078
  undoable: true,
16011
16079
  run: (_ctx, params) => {
16012
- check(controller.deleteAnchors(anchorsOf(_optionalChain([params, 'optionalAccess', _671 => _671.anchors])), { keepShape: _optionalChain([params, 'optionalAccess', _672 => _672.keepShape]) }));
16080
+ check(controller.deleteAnchors(anchorsOf(_optionalChain([params, 'optionalAccess', _678 => _678.anchors])), { keepShape: _optionalChain([params, 'optionalAccess', _679 => _679.keepShape]) }));
16013
16081
  return { ok: true };
16014
16082
  }
16015
16083
  },
@@ -16064,7 +16132,7 @@ function createVectorCommands(controller, options = {}) {
16064
16132
  params: { type: "object", properties: { ids: IDS, tolerance: { type: "number", minimum: 0 } } },
16065
16133
  undoable: true,
16066
16134
  run: (_ctx, params) => {
16067
- check(controller.joinPaths({ ids: _optionalChain([params, 'optionalAccess', _673 => _673.ids]) ? ids(params) : void 0, tolerance: _optionalChain([params, 'optionalAccess', _674 => _674.tolerance]) }));
16135
+ check(controller.joinPaths({ ids: _optionalChain([params, 'optionalAccess', _680 => _680.ids]) ? ids(params) : void 0, tolerance: _optionalChain([params, 'optionalAccess', _681 => _681.tolerance]) }));
16068
16136
  return { selection: controller.getState().selection };
16069
16137
  }
16070
16138
  },
@@ -16078,7 +16146,7 @@ function createVectorCommands(controller, options = {}) {
16078
16146
  params: { type: "object", properties: { axis: { type: "string", enum: ["horizontal", "vertical", "both"] }, anchors: ANCHORS } },
16079
16147
  undoable: true,
16080
16148
  run: (_ctx, params) => {
16081
- check(controller.averageAnchors(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _675 => _675.axis]), () => ( "both")), anchorsOf(_optionalChain([params, 'optionalAccess', _676 => _676.anchors]))));
16149
+ check(controller.averageAnchors(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _682 => _682.axis]), () => ( "both")), anchorsOf(_optionalChain([params, 'optionalAccess', _683 => _683.anchors]))));
16082
16150
  return { ok: true };
16083
16151
  }
16084
16152
  },
@@ -16092,7 +16160,7 @@ function createVectorCommands(controller, options = {}) {
16092
16160
  enabled: enabledFor,
16093
16161
  undoable: true,
16094
16162
  run: (_ctx, params) => {
16095
- check(controller.removeRedundantPoints({ ids: _optionalChain([params, 'optionalAccess', _677 => _677.ids]) ? ids(params) : void 0, tolerance: _optionalChain([params, 'optionalAccess', _678 => _678.tolerance]) }));
16163
+ check(controller.removeRedundantPoints({ ids: _optionalChain([params, 'optionalAccess', _684 => _684.ids]) ? ids(params) : void 0, tolerance: _optionalChain([params, 'optionalAccess', _685 => _685.tolerance]) }));
16096
16164
  return { ok: true };
16097
16165
  }
16098
16166
  },
@@ -16105,7 +16173,7 @@ function createVectorCommands(controller, options = {}) {
16105
16173
  params: { type: "object", properties: { ids: IDS, amount: { type: "number", minimum: 0, maximum: 1 }, anchors: ANCHORS } },
16106
16174
  undoable: true,
16107
16175
  run: (_ctx, params) => {
16108
- check(controller.smoothPaths({ ids: _optionalChain([params, 'optionalAccess', _679 => _679.ids]) ? ids(params) : void 0, amount: _optionalChain([params, 'optionalAccess', _680 => _680.amount]), refs: _optionalChain([params, 'optionalAccess', _681 => _681.anchors]) }));
16176
+ check(controller.smoothPaths({ ids: _optionalChain([params, 'optionalAccess', _686 => _686.ids]) ? ids(params) : void 0, amount: _optionalChain([params, 'optionalAccess', _687 => _687.amount]), refs: _optionalChain([params, 'optionalAccess', _688 => _688.anchors]) }));
16109
16177
  return { ok: true };
16110
16178
  }
16111
16179
  },
@@ -16118,14 +16186,14 @@ function createVectorCommands(controller, options = {}) {
16118
16186
  params: { type: "object", properties: { nodeId: { type: "string" }, x: { type: "number" }, y: { type: "number" }, anchors: ANCHORS } },
16119
16187
  undoable: true,
16120
16188
  run: (_ctx, params) => {
16121
- if (_optionalChain([params, 'optionalAccess', _682 => _682.nodeId]) !== void 0) {
16189
+ if (_optionalChain([params, 'optionalAccess', _689 => _689.nodeId]) !== void 0) {
16122
16190
  if (!controller.getNode(params.nodeId)) fail(`There is no node "${params.nodeId}".`);
16123
16191
  if (params.x === void 0 || params.y === void 0) fail("Pass x and y with nodeId.");
16124
16192
  const created = controller.cutPathAt(params.nodeId, { x: params.x, y: params.y });
16125
16193
  if (!created) fail("Nothing to cut there (the end of an open path, or a locked path).");
16126
16194
  return { ids: created };
16127
16195
  }
16128
- check(controller.cutAtAnchors(anchorsOf(_optionalChain([params, 'optionalAccess', _683 => _683.anchors]))));
16196
+ check(controller.cutAtAnchors(anchorsOf(_optionalChain([params, 'optionalAccess', _690 => _690.anchors]))));
16129
16197
  return { ids: controller.getState().selection };
16130
16198
  }
16131
16199
  },
@@ -16176,7 +16244,7 @@ function createVectorCommands(controller, options = {}) {
16176
16244
  },
16177
16245
  run: (_ctx, params) => {
16178
16246
  const patch = {};
16179
- for (const key of ["keepShapeOnDelete", "curvatureMoves", "pencilSmoothing", "recognizeShapes", "eraserSize", "pencilPressure"]) if (_optionalChain([params, 'optionalAccess', _684 => _684[key]]) !== void 0) patch[key] = params[key];
16247
+ for (const key of ["keepShapeOnDelete", "curvatureMoves", "pencilSmoothing", "recognizeShapes", "eraserSize", "pencilPressure"]) if (_optionalChain([params, 'optionalAccess', _691 => _691[key]]) !== void 0) patch[key] = params[key];
16180
16248
  controller.setEditing(patch);
16181
16249
  return { editing: controller.getState().editing };
16182
16250
  }
@@ -16201,7 +16269,7 @@ function createVectorCommands(controller, options = {}) {
16201
16269
  keywords: ["download", "save", "markup"],
16202
16270
  description: "Returns the document as SVG markup.",
16203
16271
  params: { type: "object", properties: { precision: { type: "integer", minimum: 0, maximum: 8 } } },
16204
- run: (_ctx, params) => ({ svg: controller.toSvg({ precision: _optionalChain([params, 'optionalAccess', _685 => _685.precision]) }) })
16272
+ run: (_ctx, params) => ({ svg: controller.toSvg({ precision: _optionalChain([params, 'optionalAccess', _692 => _692.precision]) }) })
16205
16273
  },
16206
16274
  {
16207
16275
  ...base,
@@ -16243,7 +16311,7 @@ function getVectorTextPanel(state) {
16243
16311
  }
16244
16312
  const typing = state.tool === "type" || state.tool === "typePath";
16245
16313
  const one = state.selection.length === 1 ? _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, state.selection[0]) : void 0;
16246
- const pathId = _optionalChain([one, 'optionalAccess', _686 => _686.type]) === "path" ? one.id : null;
16314
+ const pathId = _optionalChain([one, 'optionalAccess', _693 => _693.type]) === "path" ? one.id : null;
16247
16315
  if (!nodes.length && !typing && !state.textEdit) return null;
16248
16316
  const styles = [];
16249
16317
  let target = "defaults";
@@ -16266,11 +16334,11 @@ function getVectorTextPanel(state) {
16266
16334
  return values.every((v) => v === values[0]) ? _nullishCoalesce(values[0], () => ( null)) : null;
16267
16335
  };
16268
16336
  const font = Object.fromEntries(FIELDS.map((k) => [k, same(k)]));
16269
- const alignSource = target === "defaults" ? [_nullishCoalesce(state.textDefaults.align, () => ( "left"))] : (target === "range" ? [edited] : nodes).map((n2) => _nullishCoalesce(_optionalChain([n2, 'access', _687 => _687.paragraph, 'optionalAccess', _688 => _688.align]), () => ( "left")));
16337
+ const alignSource = target === "defaults" ? [_nullishCoalesce(state.textDefaults.align, () => ( "left"))] : (target === "range" ? [edited] : nodes).map((n2) => _nullishCoalesce(_optionalChain([n2, 'access', _694 => _694.paragraph, 'optionalAccess', _695 => _695.align]), () => ( "left")));
16270
16338
  const align = alignSource.every((a) => a === alignSource[0]) ? alignSource[0] : null;
16271
16339
  const ids = target === "range" ? [edited.id] : nodes.map((n2) => n2.id);
16272
16340
  const frameNode = target === "range" ? edited : nodes.length === 1 ? nodes[0] : void 0;
16273
- return { target, ids, font, align, frame: _nullishCoalesce(_optionalChain([frameNode, 'optionalAccess', _689 => _689.frame, 'access', _690 => _690.kind]), () => ( null)), families: _chunkFODKPD44cjs.vectorTextFamilies.call(void 0, ), outlines: _chunkFODKPD44cjs.vectorTextHasOutlines.call(void 0, ), pathId };
16341
+ return { target, ids, font, align, frame: _nullishCoalesce(_optionalChain([frameNode, 'optionalAccess', _696 => _696.frame, 'access', _697 => _697.kind]), () => ( null)), families: _chunkFODKPD44cjs.vectorTextFamilies.call(void 0, ), outlines: _chunkFODKPD44cjs.vectorTextHasOutlines.call(void 0, ), pathId };
16274
16342
  }
16275
16343
  function applyVectorTextStyle(controller, patch, options = {}) {
16276
16344
  const state = controller.getState();
@@ -16300,7 +16368,7 @@ function applyVectorParagraphStyle(controller, patch, options = {}) {
16300
16368
  // src/vector/symbolsPanel.ts
16301
16369
  var fmt3 = (n2) => Math.round(n2 * 100) / 100;
16302
16370
  function getVectorSymbolsPanel(state, options = {}) {
16303
- const host = _nullishCoalesce(_optionalChain([state, 'access', _691 => _691.symbolEdit, 'optionalAccess', _692 => _692.host]), () => ( state.document));
16371
+ const host = _nullishCoalesce(_optionalChain([state, 'access', _698 => _698.symbolEdit, 'optionalAccess', _699 => _699.host]), () => ( state.document));
16304
16372
  const counts = /* @__PURE__ */ new Map();
16305
16373
  const count = (list) => {
16306
16374
  for (const n2 of list) {
@@ -16321,15 +16389,15 @@ function getVectorSymbolsPanel(state, options = {}) {
16321
16389
  instances: _nullishCoalesce(counts.get(s.id), () => ( 0)),
16322
16390
  viewBox: `${fmt3(b.x - pad)} ${fmt3(b.y - pad)} ${fmt3(b.width + 2 * pad)} ${fmt3(b.height + 2 * pad)}`,
16323
16391
  scene,
16324
- editing: _optionalChain([state, 'access', _693 => _693.symbolEdit, 'optionalAccess', _694 => _694.symbolId]) === s.id
16392
+ editing: _optionalChain([state, 'access', _700 => _700.symbolEdit, 'optionalAccess', _701 => _701.symbolId]) === s.id
16325
16393
  };
16326
16394
  });
16327
16395
  const one = state.selection.length === 1 ? _chunkFODKPD44cjs.findVectorNode.call(void 0, state.document.nodes, state.selection[0]) : void 0;
16328
- const inst = _optionalChain([one, 'optionalAccess', _695 => _695.type]) === "instance" ? one : null;
16396
+ const inst = _optionalChain([one, 'optionalAccess', _702 => _702.type]) === "instance" ? one : null;
16329
16397
  return {
16330
16398
  symbols,
16331
16399
  canMake: state.selection.length > 0 && !(state.selection.length === 1 && inst),
16332
- instance: inst ? { id: inst.id, symbolId: inst.symbolId, scaleStrokes: inst.scaleStrokes !== false, fill: _nullishCoalesce(_optionalChain([inst, 'access', _696 => _696.overrides, 'optionalAccess', _697 => _697.fill]), () => ( null)), stroke: _nullishCoalesce(_optionalChain([inst, 'access', _698 => _698.overrides, 'optionalAccess', _699 => _699.stroke]), () => ( null)), hidden: _nullishCoalesce(_optionalChain([inst, 'access', _700 => _700.overrides, 'optionalAccess', _701 => _701.hidden, 'optionalAccess', _702 => _702.length]), () => ( 0)) } : null,
16400
+ instance: inst ? { id: inst.id, symbolId: inst.symbolId, scaleStrokes: inst.scaleStrokes !== false, fill: _nullishCoalesce(_optionalChain([inst, 'access', _703 => _703.overrides, 'optionalAccess', _704 => _704.fill]), () => ( null)), stroke: _nullishCoalesce(_optionalChain([inst, 'access', _705 => _705.overrides, 'optionalAccess', _706 => _706.stroke]), () => ( null)), hidden: _nullishCoalesce(_optionalChain([inst, 'access', _707 => _707.overrides, 'optionalAccess', _708 => _708.hidden, 'optionalAccess', _709 => _709.length]), () => ( 0)) } : null,
16333
16401
  editing: state.symbolEdit ? { symbolId: state.symbolEdit.symbolId, name: state.symbolEdit.name } : null
16334
16402
  };
16335
16403
  }