@pixerate/editor 0.273.0 → 0.275.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.
Files changed (97) hide show
  1. package/dist/animation-editor/index.cjs +60 -60
  2. package/dist/animation-editor/index.js +4 -4
  3. package/dist/brushes/index.cjs +102 -74
  4. package/dist/brushes/index.js +34 -6
  5. package/dist/brushes/patch.d.cts +1 -1
  6. package/dist/brushes/patch.d.ts +1 -1
  7. package/dist/brushes/preview.d.cts +3 -0
  8. package/dist/brushes/preview.d.ts +3 -0
  9. package/dist/brushes/profiles.d.cts +2 -0
  10. package/dist/brushes/profiles.d.ts +2 -0
  11. package/dist/brushes/schema.d.cts +4 -0
  12. package/dist/brushes/schema.d.ts +4 -0
  13. package/dist/brushes/types.d.cts +47 -0
  14. package/dist/brushes/types.d.ts +47 -0
  15. package/dist/{brushstrokeRender-5YBCLFDQ.cjs → brushstrokeRender-2RQL46WB.cjs} +15 -15
  16. package/dist/{brushstrokeRender-DZGFU3J4.js → brushstrokeRender-WGY4DZHF.js} +3 -3
  17. package/dist/canvas/index.cjs +13 -13
  18. package/dist/canvas/index.js +1 -1
  19. package/dist/{chunk-2XDNF73E.js → chunk-43XJC3PP.js} +1 -1
  20. package/dist/{chunk-GHGBIAWQ.cjs → chunk-6QNDGMK7.cjs} +263 -45
  21. package/dist/{chunk-2F3YDXCN.js → chunk-75SYKUOT.js} +1 -1
  22. package/dist/{chunk-M3RZOF3G.cjs → chunk-C6VB7CPY.cjs} +1 -1
  23. package/dist/{chunk-N5IMDAHM.cjs → chunk-DHC4E2DU.cjs} +89 -37
  24. package/dist/{chunk-NAHJV3O6.js → chunk-G5TCMKX5.js} +28 -11
  25. package/dist/{chunk-DZVRH63Y.js → chunk-IEEY5RJV.js} +1 -1
  26. package/dist/{chunk-7W2EQQBP.cjs → chunk-JDXWLCXF.cjs} +6 -6
  27. package/dist/{chunk-N3SKPQEH.js → chunk-LMG57L5A.js} +62 -10
  28. package/dist/{chunk-5HP2VSAS.js → chunk-MSWLJI4G.js} +1 -1
  29. package/dist/{chunk-SNAFFCAX.cjs → chunk-OLZXXAER.cjs} +221 -196
  30. package/dist/{chunk-YJANF2BL.cjs → chunk-RAPNRK4R.cjs} +86 -86
  31. package/dist/{chunk-CLB2I2FU.js → chunk-RJGW3RQS.js} +2 -2
  32. package/dist/{chunk-FXVCB6YG.cjs → chunk-T6KNJVBP.cjs} +35 -35
  33. package/dist/{chunk-ZEI7ZEA4.js → chunk-Y2ISSVPH.js} +34 -9
  34. package/dist/{chunk-3JKCREEU.cjs → chunk-Y354ETAE.cjs} +76 -59
  35. package/dist/{chunk-TNLKFW7D.cjs → chunk-YYZC2EQO.cjs} +23 -23
  36. package/dist/{chunk-UXYCY3HP.js → chunk-ZM7IKQ4X.js} +239 -21
  37. package/dist/image-editor/index.cjs +789 -789
  38. package/dist/image-editor/index.js +5 -5
  39. package/dist/paint/index.cjs +2 -2
  40. package/dist/paint/index.js +1 -1
  41. package/dist/paint/wet/world.d.cts +15 -2
  42. package/dist/paint/wet/world.d.ts +15 -2
  43. package/dist/paint-editor/brush-controls.d.cts +7 -0
  44. package/dist/paint-editor/brush-controls.d.ts +7 -0
  45. package/dist/paint-editor/brush-model.d.cts +59 -1
  46. package/dist/paint-editor/brush-model.d.ts +59 -1
  47. package/dist/paint-editor/collaboration.d.cts +6 -1
  48. package/dist/paint-editor/collaboration.d.ts +6 -1
  49. package/dist/paint-editor/controller.d.cts +199 -1
  50. package/dist/paint-editor/controller.d.ts +199 -1
  51. package/dist/paint-editor/dab-stroke.d.cts +3 -0
  52. package/dist/paint-editor/dab-stroke.d.ts +3 -0
  53. package/dist/paint-editor/document.d.cts +13 -3
  54. package/dist/paint-editor/document.d.ts +13 -3
  55. package/dist/paint-editor/engine.d.cts +3 -0
  56. package/dist/paint-editor/engine.d.ts +3 -0
  57. package/dist/paint-editor/evolution-tools.d.cts +48 -0
  58. package/dist/paint-editor/evolution-tools.d.ts +48 -0
  59. package/dist/paint-editor/evolution.d.cts +175 -0
  60. package/dist/paint-editor/evolution.d.ts +175 -0
  61. package/dist/paint-editor/heat.d.cts +156 -0
  62. package/dist/paint-editor/heat.d.ts +156 -0
  63. package/dist/paint-editor/index.cjs +4905 -1525
  64. package/dist/paint-editor/index.d.cts +5 -0
  65. package/dist/paint-editor/index.d.ts +5 -0
  66. package/dist/paint-editor/index.js +10952 -7572
  67. package/dist/paint-editor/mutation-tools.d.cts +13 -0
  68. package/dist/paint-editor/mutation-tools.d.ts +13 -0
  69. package/dist/paint-editor/mutation.d.cts +67 -0
  70. package/dist/paint-editor/mutation.d.ts +67 -0
  71. package/dist/paint-editor/presence.d.cts +7 -1
  72. package/dist/paint-editor/presence.d.ts +7 -1
  73. package/dist/paint-editor/procedural.d.cts +3 -0
  74. package/dist/paint-editor/procedural.d.ts +3 -0
  75. package/dist/paint-editor/stroke.d.cts +32 -2
  76. package/dist/paint-editor/stroke.d.ts +32 -2
  77. package/dist/paint-editor/thick.d.cts +48 -7
  78. package/dist/paint-editor/thick.d.ts +48 -7
  79. package/dist/paint-editor/ui.d.cts +36 -1
  80. package/dist/paint-editor/ui.d.ts +36 -1
  81. package/dist/paint-editor/wet.d.cts +8 -1
  82. package/dist/paint-editor/wet.d.ts +8 -1
  83. package/dist/vector/index.cjs +999 -999
  84. package/dist/vector/index.js +5 -5
  85. package/package.json +1 -1
  86. package/skills/README.md +1 -0
  87. package/skills/pixerate-brushes/SKILL.md +3 -0
  88. package/skills/pixerate-paint-editor/SKILL.md +36 -53
  89. package/skills/pixerate-paint-editor/references/brush-facets.md +3 -0
  90. package/skills/pixerate-paint-editor/references/mutation.md +25 -0
  91. package/skills/pixerate-paint-editor/references/oils.md +8 -1
  92. package/skills/pixerate-paint-editor/references/smart-inks.md +51 -0
  93. package/skills/pixerate-paint-mutation/SKILL.md +76 -0
  94. package/skills/pixerate-paint-mutation/evals/decline-unanswered.json +58 -0
  95. package/skills/pixerate-paint-mutation/evals/dry-ink-answer.json +74 -0
  96. package/skills/pixerate-paint-mutation/evals/wet-wash-answer.json +76 -0
  97. package/skills/pixerate-paint-oil-impasto/SKILL.md +2 -1
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkGHGBIAWQcjs = require('./chunk-GHGBIAWQ.cjs');
11
+ var _chunk6QNDGMK7cjs = require('./chunk-6QNDGMK7.cjs');
12
12
 
13
13
 
14
14
 
@@ -74,7 +74,7 @@ var _chunkJBZRVLXVcjs = require('./chunk-JBZRVLXV.cjs');
74
74
 
75
75
 
76
76
 
77
- var _chunkN5IMDAHMcjs = require('./chunk-N5IMDAHM.cjs');
77
+ var _chunkDHC4E2DUcjs = require('./chunk-DHC4E2DU.cjs');
78
78
 
79
79
 
80
80
 
@@ -2793,7 +2793,7 @@ function effectDabField(img, rect, cov, centre, mixed, field, steps = 0, dab = n
2793
2793
  var samplers = /* @__PURE__ */ new WeakMap();
2794
2794
  function stampSampler(ref, art, hardness = 1) {
2795
2795
  const sampler = baseSampler(ref, art);
2796
- if (!sampler || hardness >= 1 || !_chunkGHGBIAWQcjs.isBrushSourceRef.call(void 0, ref)) return sampler;
2796
+ if (!sampler || hardness >= 1 || !_chunk6QNDGMK7cjs.isBrushSourceRef.call(void 0, ref)) return sampler;
2797
2797
  const h = Math.max(0, hardness);
2798
2798
  return (u, v2, seed) => {
2799
2799
  const r = Math.hypot(u, v2) / Math.SQRT2;
@@ -2868,7 +2868,7 @@ function rasterizeStampDab(d, sample, seed, rect, out) {
2868
2868
  }
2869
2869
  function brushStickerRefs(brush) {
2870
2870
  const refs = brush.engine === "sticker" ? [...brush.sticker.stamps] : brush.engine === "particle" ? [...brush.particle.dotTextures] : brush.engine === "dab" && brush.stamp ? [brush.stamp] : [];
2871
- return [...new Set(refs.filter((r) => r.includes(":") && !r.startsWith("editor:") && !_chunkGHGBIAWQcjs.isBrushSourceRef.call(void 0, r)))];
2871
+ return [...new Set(refs.filter((r) => r.includes(":") && !r.startsWith("editor:") && !_chunk6QNDGMK7cjs.isBrushSourceRef.call(void 0, r)))];
2872
2872
  }
2873
2873
  function sprayDroplets(d, spray, seed) {
2874
2874
  const count = 1 + Math.round(spray.density * 31);
@@ -3405,6 +3405,10 @@ var DryStroke = (_class3 = class {
3405
3405
  sampleEffectField(this.options.effect, rect, vals, field, d);
3406
3406
  }
3407
3407
  this.coverage.accumulate(rect, vals, m.opacity, null, field);
3408
+ if (this.options.film) {
3409
+ if (this.brush.engine === "eraser") this.options.film.erase(rect, vals, m.opacity * this.brush.tip.opacity);
3410
+ else if (this.brush.iridescence) this.options.film.deposit(rect, vals, m.opacity * this.brush.tip.opacity, this.brush.iridescence, d.pressure);
3411
+ }
3408
3412
  rects.push(rect);
3409
3413
  this.dabCount++;
3410
3414
  }
@@ -3611,11 +3615,10 @@ var PaintDabStroke = (_class4 = class {
3611
3615
  if (this.gradientAlpha) laid = this.tipAlpha(d, rect, cov);
3612
3616
  } else total = ex.paint(this.paint);
3613
3617
  if (total > 0 && flow > 0) {
3618
+ const dep = Math.min(1, total) * d.alpha * brush.tip.opacity * d.opacity * flow;
3614
3619
  if (this.coverage) this.depositWithCeiling(d, rect, laid, field, ex, flow);
3615
- else {
3616
- const dep = Math.min(1, total) * d.alpha * brush.tip.opacity * d.opacity * flow;
3617
- if (dep > 0) this.medium.deposit(rect, laid, dep, this.paint, ex.paintPigment, field);
3618
- }
3620
+ else if (dep > 0) this.medium.deposit(rect, laid, dep, this.paint, ex.paintPigment, field);
3621
+ if (brush.iridescence && this.options.film && dep > 0) this.options.film.deposit(rect, laid, dep, brush.iridescence, d.pressure);
3619
3622
  }
3620
3623
  ex.drain();
3621
3624
  }
@@ -3700,7 +3703,7 @@ var PaintDabStroke = (_class4 = class {
3700
3703
 
3701
3704
  // src/paint-editor/wet.ts
3702
3705
  var STROKE_WATER = 0.9;
3703
- var STROKE_MASS = _chunkN5IMDAHMcjs.PIGMENT_UNIT * 2.5;
3706
+ var STROKE_MASS = _chunkDHC4E2DUcjs.PIGMENT_UNIT * 2.5;
3704
3707
  var STROKE_LIGHT = 1.5;
3705
3708
  var COVERAGE_STEPS = 4096;
3706
3709
  function union(a, b) {
@@ -3731,15 +3734,15 @@ var WetStrokeDriver = (_class5 = class {
3731
3734
  const perDab = Math.min(1, spacing * 1.2);
3732
3735
  const thin = wet.thinner;
3733
3736
  const body = wet.body * (1 - thin);
3734
- this.medium = new (0, _chunkN5IMDAHMcjs.WetMedium)(init.world, init.laneId, {
3737
+ this.medium = new (0, _chunkDHC4E2DUcjs.WetMedium)(init.world, init.laneId, {
3735
3738
  water: STROKE_WATER * Math.min(1, wet.water * (1 + thin)) * perDab,
3736
3739
  mass: STROKE_MASS * wet.pigment * (1 - 0.6 * thin) * perDab,
3737
3740
  body,
3738
3741
  light: 0
3739
3742
  });
3740
3743
  if (wet.tool === "paint" && brush.ghost && wet.pigment > 0) {
3741
- const one = _chunkN5IMDAHMcjs.pigmentOf.call(void 0, init.color, body);
3742
- init.world.startGhost(init.laneId, [one[0], one[1], one[2], one[3]], brush.ghost.linger, _nullishCoalesce(init.speed, () => ( 120)));
3744
+ const one = _chunkDHC4E2DUcjs.pigmentOf.call(void 0, init.color, body);
3745
+ init.world.startGhost(init.laneId, [one[0], one[1], one[2], one[3]], brush.ghost.linger, _nullishCoalesce(init.speed, () => ( 120)), _nullishCoalesce(brush.ghost.trigger, () => ( "immediate")));
3743
3746
  }
3744
3747
  this.lightBase = wet.tool === "paint" ? STROKE_LIGHT * brush.light.amount * (1 - 0.6 * thin) * perDab : 0;
3745
3748
  const rates = _chunkNIBFKXMDcjs.exchangeRates.call(void 0, brush.behavior.pickup, brush.behavior.mix, wet.load, brush.behavior.mixing);
@@ -3904,8 +3907,11 @@ var WetStrokeDriver = (_class5 = class {
3904
3907
  const field = new Float32Array(ec.length * 3);
3905
3908
  effectDabField(effect, rect, ec, this.centre, this.paint, field, COVERAGE_STEPS, d);
3906
3909
  this.medium.deposit(rect, ec, Math.min(1, total) * k, this.paint, null, field);
3907
- } else if (total > 0 && flow > 0) this.medium.deposit(rect, cov, Math.min(1, total) * k * flow, this.paint, null);
3908
- else world.paint(laneId, rect, cov, this.medium.options.water * k, null);
3910
+ if (brush.iridescence && this.init.film) this.init.film.deposit(rect, ec, Math.min(1, total) * k, brush.iridescence, d.pressure);
3911
+ } else if (total > 0 && flow > 0) {
3912
+ this.medium.deposit(rect, cov, Math.min(1, total) * k * flow, this.paint, null);
3913
+ if (brush.iridescence && this.init.film) this.init.film.deposit(rect, cov, Math.min(1, total) * k * flow, brush.iridescence, d.pressure);
3914
+ } else world.paint(laneId, rect, cov, this.medium.options.water * k, null);
3909
3915
  ex.drain();
3910
3916
  if (wet.rewet > 0) world.rewet(laneId, rect, cov, wet.rewet * k * 0.15, this.init.paperColor);
3911
3917
  break;
@@ -3932,6 +3938,7 @@ var WetStrokeDriver = (_class5 = class {
3932
3938
  }
3933
3939
  case "blot":
3934
3940
  world.remove(laneId, rect, cov, wet.strength * 0.8 * k, wet.strength * 0.6 * k, wet.strength * 0.15 * k, wet.strength * 0.5 * k);
3941
+ _optionalChain([this, 'access', _83 => _83.init, 'access', _84 => _84.film, 'optionalAccess', _85 => _85.erase, 'call', _86 => _86(rect, cov, wet.strength * 0.6 * k)]);
3935
3942
  break;
3936
3943
  }
3937
3944
  st.last = d;
@@ -3957,7 +3964,7 @@ var PaintWetLayers = (_class6 = class {
3957
3964
 
3958
3965
 
3959
3966
  __init41() {this.world = null}
3960
- __init42() {this.tilt = { ..._chunkN5IMDAHMcjs.FLAT }}
3967
+ __init42() {this.tilt = { ..._chunkDHC4E2DUcjs.FLAT }}
3961
3968
  __init43() {this.settings = /* @__PURE__ */ new Map()}
3962
3969
  __init44() {this.paused = false}
3963
3970
  /** Wet strokes dry as soon as they end (one undo step with the stroke). */
@@ -3981,8 +3988,8 @@ var PaintWetLayers = (_class6 = class {
3981
3988
  /** Starts the GPU engine for the world (once; it may turn out unavailable). */
3982
3989
  startGpu() {
3983
3990
  if (this.gpuMode === "off" || this.gpu || this.gpuStarting || this.gpuSupport) return;
3984
- const provider = this.options.gpuProvider === void 0 ? _chunkN5IMDAHMcjs.findWebGpu.call(void 0, ) : this.options.gpuProvider;
3985
- this.gpuStarting = _chunkN5IMDAHMcjs.createWetGpuEngine.call(void 0, provider).then(({ engine, support }) => {
3991
+ const provider = this.options.gpuProvider === void 0 ? _chunkDHC4E2DUcjs.findWebGpu.call(void 0, ) : this.options.gpuProvider;
3992
+ this.gpuStarting = _chunkDHC4E2DUcjs.createWetGpuEngine.call(void 0, provider).then(({ engine, support }) => {
3986
3993
  this.gpuSupport = support;
3987
3994
  if (!engine) return;
3988
3995
  if (this.gpuMode === "off" || !this.world) {
@@ -4012,8 +4019,8 @@ var PaintWetLayers = (_class6 = class {
4012
4019
  if (mode === this.gpuMode) return this.engineInfo();
4013
4020
  this.gpuMode = mode;
4014
4021
  if (mode === "off") {
4015
- _optionalChain([this, 'access', _83 => _83.world, 'optionalAccess', _84 => _84.attachGpu, 'call', _85 => _85(null)]);
4016
- _optionalChain([this, 'access', _86 => _86.gpu, 'optionalAccess', _87 => _87.destroy, 'call', _88 => _88()]);
4022
+ _optionalChain([this, 'access', _87 => _87.world, 'optionalAccess', _88 => _88.attachGpu, 'call', _89 => _89(null)]);
4023
+ _optionalChain([this, 'access', _90 => _90.gpu, 'optionalAccess', _91 => _91.destroy, 'call', _92 => _92()]);
4017
4024
  this.gpu = null;
4018
4025
  this.gpuSupport = null;
4019
4026
  } else if (this.world) this.startGpu();
@@ -4021,13 +4028,13 @@ var PaintWetLayers = (_class6 = class {
4021
4028
  }
4022
4029
  engineInfo() {
4023
4030
  const w = this.world;
4024
- const base = { mode: this.gpuMode, adapter: _nullishCoalesce(_optionalChain([this, 'access', _89 => _89.gpuSupport, 'optionalAccess', _90 => _90.adapter]), () => ( null)), maxTiles: _nullishCoalesce(_optionalChain([this, 'access', _91 => _91.gpuSupport, 'optionalAccess', _92 => _92.maxSlots]), () => ( 0)), minTiles: this.gpuMinTiles, activeTiles: _nullishCoalesce(_optionalChain([w, 'optionalAccess', _93 => _93.activeTiles, 'call', _94 => _94()]), () => ( 0)), cpu: this.backend() };
4031
+ const base = { mode: this.gpuMode, adapter: _nullishCoalesce(_optionalChain([this, 'access', _93 => _93.gpuSupport, 'optionalAccess', _94 => _94.adapter]), () => ( null)), maxTiles: _nullishCoalesce(_optionalChain([this, 'access', _95 => _95.gpuSupport, 'optionalAccess', _96 => _96.maxSlots]), () => ( 0)), minTiles: this.gpuMinTiles, activeTiles: _nullishCoalesce(_optionalChain([w, 'optionalAccess', _97 => _97.activeTiles, 'call', _98 => _98()]), () => ( 0)), cpu: this.backend() };
4025
4032
  if (this.gpuMode === "off") return { ...base, state: "off", reason: "Forced to the CPU." };
4026
4033
  if (this.gpuStarting) return { ...base, state: "starting", reason: null };
4027
- if (_optionalChain([w, 'optionalAccess', _95 => _95.gpuError])) return { ...base, state: "failed", reason: w.gpuError };
4034
+ if (_optionalChain([w, 'optionalAccess', _99 => _99.gpuError])) return { ...base, state: "failed", reason: w.gpuError };
4028
4035
  if (this.gpuSupport && !this.gpuSupport.supported) return { ...base, state: "unavailable", reason: this.gpuSupport.reason };
4029
4036
  if (!this.gpu) return { ...base, state: "not-started", reason: "Starts with the first wet stroke." };
4030
- if (_optionalChain([w, 'optionalAccess', _96 => _96.gpuActive])) return { ...base, state: "active", reason: null };
4037
+ if (_optionalChain([w, 'optionalAccess', _100 => _100.gpuActive])) return { ...base, state: "active", reason: null };
4031
4038
  return { ...base, state: "standby", reason: `The GPU takes over at ${this.gpuMinTiles} wet tiles (256 px).` };
4032
4039
  }
4033
4040
  /** The world (made on first use, at the canvas size). */
@@ -4041,7 +4048,7 @@ var PaintWetLayers = (_class6 = class {
4041
4048
  return this.world;
4042
4049
  }
4043
4050
  makeWorld(width, height, paper) {
4044
- const world = new (0, _chunkN5IMDAHMcjs.WetWorld)(width, height, wetPaperInput(paper), { kernel: this.options.kernel, threads: this.options.threads });
4051
+ const world = new (0, _chunkDHC4E2DUcjs.WetWorld)(width, height, wetPaperInput(paper), { kernel: this.options.kernel, threads: this.options.threads });
4045
4052
  world.setTilt(this.tilt);
4046
4053
  world.gpuMinTiles = this.gpuMinTiles;
4047
4054
  if (this.gpu) world.attachGpu(this.gpu);
@@ -4053,7 +4060,7 @@ var PaintWetLayers = (_class6 = class {
4053
4060
  * sides: the shift has to be whole wet tiles (256 px), and no wet stroke may be live.
4054
4061
  */
4055
4062
  canExtend(left2, top) {
4056
- return left2 % _chunkN5IMDAHMcjs.WET_TILE === 0 && top % _chunkN5IMDAHMcjs.WET_TILE === 0 && !this.driver;
4063
+ return left2 % _chunkDHC4E2DUcjs.WET_TILE === 0 && top % _chunkDHC4E2DUcjs.WET_TILE === 0 && !this.driver;
4057
4064
  }
4058
4065
  /**
4059
4066
  * Keeps the wet paint while the canvas grows to `width`×`height` by `left` / `top` on those
@@ -4066,17 +4073,17 @@ var PaintWetLayers = (_class6 = class {
4066
4073
  if (!this.canExtend(left2, top)) throw new Error("Wet paint only moves by whole 256 px tiles, between strokes.");
4067
4074
  for (const [id, s] of this.settings) if (s.flow.center) this.settings.set(id, { ...s, flow: { ...s.flow, center: { x: s.flow.center.x + left2, y: s.flow.center.y + top } } });
4068
4075
  const old = this.world;
4069
- const snap = _optionalChain([old, 'optionalAccess', _97 => _97.laneIds, 'call', _98 => _98(), 'access', _99 => _99.length]) ? old.snapshot() : null;
4076
+ const snap = _optionalChain([old, 'optionalAccess', _101 => _101.laneIds, 'call', _102 => _102(), 'access', _103 => _103.length]) ? old.snapshot() : null;
4070
4077
  this.dropWorld();
4071
4078
  this.lastTick = null;
4072
4079
  this.stepsOwed = 0;
4073
4080
  if (!old || !snap) return;
4074
- const moved = _chunkN5IMDAHMcjs.moveWetSnapshot.call(void 0, snap, old, { width, height }, left2, top, (l) => {
4075
- const flow = _optionalChain([this, 'access', _100 => _100.settings, 'access', _101 => _101.get, 'call', _102 => _102(l.id), 'optionalAccess', _103 => _103.flow]);
4081
+ const moved = _chunkDHC4E2DUcjs.moveWetSnapshot.call(void 0, snap, old, { width, height }, left2, top, (l) => {
4082
+ const flow = _optionalChain([this, 'access', _104 => _104.settings, 'access', _105 => _105.get, 'call', _106 => _106(l.id), 'optionalAccess', _107 => _107.flow]);
4076
4083
  return {
4077
4084
  base: _chunk474IQG74cjs.translateSurface.call(void 0, l.base, left2, top),
4078
4085
  ...l.light ? { light: _chunk474IQG74cjs.translateSurface.call(void 0, l.light, left2, top) } : {},
4079
- flow: l.flow && flow && flow.kind !== "none" ? _chunkN5IMDAHMcjs.flowField.call(void 0, flow, width, height) : l.flow
4086
+ flow: l.flow && flow && flow.kind !== "none" ? _chunkDHC4E2DUcjs.flowField.call(void 0, flow, width, height) : l.flow
4080
4087
  };
4081
4088
  });
4082
4089
  this.world = this.makeWorld(width, height, paper);
@@ -4091,11 +4098,11 @@ var PaintWetLayers = (_class6 = class {
4091
4098
  }
4092
4099
  /** Layers holding a wet layer (wet or drying). */
4093
4100
  wetLayerIds() {
4094
- return _nullishCoalesce(_optionalChain([this, 'access', _104 => _104.world, 'optionalAccess', _105 => _105.laneIds, 'call', _106 => _106()]), () => ( []));
4101
+ return _nullishCoalesce(_optionalChain([this, 'access', _108 => _108.world, 'optionalAccess', _109 => _109.laneIds, 'call', _110 => _110()]), () => ( []));
4095
4102
  }
4096
4103
  /** Whether a batch is running (edits wait). */
4097
4104
  get busy() {
4098
- return Boolean(_optionalChain([this, 'access', _107 => _107.world, 'optionalAccess', _108 => _108.busy]));
4105
+ return Boolean(_optionalChain([this, 'access', _111 => _111.world, 'optionalAccess', _112 => _112.busy]));
4099
4106
  }
4100
4107
  /** Resolves when no batch is running. */
4101
4108
  async idle() {
@@ -4104,7 +4111,7 @@ var PaintWetLayers = (_class6 = class {
4104
4111
  settingsOf(layerId, medium = "watercolor") {
4105
4112
  let s = this.settings.get(layerId);
4106
4113
  if (!s) {
4107
- s = { params: _chunkN5IMDAHMcjs.normalizeWetParams.call(void 0, WET_MEDIUM_PARAMS[medium], _chunkN5IMDAHMcjs.DEFAULT_WET_PARAMS), flow: { ..._chunkN5IMDAHMcjs.DEFAULT_FLOW } };
4114
+ s = { params: _chunkDHC4E2DUcjs.normalizeWetParams.call(void 0, WET_MEDIUM_PARAMS[medium], _chunkDHC4E2DUcjs.DEFAULT_WET_PARAMS), flow: { ..._chunkDHC4E2DUcjs.DEFAULT_FLOW } };
4108
4115
  this.settings.set(layerId, s);
4109
4116
  }
4110
4117
  return s;
@@ -4117,52 +4124,52 @@ var PaintWetLayers = (_class6 = class {
4117
4124
  const s = this.settingsOf(layerId, medium);
4118
4125
  w.ensureLane(layerId, { params: s.params, base, light: this.host.layerLight(layerId), ghost: s.ghost });
4119
4126
  const { width, height } = this.host.canvas();
4120
- if (s.flow.kind !== "none") w.setFlow(layerId, _chunkN5IMDAHMcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
4127
+ if (s.flow.kind !== "none") w.setFlow(layerId, _chunkDHC4E2DUcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
4121
4128
  }
4122
4129
  return w;
4123
4130
  }
4124
4131
  setParams(layerId, update) {
4125
4132
  const s = this.settingsOf(layerId);
4126
- s.params = _chunkN5IMDAHMcjs.normalizeWetParams.call(void 0, update, s.params);
4127
- if (_optionalChain([this, 'access', _109 => _109.world, 'optionalAccess', _110 => _110.hasLane, 'call', _111 => _111(layerId)])) this.world.setParams(layerId, s.params);
4133
+ s.params = _chunkDHC4E2DUcjs.normalizeWetParams.call(void 0, update, s.params);
4134
+ if (_optionalChain([this, 'access', _113 => _113.world, 'optionalAccess', _114 => _114.hasLane, 'call', _115 => _115(layerId)])) this.world.setParams(layerId, s.params);
4128
4135
  return { ...s.params };
4129
4136
  }
4130
4137
  setFlow(layerId, update) {
4131
4138
  const s = this.settingsOf(layerId);
4132
- s.flow = _chunkN5IMDAHMcjs.normalizeFlow.call(void 0, update, s.flow);
4133
- if (_optionalChain([this, 'access', _112 => _112.world, 'optionalAccess', _113 => _113.hasLane, 'call', _114 => _114(layerId)])) {
4139
+ s.flow = _chunkDHC4E2DUcjs.normalizeFlow.call(void 0, update, s.flow);
4140
+ if (_optionalChain([this, 'access', _116 => _116.world, 'optionalAccess', _117 => _117.hasLane, 'call', _118 => _118(layerId)])) {
4134
4141
  const { width, height } = this.host.canvas();
4135
- this.world.setFlow(layerId, _chunkN5IMDAHMcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
4142
+ this.world.setFlow(layerId, _chunkDHC4E2DUcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
4136
4143
  }
4137
4144
  return { ...s.flow };
4138
4145
  }
4139
4146
  setTilt(update) {
4140
- this.tilt = _chunkN5IMDAHMcjs.normalizeTilt.call(void 0, update, this.tilt);
4141
- _optionalChain([this, 'access', _115 => _115.world, 'optionalAccess', _116 => _116.setTilt, 'call', _117 => _117(this.tilt)]);
4147
+ this.tilt = _chunkDHC4E2DUcjs.normalizeTilt.call(void 0, update, this.tilt);
4148
+ _optionalChain([this, 'access', _119 => _119.world, 'optionalAccess', _120 => _120.setTilt, 'call', _121 => _121(this.tilt)]);
4142
4149
  return { ...this.tilt };
4143
4150
  }
4144
4151
  /** The paper changed. */
4145
4152
  paperChanged() {
4146
- _optionalChain([this, 'access', _118 => _118.world, 'optionalAccess', _119 => _119.setPaper, 'call', _120 => _120(wetPaperInput(this.host.paper()))]);
4153
+ _optionalChain([this, 'access', _122 => _122.world, 'optionalAccess', _123 => _123.setPaper, 'call', _124 => _124(wetPaperInput(this.host.paper()))]);
4147
4154
  }
4148
4155
  /** A layer as tools describe it. */
4149
4156
  info(layerId) {
4150
4157
  const s = this.settingsOf(layerId);
4151
- const st = _optionalChain([this, 'access', _121 => _121.world, 'optionalAccess', _122 => _122.hasLane, 'call', _123 => _123(layerId)]) ? this.world.stats(layerId) : null;
4152
- const g = _optionalChain([this, 'access', _124 => _124.world, 'optionalAccess', _125 => _125.hasLane, 'call', _126 => _126(layerId)]) ? this.world.getGhost(layerId) : _nullishCoalesce(s.ghost, () => ( null));
4158
+ const st = _optionalChain([this, 'access', _125 => _125.world, 'optionalAccess', _126 => _126.hasLane, 'call', _127 => _127(layerId)]) ? this.world.stats(layerId) : null;
4159
+ const g = _optionalChain([this, 'access', _128 => _128.world, 'optionalAccess', _129 => _129.hasLane, 'call', _130 => _130(layerId)]) ? this.world.getGhost(layerId) : _nullishCoalesce(s.ghost, () => ( null));
4153
4160
  return {
4154
4161
  layerId,
4155
4162
  wet: Boolean(st && st.wetCells > 0),
4156
- wetCells: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _127 => _127.wetCells]), () => ( 0)),
4157
- wetBounds: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _128 => _128.wetBounds]), () => ( null)),
4158
- activeTiles: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _129 => _129.activeTiles]), () => ( 0)),
4163
+ wetCells: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _131 => _131.wetCells]), () => ( 0)),
4164
+ wetBounds: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _132 => _132.wetBounds]), () => ( null)),
4165
+ activeTiles: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _133 => _133.activeTiles]), () => ( 0)),
4159
4166
  params: { ...s.params },
4160
4167
  flow: { ...s.flow },
4161
- ...g ? { ghost: { remaining: Math.round(g.remaining * _chunkN5IMDAHMcjs.FREE_INTERVAL / this.speed * 100) / 100 } } : {}
4168
+ ...g ? { ghost: { remaining: Math.round(g.remaining * _chunkDHC4E2DUcjs.FREE_INTERVAL / this.speed * 100) / 100 } } : {}
4162
4169
  };
4163
4170
  }
4164
4171
  backend() {
4165
- return _nullishCoalesce(_optionalChain([this, 'access', _130 => _130.world, 'optionalAccess', _131 => _131.backend, 'call', _132 => _132()]), () => ( null));
4172
+ return _nullishCoalesce(_optionalChain([this, 'access', _134 => _134.world, 'optionalAccess', _135 => _135.backend, 'call', _136 => _136()]), () => ( null));
4166
4173
  }
4167
4174
  /** Shows the current wet pixels (at most `maxTiles` reshaded per layer). */
4168
4175
  syncDisplays(maxTiles = Infinity) {
@@ -4211,12 +4218,12 @@ var PaintWetLayers = (_class6 = class {
4211
4218
  const w = this.world;
4212
4219
  if (!w) return;
4213
4220
  for (const id of w.laneIds()) {
4214
- if (w.isActive(id) || _optionalChain([this, 'access', _133 => _133.driver, 'optionalAccess', _134 => _134.init, 'access', _135 => _135.laneId]) === id) continue;
4221
+ if (w.isActive(id) || _optionalChain([this, 'access', _137 => _137.driver, 'optionalAccess', _138 => _138.init, 'access', _139 => _139.laneId]) === id) continue;
4215
4222
  const base = w.getBase(id);
4216
4223
  const light = w.isLit(id) ? w.getLight(id) : null;
4217
4224
  w.removeLane(id);
4218
4225
  const s = this.settings.get(id);
4219
- if (_optionalChain([s, 'optionalAccess', _136 => _136.ghost])) delete s.ghost;
4226
+ if (_optionalChain([s, 'optionalAccess', _140 => _140.ghost])) delete s.ghost;
4220
4227
  if (light && this.host.layerLight(id) !== light) this.host.updateLights(/* @__PURE__ */ new Map([[id, light]]));
4221
4228
  this.host.updateSurfaces(/* @__PURE__ */ new Map([[id, base]]), []);
4222
4229
  }
@@ -4295,7 +4302,7 @@ var PaintWetLayers = (_class6 = class {
4295
4302
  if (!d || !this.world) return;
4296
4303
  const rects = d.flush();
4297
4304
  if (rects.length) this.syncDisplays(DISPLAY_TILES_PER_TICK);
4298
- if (d.done) _optionalChain([this, 'access', _137 => _137.onDriverDone, 'optionalCall', _138 => _138(d)]);
4305
+ if (d.done) _optionalChain([this, 'access', _141 => _141.onDriverDone, 'optionalCall', _142 => _142(d)]);
4299
4306
  }
4300
4307
  /** Called when a live stroke that ended mid-batch has finished applying. */
4301
4308
  __init56() {this.onDriverDone = null}
@@ -4336,16 +4343,34 @@ var PaintWetLayers = (_class6 = class {
4336
4343
  this.retireDry();
4337
4344
  return out;
4338
4345
  }
4346
+ /** Starts the fade countdown of an agent-triggered ghost on `layerId`. */
4347
+ releaseGhost(layerId, linger) {
4348
+ const w = this.world;
4349
+ if (_optionalChain([w, 'optionalAccess', _143 => _143.hasLane, 'call', _144 => _144(layerId)])) w.releaseGhost(layerId, linger, this.speed);
4350
+ const s = this.settings.get(layerId);
4351
+ if (_optionalChain([s, 'optionalAccess', _145 => _145.ghost, 'optionalAccess', _146 => _146.trigger]) === "agent") {
4352
+ const sec = linger !== void 0 ? Math.max(0.5, Math.min(60, linger)) : s.ghost.linger;
4353
+ const total = Math.max(1, Math.round(sec * this.speed / _chunkDHC4E2DUcjs.FREE_INTERVAL));
4354
+ s.ghost = { ...s.ghost, linger: sec, total, remaining: total, trigger: void 0 };
4355
+ }
4356
+ }
4357
+ /** Keeps an unclaimed agent-triggered ghost on `layerId` as ordinary wet paint. */
4358
+ keepGhost(layerId) {
4359
+ const w = this.world;
4360
+ if (_optionalChain([w, 'optionalAccess', _147 => _147.hasLane, 'call', _148 => _148(layerId)])) w.keepGhost(layerId);
4361
+ const s = this.settings.get(layerId);
4362
+ if (_optionalChain([s, 'optionalAccess', _149 => _149.ghost])) delete s.ghost;
4363
+ }
4339
4364
  /** The layer's light paint with all its wet paint dried (`null` without a wet layer or light), without changing anything. */
4340
4365
  bakedLight(layerId) {
4341
4366
  const w = this.world;
4342
- if (!_optionalChain([w, 'optionalAccess', _139 => _139.hasLane, 'call', _140 => _140(layerId)]) || !w.isLit(layerId)) return null;
4367
+ if (!_optionalChain([w, 'optionalAccess', _150 => _150.hasLane, 'call', _151 => _151(layerId)]) || !w.isLit(layerId)) return null;
4343
4368
  return w.bakedLight(layerId);
4344
4369
  }
4345
4370
  /** The layer's pixels with all its wet paint dried (deterministic), without changing anything. */
4346
4371
  bakedSurface(layerId) {
4347
4372
  const w = this.world;
4348
- if (!_optionalChain([w, 'optionalAccess', _141 => _141.hasLane, 'call', _142 => _142(layerId)])) return null;
4373
+ if (!_optionalChain([w, 'optionalAccess', _152 => _152.hasLane, 'call', _153 => _153(layerId)])) return null;
4349
4374
  return w.bakedSurface(layerId);
4350
4375
  }
4351
4376
  /** A snapshot of the world for undo (`null` when there is none). */
@@ -4366,13 +4391,13 @@ var PaintWetLayers = (_class6 = class {
4366
4391
  this.syncDisplays();
4367
4392
  }
4368
4393
  dropWorld() {
4369
- _optionalChain([this, 'access', _143 => _143.world, 'optionalAccess', _144 => _144.destroy, 'call', _145 => _145()]);
4394
+ _optionalChain([this, 'access', _154 => _154.world, 'optionalAccess', _155 => _155.destroy, 'call', _156 => _156()]);
4370
4395
  this.world = null;
4371
4396
  this.driver = null;
4372
4397
  }
4373
4398
  /** Forgets everything wet (a new canvas, a resize, opening a document). */
4374
4399
  reset() {
4375
- _optionalChain([this, 'access', _146 => _146.world, 'optionalAccess', _147 => _147.destroy, 'call', _148 => _148()]);
4400
+ _optionalChain([this, 'access', _157 => _157.world, 'optionalAccess', _158 => _158.destroy, 'call', _159 => _159()]);
4376
4401
  this.world = null;
4377
4402
  this.driver = null;
4378
4403
  this.settings.clear();
@@ -4402,15 +4427,15 @@ var PaintWetLayers = (_class6 = class {
4402
4427
  return out;
4403
4428
  }
4404
4429
  destroy() {
4405
- _optionalChain([this, 'access', _149 => _149.world, 'optionalAccess', _150 => _150.destroy, 'call', _151 => _151()]);
4430
+ _optionalChain([this, 'access', _160 => _160.world, 'optionalAccess', _161 => _161.destroy, 'call', _162 => _162()]);
4406
4431
  this.world = null;
4407
- _optionalChain([this, 'access', _152 => _152.gpu, 'optionalAccess', _153 => _153.destroy, 'call', _154 => _154()]);
4432
+ _optionalChain([this, 'access', _163 => _163.gpu, 'optionalAccess', _164 => _164.destroy, 'call', _165 => _165()]);
4408
4433
  this.gpu = null;
4409
4434
  }
4410
4435
  }, _class6);
4411
4436
  function wetPigmentOf(hex, body) {
4412
4437
  const [r, g, b] = hexToRgb8(hex);
4413
- return Array.from(_chunkN5IMDAHMcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], body));
4438
+ return Array.from(_chunkDHC4E2DUcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], body));
4414
4439
  }
4415
4440
 
4416
4441
  // src/vector/brushstrokeMedia.ts
@@ -4446,8 +4471,8 @@ function place(input, brush, options, pad = 0) {
4446
4471
  const [r, g, b, a] = options.color;
4447
4472
  const hex = "#" + [r, g, b].map((v2) => Math.round(Math.min(255, Math.max(0, v2))).toString(16).padStart(2, "0")).join("");
4448
4473
  const source = _nullishCoalesce(options.paint, () => ( null));
4449
- const paint = _optionalChain([source, 'optionalAccess', _155 => _155.type]) === "gradient" ? _chunkNIBFKXMDcjs.resolvePaintGradient.call(void 0, _chunkNIBFKXMDcjs.scalePaintGradient.call(void 0, source, scale3), { paint: hex, secondary: "#ffffff" }) : null;
4450
- const color2 = _optionalChain([source, 'optionalAccess', _156 => _156.type]) === "color" ? hexRgb(source.color) : [r / 255, g / 255, b / 255];
4474
+ const paint = _optionalChain([source, 'optionalAccess', _166 => _166.type]) === "gradient" ? _chunkNIBFKXMDcjs.resolvePaintGradient.call(void 0, _chunkNIBFKXMDcjs.scalePaintGradient.call(void 0, source, scale3), { paint: hex, secondary: "#ffffff" }) : null;
4475
+ const color2 = _optionalChain([source, 'optionalAccess', _167 => _167.type]) === "color" ? hexRgb(source.color) : [r / 255, g / 255, b / 255];
4451
4476
  return { points, brush: sized, rect, scale: scale3, color: color2, alpha: Math.min(1, Math.max(0, a / 255)), paint };
4452
4477
  }
4453
4478
  function hexRgb(hex) {
@@ -4498,7 +4523,7 @@ var WetBrushstrokeJob = (_class7 = class {
4498
4523
  return;
4499
4524
  }
4500
4525
  const { rect, points } = this.placed;
4501
- this.world = new (0, _chunkN5IMDAHMcjs.WetWorld)(rect.width, rect.height, wetPaperInput(DEFAULT_PAPER), { kernel: "typescript", threads: 0 });
4526
+ this.world = new (0, _chunkDHC4E2DUcjs.WetWorld)(rect.width, rect.height, wetPaperInput(DEFAULT_PAPER), { kernel: "typescript", threads: 0 });
4502
4527
  const medium = _nullishCoalesce(this.placed.brush.wet.medium, () => ( "watercolor"));
4503
4528
  this.world.ensureLane("s", { params: _nullishCoalesce(WET_MEDIUM_PARAMS[medium], () => ( {})) });
4504
4529
  const color2 = this.placed.color;
@@ -4557,7 +4582,7 @@ var WetBrushstrokeJob = (_class7 = class {
4557
4582
  return this.final;
4558
4583
  }
4559
4584
  destroy() {
4560
- _optionalChain([this, 'access', _157 => _157.world, 'optionalAccess', _158 => _158.destroy, 'call', _159 => _159()]);
4585
+ _optionalChain([this, 'access', _168 => _168.world, 'optionalAccess', _169 => _169.destroy, 'call', _170 => _170()]);
4561
4586
  }
4562
4587
  bake() {
4563
4588
  if (!this.world || !this.placed) return EMPTY;
@@ -4582,8 +4607,8 @@ function renderBackdropBrushstroke(input, brush, options) {
4582
4607
  const area = { x: 0, y: 0, width: rect.width, height: rect.height };
4583
4608
  const before = options.backdrop ? options.backdrop(rect, placed.scale) : new Uint8ClampedArray(rect.width * rect.height * 4);
4584
4609
  if (before.length !== rect.width * rect.height * 4) throw new Error(`The backdrop must be ${rect.width}\xD7${rect.height} RGBA pixels.`);
4585
- const cached = _optionalChain([options, 'access', _160 => _160.cache, 'optionalCall', _161 => _161(before)]);
4586
- const hit = _optionalChain([cached, 'optionalAccess', _162 => _162.get, 'call', _163 => _163()]);
4610
+ const cached = _optionalChain([options, 'access', _171 => _171.cache, 'optionalCall', _172 => _172(before)]);
4611
+ const hit = _optionalChain([cached, 'optionalAccess', _173 => _173.get, 'call', _174 => _174()]);
4587
4612
  if (hit) return hit;
4588
4613
  const base = _chunk474IQG74cjs.writeRegion.call(void 0, _chunk474IQG74cjs.emptySurface.call(void 0, 4), area, before);
4589
4614
  const live = /* @__PURE__ */ new Map();
@@ -4591,7 +4616,7 @@ function renderBackdropBrushstroke(input, brush, options) {
4591
4616
  offset: { x: 0, y: 0 },
4592
4617
  lockTransparency: false,
4593
4618
  selection: null,
4594
- readTile: (tx, ty) => _nullishCoalesce(_nullishCoalesce(live.get(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)), () => ( _optionalChain([base, 'access', _164 => _164.tiles, 'access', _165 => _165.get, 'call', _166 => _166(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _167 => _167.data]))), () => ( null)),
4619
+ readTile: (tx, ty) => _nullishCoalesce(_nullishCoalesce(live.get(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)), () => ( _optionalChain([base, 'access', _175 => _175.tiles, 'access', _176 => _176.get, 'call', _177 => _177(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _178 => _178.data]))), () => ( null)),
4595
4620
  writeTile: (tx, ty) => {
4596
4621
  const key = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
4597
4622
  let t = live.get(key);
@@ -4609,17 +4634,17 @@ function renderBackdropBrushstroke(input, brush, options) {
4609
4634
  for (const [key, data] of live) tiles.set(key, { data, uniform: null });
4610
4635
  _chunk474IQG74cjs.readRegion.call(void 0, new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles), area, after);
4611
4636
  const result = cropped(after, placed, stroke.dabCount, (i) => after[i] !== before[i] || after[i + 1] !== before[i + 1] || after[i + 2] !== before[i + 2] || after[i + 3] !== before[i + 3]);
4612
- _optionalChain([cached, 'optionalAccess', _168 => _168.set, 'call', _169 => _169(result)]);
4637
+ _optionalChain([cached, 'optionalAccess', _179 => _179.set, 'call', _180 => _180(result)]);
4613
4638
  return result;
4614
4639
  }
4615
4640
 
4616
4641
  // src/vector/brushstroke.ts
4617
4642
  var VECTOR_BRUSHSTROKE_SCALE = 2;
4618
- var PRESETS = _chunkGHGBIAWQcjs.listPresets.call(void 0, _chunkGHGBIAWQcjs.VECTOR_PROFILE).map((spec) => _chunkGHGBIAWQcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id));
4643
+ var PRESETS = _chunk6QNDGMK7cjs.listPresets.call(void 0, _chunk6QNDGMK7cjs.VECTOR_PROFILE).map((spec) => _chunk6QNDGMK7cjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id));
4619
4644
  function admitted(spec) {
4620
4645
  try {
4621
- const brush = _chunkGHGBIAWQcjs.normalizeBrushSpec.call(void 0, spec);
4622
- return _chunkGHGBIAWQcjs.checkBrush.call(void 0, brush, _chunkGHGBIAWQcjs.VECTOR_PROFILE).ok && isVectorBrushstrokeEngine(_chunkGHGBIAWQcjs.resolveBrush.call(void 0, brush)) ? brush : null;
4646
+ const brush = _chunk6QNDGMK7cjs.normalizeBrushSpec.call(void 0, spec);
4647
+ return _chunk6QNDGMK7cjs.checkBrush.call(void 0, brush, _chunk6QNDGMK7cjs.VECTOR_PROFILE).ok && isVectorBrushstrokeEngine(_chunk6QNDGMK7cjs.resolveBrush.call(void 0, brush)) ? brush : null;
4623
4648
  } catch (e6) {
4624
4649
  return null;
4625
4650
  }
@@ -4631,7 +4656,7 @@ function vectorBrushstrokeBrushes(user = []) {
4631
4656
  const out = [...PRESETS];
4632
4657
  for (const raw of user) {
4633
4658
  const brush = admitted(raw);
4634
- if (brush && !out.some((b) => b.id === brush.id)) out.push(_chunkGHGBIAWQcjs.resolveBrush.call(void 0, brush));
4659
+ if (brush && !out.some((b) => b.id === brush.id)) out.push(_chunk6QNDGMK7cjs.resolveBrush.call(void 0, brush));
4635
4660
  }
4636
4661
  return out;
4637
4662
  }
@@ -4641,7 +4666,7 @@ function vectorBrushstrokeBrush(id) {
4641
4666
  function vectorBrushstrokeBrushOf(brush) {
4642
4667
  if (brush.spec) {
4643
4668
  const saved = admitted(brush.spec);
4644
- return saved && saved.id === brush.brushId ? _chunkGHGBIAWQcjs.resolveBrush.call(void 0, saved) : null;
4669
+ return saved && saved.id === brush.brushId ? _chunk6QNDGMK7cjs.resolveBrush.call(void 0, saved) : null;
4645
4670
  }
4646
4671
  return vectorBrushstrokeBrush(brush.brushId);
4647
4672
  }
@@ -4649,15 +4674,15 @@ function vectorBrushstrokeBrushError(id, user = []) {
4649
4674
  if (vectorBrushstrokeBrush(id)) return null;
4650
4675
  const saved = user.find((b) => b.id === id);
4651
4676
  const ids = vectorBrushstrokeBrushes(user).map((b) => b.id);
4652
- const reasons = (b) => _chunkGHGBIAWQcjs.checkBrush.call(void 0, b, _chunkGHGBIAWQcjs.VECTOR_PROFILE).issues.filter((i) => i.severity === "error").map((i) => `${i.reason} ${i.fix}`).join(" ") || "its engine does not paint brushstrokes.";
4677
+ const reasons = (b) => _chunk6QNDGMK7cjs.checkBrush.call(void 0, b, _chunk6QNDGMK7cjs.VECTOR_PROFILE).issues.filter((i) => i.severity === "error").map((i) => `${i.reason} ${i.fix}`).join(" ") || "its engine does not paint brushstrokes.";
4653
4678
  if (saved) return admitted(saved) ? null : `Brush "${id}" (${saved.name}) can't paint a brushstroke: ${reasons(saved)} Use one of: ${ids.join(", ")}.`;
4654
- const preset2 = _chunkGHGBIAWQcjs.BRUSH_PRESETS.find((b) => b.id === id);
4679
+ const preset2 = _chunk6QNDGMK7cjs.BRUSH_PRESETS.find((b) => b.id === id);
4655
4680
  if (preset2) return `Brush "${id}" (${preset2.name}) can't paint a brushstroke: ${reasons(preset2)} Use one of: ${ids.join(", ")}.`;
4656
- return `Unknown brush "${id}". ${_chunkGHGBIAWQcjs.closest.call(void 0, id, ids)}Use one of: ${ids.join(", ")} (vector.listBrushes lists them).`;
4681
+ return `Unknown brush "${id}". ${_chunk6QNDGMK7cjs.closest.call(void 0, id, ids)}Use one of: ${ids.join(", ")} (vector.listBrushes lists them).`;
4657
4682
  }
4658
4683
  function vectorBrushstrokeDefaultColour(id, user = [], scheme = "light") {
4659
- const brush = _nullishCoalesce(_chunkGHGBIAWQcjs.BRUSH_PRESETS.find((b) => b.id === id), () => ( user.find((b) => b.id === id)));
4660
- return brush ? _chunkJBZRVLXVcjs.brushColourHex.call(void 0, _optionalChain([brush, 'access', _170 => _170.colour, 'optionalAccess', _171 => _171.default]), scheme) : null;
4684
+ const brush = _nullishCoalesce(_chunk6QNDGMK7cjs.BRUSH_PRESETS.find((b) => b.id === id), () => ( user.find((b) => b.id === id)));
4685
+ return brush ? _chunkJBZRVLXVcjs.brushColourHex.call(void 0, _optionalChain([brush, 'access', _181 => _181.colour, 'optionalAccess', _182 => _182.default]), scheme) : null;
4661
4686
  }
4662
4687
  function sanitizeVectorBrushstroke(value, user = []) {
4663
4688
  if (!value || typeof value !== "object") return null;
@@ -4781,7 +4806,7 @@ function strokePaintOf(node, layer, brush, length2) {
4781
4806
  const color2 = [c[0] * 255, c[1] * 255, c[2] * 255, c[3] * 255].map(Math.round);
4782
4807
  if (layer.brush.paint) return { color: color2, paint: layer.brush.paint, within: null };
4783
4808
  const g = layer.paint;
4784
- if (isVectorGradient(g) && _optionalChain([g, 'access', _172 => _172.stops, 'optionalAccess', _173 => _173.length])) {
4809
+ if (isVectorGradient(g) && _optionalChain([g, 'access', _183 => _183.stops, 'optionalAccess', _184 => _184.length])) {
4785
4810
  const mode = _nullishCoalesce(g.strokeMode, () => ( "within"));
4786
4811
  if (mode === "along") return { color: [color2[0], color2[1], color2[2], 255], paint: gradientPaint(g, { by: "distance", length: Math.max(1, length2), repeat: REPEAT[_nullishCoalesce(g.spread, () => ( "pad"))], unit: "px" }), within: null };
4787
4812
  if (mode === "across") return { color: [color2[0], color2[1], color2[2], 255], paint: gradientPaint(g, { by: "across-tip" }), within: null };
@@ -4936,7 +4961,7 @@ function vectorBrushstrokeImages(node, layer, context = {}) {
4936
4961
  const source = usesVectorBackdrop(engine) && backdropSource ? backdropSource(document2, node, Math.max(0, index), settle) : null;
4937
4962
  const deps = source ? [...source.deps, wetGeneration] : null;
4938
4963
  let byLayer = layerCache.get(node);
4939
- const hit = _optionalChain([byLayer, 'optionalAccess', _174 => _174.get, 'call', _175 => _175(layer)]);
4964
+ const hit = _optionalChain([byLayer, 'optionalAccess', _185 => _185.get, 'call', _186 => _186(layer)]);
4940
4965
  const stale = hit && (hit.pending.length && hit.pending.some((k) => wetSettled.has(k)) || settle === "now" && !hit.settled);
4941
4966
  if (hit && sameDeps(hit.deps, deps) && !stale) return hit.images;
4942
4967
  const brush = layer.brush.size ? { ...preset2, tip: { ...preset2.tip, size: layer.brush.size } } : preset2;
@@ -4961,7 +4986,7 @@ function vectorBrushstrokeImages(node, layer, context = {}) {
4961
4986
  const key = mediaKey(input, brush, options);
4962
4987
  stroke = renderBackdropBrushstroke(input, brush, {
4963
4988
  ...options,
4964
- backdrop: _nullishCoalesce(_optionalChain([source, 'optionalAccess', _176 => _176.backdrop]), () => ( null)),
4989
+ backdrop: _nullishCoalesce(_optionalChain([source, 'optionalAccess', _187 => _187.backdrop]), () => ( null)),
4965
4990
  cache: (bytes) => {
4966
4991
  const k = `${key}:${hashBytes(bytes).toString(16)}`;
4967
4992
  return { get: () => backdropResults.get(k), set: (img) => backdropResults.set(k, img) };
@@ -5065,7 +5090,7 @@ function withVectorFills(node, fills) {
5065
5090
  const next = { ...node };
5066
5091
  if (fills.length === 0 || fills.length === 1 && isPlainVectorPaintLayer(fills[0])) {
5067
5092
  delete next.fills;
5068
- next.fill = _nullishCoalesce(_optionalChain([fills, 'access', _177 => _177[0], 'optionalAccess', _178 => _178.paint]), () => ( null));
5093
+ next.fill = _nullishCoalesce(_optionalChain([fills, 'access', _188 => _188[0], 'optionalAccess', _189 => _189.paint]), () => ( null));
5069
5094
  return next;
5070
5095
  }
5071
5096
  next.fills = fills.map((l) => ({ ...l }));
@@ -5090,8 +5115,8 @@ function withVectorStrokes(node, strokes) {
5090
5115
  var json = (v2) => JSON.stringify(_nullishCoalesce(v2, () => ( null)));
5091
5116
  function strokeShorthandDiff(node, top) {
5092
5117
  const out = [];
5093
- if (json(node.stroke) !== json(_optionalChain([top, 'optionalAccess', _179 => _179.paint]))) out.push("stroke");
5094
- for (const key of VECTOR_STROKE_SETTING_KEYS) if (json(node[key]) !== json(_optionalChain([top, 'optionalAccess', _180 => _180[key]]))) out.push(key);
5118
+ if (json(node.stroke) !== json(_optionalChain([top, 'optionalAccess', _190 => _190.paint]))) out.push("stroke");
5119
+ for (const key of VECTOR_STROKE_SETTING_KEYS) if (json(node[key]) !== json(_optionalChain([top, 'optionalAccess', _191 => _191[key]]))) out.push(key);
5095
5120
  return out;
5096
5121
  }
5097
5122
  var checked = /* @__PURE__ */ new WeakSet();
@@ -5108,7 +5133,7 @@ function normalizeVectorPaintStacks(node, prefer = "shorthand") {
5108
5133
  if (Array.isArray(node.fills)) {
5109
5134
  let fills = node.fills;
5110
5135
  const top = fills[fills.length - 1];
5111
- if (prefer === "shorthand" && json(node.fill) !== json(_optionalChain([top, 'optionalAccess', _181 => _181.paint]))) {
5136
+ if (prefer === "shorthand" && json(node.fill) !== json(_optionalChain([top, 'optionalAccess', _192 => _192.paint]))) {
5112
5137
  if (!draws(node.fill)) fills = [];
5113
5138
  else fills = top ? [...fills.slice(0, -1), { ...top, paint: node.fill }] : [{ paint: node.fill }];
5114
5139
  }
@@ -5324,8 +5349,8 @@ var Measured = class {
5324
5349
  append(sa, sb, out) {
5325
5350
  for (const piece of _chunkGF2RBSDMcjs.trimSegments.call(void 0, this.segs, sa, sb, this.lens)) {
5326
5351
  if (degenerate(piece)) continue;
5327
- const last = _optionalChain([out, 'access', _182 => _182[out.length - 1], 'optionalAccess', _183 => _183.segs]);
5328
- const end = _optionalChain([last, 'optionalAccess', _184 => _184[last.length - 1], 'optionalAccess', _185 => _185.at, 'call', _186 => _186(-1)]);
5352
+ const last = _optionalChain([out, 'access', _193 => _193[out.length - 1], 'optionalAccess', _194 => _194.segs]);
5353
+ const end = _optionalChain([last, 'optionalAccess', _195 => _195[last.length - 1], 'optionalAccess', _196 => _196.at, 'call', _197 => _197(-1)]);
5329
5354
  if (!end || Math.hypot(end[0] - piece[0][0], end[1] - piece[0][1]) > 1e-6) out.push({ segs: [piece], closed: false });
5330
5355
  else last.push(piece);
5331
5356
  }
@@ -5637,9 +5662,9 @@ function vectorRepeaterCopies(r, pivot) {
5637
5662
  for (let i = 0; i < n; i++) {
5638
5663
  const k = i + offset;
5639
5664
  let m = translateMatrix(-pivot.x, -pivot.y);
5640
- m = multiplyMatrices(m, scaleMatrix(Math.pow((_nullishCoalesce(_optionalChain([r, 'access', _187 => _187.scale, 'optionalAccess', _188 => _188.x]), () => ( 100))) / 100, k), Math.pow((_nullishCoalesce(_optionalChain([r, 'access', _189 => _189.scale, 'optionalAccess', _190 => _190.y]), () => ( 100))) / 100, k)));
5665
+ m = multiplyMatrices(m, scaleMatrix(Math.pow((_nullishCoalesce(_optionalChain([r, 'access', _198 => _198.scale, 'optionalAccess', _199 => _199.x]), () => ( 100))) / 100, k), Math.pow((_nullishCoalesce(_optionalChain([r, 'access', _200 => _200.scale, 'optionalAccess', _201 => _201.y]), () => ( 100))) / 100, k)));
5641
5666
  m = multiplyMatrices(m, rotateMatrix((_nullishCoalesce(r.rotation, () => ( 0))) * k));
5642
- m = multiplyMatrices(m, translateMatrix(pivot.x + (_nullishCoalesce(_optionalChain([r, 'access', _191 => _191.position, 'optionalAccess', _192 => _192.x]), () => ( 0))) * k, pivot.y + (_nullishCoalesce(_optionalChain([r, 'access', _193 => _193.position, 'optionalAccess', _194 => _194.y]), () => ( 0))) * k));
5667
+ m = multiplyMatrices(m, translateMatrix(pivot.x + (_nullishCoalesce(_optionalChain([r, 'access', _202 => _202.position, 'optionalAccess', _203 => _203.x]), () => ( 0))) * k, pivot.y + (_nullishCoalesce(_optionalChain([r, 'access', _204 => _204.position, 'optionalAccess', _205 => _205.y]), () => ( 0))) * k));
5643
5668
  const t = n > 1 ? i / (n - 1) : 0;
5644
5669
  const partial = i + 1 === n && fract > 0 ? fract : 1;
5645
5670
  out.push({ index: i, matrix: m, opacity: Math.min(1, Math.max(0, (so + (eo - so) * t) * partial)) });
@@ -5803,7 +5828,7 @@ function mapBezierPath(path, f, tolerance = 0.1, options = {}) {
5803
5828
 
5804
5829
  // src/vector/frames.ts
5805
5830
  function isVectorFrame(node) {
5806
- return _optionalChain([node, 'optionalAccess', _195 => _195.type]) === "group" && !!node.frame && !node.blend && !node.liveBoolean && !node.mask;
5831
+ return _optionalChain([node, 'optionalAccess', _206 => _206.type]) === "group" && !!node.frame && !node.blend && !node.liveBoolean && !node.mask;
5807
5832
  }
5808
5833
  function vectorFrameRectPath(frame) {
5809
5834
  const { x, y, width: w, height: h } = frame;
@@ -5848,8 +5873,8 @@ function placeSpan(rule, a0, a1, f0, f1, g0, g1) {
5848
5873
  }
5849
5874
  }
5850
5875
  function vectorFrameChildMatrix(resizing, box, from, to) {
5851
- const [x0, x1] = placeSpan(_nullishCoalesce(H[_nullishCoalesce(_optionalChain([resizing, 'optionalAccess', _196 => _196.horizontal]), () => ( "left"))], () => ( "start")), box.x, box.x + box.width, from.x, from.x + from.width, to.x, to.x + to.width);
5852
- const [y0, y1] = placeSpan(_nullishCoalesce(V[_nullishCoalesce(_optionalChain([resizing, 'optionalAccess', _197 => _197.vertical]), () => ( "top"))], () => ( "start")), box.y, box.y + box.height, from.y, from.y + from.height, to.y, to.y + to.height);
5876
+ const [x0, x1] = placeSpan(_nullishCoalesce(H[_nullishCoalesce(_optionalChain([resizing, 'optionalAccess', _207 => _207.horizontal]), () => ( "left"))], () => ( "start")), box.x, box.x + box.width, from.x, from.x + from.width, to.x, to.x + to.width);
5877
+ const [y0, y1] = placeSpan(_nullishCoalesce(V[_nullishCoalesce(_optionalChain([resizing, 'optionalAccess', _208 => _208.vertical]), () => ( "top"))], () => ( "start")), box.y, box.y + box.height, from.y, from.y + from.height, to.y, to.y + to.height);
5853
5878
  const sx = box.width > 1e-9 ? (x1 - x0) / box.width : 1;
5854
5879
  const sy = box.height > 1e-9 ? (y1 - y0) / box.height : 1;
5855
5880
  return [sx, 0, 0, sy, x0 - sx * box.x, y0 - sy * box.y];
@@ -5905,7 +5930,7 @@ function vectorFrameDocument(doc, id, find) {
5905
5930
  height,
5906
5931
  ...doc.background ? { background: doc.background } : {},
5907
5932
  nodes: [placed],
5908
- ..._optionalChain([doc, 'access', _198 => _198.symbols, 'optionalAccess', _199 => _199.length]) ? { symbols: doc.symbols } : {}
5933
+ ..._optionalChain([doc, 'access', _209 => _209.symbols, 'optionalAccess', _210 => _210.length]) ? { symbols: doc.symbols } : {}
5909
5934
  };
5910
5935
  }
5911
5936
  function getVectorFramePanel(state) {
@@ -5925,7 +5950,7 @@ function getVectorFramePanel(state) {
5925
5950
  const one = (values) => values.every((v2) => v2 === values[0]) ? values[0] : "mixed";
5926
5951
  return {
5927
5952
  frame: f ? { id: f.id, name: _nullishCoalesce(f.name, () => ( "Frame")), artboard: parents.get(f.id) === null, frame: f.frame } : null,
5928
- resizing: children.length ? { ids: children.map((c) => c.id), horizontal: one(children.map((c) => _nullishCoalesce(_optionalChain([c, 'access', _200 => _200.resizing, 'optionalAccess', _201 => _201.horizontal]), () => ( "left")))), vertical: one(children.map((c) => _nullishCoalesce(_optionalChain([c, 'access', _202 => _202.resizing, 'optionalAccess', _203 => _203.vertical]), () => ( "top")))) } : null
5953
+ resizing: children.length ? { ids: children.map((c) => c.id), horizontal: one(children.map((c) => _nullishCoalesce(_optionalChain([c, 'access', _211 => _211.resizing, 'optionalAccess', _212 => _212.horizontal]), () => ( "left")))), vertical: one(children.map((c) => _nullishCoalesce(_optionalChain([c, 'access', _213 => _213.resizing, 'optionalAccess', _214 => _214.vertical]), () => ( "top")))) } : null
5929
5954
  };
5930
5955
  }
5931
5956
 
@@ -6311,7 +6336,7 @@ function normalizeVectorFilterParams(type, params, base) {
6311
6336
  if (!isVectorFilterType(type)) return null;
6312
6337
  const out = { ...VECTOR_FILTER_DEFAULTS[type], ..._nullishCoalesce(base, () => ( {})) };
6313
6338
  for (const spec of VECTOR_FILTER_PARAM_SPECS[type]) {
6314
- const v2 = _optionalChain([params, 'optionalAccess', _204 => _204[spec.key]]);
6339
+ const v2 = _optionalChain([params, 'optionalAccess', _215 => _215[spec.key]]);
6315
6340
  if (v2 === void 0) continue;
6316
6341
  if (spec.kind === "number" && typeof v2 === "number" && Number.isFinite(v2)) out[spec.key] = Math.min(_nullishCoalesce(spec.max, () => ( Infinity)), Math.max(_nullishCoalesce(spec.min, () => ( -Infinity)), v2));
6317
6342
  else if (spec.kind === "color" && typeof v2 === "string" && v2.trim()) out[spec.key] = v2.trim();
@@ -6443,7 +6468,7 @@ function vectorFilterSvg(filters, id, bounds) {
6443
6468
  primitives.push(fe("feGaussianBlur", { in: body, stdDeviation: round(f.params.radius / 2), result: name("body") }));
6444
6469
  body = name("body");
6445
6470
  }
6446
- const lastResult = _optionalChain([primitives, 'access', _205 => _205[primitives.length - 1], 'optionalAccess', _206 => _206.attrs, 'access', _207 => _207.result]);
6471
+ const lastResult = _optionalChain([primitives, 'access', _216 => _216[primitives.length - 1], 'optionalAccess', _217 => _217.attrs, 'access', _218 => _218.result]);
6447
6472
  if (lastResult !== body) primitives.push(fe("feMerge", {}, [fe("feMergeNode", { in: body })]));
6448
6473
  const pad = vectorFilterReach(active) + 2;
6449
6474
  return {
@@ -6458,7 +6483,7 @@ function vectorFilterSvg(filters, id, bounds) {
6458
6483
  var escapeAttr = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
6459
6484
  function primitiveMarkup(p) {
6460
6485
  const attrs = Object.entries(p.attrs).map(([k, v2]) => ` ${k}="${escapeAttr(String(v2))}"`).join("");
6461
- return _optionalChain([p, 'access', _208 => _208.children, 'optionalAccess', _209 => _209.length]) ? `<${p.tag}${attrs}>${p.children.map(primitiveMarkup).join("")}</${p.tag}>` : `<${p.tag}${attrs}/>`;
6486
+ return _optionalChain([p, 'access', _219 => _219.children, 'optionalAccess', _220 => _220.length]) ? `<${p.tag}${attrs}>${p.children.map(primitiveMarkup).join("")}</${p.tag}>` : `<${p.tag}${attrs}/>`;
6462
6487
  }
6463
6488
  function vectorFilterMarkup(filter, extra = "") {
6464
6489
  return `<filter id="${escapeAttr(filter.id)}" filterUnits="userSpaceOnUse" x="${filter.x}" y="${filter.y}" width="${filter.width}" height="${filter.height}" color-interpolation-filters="sRGB"${extra}>${filter.primitives.map(primitiveMarkup).join("")}</filter>`;
@@ -6476,7 +6501,7 @@ function sanitizeVectorMask(value) {
6476
6501
  return r.invert === true ? { type: r.type, invert: true } : { type: r.type };
6477
6502
  }
6478
6503
  function isVectorMaskGroup(node) {
6479
- return _optionalChain([node, 'optionalAccess', _210 => _210.type]) === "group" && !!node.mask && isVectorMaskType(node.mask.type) && !node.blend && !node.liveBoolean && node.children.length > 0;
6504
+ return _optionalChain([node, 'optionalAccess', _221 => _221.type]) === "group" && !!node.mask && isVectorMaskType(node.mask.type) && !node.blend && !node.liveBoolean && node.children.length > 0;
6480
6505
  }
6481
6506
  function isVectorMaskActive(node) {
6482
6507
  return isVectorMaskGroup(node) && node.children[0].visible !== false;
@@ -6511,7 +6536,7 @@ function vectorMaskRegionShapes(node, type, parent = IDENTITY_MATRIX, self = tru
6511
6536
  if (!self && node.visible === false) return [];
6512
6537
  if (isVectorFrame(node)) node = vectorFrameDrawn(node);
6513
6538
  const m = multiplyMatrices(nodeMatrix(node), parent);
6514
- if (isVectorMaskActive(node) || node.type === "group" && _optionalChain([node, 'access', _211 => _211.effects, 'optionalAccess', _212 => _212.length])) {
6539
+ if (isVectorMaskActive(node) || node.type === "group" && _optionalChain([node, 'access', _222 => _222.effects, 'optionalAccess', _223 => _223.length])) {
6515
6540
  return vectorAppearanceShapes(node).flatMap((s) => regionOfPath(s.path, s.source, type, m));
6516
6541
  }
6517
6542
  const drawn = expandVectorAppearance(node);
@@ -6716,7 +6741,7 @@ function fitRuns(runs, length2, fallback) {
6716
6741
  }
6717
6742
  if (left2 > 0) {
6718
6743
  if (out.length) out[out.length - 1] = { ...out[out.length - 1], length: out[out.length - 1].length + left2 };
6719
- else out.push({ length: left2, style: _nullishCoalesce(_optionalChain([runs, 'access', _213 => _213[runs.length - 1], 'optionalAccess', _214 => _214.style]), () => ( fallback)) });
6744
+ else out.push({ length: left2, style: _nullishCoalesce(_optionalChain([runs, 'access', _224 => _224[runs.length - 1], 'optionalAccess', _225 => _225.style]), () => ( fallback)) });
6720
6745
  }
6721
6746
  return compact(out);
6722
6747
  }
@@ -6726,7 +6751,7 @@ function styleAt(runs, index, fallback) {
6726
6751
  if (index < at2 + r.length) return r.style;
6727
6752
  at2 += r.length;
6728
6753
  }
6729
- return _nullishCoalesce(_optionalChain([runs, 'access', _215 => _215[runs.length - 1], 'optionalAccess', _216 => _216.style]), () => ( fallback));
6754
+ return _nullishCoalesce(_optionalChain([runs, 'access', _226 => _226[runs.length - 1], 'optionalAccess', _227 => _227.style]), () => ( fallback));
6730
6755
  }
6731
6756
  function restyleRange(runs, start, end, patch) {
6732
6757
  const out = [];
@@ -6782,7 +6807,7 @@ function paragraphRanges(text) {
6782
6807
  return out;
6783
6808
  }
6784
6809
  function fitParagraphRuns(runs, text) {
6785
- const fallback = _nullishCoalesce(_optionalChain([runs, 'access', _217 => _217[0], 'optionalAccess', _218 => _218.style]), () => ( {}));
6810
+ const fallback = _nullishCoalesce(_optionalChain([runs, 'access', _228 => _228[0], 'optionalAccess', _229 => _229.style]), () => ( {}));
6786
6811
  const out = compact(paragraphRanges(text).map((p) => ({ length: p.end - p.start, style: styleAt(runs, p.start, fallback) })));
6787
6812
  return out.length ? out : [{ length: 0, style: fallback }];
6788
6813
  }
@@ -6832,7 +6857,7 @@ function textLineRect(l) {
6832
6857
  var layoutCache = /* @__PURE__ */ new WeakMap();
6833
6858
  function layoutText(layer, shaper) {
6834
6859
  let byShaper = layoutCache.get(layer);
6835
- const hit = _optionalChain([byShaper, 'optionalAccess', _219 => _219.get, 'call', _220 => _220(shaper.id)]);
6860
+ const hit = _optionalChain([byShaper, 'optionalAccess', _230 => _230.get, 'call', _231 => _231(shaper.id)]);
6836
6861
  if (hit) return hit;
6837
6862
  const out = computeLayout(layer, shaper);
6838
6863
  if (!byShaper) {
@@ -6896,7 +6921,7 @@ function computeLayout(layer, shaper) {
6896
6921
  const code = seg.charCodeAt(k);
6897
6922
  if (isLow(code) && index > 0 && isHigh(text.charCodeAt(index - 1))) {
6898
6923
  const prev = chars[chars.length - 1];
6899
- if (_optionalChain([prev, 'optionalAccess', _221 => _221.up])) {
6924
+ if (_optionalChain([prev, 'optionalAccess', _232 => _232.up])) {
6900
6925
  chars.push({ index, ch: seg[k], advance: 0, style, up: prev.up, low: true });
6901
6926
  } else chars.push({ index, ch: seg[k], advance, style, low: true });
6902
6927
  continue;
@@ -7224,7 +7249,7 @@ function createCanvasTextShaper(options = {}) {
7224
7249
  return null;
7225
7250
  })));
7226
7251
  const canvas = make(1, 1);
7227
- const ctx = _optionalChain([canvas, 'optionalAccess', _222 => _222.getContext, 'call', _223 => _223("2d")]);
7252
+ const ctx = _optionalChain([canvas, 'optionalAccess', _233 => _233.getContext, 'call', _234 => _234("2d")]);
7228
7253
  if (!ctx || typeof ctx.measureText !== "function") return null;
7229
7254
  const fallback = _nullishCoalesce(options.fallbackFamily, () => ( "sans-serif"));
7230
7255
  const available = /* @__PURE__ */ new Map();
@@ -7297,10 +7322,10 @@ function createOutlineTextShaper(fonts, options = {}) {
7297
7322
  const entries = fonts.map((f) => {
7298
7323
  const e = "face" in f ? f : { face: f };
7299
7324
  const names = e.face.names;
7300
- const family = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.family, () => ( _optionalChain([names, 'optionalAccess', _224 => _224.fontFamily, 'optionalAccess', _225 => _225.en]))), () => ( Object.values(_nullishCoalesce(_optionalChain([names, 'optionalAccess', _226 => _226.fontFamily]), () => ( {})))[0])), () => ( "Font"));
7301
- const weight = _nullishCoalesce(_nullishCoalesce(e.weight, () => ( _optionalChain([e, 'access', _227 => _227.face, 'access', _228 => _228.tables, 'optionalAccess', _229 => _229.os2, 'optionalAccess', _230 => _230.usWeightClass]))), () => ( 400));
7302
- const italic = _nullishCoalesce(e.italic, () => ( Boolean((_nullishCoalesce(_optionalChain([e, 'access', _231 => _231.face, 'access', _232 => _232.tables, 'optionalAccess', _233 => _233.os2, 'optionalAccess', _234 => _234.fsSelection]), () => ( 0))) & 1)));
7303
- const postScript = _nullishCoalesce(_optionalChain([names, 'optionalAccess', _235 => _235.postScriptName, 'optionalAccess', _236 => _236.en]), () => ( Object.values(_nullishCoalesce(_optionalChain([names, 'optionalAccess', _237 => _237.postScriptName]), () => ( {})))[0]));
7325
+ const family = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.family, () => ( _optionalChain([names, 'optionalAccess', _235 => _235.fontFamily, 'optionalAccess', _236 => _236.en]))), () => ( Object.values(_nullishCoalesce(_optionalChain([names, 'optionalAccess', _237 => _237.fontFamily]), () => ( {})))[0])), () => ( "Font"));
7326
+ const weight = _nullishCoalesce(_nullishCoalesce(e.weight, () => ( _optionalChain([e, 'access', _238 => _238.face, 'access', _239 => _239.tables, 'optionalAccess', _240 => _240.os2, 'optionalAccess', _241 => _241.usWeightClass]))), () => ( 400));
7327
+ const italic = _nullishCoalesce(e.italic, () => ( Boolean((_nullishCoalesce(_optionalChain([e, 'access', _242 => _242.face, 'access', _243 => _243.tables, 'optionalAccess', _244 => _244.os2, 'optionalAccess', _245 => _245.fsSelection]), () => ( 0))) & 1)));
7328
+ const postScript = _nullishCoalesce(_optionalChain([names, 'optionalAccess', _246 => _246.postScriptName, 'optionalAccess', _247 => _247.en]), () => ( Object.values(_nullishCoalesce(_optionalChain([names, 'optionalAccess', _248 => _248.postScriptName]), () => ( {})))[0]));
7304
7329
  return { face: e.face, family, key: family.toLowerCase(), weight, italic, postScript };
7305
7330
  });
7306
7331
  const fallbackKey = (_nullishCoalesce(options.fallback, () => ( entries[0].family))).toLowerCase();
@@ -7347,12 +7372,12 @@ function createOutlineTextShaper(fonts, options = {}) {
7347
7372
  return out;
7348
7373
  },
7349
7374
  outline(text, font, x, y, opts) {
7350
- return toPath(pick(font).entry.face.getPath(text, x, y, font.size, _optionalChain([opts, 'optionalAccess', _238 => _238.vertical]) ? { kerning: true, vertical: true } : { kerning: true }).commands);
7375
+ return toPath(pick(font).entry.face.getPath(text, x, y, font.size, _optionalChain([opts, 'optionalAccess', _249 => _249.vertical]) ? { kerning: true, vertical: true } : { kerning: true }).commands);
7351
7376
  },
7352
7377
  vertical(char, font) {
7353
7378
  const { face } = pick(font).entry;
7354
7379
  const k = font.size / face.unitsPerEm;
7355
- const v2 = _optionalChain([face, 'access', _239 => _239.getVerticalMetrics, 'optionalCall', _240 => _240(char)]);
7380
+ const v2 = _optionalChain([face, 'access', _250 => _250.getVerticalMetrics, 'optionalCall', _251 => _251(char)]);
7356
7381
  if (v2) return { advance: v2.advance * k, originY: v2.originY * k, alternate: v2.alternate };
7357
7382
  return { advance: (face.ascender - face.descender) * k, originY: face.ascender * k, alternate: false };
7358
7383
  },
@@ -7413,7 +7438,7 @@ function vectorTextHasOutlines() {
7413
7438
  return typeof getVectorTextShaper().outline === "function";
7414
7439
  }
7415
7440
  function vectorTextFamilies() {
7416
- return _nullishCoalesce(_optionalChain([getVectorTextShaper, 'call', _241 => _241(), 'access', _242 => _242.families, 'optionalCall', _243 => _243()]), () => ( ["sans-serif", "serif", "monospace"]));
7441
+ return _nullishCoalesce(_optionalChain([getVectorTextShaper, 'call', _252 => _252(), 'access', _253 => _253.families, 'optionalCall', _254 => _254()]), () => ( ["sans-serif", "serif", "monospace"]));
7417
7442
  }
7418
7443
  var DEFAULT_VECTOR_FONT = { fontFamily: "sans-serif", fontWeight: 400, fontSize: 24 };
7419
7444
  var VECTOR_CHARACTER_STYLE_KEYS = ["fontFamily", "fontWeight", "italic", "fontSize", "tracking", "leading", "baselineShift", "underline", "strikethrough", "upright"];
@@ -7589,7 +7614,7 @@ function computeLayout2(node, shaper) {
7589
7614
  const fragments = [];
7590
7615
  const lines = [];
7591
7616
  let overflow = false;
7592
- const fillOf = (f) => _optionalChain([runs, 'access', _244 => _244.find, 'call', _245 => _245((r) => f.start >= r.start && f.start < r.end), 'optionalAccess', _246 => _246.fill]);
7617
+ const fillOf = (f) => _optionalChain([runs, 'access', _255 => _255.find, 'call', _256 => _256((r) => f.start >= r.start && f.start < r.end), 'optionalAccess', _257 => _257.fill]);
7593
7618
  const styleOf = (f) => {
7594
7619
  const { color: _c, opacity: _o, postScriptName: _p, ...style } = f.style;
7595
7620
  return style;
@@ -7628,11 +7653,11 @@ function computeLayout2(node, shaper) {
7628
7653
  } else {
7629
7654
  const line = text.lines[0];
7630
7655
  const measure = measureVectorPath(subpathPath(frame.path), !!frame.flip);
7631
- const align = _nullishCoalesce(_optionalChain([node, 'access', _247 => _247.paragraph, 'optionalAccess', _248 => _248.align]), () => ( "left"));
7656
+ const align = _nullishCoalesce(_optionalChain([node, 'access', _258 => _258.paragraph, 'optionalAccess', _259 => _259.align]), () => ( "left"));
7632
7657
  const start = Math.max(0, _nullishCoalesce(frame.start, () => ( 0)));
7633
7658
  const end = Math.max(0, _nullishCoalesce(frame.end, () => ( 0)));
7634
7659
  const upright = frame.orientation === "upright";
7635
- const baselineOffset = pathBaselineOffset(_nullishCoalesce(frame.baseline, () => ( "baseline")), _nullishCoalesce(_optionalChain([line, 'optionalAccess', _249 => _249.ascent]), () => ( 0)), _nullishCoalesce(_optionalChain([line, 'optionalAccess', _250 => _250.descent]), () => ( 0)));
7660
+ const baselineOffset = pathBaselineOffset(_nullishCoalesce(frame.baseline, () => ( "baseline")), _nullishCoalesce(_optionalChain([line, 'optionalAccess', _260 => _260.ascent]), () => ( 0)), _nullishCoalesce(_optionalChain([line, 'optionalAccess', _261 => _261.descent]), () => ( 0)));
7636
7661
  if (line) {
7637
7662
  const chars = line.chars.filter((c) => {
7638
7663
  const lo = block.text.charCodeAt(c.index);
@@ -7641,7 +7666,7 @@ function computeLayout2(node, shaper) {
7641
7666
  const advanceOf = (c) => {
7642
7667
  const pair = charAt(block.text, c.index).length === 2;
7643
7668
  const low = pair ? line.chars.find((d) => d.index === c.index + 1) : void 0;
7644
- return c.advance + (_nullishCoalesce(_optionalChain([low, 'optionalAccess', _251 => _251.advance]), () => ( 0)));
7669
+ return c.advance + (_nullishCoalesce(_optionalChain([low, 'optionalAccess', _262 => _262.advance]), () => ( 0)));
7645
7670
  };
7646
7671
  const pivots = chars.map((c) => c.x + advanceOf(c) / 2);
7647
7672
  const positions = vectorPathTextPositions(pivots, [line.x, line.x + line.width], align, measure.length, start, end);
@@ -7696,7 +7721,7 @@ function computeLayout2(node, shaper) {
7696
7721
  if (x0 < Infinity) bounds = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
7697
7722
  else if (frame.kind === "point") {
7698
7723
  const l = text.lines[0];
7699
- bounds = { x: frame.x, y: frame.y - (_nullishCoalesce(_optionalChain([l, 'optionalAccess', _252 => _252.ascent]), () => ( 0))), width: 0, height: (_nullishCoalesce(_optionalChain([l, 'optionalAccess', _253 => _253.ascent]), () => ( 0))) + (_nullishCoalesce(_optionalChain([l, 'optionalAccess', _254 => _254.descent]), () => ( 0))) };
7724
+ bounds = { x: frame.x, y: frame.y - (_nullishCoalesce(_optionalChain([l, 'optionalAccess', _263 => _263.ascent]), () => ( 0))), width: 0, height: (_nullishCoalesce(_optionalChain([l, 'optionalAccess', _264 => _264.ascent]), () => ( 0))) + (_nullishCoalesce(_optionalChain([l, 'optionalAccess', _265 => _265.descent]), () => ( 0))) };
7700
7725
  }
7701
7726
  }
7702
7727
  return { shaper: shaper.id, glyphs, fragments, lines, origin, text, bounds, overflow, missingFonts: text.missingFonts };
@@ -7817,7 +7842,7 @@ function vectorTextCaret(node, index) {
7817
7842
  const t = { x: Math.cos(r), y: Math.sin(r) };
7818
7843
  const n2 = { x: -t.y, y: t.x };
7819
7844
  const o = { x: g2.x + t.x * u, y: g2.y + t.y * u };
7820
- return { top: { x: o.x - n2.x * g2.ascent, y: o.y - n2.y * g2.ascent }, bottom: { x: o.x + n2.x * g2.descent, y: o.y + n2.y * g2.descent }, line: _nullishCoalesce(_optionalChain([layout, 'access', _255 => _255.fragments, 'access', _256 => _256[g2.fragment], 'optionalAccess', _257 => _257.line]), () => ( 0)) };
7845
+ return { top: { x: o.x - n2.x * g2.ascent, y: o.y - n2.y * g2.ascent }, bottom: { x: o.x + n2.x * g2.descent, y: o.y + n2.y * g2.descent }, line: _nullishCoalesce(_optionalChain([layout, 'access', _266 => _266.fragments, 'access', _267 => _267[g2.fragment], 'optionalAccess', _268 => _268.line]), () => ( 0)) };
7821
7846
  };
7822
7847
  if (node.frame.kind !== "path") {
7823
7848
  const c = caretAt(layout.text, index);
@@ -7957,7 +7982,7 @@ function sanitizeVectorTextFrame(value, path = "frame") {
7957
7982
  return { kind: "area", x: num2(f.x, `${path}.x`, -1e7, 1e7), y: num2(f.y, `${path}.y`, -1e7, 1e7), width: num2(f.width, `${path}.width`, 0, 1e7), height: num2(f.height, `${path}.height`, 0, 1e7) };
7958
7983
  if (f.kind === "path") {
7959
7984
  const sp = f.path;
7960
- if (!sp || !Array.isArray(sp.anchors) || sp.anchors.length < 2 || !sp.anchors.every((a) => isNum(_optionalChain([a, 'optionalAccess', _258 => _258.x])) && isNum(_optionalChain([a, 'optionalAccess', _259 => _259.y])))) fail(`${path}.path must be a subpath with at least two anchors.`);
7985
+ if (!sp || !Array.isArray(sp.anchors) || sp.anchors.length < 2 || !sp.anchors.every((a) => isNum(_optionalChain([a, 'optionalAccess', _269 => _269.x])) && isNum(_optionalChain([a, 'optionalAccess', _270 => _270.y])))) fail(`${path}.path must be a subpath with at least two anchors.`);
7961
7986
  const out = { kind: "path", path: { closed: !!sp.closed, anchors: sp.anchors.map((a) => ({ ...a })) } };
7962
7987
  if (f.start !== void 0 && f.start !== 0) out.start = num2(f.start, `${path}.start`, 0, 1e7);
7963
7988
  if (f.end !== void 0 && f.end !== 0) out.end = num2(f.end, `${path}.end`, 0, 1e7);
@@ -7975,7 +8000,7 @@ function sanitizeVectorTextFrame(value, path = "frame") {
7975
8000
  return fail(`${path}.kind must be point, area or path, got ${JSON.stringify(f.kind)}.`);
7976
8001
  }
7977
8002
  function normalizeVectorTextRuns(text, runs) {
7978
- if (!_optionalChain([runs, 'optionalAccess', _260 => _260.length])) return null;
8003
+ if (!_optionalChain([runs, 'optionalAccess', _271 => _271.length])) return null;
7979
8004
  const cleaned = fitVectorTextRuns(
7980
8005
  runs.map((r) => ({ length: r.length, style: stripUndefined(r.style) })),
7981
8006
  text.length
@@ -8015,7 +8040,7 @@ function replaceVectorText(node, start, end, insert) {
8015
8040
  const clean2 = insert.replace(/\r\n?/g, "\n");
8016
8041
  const text = node.text.slice(0, start) + clean2 + node.text.slice(end);
8017
8042
  let runs = null;
8018
- if (_optionalChain([node, 'access', _261 => _261.runs, 'optionalAccess', _262 => _262.length])) {
8043
+ if (_optionalChain([node, 'access', _272 => _272.runs, 'optionalAccess', _273 => _273.length])) {
8019
8044
  const fitted = fitVectorTextRuns(node.runs, node.text.length);
8020
8045
  const style = styleAt(fitted, start > 0 ? start - 1 : start, {});
8021
8046
  runs = normalizeVectorTextRuns(text, spliceRuns(fitted, start, end, clean2.length, style));
@@ -8031,7 +8056,7 @@ function styleVectorText(node, start, end, patch) {
8031
8056
  if (whole) {
8032
8057
  let next2 = { ...node, font: patchVectorCharacterStyle(node.font, fields, "style") };
8033
8058
  const keys = Object.keys(fields).filter((k) => fields[k] !== void 0);
8034
- if (_optionalChain([next2, 'access', _263 => _263.runs, 'optionalAccess', _264 => _264.length]) && (keys.length || fill !== void 0)) {
8059
+ if (_optionalChain([next2, 'access', _274 => _274.runs, 'optionalAccess', _275 => _275.length]) && (keys.length || fill !== void 0)) {
8035
8060
  const runs2 = normalizeVectorTextRuns(
8036
8061
  next2.text,
8037
8062
  next2.runs.map((r) => {
@@ -8076,7 +8101,7 @@ function bakeVectorTextGeometry(node, m) {
8076
8101
  ...s.baselineShift !== void 0 ? { baselineShift: s.baselineShift * k } : {}
8077
8102
  });
8078
8103
  const font = scaleStyle(node.font);
8079
- const runs = _optionalChain([node, 'access', _265 => _265.runs, 'optionalAccess', _266 => _266.map, 'call', _267 => _267((r) => ({ length: r.length, style: scaleStyle(r.style) }))]);
8104
+ const runs = _optionalChain([node, 'access', _276 => _276.runs, 'optionalAccess', _277 => _277.map, 'call', _278 => _278((r) => ({ length: r.length, style: scaleStyle(r.style) }))]);
8080
8105
  const p = node.paragraph;
8081
8106
  const paragraph = p ? {
8082
8107
  ...p,
@@ -8365,7 +8390,7 @@ function vectorInstanceGroup(node, bake) {
8365
8390
  const m = _nullishCoalesce(node.transform, () => ( [1, 0, 0, 1, 0, 0]));
8366
8391
  const { rigid, residual } = decomposeRigid(m);
8367
8392
  const k = Math.sqrt(Math.abs(residual[0] * residual[3] - residual[1] * residual[2]));
8368
- const hidden = new Set(_nullishCoalesce(_optionalChain([node, 'access', _268 => _268.overrides, 'optionalAccess', _269 => _269.hidden]), () => ( [])));
8393
+ const hidden = new Set(_nullishCoalesce(_optionalChain([node, 'access', _279 => _279.overrides, 'optionalAccess', _280 => _280.hidden]), () => ( [])));
8369
8394
  const keep = (list) => list.filter((n) => !hidden.has(n.id)).map((n) => n.type === "group" ? { ...n, children: keep(n.children) } : n);
8370
8395
  let children = prefixVectorIds(keep(_nullishCoalesce(node.art, () => ( []))), node.id);
8371
8396
  if (!isIdentityMatrix(residual)) children = children.map((c) => bake(c, residual));
@@ -8378,8 +8403,8 @@ function vectorInstanceGroup(node, bake) {
8378
8403
  if (node.locked) group.locked = true;
8379
8404
  if (node.opacity !== void 0) group.opacity = node.opacity;
8380
8405
  if (node.blendMode) group.blendMode = node.blendMode;
8381
- if (_optionalChain([node, 'access', _270 => _270.filters, 'optionalAccess', _271 => _271.length])) group.filters = node.filters;
8382
- if (_optionalChain([node, 'access', _272 => _272.effects, 'optionalAccess', _273 => _273.length])) group.effects = node.effects;
8406
+ if (_optionalChain([node, 'access', _281 => _281.filters, 'optionalAccess', _282 => _282.length])) group.filters = node.filters;
8407
+ if (_optionalChain([node, 'access', _283 => _283.effects, 'optionalAccess', _284 => _284.length])) group.effects = node.effects;
8383
8408
  if (node.booleanOperation) group.booleanOperation = node.booleanOperation;
8384
8409
  if (node.blendStep) group.blendStep = true;
8385
8410
  return group;
@@ -8632,8 +8657,8 @@ function vectorLensDrawn(node) {
8632
8657
  if (wire) {
8633
8658
  contents.push(shapePath(shape, id, changed, { fill: null, fills: void 0, stroke: wire, strokes: void 0, strokeWidth: 1, strokeAlign: void 0, strokeDasharray: void 0, strokeWidthProfile: void 0, opacity: Math.min(1, Math.max(0, lens.amount / 100)) }));
8634
8659
  } else if (recolour) {
8635
- const fills = _optionalChain([shape, 'access', _274 => _274.source, 'access', _275 => _275.fills, 'optionalAccess', _276 => _276.map, 'call', _277 => _277((l) => ({ ...l, paint: _nullishCoalesce(mapVectorPaintColors(l.paint, recolour), () => ( null)) }))]);
8636
- const strokes = _optionalChain([shape, 'access', _278 => _278.source, 'access', _279 => _279.strokes, 'optionalAccess', _280 => _280.map, 'call', _281 => _281((l) => ({ ...l, paint: _nullishCoalesce(mapVectorPaintColors(l.paint, recolour), () => ( null)) }))]);
8660
+ const fills = _optionalChain([shape, 'access', _285 => _285.source, 'access', _286 => _286.fills, 'optionalAccess', _287 => _287.map, 'call', _288 => _288((l) => ({ ...l, paint: _nullishCoalesce(mapVectorPaintColors(l.paint, recolour), () => ( null)) }))]);
8661
+ const strokes = _optionalChain([shape, 'access', _289 => _289.source, 'access', _290 => _290.strokes, 'optionalAccess', _291 => _291.map, 'call', _292 => _292((l) => ({ ...l, paint: _nullishCoalesce(mapVectorPaintColors(l.paint, recolour), () => ( null)) }))]);
8637
8662
  contents.push(shapePath(shape, id, changed, { fill: _nullishCoalesce(mapVectorPaintColors(shape.source.fill, recolour), () => ( null)), stroke: _nullishCoalesce(mapVectorPaintColors(shape.source.stroke, recolour), () => ( null)), ...fills ? { fills } : {}, ...strokes ? { strokes } : {} }));
8638
8663
  } else contents.push(shapePath(shape, id, changed));
8639
8664
  }
@@ -8646,7 +8671,7 @@ function vectorLensDrawn(node) {
8646
8671
  const { lens: _l, lensView: _v, transform: _t, opacity: _o, effects: _e, blendMode: _bm, filters: _f, ...style } = node;
8647
8672
  const fillOpacity = lens.type === "transparency" ? 1 - Math.min(100, Math.max(0, lens.amount)) / 100 : 0;
8648
8673
  children.push({ ...style, id: `${node.id}~lens-fill`, stroke: null, strokes: void 0, opacity: fillOpacity });
8649
- const stroked = (_nullishCoalesce(_optionalChain([node, 'access', _282 => _282.strokes, 'optionalAccess', _283 => _283.length]), () => ( 0))) > 0 || node.stroke != null && node.stroke !== "none";
8674
+ const stroked = (_nullishCoalesce(_optionalChain([node, 'access', _293 => _293.strokes, 'optionalAccess', _294 => _294.length]), () => ( 0))) > 0 || node.stroke != null && node.stroke !== "none";
8650
8675
  if (stroked) children.push({ ...style, id: `${node.id}~lens-stroke`, fill: null, fills: void 0 });
8651
8676
  const out = {
8652
8677
  id: node.id,
@@ -8655,7 +8680,7 @@ function vectorLensDrawn(node) {
8655
8680
  ...node.transform ? { transform: node.transform } : {},
8656
8681
  ...node.opacity !== void 0 ? { opacity: node.opacity } : {},
8657
8682
  ...node.blendMode ? { blendMode: node.blendMode } : {},
8658
- ..._optionalChain([node, 'access', _284 => _284.filters, 'optionalAccess', _285 => _285.length]) ? { filters: node.filters } : {},
8683
+ ..._optionalChain([node, 'access', _295 => _295.filters, 'optionalAccess', _296 => _296.length]) ? { filters: node.filters } : {},
8659
8684
  children
8660
8685
  };
8661
8686
  drawnCache2.set(node, out);
@@ -9656,7 +9681,7 @@ function normalizeVectorEffectParams(type, params, base) {
9656
9681
  if (!defaults) return null;
9657
9682
  const out = { ...defaults, ..._nullishCoalesce(base, () => ( {})) };
9658
9683
  for (const spec of VECTOR_EFFECT_PARAM_SPECS[type]) {
9659
- const v2 = _optionalChain([params, 'optionalAccess', _286 => _286[spec.key]]);
9684
+ const v2 = _optionalChain([params, 'optionalAccess', _297 => _297[spec.key]]);
9660
9685
  if (v2 === void 0) continue;
9661
9686
  if (spec.kind === "number" && typeof v2 === "number" && Number.isFinite(v2)) out[spec.key] = Math.min(_nullishCoalesce(spec.max, () => ( Infinity)), Math.max(_nullishCoalesce(spec.min, () => ( -Infinity)), v2));
9662
9687
  else if (spec.kind === "boolean" && typeof v2 === "boolean") out[spec.key] = v2;
@@ -9668,7 +9693,7 @@ function normalizeVectorEffectParams(type, params, base) {
9668
9693
  const o = out;
9669
9694
  o.rows = Math.round(o.rows);
9670
9695
  o.columns = Math.round(o.columns);
9671
- const given = _optionalChain([params, 'optionalAccess', _287 => _287.mesh]);
9696
+ const given = _optionalChain([params, 'optionalAccess', _298 => _298.mesh]);
9672
9697
  let mesh = given !== void 0 ? isValidWarpMesh(given) ? cloneMesh(given) : null : o.mesh;
9673
9698
  if (o.style !== "mesh") mesh = null;
9674
9699
  if (mesh && given !== void 0) {
@@ -9685,10 +9710,10 @@ function createVectorEffect(type, id, params) {
9685
9710
  }
9686
9711
  var isEnabled = (e) => e.enabled !== false && !!VECTOR_EFFECT_DEFAULTS[e.type];
9687
9712
  function activeVectorEffects(node) {
9688
- return _nullishCoalesce(_optionalChain([node, 'access', _288 => _288.effects, 'optionalAccess', _289 => _289.filter, 'call', _290 => _290(isEnabled)]), () => ( []));
9713
+ return _nullishCoalesce(_optionalChain([node, 'access', _299 => _299.effects, 'optionalAccess', _300 => _300.filter, 'call', _301 => _301(isEnabled)]), () => ( []));
9689
9714
  }
9690
9715
  function hasOwnVectorAppearance(node) {
9691
- return node.type === "text" || node.type === "instance" || node.type === "group" && !!node.liveBoolean || isVectorFrame(node) || isVectorSymmetryGroup(node) || isVectorLens(node) || !!_optionalChain([node, 'access', _291 => _291.effects, 'optionalAccess', _292 => _292.some, 'call', _293 => _293(isEnabled)]);
9716
+ return node.type === "text" || node.type === "instance" || node.type === "group" && !!node.liveBoolean || isVectorFrame(node) || isVectorSymmetryGroup(node) || isVectorLens(node) || !!_optionalChain([node, 'access', _302 => _302.effects, 'optionalAccess', _303 => _303.some, 'call', _304 => _304(isEnabled)]);
9692
9717
  }
9693
9718
  var liveCache = /* @__PURE__ */ new WeakMap();
9694
9719
  function hasVectorAppearance(node) {
@@ -9700,7 +9725,7 @@ function hasVectorAppearance(node) {
9700
9725
  return v2;
9701
9726
  }
9702
9727
  function isVectorLiveBoolean(node) {
9703
- return _optionalChain([node, 'optionalAccess', _294 => _294.type]) === "group" && !!node.liveBoolean;
9728
+ return _optionalChain([node, 'optionalAccess', _305 => _305.type]) === "group" && !!node.liveBoolean;
9704
9729
  }
9705
9730
  function vectorOperandOperation(group, child) {
9706
9731
  return _nullishCoalesce(_nullishCoalesce(child.booleanOperation, () => ( group.liveBoolean)), () => ( "union"));
@@ -9817,7 +9842,7 @@ var compareOrder = (a, b) => {
9817
9842
  for (let i = 0; i < n; i++) if (a[i] !== b[i]) return a[i] - b[i];
9818
9843
  return a.length - b.length;
9819
9844
  };
9820
- var add3 = (a, b) => ({ x: a.x + (_nullishCoalesce(_optionalChain([b, 'optionalAccess', _295 => _295.x]), () => ( 0))), y: a.y + (_nullishCoalesce(_optionalChain([b, 'optionalAccess', _296 => _296.y]), () => ( 0))) });
9845
+ var add3 = (a, b) => ({ x: a.x + (_nullishCoalesce(_optionalChain([b, 'optionalAccess', _306 => _306.x]), () => ( 0))), y: a.y + (_nullishCoalesce(_optionalChain([b, 'optionalAccess', _307 => _307.y]), () => ( 0))) });
9821
9846
  var mapPaths = (shapes, fn) => {
9822
9847
  const out = fn(shapes.map((s) => s.path));
9823
9848
  return shapes.map((s, i) => ({ ...s, path: _nullishCoalesce(out[i], () => ( [])) }));
@@ -9845,7 +9870,7 @@ function contourShapes(shapes, c) {
9845
9870
  const power = 2 ** (Math.min(100, Math.max(-100, c.acceleration)) / 50);
9846
9871
  for (let k = 1; k <= n; k++) {
9847
9872
  const [path] = offsetPaths([s.path], (outside ? 1 : -1) * step * k, c.join, c.miterLimit, 1, 0);
9848
- if (!_optionalChain([path, 'optionalAccess', _297 => _297.length])) break;
9873
+ if (!_optionalChain([path, 'optionalAccess', _308 => _308.length])) break;
9849
9874
  const t = (k / n) ** power;
9850
9875
  const source = { ...s.source, fill: _nullishCoalesce(blendPaint(s.source.fill, c.fillColor, t), () => ( null)), stroke: _nullishCoalesce(blendPaint(s.source.stroke, c.strokeColor, t), () => ( null)), fills: void 0, strokes: void 0 };
9851
9876
  out.push({ source, path, opacity: s.opacity, order: [outside ? n - k : k, ...s.order] });
@@ -9920,8 +9945,8 @@ function bevelShapes(shapes, b) {
9920
9945
  out.push({ source, path: f.path, opacity: s.opacity, order: [...s.order, 1, k] });
9921
9946
  });
9922
9947
  const [middle] = offsetPaths([s.path], -b.width, "miter", 4, 1, 0);
9923
- if (_optionalChain([middle, 'optionalAccess', _298 => _298.length])) out.push({ ...s, source: fillOnly, path: middle, order: [...s.order, 2] });
9924
- const hasStroke = _optionalChain([s, 'access', _299 => _299.source, 'access', _300 => _300.strokes, 'optionalAccess', _301 => _301.length]) || s.source.stroke != null && s.source.stroke !== "none";
9948
+ if (_optionalChain([middle, 'optionalAccess', _309 => _309.length])) out.push({ ...s, source: fillOnly, path: middle, order: [...s.order, 2] });
9949
+ const hasStroke = _optionalChain([s, 'access', _310 => _310.source, 'access', _311 => _311.strokes, 'optionalAccess', _312 => _312.length]) || s.source.stroke != null && s.source.stroke !== "none";
9925
9950
  if (hasStroke) out.push({ ...s, source: { ...s.source, fill: null, fills: void 0 }, order: [...s.order, 3] });
9926
9951
  }
9927
9952
  return out;
@@ -10054,10 +10079,10 @@ function vectorEffectInputBounds(node, effectId) {
10054
10079
  return paths ? pathsBounds(paths) : null;
10055
10080
  }
10056
10081
  function vectorNodeEnvelope(node) {
10057
- return _nullishCoalesce(_optionalChain([node, 'optionalAccess', _302 => _302.effects, 'optionalAccess', _303 => _303.find, 'call', _304 => _304((e) => e.type === "envelope" && e.enabled !== false)]), () => ( null));
10082
+ return _nullishCoalesce(_optionalChain([node, 'optionalAccess', _313 => _313.effects, 'optionalAccess', _314 => _314.find, 'call', _315 => _315((e) => e.type === "envelope" && e.enabled !== false)]), () => ( null));
10058
10083
  }
10059
10084
  function vectorEnvelopeFrame(node, effectId) {
10060
- const e = effectId ? _optionalChain([node, 'access', _305 => _305.effects, 'optionalAccess', _306 => _306.find, 'call', _307 => _307((x) => x.id === effectId)]) : vectorNodeEnvelope(node);
10085
+ const e = effectId ? _optionalChain([node, 'access', _316 => _316.effects, 'optionalAccess', _317 => _317.find, 'call', _318 => _318((x) => x.id === effectId)]) : vectorNodeEnvelope(node);
10061
10086
  if (!e || e.type !== "envelope") return null;
10062
10087
  const bounds = vectorEffectInputBounds(node, e.id);
10063
10088
  if (!bounds || !(bounds.width > 0 && bounds.height > 0)) return null;
@@ -10118,7 +10143,7 @@ function placement(node) {
10118
10143
  ...node.blendStep ? { blendStep: true } : {},
10119
10144
  ...node.booleanOperation ? { booleanOperation: node.booleanOperation } : {},
10120
10145
  ...node.blendMode ? { blendMode: node.blendMode } : {},
10121
- ..._optionalChain([node, 'access', _308 => _308.filters, 'optionalAccess', _309 => _309.length]) ? { filters: node.filters } : {}
10146
+ ..._optionalChain([node, 'access', _319 => _319.filters, 'optionalAccess', _320 => _320.length]) ? { filters: node.filters } : {}
10122
10147
  };
10123
10148
  }
10124
10149
  function vectorAppearanceNodes(node) {
@@ -10250,7 +10275,7 @@ function vectorMasterPages(doc) {
10250
10275
  function fillTokens(node, page, pages) {
10251
10276
  const map = (s) => s.replace(/\{page\}/g, String(page)).replace(/\{pages\}/g, String(pages));
10252
10277
  if (!/\{pages?\}/.test(node.text)) return node;
10253
- if (!_optionalChain([node, 'access', _310 => _310.runs, 'optionalAccess', _311 => _311.length])) return { ...node, text: map(node.text) };
10278
+ if (!_optionalChain([node, 'access', _321 => _321.runs, 'optionalAccess', _322 => _322.length])) return { ...node, text: map(node.text) };
10254
10279
  let at2 = 0;
10255
10280
  let text = "";
10256
10281
  const runs = [];
@@ -10273,7 +10298,7 @@ function vectorMasterArt(master, page, number, count) {
10273
10298
  const f = page.frame;
10274
10299
  const key = `${page.id}|${f.x}|${f.y}|${f.width}|${f.height}|${number}|${count}`;
10275
10300
  let byKey = artCache.get(master);
10276
- const hit = _optionalChain([byKey, 'optionalAccess', _312 => _312.get, 'call', _313 => _313(key)]);
10301
+ const hit = _optionalChain([byKey, 'optionalAccess', _323 => _323.get, 'call', _324 => _324(key)]);
10277
10302
  if (hit) return hit;
10278
10303
  const art = master.children.filter((c) => c.visible !== false).map((c) => {
10279
10304
  const box = vectorNodeBounds(c);
@@ -10318,7 +10343,7 @@ function stripVectorMasterArt(doc) {
10318
10343
  // src/vector/connectors.ts
10319
10344
  var SIDES = ["top", "right", "bottom", "left", "center"];
10320
10345
  function isVectorConnector(node) {
10321
- return _optionalChain([node, 'optionalAccess', _314 => _314.type]) === "path" && !!node.connector;
10346
+ return _optionalChain([node, 'optionalAccess', _325 => _325.type]) === "path" && !!node.connector;
10322
10347
  }
10323
10348
  function vectorConnectionSites(nodes, id) {
10324
10349
  const node = findVectorNode(nodes, id);
@@ -10375,7 +10400,7 @@ function facingSite(sites, toward) {
10375
10400
  }
10376
10401
  function storedEnds(node, world) {
10377
10402
  const sp = node.subpaths[0];
10378
- if (!_optionalChain([sp, 'optionalAccess', _315 => _315.anchors, 'access', _316 => _316.length])) return null;
10403
+ if (!_optionalChain([sp, 'optionalAccess', _326 => _326.anchors, 'access', _327 => _327.length])) return null;
10379
10404
  const a = sp.anchors[0];
10380
10405
  const b = sp.anchors[sp.anchors.length - 1];
10381
10406
  return [applyMatrix(world, a), applyMatrix(world, b)];
@@ -10482,8 +10507,8 @@ function routeVectorConnector(nodes, id) {
10482
10507
  }));
10483
10508
  return {
10484
10509
  subpaths: [{ closed: false, anchors: local }],
10485
- startSide: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _317 => _317.side]), () => ( null)),
10486
- endSide: _nullishCoalesce(_optionalChain([e, 'optionalAccess', _318 => _318.side]), () => ( null)),
10510
+ startSide: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _328 => _328.side]), () => ( null)),
10511
+ endSide: _nullishCoalesce(_optionalChain([e, 'optionalAccess', _329 => _329.side]), () => ( null)),
10487
10512
  dropped: { start: !!startGlue && !s, end: !!endGlue && !e }
10488
10513
  };
10489
10514
  }
@@ -10495,7 +10520,7 @@ function sameSubpaths(a, b) {
10495
10520
  const o = b[i];
10496
10521
  return sp.closed === o.closed && sp.anchors.length === o.anchors.length && sp.anchors.every((p, k) => {
10497
10522
  const q = o.anchors[k];
10498
- return samePoint(p, q) && samePoint(p.in, q.in) && samePoint(p.out, q.out) && (_nullishCoalesce(_optionalChain([p, 'access', _319 => _319.corner, 'optionalAccess', _320 => _320.radius]), () => ( 0))) === (_nullishCoalesce(_optionalChain([q, 'access', _321 => _321.corner, 'optionalAccess', _322 => _322.radius]), () => ( 0)));
10523
+ return samePoint(p, q) && samePoint(p.in, q.in) && samePoint(p.out, q.out) && (_nullishCoalesce(_optionalChain([p, 'access', _330 => _330.corner, 'optionalAccess', _331 => _331.radius]), () => ( 0))) === (_nullishCoalesce(_optionalChain([q, 'access', _332 => _332.corner, 'optionalAccess', _333 => _333.radius]), () => ( 0)));
10499
10524
  });
10500
10525
  });
10501
10526
  }
@@ -10774,7 +10799,7 @@ function applyVectorCornersAttribute(subpaths, value) {
10774
10799
  for (const item of value.trim().split(/\s+/)) {
10775
10800
  const m = /^(\d+)\.(\d+):([\d.eE+-]+)(?::([a-z]+))?$/.exec(item);
10776
10801
  if (!m) continue;
10777
- const a = _optionalChain([subpaths, 'access', _323 => _323[+m[1]], 'optionalAccess', _324 => _324.anchors, 'access', _325 => _325[+m[2]]]);
10802
+ const a = _optionalChain([subpaths, 'access', _334 => _334[+m[1]], 'optionalAccess', _335 => _335.anchors, 'access', _336 => _336[+m[2]]]);
10778
10803
  const radius = parseFloat(m[3]);
10779
10804
  if (!a || !(radius > 0)) continue;
10780
10805
  const kind = VECTOR_CORNER_KINDS.includes(m[4]) ? m[4] : void 0;
@@ -10799,7 +10824,7 @@ function vectorPaintToSvg(paint, gradientId, options = {}) {
10799
10824
  const area2 = bounds2 ? { x: bounds2.x - reach2, y: bounds2.y - reach2, width: bounds2.width + 2 * reach2, height: bounds2.height + 2 * reach2 } : null;
10800
10825
  const key2 = `${gradientId}|${_nullishCoalesce(options.role, () => ( "fill"))}|${_nullishCoalesce(options.precision, () => ( 3))}|${area2 ? [area2.x, area2.y, area2.width, area2.height].join(",") : ""}`;
10801
10826
  let byKey2 = paintCache.get(paint);
10802
- const hit = _optionalChain([byKey2, 'optionalAccess', _326 => _326.get, 'call', _327 => _327(key2)]);
10827
+ const hit = _optionalChain([byKey2, 'optionalAccess', _337 => _337.get, 'call', _338 => _338(key2)]);
10803
10828
  if (hit) return { value: `url(#${gradientId})`, defs: hit };
10804
10829
  const defs2 = vectorShadedSvgDefs(paint, gradientId, { bounds: bounds2, area: area2, precision: _nullishCoalesce(options.precision, () => ( 3)) });
10805
10830
  if (!byKey2) paintCache.set(paint, byKey2 = /* @__PURE__ */ new Map());
@@ -10811,7 +10836,7 @@ function vectorPaintToSvg(paint, gradientId, options = {}) {
10811
10836
  const precision = _nullishCoalesce(options.precision, () => ( 3));
10812
10837
  const key = `${gradientId}|${role}|${precision}`;
10813
10838
  const owner = _nullishCoalesce(options.node, () => ( paint));
10814
- const cached = _optionalChain([paintCache, 'access', _328 => _328.get, 'call', _329 => _329(owner), 'optionalAccess', _330 => _330.get, 'call', _331 => _331(key)]);
10839
+ const cached = _optionalChain([paintCache, 'access', _339 => _339.get, 'call', _340 => _340(owner), 'optionalAccess', _341 => _341.get, 'call', _342 => _342(key)]);
10815
10840
  if (cached && (!options.node || (role === "fill" ? options.node.fill : options.node.stroke) === paint)) return { value: `url(#${gradientId})`, defs: cached };
10816
10841
  const node = options.node;
10817
10842
  const bounds = node ? vectorPathLocalBounds(node) : null;
@@ -10865,7 +10890,7 @@ function vectorNodeLocalPaintBounds(node) {
10865
10890
  }
10866
10891
  var filterCache = /* @__PURE__ */ new WeakMap();
10867
10892
  function vectorNodeFilterSvg(node, id) {
10868
- if (!_optionalChain([node, 'access', _332 => _332.filters, 'optionalAccess', _333 => _333.length])) return null;
10893
+ if (!_optionalChain([node, 'access', _343 => _343.filters, 'optionalAccess', _344 => _344.length])) return null;
10869
10894
  const hit = filterCache.get(node);
10870
10895
  if (hit && hit.id === id) return hit.filter;
10871
10896
  const active = activeVectorFilters(node);
@@ -10951,7 +10976,7 @@ function vectorDocumentToSvg(doc, options = {}) {
10951
10976
  if (node.type === "path" && node.lens) out2 += ` data-vector-lens="${escapeAttr2(JSON.stringify(node.lens))}"`;
10952
10977
  const blend = vectorBlendModeCss(node.blendMode);
10953
10978
  if (blend) out2 += ` style="mix-blend-mode:${blend}"`;
10954
- if (_optionalChain([node, 'access', _334 => _334.filters, 'optionalAccess', _335 => _335.length])) {
10979
+ if (_optionalChain([node, 'access', _345 => _345.filters, 'optionalAccess', _346 => _346.length])) {
10955
10980
  const filter = vectorNodeFilterSvg(node, `${prefix}filter-${node.id}`);
10956
10981
  const data = ` data-vector-filters="${escapeAttr2(JSON.stringify(node.filters))}"`;
10957
10982
  if (filter) {
@@ -10998,7 +11023,7 @@ function vectorDocumentToSvg(doc, options = {}) {
10998
11023
  let out2 = ` stroke="${escapeAttr2(strokeValue)}" stroke-width="${num3(width)}"`;
10999
11024
  if (node.strokeLinecap && node.strokeLinecap !== "butt") out2 += ` stroke-linecap="${node.strokeLinecap}"`;
11000
11025
  if (node.strokeLinejoin && node.strokeLinejoin !== "miter") out2 += ` stroke-linejoin="${node.strokeLinejoin}"`;
11001
- if (_optionalChain([node, 'access', _336 => _336.strokeDasharray, 'optionalAccess', _337 => _337.length])) out2 += ` stroke-dasharray="${node.strokeDasharray.map(num3).join(" ")}"`;
11026
+ if (_optionalChain([node, 'access', _347 => _347.strokeDasharray, 'optionalAccess', _348 => _348.length])) out2 += ` stroke-dasharray="${node.strokeDasharray.map(num3).join(" ")}"`;
11002
11027
  return out2;
11003
11028
  };
11004
11029
  const liveCorners = (node) => {
@@ -11047,7 +11072,7 @@ function vectorDocumentToSvg(doc, options = {}) {
11047
11072
  };
11048
11073
  const emit2 = (node, depth) => {
11049
11074
  if (node.visible === false && !options.includeHidden) return;
11050
- const wrappers = _nullishCoalesce(_optionalChain([options, 'access', _338 => _338.wrap, 'optionalAccess', _339 => _339[node.id]]), () => ( []));
11075
+ const wrappers = _nullishCoalesce(_optionalChain([options, 'access', _349 => _349.wrap, 'optionalAccess', _350 => _350[node.id]]), () => ( []));
11051
11076
  wrappers.forEach((w2, i) => {
11052
11077
  let attrs = w2.id !== void 0 ? ` id="${escapeAttr2(w2.id)}"` : "";
11053
11078
  if (w2.transform) attrs += ` transform="${escapeAttr2(w2.transform)}"`;
@@ -11068,7 +11093,7 @@ function vectorDocumentToSvg(doc, options = {}) {
11068
11093
  };
11069
11094
  const emitMaskGroup = (node, depth) => {
11070
11095
  const [source, ...contents] = node.children;
11071
- const body = _optionalChain([node, 'access', _340 => _340.effects, 'optionalAccess', _341 => _341.length]) && contents.length ? [{ id: `${node.id}~content`, type: "group", effects: node.effects, children: contents }] : contents;
11096
+ const body = _optionalChain([node, 'access', _351 => _351.effects, 'optionalAccess', _352 => _352.length]) && contents.length ? [{ id: `${node.id}~content`, type: "group", effects: node.effects, children: contents }] : contents;
11072
11097
  const settings = { type: node.mask.type, ...node.mask.invert ? { invert: true } : {} };
11073
11098
  lines.push(`${indent(depth)}<g${common(node)} data-vector-mask="${escapeAttr2(JSON.stringify(settings))}">`);
11074
11099
  const mask = vectorMaskRenderData(node, `${prefix}mask-${node.id}`, `${prefix}mask-filter-${node.id}`, precision);
@@ -11085,7 +11110,7 @@ function vectorDocumentToSvg(doc, options = {}) {
11085
11110
  lines.push(`${indent(depth + 1)}<g data-vector-part="mask-source" display="none">`);
11086
11111
  emitNode(source, depth + 2);
11087
11112
  lines.push(`${indent(depth + 1)}</g>`);
11088
- if (_optionalChain([mask, 'optionalAccess', _342 => _342.clip])) {
11113
+ if (_optionalChain([mask, 'optionalAccess', _353 => _353.clip])) {
11089
11114
  defs.push(`<clipPath id="${escapeAttr2(mask.id)}">${mask.clip.map((c) => `<path d="${c.d}" clip-rule="${c.clipRule}"/>`).join("")}</clipPath>`);
11090
11115
  ref = ` clip-path="url(#${escapeAttr2(mask.id)})"`;
11091
11116
  }
@@ -11097,7 +11122,7 @@ function vectorDocumentToSvg(doc, options = {}) {
11097
11122
  };
11098
11123
  const emitTextElement = (node, depth, attrs) => {
11099
11124
  const geometry = vectorTextGeometryNode(node);
11100
- const fields = { text: node.text, font: node.font, ..._optionalChain([node, 'access', _343 => _343.runs, 'optionalAccess', _344 => _344.length]) ? { runs: node.runs } : {}, ...node.paragraph ? { paragraph: node.paragraph } : {}, frame: node.frame, ...node.orientation ? { orientation: node.orientation } : {}, ..._optionalChain([node, 'access', _345 => _345.effects, 'optionalAccess', _346 => _346.length]) ? { effects: node.effects } : {} };
11125
+ const fields = { text: node.text, font: node.font, ..._optionalChain([node, 'access', _354 => _354.runs, 'optionalAccess', _355 => _355.length]) ? { runs: node.runs } : {}, ...node.paragraph ? { paragraph: node.paragraph } : {}, frame: node.frame, ...node.orientation ? { orientation: node.orientation } : {}, ..._optionalChain([node, 'access', _356 => _356.effects, 'optionalAccess', _357 => _357.length]) ? { effects: node.effects } : {} };
11101
11126
  let data = ` data-vector-text="${escapeAttr2(JSON.stringify(fields))}"`;
11102
11127
  if (hasVectorPaintStacks(node)) data += ` data-vector-fills="${escapeAttr2(JSON.stringify(vectorFills(node)))}" data-vector-strokes="${escapeAttr2(JSON.stringify(vectorStrokes(node)))}"`;
11103
11128
  else {
@@ -11139,12 +11164,12 @@ function vectorDocumentToSvg(doc, options = {}) {
11139
11164
  };
11140
11165
  const emitText = (node, depth) => {
11141
11166
  const outlines = vectorTextPaths(node).outlines;
11142
- const effects = !!_optionalChain([node, 'access', _347 => _347.effects, 'optionalAccess', _348 => _348.some, 'call', _349 => _349((e) => e.enabled !== false)]);
11167
+ const effects = !!_optionalChain([node, 'access', _358 => _358.effects, 'optionalAccess', _359 => _359.some, 'call', _360 => _360((e) => e.enabled !== false)]);
11143
11168
  if (!outlines || !effects && options.text !== "outlines") {
11144
11169
  emitTextElement(node, depth, common(node));
11145
11170
  return;
11146
11171
  }
11147
- lines.push(`${indent(depth)}<g${common(node)} data-vector-live="${escapeAttr2(JSON.stringify({ kind: "text", ..._optionalChain([node, 'access', _350 => _350.effects, 'optionalAccess', _351 => _351.length]) ? { effects: node.effects } : {} }))}">`);
11172
+ lines.push(`${indent(depth)}<g${common(node)} data-vector-live="${escapeAttr2(JSON.stringify({ kind: "text", ..._optionalChain([node, 'access', _361 => _361.effects, 'optionalAccess', _362 => _362.length]) ? { effects: node.effects } : {} }))}">`);
11148
11173
  lines.push(`${indent(depth + 1)}<g data-vector-part="appearance">`);
11149
11174
  for (const shape of vectorAppearanceNodes(node)) emit2(shape, depth + 2);
11150
11175
  lines.push(`${indent(depth + 1)}</g>`);
@@ -11158,7 +11183,7 @@ function vectorDocumentToSvg(doc, options = {}) {
11158
11183
  const symbolRef = (symbolId) => {
11159
11184
  const hit = symbolIds.get(symbolId);
11160
11185
  if (hit) return hit;
11161
- const sym2 = _optionalChain([doc, 'access', _352 => _352.symbols, 'optionalAccess', _353 => _353.find, 'call', _354 => _354((x) => x.id === symbolId)]);
11186
+ const sym2 = _optionalChain([doc, 'access', _363 => _363.symbols, 'optionalAccess', _364 => _364.find, 'call', _365 => _365((x) => x.id === symbolId)]);
11162
11187
  if (!sym2) return null;
11163
11188
  const id = `${prefix}symbol-${symbolId}`;
11164
11189
  symbolIds.set(symbolId, id);
@@ -11168,20 +11193,20 @@ function vectorDocumentToSvg(doc, options = {}) {
11168
11193
  };
11169
11194
  const emitInstance = (node, depth) => {
11170
11195
  const data = { symbolId: node.symbolId, ...node.scaleStrokes === false ? { scaleStrokes: false } : {}, ...node.overrides ? { overrides: node.overrides } : {} };
11171
- const exact2 = !node.overrides && node.scaleStrokes !== false && !_optionalChain([node, 'access', _355 => _355.effects, 'optionalAccess', _356 => _356.length]) && !_optionalChain([node, 'access', _357 => _357.filters, 'optionalAccess', _358 => _358.length]);
11196
+ const exact2 = !node.overrides && node.scaleStrokes !== false && !_optionalChain([node, 'access', _366 => _366.effects, 'optionalAccess', _367 => _367.length]) && !_optionalChain([node, 'access', _368 => _368.filters, 'optionalAccess', _369 => _369.length]);
11172
11197
  const ref = symbolRef(node.symbolId);
11173
11198
  if (exact2 && ref) {
11174
11199
  lines.push(`${indent(depth)}<use${common(node)} href="#${escapeAttr2(ref)}" data-vector-instance="${escapeAttr2(JSON.stringify(data))}"/>`);
11175
11200
  return;
11176
11201
  }
11177
- const full = { ...data, ...node.transform ? { transform: node.transform } : {}, ..._optionalChain([node, 'access', _359 => _359.effects, 'optionalAccess', _360 => _360.length]) ? { effects: node.effects } : {} };
11202
+ const full = { ...data, ...node.transform ? { transform: node.transform } : {}, ..._optionalChain([node, 'access', _370 => _370.effects, 'optionalAccess', _371 => _371.length]) ? { effects: node.effects } : {} };
11178
11203
  lines.push(`${indent(depth)}<g data-vector-instance="${escapeAttr2(JSON.stringify(full))}">`);
11179
11204
  emitNode(vectorInstanceDrawn(node), depth + 1);
11180
11205
  lines.push(`${indent(depth)}</g>`);
11181
11206
  };
11182
11207
  const emitFrame = (node, depth) => {
11183
11208
  const f = node.frame;
11184
- const data = { ...f, ..._optionalChain([node, 'access', _361 => _361.effects, 'optionalAccess', _362 => _362.length]) ? { effects: node.effects } : {} };
11209
+ const data = { ...f, ..._optionalChain([node, 'access', _372 => _372.effects, 'optionalAccess', _373 => _373.length]) ? { effects: node.effects } : {} };
11185
11210
  lines.push(`${indent(depth)}<g${common(node)} data-vector-frame="${escapeAttr2(JSON.stringify(data))}">`);
11186
11211
  const rect = vectorFrameRectPath(f);
11187
11212
  if (f.fill !== void 0 && f.fill !== null && f.fill !== "none") {
@@ -11196,7 +11221,7 @@ function vectorDocumentToSvg(doc, options = {}) {
11196
11221
  ref = ` clip-path="url(#${escapeAttr2(id)})"`;
11197
11222
  }
11198
11223
  lines.push(`${indent(depth + 1)}<g data-vector-part="frame-contents"${ref}>`);
11199
- if (_optionalChain([node, 'access', _363 => _363.masterArt, 'optionalAccess', _364 => _364.length])) {
11224
+ if (_optionalChain([node, 'access', _374 => _374.masterArt, 'optionalAccess', _375 => _375.length])) {
11200
11225
  lines.push(`${indent(depth + 2)}<g data-vector-part="frame-master">`);
11201
11226
  for (const child of node.masterArt) emit2(child, depth + 3);
11202
11227
  lines.push(`${indent(depth + 2)}</g>`);
@@ -11225,7 +11250,7 @@ function vectorDocumentToSvg(doc, options = {}) {
11225
11250
  if (hasOwnVectorAppearance(node)) {
11226
11251
  const live2 = {
11227
11252
  kind: node.type,
11228
- ..._optionalChain([node, 'access', _365 => _365.effects, 'optionalAccess', _366 => _366.length]) ? { effects: node.effects } : {},
11253
+ ..._optionalChain([node, 'access', _376 => _376.effects, 'optionalAccess', _377 => _377.length]) ? { effects: node.effects } : {},
11229
11254
  ...node.type === "group" && node.liveBoolean ? { liveBoolean: node.liveBoolean } : {},
11230
11255
  ...node.type === "group" && node.symmetry ? { symmetry: node.symmetry } : {}
11231
11256
  };
@@ -11276,7 +11301,7 @@ function vectorDocumentToSvg(doc, options = {}) {
11276
11301
  data += ` data-vector-width-profile="${widthProfileToAttribute(profile)}"`;
11277
11302
  if (node.strokeLinecap && node.strokeLinecap !== "butt") data += ` data-vector-stroke-linecap="${node.strokeLinecap}"`;
11278
11303
  if (node.strokeLinejoin && node.strokeLinejoin !== "miter") data += ` data-vector-stroke-linejoin="${node.strokeLinejoin}"`;
11279
- if (_optionalChain([node, 'access', _367 => _367.strokeDasharray, 'optionalAccess', _368 => _368.length])) data += ` data-vector-stroke-dasharray="${node.strokeDasharray.map(num3).join(" ")}"`;
11304
+ if (_optionalChain([node, 'access', _378 => _378.strokeDasharray, 'optionalAccess', _379 => _379.length])) data += ` data-vector-stroke-dasharray="${node.strokeDasharray.map(num3).join(" ")}"`;
11280
11305
  }
11281
11306
  lines.push(`${indent(depth)}<g${common(node)}${data}>`);
11282
11307
  lines.push(`${indent(depth + 1)}<path data-vector-part="fill" d="${d}"${fillAttrs}${live}/>`);
@@ -11457,7 +11482,7 @@ function readStyle(el, parent, cssRules) {
11457
11482
  const { mixBlendMode: _m, filter: _f, ...inherited } = parent;
11458
11483
  const out = { ...inherited };
11459
11484
  for (const [attr, key] of Object.entries(STYLE_KEYS)) if (el.attrs[attr] !== void 0) out[key] = el.attrs[attr].trim();
11460
- if (_optionalChain([cssRules, 'optionalAccess', _369 => _369.length])) {
11485
+ if (_optionalChain([cssRules, 'optionalAccess', _380 => _380.length])) {
11461
11486
  for (const rule of cssRules) {
11462
11487
  if (matchesSelector(el, rule.selector)) {
11463
11488
  for (const [prop, val] of Object.entries(rule.properties)) {
@@ -11513,7 +11538,7 @@ function attrOrStyle(el, name) {
11513
11538
  return el.attrs[name];
11514
11539
  }
11515
11540
  function urlId(value) {
11516
- return _nullishCoalesce(_optionalChain([/^url\(\s*['"]?#([^'")\s]+)['"]?\s*\)/, 'access', _370 => _370.exec, 'call', _371 => _371((_nullishCoalesce(value, () => ( ""))).trim()), 'optionalAccess', _372 => _372[1]]), () => ( null));
11541
+ return _nullishCoalesce(_optionalChain([/^url\(\s*['"]?#([^'")\s]+)['"]?\s*\)/, 'access', _381 => _381.exec, 'call', _382 => _382((_nullishCoalesce(value, () => ( ""))).trim()), 'optionalAccess', _383 => _383[1]]), () => ( null));
11517
11542
  }
11518
11543
  function clipRulesAsFillRules(el) {
11519
11544
  const attrs = { ...el.attrs };
@@ -11578,9 +11603,9 @@ function resolveGradient(id, raw) {
11578
11603
  for (let el = first; el && !chain.includes(el) && chain.length < 32; ) {
11579
11604
  chain.push(el);
11580
11605
  const href = _nullishCoalesce(el.attrs.href, () => ( el.attrs["xlink:href"]));
11581
- el = _optionalChain([href, 'optionalAccess', _373 => _373.startsWith, 'call', _374 => _374("#")]) ? raw.get(href.slice(1)) : void 0;
11606
+ el = _optionalChain([href, 'optionalAccess', _384 => _384.startsWith, 'call', _385 => _385("#")]) ? raw.get(href.slice(1)) : void 0;
11582
11607
  }
11583
- const attr = (name) => _optionalChain([chain, 'access', _375 => _375.find, 'call', _376 => _376((el) => el.attrs[name] !== void 0), 'optionalAccess', _377 => _377.attrs, 'access', _378 => _378[name]]);
11608
+ const attr = (name) => _optionalChain([chain, 'access', _386 => _386.find, 'call', _387 => _387((el) => el.attrs[name] !== void 0), 'optionalAccess', _388 => _388.attrs, 'access', _389 => _389[name]]);
11584
11609
  const stops = _nullishCoalesce(chain.map(readStops).find((s) => s.length), () => ( []));
11585
11610
  if (!stops.length) return null;
11586
11611
  const user = attr("gradientUnits") === "userSpaceOnUse";
@@ -11752,7 +11777,7 @@ function parseVectorSvg(svg, options = {}) {
11752
11777
  const stackedPath = (g, _style, m, meta) => {
11753
11778
  const fillEl = g.children.find((c) => c.name === "path" && c.attrs["data-vector-part"] === "fill");
11754
11779
  const subpaths = fillEl ? shapeOf(fillEl) : null;
11755
- if (!_optionalChain([subpaths, 'optionalAccess', _379 => _379.length])) return null;
11780
+ if (!_optionalChain([subpaths, 'optionalAccess', _390 => _390.length])) return null;
11756
11781
  const parse = (v2) => {
11757
11782
  try {
11758
11783
  return v2 ? JSON.parse(v2) : [];
@@ -11771,7 +11796,7 @@ function parseVectorSvg(svg, options = {}) {
11771
11796
  const key = (n) => JSON.stringify([n.subpaths, _nullishCoalesce(n.transform, () => ( null)), _nullishCoalesce(n.opacity, () => ( 1)), n.visible !== false, _nullishCoalesce(n.filters, () => ( null)), _nullishCoalesce(n.blendMode, () => ( "normal")), _nullishCoalesce(n.fillRule, () => ( "nonzero")), _nullishCoalesce(n.booleanOperation, () => ( null))]);
11772
11797
  for (const n of nodes2) {
11773
11798
  const prev = out[out.length - 1];
11774
- if (_optionalChain([prev, 'optionalAccess', _380 => _380.type]) === "path" && n.type === "path" && key(prev) === key(n)) {
11799
+ if (_optionalChain([prev, 'optionalAccess', _391 => _391.type]) === "path" && n.type === "path" && key(prev) === key(n)) {
11775
11800
  const fills = vectorFills(n);
11776
11801
  const strokesBefore = vectorStrokes(prev);
11777
11802
  if (!(fills.length && strokesBefore.length)) {
@@ -11789,7 +11814,7 @@ function parseVectorSvg(svg, options = {}) {
11789
11814
  const part = (name) => g.children.find((c) => c.name === "path" && c.attrs["data-vector-part"] === name);
11790
11815
  const fillEl = part("fill");
11791
11816
  const subpaths = fillEl ? shapeOf(fillEl) : null;
11792
- if (!fillEl || !_optionalChain([subpaths, 'optionalAccess', _381 => _381.length])) return null;
11817
+ if (!fillEl || !_optionalChain([subpaths, 'optionalAccess', _392 => _392.length])) return null;
11793
11818
  const a = g.attrs;
11794
11819
  const fs = readStyle(fillEl, style, styleRules);
11795
11820
  const strokeEl = part("stroke");
@@ -11826,7 +11851,7 @@ function parseVectorSvg(svg, options = {}) {
11826
11851
  ...profile.length ? { strokeWidthProfile: profile } : {},
11827
11852
  ...keptCap ? { strokeLinecap: keptCap } : {},
11828
11853
  ...keptJoin ? { strokeLinejoin: keptJoin } : {},
11829
- ..._optionalChain([keptDash, 'optionalAccess', _382 => _382.length]) ? { strokeDasharray: keptDash } : {}
11854
+ ..._optionalChain([keptDash, 'optionalAccess', _393 => _393.length]) ? { strokeDasharray: keptDash } : {}
11830
11855
  };
11831
11856
  return placed(node, m);
11832
11857
  };
@@ -11891,8 +11916,8 @@ function parseVectorSvg(svg, options = {}) {
11891
11916
  } else {
11892
11917
  const fill = json2(g.attrs["data-vector-fill"]);
11893
11918
  const stroke = json2(g.attrs["data-vector-stroke"]);
11894
- node.fill = fill == null ? null : _nullishCoalesce(_optionalChain([sanitizeVectorFills, 'call', _383 => _383([{ paint: fill }]), 'access', _384 => _384[0], 'optionalAccess', _385 => _385.paint]), () => ( null));
11895
- node.stroke = stroke == null ? null : _nullishCoalesce(_optionalChain([sanitizeVectorFills, 'call', _386 => _386([{ paint: stroke }]), 'access', _387 => _387[0], 'optionalAccess', _388 => _388.paint]), () => ( null));
11919
+ node.fill = fill == null ? null : _nullishCoalesce(_optionalChain([sanitizeVectorFills, 'call', _394 => _394([{ paint: fill }]), 'access', _395 => _395[0], 'optionalAccess', _396 => _396.paint]), () => ( null));
11920
+ node.stroke = stroke == null ? null : _nullishCoalesce(_optionalChain([sanitizeVectorFills, 'call', _397 => _397([{ paint: stroke }]), 'access', _398 => _398[0], 'optionalAccess', _399 => _399.paint]), () => ( null));
11896
11921
  const settings = json2(g.attrs["data-vector-stroke-settings"]);
11897
11922
  if (settings && typeof settings === "object") {
11898
11923
  const strokes = sanitizeVectorStrokes([{ paint: _nullishCoalesce(node.stroke, () => ( "#000")), ...settings }]);
@@ -11928,8 +11953,8 @@ function parseVectorSvg(svg, options = {}) {
11928
11953
  const anchor = attrOrStyle(el, "text-anchor");
11929
11954
  const first0 = (v2) => _nullishCoalesce(numberList(v2)[0], () => ( 0));
11930
11955
  const tspan = el.children.find((c) => c.name === "tspan");
11931
- const x = el.attrs.x !== void 0 ? first0(el.attrs.x) : first0(_optionalChain([tspan, 'optionalAccess', _389 => _389.attrs, 'access', _390 => _390.x]));
11932
- const y = el.attrs.y !== void 0 ? first0(el.attrs.y) : first0(_optionalChain([tspan, 'optionalAccess', _391 => _391.attrs, 'access', _392 => _392.y]));
11956
+ const x = el.attrs.x !== void 0 ? first0(el.attrs.x) : first0(_optionalChain([tspan, 'optionalAccess', _400 => _400.attrs, 'access', _401 => _401.x]));
11957
+ const y = el.attrs.y !== void 0 ? first0(el.attrs.y) : first0(_optionalChain([tspan, 'optionalAccess', _402 => _402.attrs, 'access', _403 => _403.y]));
11933
11958
  const fillValue = _nullishCoalesce(attrOrStyle(el, "fill"), () => ( style.fill));
11934
11959
  let node = {
11935
11960
  id: idFor(el),
@@ -11960,12 +11985,12 @@ function parseVectorSvg(svg, options = {}) {
11960
11985
  if (symbolOfElement.has(el)) return symbolOfElement.get(el);
11961
11986
  symbolOfElement.set(el, null);
11962
11987
  const own = json2(el.attrs["data-vector-symbol"]);
11963
- let id = typeof _optionalChain([own, 'optionalAccess', _393 => _393.id]) === "string" && own.id ? own.id : _nullishCoalesce(el.attrs.id, () => ( createId()));
11988
+ let id = typeof _optionalChain([own, 'optionalAccess', _404 => _404.id]) === "string" && own.id ? own.id : _nullishCoalesce(el.attrs.id, () => ( createId()));
11964
11989
  while (usedSymbolIds.has(id)) id = `${id}-${usedSymbolIds.size}`;
11965
11990
  usedSymbolIds.add(id);
11966
11991
  const style = readStyle(el, rootStyle, styleRules);
11967
11992
  const nodes2 = el.name === "symbol" ? visit2(el, style, IDENTITY_MATRIX) : visitOne({ ...el, attrs: { ...el.attrs, transform: "" } }, rootStyle, parseSvgTransform(el.attrs.transform));
11968
- symbols.push({ id, name: typeof _optionalChain([own, 'optionalAccess', _394 => _394.name]) === "string" && own.name ? own.name : _nullishCoalesce(el.attrs.id, () => ( "Symbol")), nodes: nodes2 });
11993
+ symbols.push({ id, name: typeof _optionalChain([own, 'optionalAccess', _405 => _405.name]) === "string" && own.name ? own.name : _nullishCoalesce(el.attrs.id, () => ( "Symbol")), nodes: nodes2 });
11969
11994
  symbolOfElement.set(el, id);
11970
11995
  return id;
11971
11996
  };
@@ -11977,13 +12002,13 @@ function parseVectorSvg(svg, options = {}) {
11977
12002
  if (!symbolId) return null;
11978
12003
  const own = json2(el.attrs["data-vector-instance"]);
11979
12004
  const place3 = multiplyMatrices(translateMatrix(length(el.attrs.x), length(el.attrs.y)), m);
11980
- const node = { id: idFor(el), type: "instance", ...meta, symbolId, ..._optionalChain([own, 'optionalAccess', _395 => _395.scaleStrokes]) === false ? { scaleStrokes: false } : {}, ..._optionalChain([own, 'optionalAccess', _396 => _396.overrides]) ? { overrides: own.overrides } : {} };
12005
+ const node = { id: idFor(el), type: "instance", ...meta, symbolId, ..._optionalChain([own, 'optionalAccess', _406 => _406.scaleStrokes]) === false ? { scaleStrokes: false } : {}, ..._optionalChain([own, 'optionalAccess', _407 => _407.overrides]) ? { overrides: own.overrides } : {} };
11981
12006
  return isIdentityMatrix(place3) ? node : { ...node, transform: place3 };
11982
12007
  };
11983
12008
  const ownInstance = (g, m, meta) => {
11984
12009
  const raw = json2(g.attrs["data-vector-instance"]);
11985
12010
  if (!raw || typeof raw.symbolId !== "string") return null;
11986
- const sym2 = [...byId.values()].find((e) => e.name === "symbol" && _optionalChain([json2, 'call', _397 => _397(e.attrs["data-vector-symbol"]), 'optionalAccess', _398 => _398.id]) === raw.symbolId);
12011
+ const sym2 = [...byId.values()].find((e) => e.name === "symbol" && _optionalChain([json2, 'call', _408 => _408(e.attrs["data-vector-symbol"]), 'optionalAccess', _409 => _409.id]) === raw.symbolId);
11987
12012
  const symbolId = sym2 ? symbolFor(sym2) : raw.symbolId;
11988
12013
  if (!symbolId) return null;
11989
12014
  const t = Array.isArray(raw.transform) && raw.transform.length === 6 && raw.transform.every(Number.isFinite) ? raw.transform : IDENTITY_MATRIX;
@@ -11991,7 +12016,7 @@ function parseVectorSvg(svg, options = {}) {
11991
12016
  const drawn = g.children.find((c) => c.name === "g");
11992
12017
  const effects = sanitizeVectorEffects(raw.effects);
11993
12018
  const node = {
11994
- id: _nullishCoalesce(_optionalChain([drawn, 'optionalAccess', _399 => _399.attrs, 'access', _400 => _400.id]), () => ( idFor(g))),
12019
+ id: _nullishCoalesce(_optionalChain([drawn, 'optionalAccess', _410 => _410.attrs, 'access', _411 => _411.id]), () => ( idFor(g))),
11995
12020
  type: "instance",
11996
12021
  ...meta,
11997
12022
  symbolId,
@@ -12048,12 +12073,12 @@ function parseVectorSvg(svg, options = {}) {
12048
12073
  const masked = (el, nodes2, m) => {
12049
12074
  let out = nodes2;
12050
12075
  const clipEl = rawMasks.get(_nullishCoalesce(urlId(attrOrStyle(el, "clip-path")), () => ( "")));
12051
- if (_optionalChain([clipEl, 'optionalAccess', _401 => _401.name]) === "clipPath") {
12076
+ if (_optionalChain([clipEl, 'optionalAccess', _412 => _412.name]) === "clipPath") {
12052
12077
  const source = maskNode(clipEl, m, out, clipEl.attrs.clipPathUnits);
12053
12078
  if (source) out = [{ id: idFor({ name: "g", attrs: {}, children: [] }), type: "group", name: "Clip Group", mask: { type: "clip" }, children: [source, ...out] }];
12054
12079
  }
12055
12080
  const maskEl = rawMasks.get(_nullishCoalesce(urlId(attrOrStyle(el, "mask")), () => ( "")));
12056
- if (_optionalChain([maskEl, 'optionalAccess', _402 => _402.name]) === "mask") {
12081
+ if (_optionalChain([maskEl, 'optionalAccess', _413 => _413.name]) === "mask") {
12057
12082
  const source = maskNode(maskEl, m, out, maskEl.attrs.maskContentUnits);
12058
12083
  const type = attrOrStyle(maskEl, "mask-type") === "alpha" ? "alpha" : "luminance";
12059
12084
  if (source) out = [{ id: idFor({ name: "g", attrs: {}, children: [] }), type: "group", name: "Opacity Mask", mask: { type }, children: [source, ...out] }];
@@ -12075,19 +12100,19 @@ function parseVectorSvg(svg, options = {}) {
12075
12100
  let sourceEl = part("mask-source");
12076
12101
  if (!sourceEl) {
12077
12102
  const el = rawMasks.get(_nullishCoalesce(urlId(maskedEl.attrs.mask), () => ( "")));
12078
- const invert2 = _optionalChain([el, 'optionalAccess', _403 => _403.children, 'access', _404 => _404.find, 'call', _405 => _405((c) => c.name === "g" && c.attrs["data-vector-part"] === "mask-invert")]);
12103
+ const invert2 = _optionalChain([el, 'optionalAccess', _414 => _414.children, 'access', _415 => _415.find, 'call', _416 => _416((c) => c.name === "g" && c.attrs["data-vector-part"] === "mask-invert")]);
12079
12104
  sourceEl = _nullishCoalesce(invert2, () => ( el));
12080
12105
  }
12081
12106
  const source = sourceEl ? visit2(sourceEl, style, m)[0] : void 0;
12082
12107
  let contents = visit2(maskedEl, style, m);
12083
12108
  let effects;
12084
12109
  const wrapper = contents.length === 1 && contents[0].type === "group" && contents[0].id === `${id}~content` ? contents[0] : null;
12085
- if (_optionalChain([wrapper, 'optionalAccess', _406 => _406.type]) === "group") {
12110
+ if (_optionalChain([wrapper, 'optionalAccess', _417 => _417.type]) === "group") {
12086
12111
  effects = _nullishCoalesce(wrapper.effects, () => ( void 0));
12087
12112
  contents = wrapper.children;
12088
12113
  }
12089
12114
  if (!source) return contents.length ? { id, type: "group", ...meta, children: contents } : null;
12090
- return { id, type: "group", ...meta, mask, ..._optionalChain([effects, 'optionalAccess', _407 => _407.length]) ? { effects } : {}, children: [source, ...contents] };
12115
+ return { id, type: "group", ...meta, mask, ..._optionalChain([effects, 'optionalAccess', _418 => _418.length]) ? { effects } : {}, children: [source, ...contents] };
12091
12116
  };
12092
12117
  const frameGroup = (g, style, m, meta) => {
12093
12118
  const raw = parseJson(g.attrs["data-vector-frame"]);
@@ -12099,7 +12124,7 @@ function parseVectorSvg(svg, options = {}) {
12099
12124
  const { rigid, residual } = decomposeRigid(m);
12100
12125
  const r = _chunkGF2RBSDMcjs.bezierPathBounds.call(void 0, _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, subpathsToBezier(vectorFrameRectPath(frame)), residual));
12101
12126
  const back = invertMatrix(rigid);
12102
- const effects = sanitizeVectorEffects(_optionalChain([raw, 'optionalAccess', _408 => _408.effects]));
12127
+ const effects = sanitizeVectorEffects(_optionalChain([raw, 'optionalAccess', _419 => _419.effects]));
12103
12128
  return {
12104
12129
  id,
12105
12130
  type: "group",
@@ -12571,13 +12596,13 @@ function hitTestVectorNode(node, p, tolerance = 0, parent = IDENTITY_MATRIX, opt
12571
12596
  }
12572
12597
  if (isVectorMaskGroup(node)) {
12573
12598
  const m = multiplyMatrices(nodeMatrix(node), parent);
12574
- const entered = !!_optionalChain([options, 'access', _409 => _409.entered, 'optionalAccess', _410 => _410.has, 'call', _411 => _411(node.id)]);
12599
+ const entered = !!_optionalChain([options, 'access', _420 => _420.entered, 'optionalAccess', _421 => _421.has, 'call', _422 => _422(node.id)]);
12575
12600
  if (!entered && isVectorMaskActive(node) && !vectorMaskContains(node, applyMatrix(invertMatrix(m), p), tolerance)) return false;
12576
12601
  const shown = !entered && hasOwnVectorAppearance(node) ? expandVectorAppearance(node).children : node.children;
12577
12602
  for (let i = shown.length - 1; i >= 1; i--) if (hitTestVectorNode(shown[i], p, tolerance, m, options)) return true;
12578
12603
  return entered && hitTestVectorMaskSource(node, p, tolerance, m, options);
12579
12604
  }
12580
- if (!(node.type === "group" && (!hasOwnVectorAppearance(node) || _optionalChain([options, 'access', _412 => _412.entered, 'optionalAccess', _413 => _413.has, 'call', _414 => _414(node.id)])))) node = expandVectorAppearance(node);
12605
+ if (!(node.type === "group" && (!hasOwnVectorAppearance(node) || _optionalChain([options, 'access', _423 => _423.entered, 'optionalAccess', _424 => _424.has, 'call', _425 => _425(node.id)])))) node = expandVectorAppearance(node);
12581
12606
  if (node.type === "group") {
12582
12607
  const m = multiplyMatrices(nodeMatrix(node), parent);
12583
12608
  return node.children.some((c) => hitTestVectorNode(c, p, tolerance, m, options));
@@ -12589,7 +12614,7 @@ function hitTestVectorNode(node, p, tolerance = 0, parent = IDENTITY_MATRIX, opt
12589
12614
  function hitTestVectorMaskSource(group, p, tolerance, m, options) {
12590
12615
  const source = group.children[0];
12591
12616
  if (source.visible === false) return false;
12592
- if (_optionalChain([group, 'access', _415 => _415.mask, 'optionalAccess', _416 => _416.type]) !== "clip") return hitTestVectorNode(source, p, tolerance, m, options);
12617
+ if (_optionalChain([group, 'access', _426 => _426.mask, 'optionalAccess', _427 => _427.type]) !== "clip") return hitTestVectorNode(source, p, tolerance, m, options);
12593
12618
  const paths = collectPathNodes(source).filter((n) => n.visible !== false);
12594
12619
  const pt2 = [p.x, p.y];
12595
12620
  return paths.some((n) => {
@@ -12638,24 +12663,24 @@ function mapAnchor(a, m) {
12638
12663
  }
12639
12664
  function bakeIntoGeometry(node, m) {
12640
12665
  if (isIdentityMatrix(m)) return node;
12641
- if (_optionalChain([node, 'access', _417 => _417.effects, 'optionalAccess', _418 => _418.length])) node = { ...node, effects: transformVectorEffects(node.effects, m, node) };
12666
+ if (_optionalChain([node, 'access', _428 => _428.effects, 'optionalAccess', _429 => _429.length])) node = { ...node, effects: transformVectorEffects(node.effects, m, node) };
12642
12667
  if (isVectorFrame(node)) return bakeFrame(node, m);
12643
12668
  if (node.type === "group") {
12644
12669
  const group = node;
12645
12670
  const children = group.children.map((c) => transformVectorNode(c, m));
12646
12671
  const sym2 = group.symmetry ? { symmetry: transformVectorSymmetry(group.symmetry, m) } : {};
12647
- const spine = _optionalChain([group, 'access', _419 => _419.blend, 'optionalAccess', _420 => _420.spine]);
12672
+ const spine = _optionalChain([group, 'access', _430 => _430.blend, 'optionalAccess', _431 => _431.spine]);
12648
12673
  if (!spine) return { ...group, ...sym2, children };
12649
12674
  const moved = { closed: spine.closed, anchors: spine.anchors.map((a) => mapAnchor(a, m)) };
12650
12675
  return { ...group, children, blend: { ...group.blend, spine: moved } };
12651
12676
  }
12652
12677
  const path = node.type === "text" ? bakeVectorTextGeometry(node, m) : node;
12653
12678
  const flips = m[0] * m[3] - m[1] * m[2] < 0;
12654
- const mirrored = flips && _optionalChain([path, 'access', _421 => _421.strokeWidthProfile, 'optionalAccess', _422 => _422.length]);
12679
+ const mirrored = flips && _optionalChain([path, 'access', _432 => _432.strokeWidthProfile, 'optionalAccess', _433 => _433.length]);
12655
12680
  const layer = (l) => ({
12656
12681
  ...l,
12657
12682
  ...isVectorGradient(l.paint) || isVectorShadedPaint(l.paint) ? { paint: transformVectorPaint(l.paint, m) } : {},
12658
- ...flips && _optionalChain([l, 'access', _423 => _423.strokeWidthProfile, 'optionalAccess', _424 => _424.length]) ? { strokeWidthProfile: mirrorWidthProfile(l.strokeWidthProfile) } : {}
12683
+ ...flips && _optionalChain([l, 'access', _434 => _434.strokeWidthProfile, 'optionalAccess', _435 => _435.length]) ? { strokeWidthProfile: mirrorWidthProfile(l.strokeWidthProfile) } : {}
12659
12684
  });
12660
12685
  return {
12661
12686
  ...path,
@@ -12890,7 +12915,7 @@ function roundSubpaths(subpaths, precision = 3) {
12890
12915
 
12891
12916
  // src/vector/symmetry.ts
12892
12917
  function isVectorSymmetryGroup(node) {
12893
- return _optionalChain([node, 'optionalAccess', _425 => _425.type]) === "group" && !!node.symmetry && !node.blend && !node.liveBoolean && !node.mask && !node.frame;
12918
+ return _optionalChain([node, 'optionalAccess', _436 => _436.type]) === "group" && !!node.symmetry && !node.blend && !node.liveBoolean && !node.mask && !node.frame;
12894
12919
  }
12895
12920
  var rad = (deg) => deg * Math.PI / 180;
12896
12921
  var exact = (v2) => Math.abs(v2) < 1e-12 ? 0 : v2;