@pixerate/editor 0.134.0 → 0.136.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 (113) hide show
  1. package/dist/animation-editor/index.cjs +58 -55
  2. package/dist/animation-editor/index.cjs.map +1 -1
  3. package/dist/animation-editor/index.d.cts +8 -5
  4. package/dist/animation-editor/index.d.ts +8 -5
  5. package/dist/animation-editor/index.js +5 -2
  6. package/dist/animation-editor/index.js.map +1 -1
  7. package/dist/{bezier-J8i4uqSH.d.cts → bezier-CdccFsF8.d.cts} +1 -1
  8. package/dist/{bezier-lNEOp0Jx.d.ts → bezier-DG9qNZQV.d.ts} +1 -1
  9. package/dist/canvas/index.d.cts +10 -7
  10. package/dist/canvas/index.d.ts +10 -7
  11. package/dist/{chunk-Z2H7KECK.cjs → chunk-2R3UW57U.cjs} +13 -2
  12. package/dist/chunk-2R3UW57U.cjs.map +1 -0
  13. package/dist/{chunk-ESIWZMMK.js → chunk-6QQR4LKE.js} +2 -2
  14. package/dist/chunk-A3BVTI3G.js +150 -0
  15. package/dist/chunk-A3BVTI3G.js.map +1 -0
  16. package/dist/{chunk-T6TV6HY6.cjs → chunk-B2CUCM7Y.cjs} +36 -36
  17. package/dist/{chunk-T6TV6HY6.cjs.map → chunk-B2CUCM7Y.cjs.map} +1 -1
  18. package/dist/chunk-ECCXGELC.cjs +727 -0
  19. package/dist/chunk-ECCXGELC.cjs.map +1 -0
  20. package/dist/{chunk-OXSV64JX.js → chunk-G6IKY6PL.js} +4 -4
  21. package/dist/chunk-I52DRGGJ.js +727 -0
  22. package/dist/chunk-I52DRGGJ.js.map +1 -0
  23. package/dist/{chunk-6CTZAGZ2.js → chunk-ILYFOJUN.js} +56 -1
  24. package/dist/chunk-ILYFOJUN.js.map +1 -0
  25. package/dist/{chunk-YAFS2QFZ.cjs → chunk-JLGNZMUV.cjs} +82 -82
  26. package/dist/{chunk-YAFS2QFZ.cjs.map → chunk-JLGNZMUV.cjs.map} +1 -1
  27. package/dist/{chunk-7RJ6P7MI.js → chunk-KZXLZCQ7.js} +2 -2
  28. package/dist/{chunk-HHTCDFZC.js → chunk-MAHQC3SK.js} +13 -2
  29. package/dist/chunk-MAHQC3SK.js.map +1 -0
  30. package/dist/{chunk-FWEO3HSL.js → chunk-PQQF5KOW.js} +8 -8
  31. package/dist/chunk-Q6OUXEK3.cjs +150 -0
  32. package/dist/chunk-Q6OUXEK3.cjs.map +1 -0
  33. package/dist/{chunk-P3RQ5UJE.cjs → chunk-UTQKC66X.cjs} +4 -4
  34. package/dist/{chunk-P3RQ5UJE.cjs.map → chunk-UTQKC66X.cjs.map} +1 -1
  35. package/dist/{chunk-J3B45HTA.cjs → chunk-XB25WOC2.cjs} +6 -6
  36. package/dist/{chunk-J3B45HTA.cjs.map → chunk-XB25WOC2.cjs.map} +1 -1
  37. package/dist/{chunk-NVTHUPJ6.cjs → chunk-YT3JL7YM.cjs} +71 -16
  38. package/dist/chunk-YT3JL7YM.cjs.map +1 -0
  39. package/dist/effects/index.d.cts +7 -4
  40. package/dist/effects/index.d.ts +7 -4
  41. package/dist/{export-BGdT02aL.d.cts → export-BOheWw2R.d.cts} +13 -5
  42. package/dist/{export-Dng22YB8.d.ts → export-ByKKIA2S.d.ts} +13 -5
  43. package/dist/{export-KzubBKo7.d.cts → export-CEYeRQXH.d.cts} +1 -1
  44. package/dist/{export-DMeG6E06.d.ts → export-Ds7zgGD8.d.ts} +1 -1
  45. package/dist/extensions/index.cjs +3 -3
  46. package/dist/extensions/index.cjs.map +1 -1
  47. package/dist/extensions/index.js +2 -2
  48. package/dist/generation/index.cjs +150 -945
  49. package/dist/generation/index.cjs.map +1 -1
  50. package/dist/generation/index.d.cts +3 -423
  51. package/dist/generation/index.d.ts +3 -423
  52. package/dist/generation/index.js +59 -854
  53. package/dist/generation/index.js.map +1 -1
  54. package/dist/grammar/index.cjs +3 -3
  55. package/dist/grammar/index.cjs.map +1 -1
  56. package/dist/grammar/index.js +2 -2
  57. package/dist/{helpers-Coa4e2j_.d.ts → helpers--ns3W2D7.d.ts} +7 -1
  58. package/dist/{helpers-DHl28yLO.d.cts → helpers-BVkU4oUi.d.cts} +7 -1
  59. package/dist/image-editor/index.cjs +742 -647
  60. package/dist/image-editor/index.cjs.map +1 -1
  61. package/dist/image-editor/index.d.cts +29 -11
  62. package/dist/image-editor/index.d.ts +29 -11
  63. package/dist/image-editor/index.js +107 -12
  64. package/dist/image-editor/index.js.map +1 -1
  65. package/dist/index.cjs +28 -28
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.js +36 -36
  68. package/dist/{opentype-Dfcx6wFx.d.ts → opentype-DfoVYgmG.d.ts} +1 -1
  69. package/dist/{opentype-BWR7Qv8W.d.cts → opentype-yi-Kz4ND.d.cts} +1 -1
  70. package/dist/paint/index.cjs +10 -2
  71. package/dist/paint/index.cjs.map +1 -1
  72. package/dist/paint/index.d.cts +2 -2
  73. package/dist/paint/index.d.ts +2 -2
  74. package/dist/paint/index.js +9 -1
  75. package/dist/paint-editor/index.cjs +10 -7
  76. package/dist/paint-editor/index.cjs.map +1 -1
  77. package/dist/paint-editor/index.d.cts +10 -7
  78. package/dist/paint-editor/index.d.ts +10 -7
  79. package/dist/paint-editor/index.js +5 -2
  80. package/dist/paint-editor/index.js.map +1 -1
  81. package/dist/{pathfinder-D8KQ6blQ.d.cts → pathfinder-7JkMwYvC.d.cts} +1 -1
  82. package/dist/{pathfinder-Celbi3e6.d.ts → pathfinder-GM3UWdBZ.d.ts} +1 -1
  83. package/dist/{pool-BfuxBKTd.d.cts → pool-04qp8iW4.d.cts} +1 -1
  84. package/dist/{pool-8JZGWHvR.d.ts → pool-CkTxlLMC.d.ts} +1 -1
  85. package/dist/provenance-DmlcgdzT.d.cts +426 -0
  86. package/dist/provenance-uh5r2TQ8.d.ts +426 -0
  87. package/dist/{rand-BaqEOs1Y.d.ts → rand-BszBST4s.d.ts} +31 -1
  88. package/dist/{rand-DdpFzCo6.d.cts → rand-DOH_aMvm.d.cts} +31 -1
  89. package/dist/{svg-pwXWq6s2.d.cts → svg-BDDKvWWY.d.cts} +2 -2
  90. package/dist/{svg-CxxqG3_W.d.ts → svg-rV6_HPmn.d.ts} +2 -2
  91. package/dist/{tools-3EBjR91b.d.cts → tools-BAjSbTdY.d.cts} +1 -1
  92. package/dist/{tools-y1M6O3UT.d.ts → tools-DPYerqeR.d.ts} +1 -1
  93. package/dist/vector/index.cjs +2684 -1860
  94. package/dist/vector/index.cjs.map +1 -1
  95. package/dist/vector/index.d.cts +313 -71
  96. package/dist/vector/index.d.ts +313 -71
  97. package/dist/vector/index.js +4700 -3876
  98. package/dist/vector/index.js.map +1 -1
  99. package/dist/video-editor/index.d.cts +7 -4
  100. package/dist/video-editor/index.d.ts +7 -4
  101. package/dist/{warp-Ceqdz7kj.d.cts → warp-DQh9R7Ie.d.cts} +1 -1
  102. package/dist/{warp-C1gwu2G_.d.ts → warp-XVL6SpSh.d.ts} +1 -1
  103. package/package.json +1 -1
  104. package/skills/pixerate-image-editor/SKILL.md +4 -4
  105. package/skills/pixerate-vector/SKILL.md +20 -1
  106. package/dist/chunk-6CTZAGZ2.js.map +0 -1
  107. package/dist/chunk-HHTCDFZC.js.map +0 -1
  108. package/dist/chunk-NVTHUPJ6.cjs.map +0 -1
  109. package/dist/chunk-Z2H7KECK.cjs.map +0 -1
  110. /package/dist/{chunk-ESIWZMMK.js.map → chunk-6QQR4LKE.js.map} +0 -0
  111. /package/dist/{chunk-OXSV64JX.js.map → chunk-G6IKY6PL.js.map} +0 -0
  112. /package/dist/{chunk-7RJ6P7MI.js.map → chunk-KZXLZCQ7.js.map} +0 -0
  113. /package/dist/{chunk-FWEO3HSL.js.map → chunk-PQQF5KOW.js.map} +0 -0
@@ -1,14 +1,17 @@
1
- import { V as VideoProject, a as VideoAnimatable, b as VideoAsset, c as VideoAssetProxy, d as VideoClip, e as VideoClipAnimation, f as VideoClipEffect, g as VideoEffectRef, h as VideoEffectValues, i as VideoGrade, j as VideoGradeLut, k as VideoKeyframes, l as VideoMarker, m as VideoSequence, n as VideoTrack, o as VideoTranscriptWord, p as VideoTransform, q as VideoTransition, v as videoKeysOf, r as VideoTrackKind, s as VideoPlacementMode, t as VideoKeyframeProperty, u as VideoKey, w as VideoMediaClip, x as VideoEffectsEngine, y as VideoLayer, z as VideoFrame, A as VideoRect, B as VideoEffectPlace, C as VideoFfmpegOptions, D as VideoFfmpegExport, E as VideoEdlOptions, F as VideoFadeCurve, G as VideoFit, H as VideoBlendMode, I as VideoAssetKind, J as VideoClipAnimationEffect, K as VideoTransitionType } from '../export-KzubBKo7.cjs';
2
- export { L as VIDEO_BLEND_MODES, M as VIDEO_CLIP_ANIMATION_EFFECTS, N as VIDEO_CLIP_TYPES, O as VIDEO_EASE_NAMES, P as VIDEO_EFFECT_PLACES, Q as VIDEO_FADE_CURVES, R as VIDEO_FITS, S as VIDEO_KEYFRAME_LIMITS, T as VIDEO_KEYFRAME_PROPERTIES, U as VIDEO_PLACEMENT_MODES, W as VIDEO_TRANSFORM_PROPERTIES, X as VIDEO_TRANSITION_TYPES, Y as VIDEO_WIPE_DIRECTIONS, Z as VideoAudioSource, _ as VideoClipType, $ as VideoColorClip, a0 as VideoEase, a1 as VideoEffectClip, a2 as VideoEffectJob, a3 as VideoEffectUse, a4 as VideoEffectsEngineOptions, a5 as VideoLayerEffect, a6 as VideoLoudnessMeasurement, a7 as VideoLoudnessTarget, a8 as VideoSequenceClip, a9 as VideoTextClip, aa as VideoWipeDirection, ab as checkVideoEffectPlace, ac as checkVideoEffectValues, ad as ffmpegFilterValue, ae as isVideoKeyframes, af as mixEffectPixels, ag as overEffectPixels, ah as parseVideoLoudnessMeasurement, ai as placeVideoRect, aj as removeVideoKey, ak as retimeVideoAnimatable, al as setVideoKey, am as sortVideoKeys, an as splitVideoAnimatable, ao as toVideoEdl, ap as toVideoFfmpeg, aq as toVideoLoudnessMeasure, ar as videoClipEffectUses, as as videoClipSoundGain, at as videoEaseBezier, au as videoEaseProgress, av as videoEffectFrameTime, aw as videoEffectLayerKey, ax as videoEffectValuesAt, ay as videoFadeCurveGain, az as videoFfmpegUnsupportedEffects, aA as videoFrameAt, aB as videoFrameLeafLayers, aC as videoKeyframeBreakpoints, aD as videoKeyframeFfmpegExpr, aE as videoLayersUseEffects, aF as videoLayersWithoutTransitionEffects, aG as videoProjectEffects, aH as videoShellQuote, aI as videoTextStyle, aJ as videoTitleFrame, aK as videoTransformAt, aL as videoTransitionAudioCurve, aM as videoTransitionEase, aN as videoValueAt } from '../export-KzubBKo7.cjs';
1
+ import { V as VideoProject, a as VideoAnimatable, b as VideoAsset, c as VideoAssetProxy, d as VideoClip, e as VideoClipAnimation, f as VideoClipEffect, g as VideoEffectRef, h as VideoEffectValues, i as VideoGrade, j as VideoGradeLut, k as VideoKeyframes, l as VideoMarker, m as VideoSequence, n as VideoTrack, o as VideoTranscriptWord, p as VideoTransform, q as VideoTransition, v as videoKeysOf, r as VideoTrackKind, s as VideoPlacementMode, t as VideoKeyframeProperty, u as VideoKey, w as VideoMediaClip, x as VideoEffectsEngine, y as VideoLayer, z as VideoFrame, A as VideoRect, B as VideoEffectPlace, C as VideoFfmpegOptions, D as VideoFfmpegExport, E as VideoEdlOptions, F as VideoFadeCurve, G as VideoFit, H as VideoBlendMode, I as VideoAssetKind, J as VideoClipAnimationEffect, K as VideoTransitionType } from '../export-CEYeRQXH.cjs';
2
+ export { L as VIDEO_BLEND_MODES, M as VIDEO_CLIP_ANIMATION_EFFECTS, N as VIDEO_CLIP_TYPES, O as VIDEO_EASE_NAMES, P as VIDEO_EFFECT_PLACES, Q as VIDEO_FADE_CURVES, R as VIDEO_FITS, S as VIDEO_KEYFRAME_LIMITS, T as VIDEO_KEYFRAME_PROPERTIES, U as VIDEO_PLACEMENT_MODES, W as VIDEO_TRANSFORM_PROPERTIES, X as VIDEO_TRANSITION_TYPES, Y as VIDEO_WIPE_DIRECTIONS, Z as VideoAudioSource, _ as VideoClipType, $ as VideoColorClip, a0 as VideoEase, a1 as VideoEffectClip, a2 as VideoEffectJob, a3 as VideoEffectUse, a4 as VideoEffectsEngineOptions, a5 as VideoLayerEffect, a6 as VideoLoudnessMeasurement, a7 as VideoLoudnessTarget, a8 as VideoSequenceClip, a9 as VideoTextClip, aa as VideoWipeDirection, ab as checkVideoEffectPlace, ac as checkVideoEffectValues, ad as ffmpegFilterValue, ae as isVideoKeyframes, af as mixEffectPixels, ag as overEffectPixels, ah as parseVideoLoudnessMeasurement, ai as placeVideoRect, aj as removeVideoKey, ak as retimeVideoAnimatable, al as setVideoKey, am as sortVideoKeys, an as splitVideoAnimatable, ao as toVideoEdl, ap as toVideoFfmpeg, aq as toVideoLoudnessMeasure, ar as videoClipEffectUses, as as videoClipSoundGain, at as videoEaseBezier, au as videoEaseProgress, av as videoEffectFrameTime, aw as videoEffectLayerKey, ax as videoEffectValuesAt, ay as videoFadeCurveGain, az as videoFfmpegUnsupportedEffects, aA as videoFrameAt, aB as videoFrameLeafLayers, aC as videoKeyframeBreakpoints, aD as videoKeyframeFfmpegExpr, aE as videoLayersUseEffects, aF as videoLayersWithoutTransitionEffects, aG as videoProjectEffects, aH as videoShellQuote, aI as videoTextStyle, aJ as videoTitleFrame, aK as videoTransformAt, aL as videoTransitionAudioCurve, aM as videoTransitionEase, aN as videoValueAt } from '../export-CEYeRQXH.cjs';
3
3
  import { A as AnimationPlayer, C as Clock } from '../player-CmbY3218.cjs';
4
4
  import { b as AnimationLoopMode } from '../evaluate-BsxYieLN.cjs';
5
5
  import { H as HistoryManager } from '../HistoryManager-DeQQMBCj.cjs';
6
- import { v as EffectsSlot, E as EffectProvider, f as EffectDescription, e as EffectValue } from '../helpers-DHl28yLO.cjs';
6
+ import { v as EffectsSlot, E as EffectProvider, f as EffectDescription, e as EffectValue } from '../helpers-BVkU4oUi.cjs';
7
7
  import { a as AgentToolProvider } from '../registry-BqA1AZt0.cjs';
8
- import { A as AppliedEffectInfo } from '../tools-3EBjR91b.cjs';
8
+ import { A as AppliedEffectInfo } from '../tools-BAjSbTdY.cjs';
9
9
  import '../easing-lM0Xo9Ni.cjs';
10
10
  import '../types-DsiXGmjo.cjs';
11
11
  import '../schema-Di0CS6Pe.cjs';
12
+ import '../provenance-DmlcgdzT.cjs';
13
+ import '../sourcemap-C8AH3MBQ.cjs';
14
+ import '../tokens-D7yXvUU6.cjs';
12
15
  import '../types-CwMPoRMU.cjs';
13
16
 
14
17
  /**
@@ -1,14 +1,17 @@
1
- import { V as VideoProject, a as VideoAnimatable, b as VideoAsset, c as VideoAssetProxy, d as VideoClip, e as VideoClipAnimation, f as VideoClipEffect, g as VideoEffectRef, h as VideoEffectValues, i as VideoGrade, j as VideoGradeLut, k as VideoKeyframes, l as VideoMarker, m as VideoSequence, n as VideoTrack, o as VideoTranscriptWord, p as VideoTransform, q as VideoTransition, v as videoKeysOf, r as VideoTrackKind, s as VideoPlacementMode, t as VideoKeyframeProperty, u as VideoKey, w as VideoMediaClip, x as VideoEffectsEngine, y as VideoLayer, z as VideoFrame, A as VideoRect, B as VideoEffectPlace, C as VideoFfmpegOptions, D as VideoFfmpegExport, E as VideoEdlOptions, F as VideoFadeCurve, G as VideoFit, H as VideoBlendMode, I as VideoAssetKind, J as VideoClipAnimationEffect, K as VideoTransitionType } from '../export-DMeG6E06.js';
2
- export { L as VIDEO_BLEND_MODES, M as VIDEO_CLIP_ANIMATION_EFFECTS, N as VIDEO_CLIP_TYPES, O as VIDEO_EASE_NAMES, P as VIDEO_EFFECT_PLACES, Q as VIDEO_FADE_CURVES, R as VIDEO_FITS, S as VIDEO_KEYFRAME_LIMITS, T as VIDEO_KEYFRAME_PROPERTIES, U as VIDEO_PLACEMENT_MODES, W as VIDEO_TRANSFORM_PROPERTIES, X as VIDEO_TRANSITION_TYPES, Y as VIDEO_WIPE_DIRECTIONS, Z as VideoAudioSource, _ as VideoClipType, $ as VideoColorClip, a0 as VideoEase, a1 as VideoEffectClip, a2 as VideoEffectJob, a3 as VideoEffectUse, a4 as VideoEffectsEngineOptions, a5 as VideoLayerEffect, a6 as VideoLoudnessMeasurement, a7 as VideoLoudnessTarget, a8 as VideoSequenceClip, a9 as VideoTextClip, aa as VideoWipeDirection, ab as checkVideoEffectPlace, ac as checkVideoEffectValues, ad as ffmpegFilterValue, ae as isVideoKeyframes, af as mixEffectPixels, ag as overEffectPixels, ah as parseVideoLoudnessMeasurement, ai as placeVideoRect, aj as removeVideoKey, ak as retimeVideoAnimatable, al as setVideoKey, am as sortVideoKeys, an as splitVideoAnimatable, ao as toVideoEdl, ap as toVideoFfmpeg, aq as toVideoLoudnessMeasure, ar as videoClipEffectUses, as as videoClipSoundGain, at as videoEaseBezier, au as videoEaseProgress, av as videoEffectFrameTime, aw as videoEffectLayerKey, ax as videoEffectValuesAt, ay as videoFadeCurveGain, az as videoFfmpegUnsupportedEffects, aA as videoFrameAt, aB as videoFrameLeafLayers, aC as videoKeyframeBreakpoints, aD as videoKeyframeFfmpegExpr, aE as videoLayersUseEffects, aF as videoLayersWithoutTransitionEffects, aG as videoProjectEffects, aH as videoShellQuote, aI as videoTextStyle, aJ as videoTitleFrame, aK as videoTransformAt, aL as videoTransitionAudioCurve, aM as videoTransitionEase, aN as videoValueAt } from '../export-DMeG6E06.js';
1
+ import { V as VideoProject, a as VideoAnimatable, b as VideoAsset, c as VideoAssetProxy, d as VideoClip, e as VideoClipAnimation, f as VideoClipEffect, g as VideoEffectRef, h as VideoEffectValues, i as VideoGrade, j as VideoGradeLut, k as VideoKeyframes, l as VideoMarker, m as VideoSequence, n as VideoTrack, o as VideoTranscriptWord, p as VideoTransform, q as VideoTransition, v as videoKeysOf, r as VideoTrackKind, s as VideoPlacementMode, t as VideoKeyframeProperty, u as VideoKey, w as VideoMediaClip, x as VideoEffectsEngine, y as VideoLayer, z as VideoFrame, A as VideoRect, B as VideoEffectPlace, C as VideoFfmpegOptions, D as VideoFfmpegExport, E as VideoEdlOptions, F as VideoFadeCurve, G as VideoFit, H as VideoBlendMode, I as VideoAssetKind, J as VideoClipAnimationEffect, K as VideoTransitionType } from '../export-Ds7zgGD8.js';
2
+ export { L as VIDEO_BLEND_MODES, M as VIDEO_CLIP_ANIMATION_EFFECTS, N as VIDEO_CLIP_TYPES, O as VIDEO_EASE_NAMES, P as VIDEO_EFFECT_PLACES, Q as VIDEO_FADE_CURVES, R as VIDEO_FITS, S as VIDEO_KEYFRAME_LIMITS, T as VIDEO_KEYFRAME_PROPERTIES, U as VIDEO_PLACEMENT_MODES, W as VIDEO_TRANSFORM_PROPERTIES, X as VIDEO_TRANSITION_TYPES, Y as VIDEO_WIPE_DIRECTIONS, Z as VideoAudioSource, _ as VideoClipType, $ as VideoColorClip, a0 as VideoEase, a1 as VideoEffectClip, a2 as VideoEffectJob, a3 as VideoEffectUse, a4 as VideoEffectsEngineOptions, a5 as VideoLayerEffect, a6 as VideoLoudnessMeasurement, a7 as VideoLoudnessTarget, a8 as VideoSequenceClip, a9 as VideoTextClip, aa as VideoWipeDirection, ab as checkVideoEffectPlace, ac as checkVideoEffectValues, ad as ffmpegFilterValue, ae as isVideoKeyframes, af as mixEffectPixels, ag as overEffectPixels, ah as parseVideoLoudnessMeasurement, ai as placeVideoRect, aj as removeVideoKey, ak as retimeVideoAnimatable, al as setVideoKey, am as sortVideoKeys, an as splitVideoAnimatable, ao as toVideoEdl, ap as toVideoFfmpeg, aq as toVideoLoudnessMeasure, ar as videoClipEffectUses, as as videoClipSoundGain, at as videoEaseBezier, au as videoEaseProgress, av as videoEffectFrameTime, aw as videoEffectLayerKey, ax as videoEffectValuesAt, ay as videoFadeCurveGain, az as videoFfmpegUnsupportedEffects, aA as videoFrameAt, aB as videoFrameLeafLayers, aC as videoKeyframeBreakpoints, aD as videoKeyframeFfmpegExpr, aE as videoLayersUseEffects, aF as videoLayersWithoutTransitionEffects, aG as videoProjectEffects, aH as videoShellQuote, aI as videoTextStyle, aJ as videoTitleFrame, aK as videoTransformAt, aL as videoTransitionAudioCurve, aM as videoTransitionEase, aN as videoValueAt } from '../export-Ds7zgGD8.js';
3
3
  import { A as AnimationPlayer, C as Clock } from '../player-BK2kKbfd.js';
4
4
  import { b as AnimationLoopMode } from '../evaluate-BbCeF6pt.js';
5
5
  import { H as HistoryManager } from '../HistoryManager-DWSLd6Tf.js';
6
- import { v as EffectsSlot, E as EffectProvider, f as EffectDescription, e as EffectValue } from '../helpers-Coa4e2j_.js';
6
+ import { v as EffectsSlot, E as EffectProvider, f as EffectDescription, e as EffectValue } from '../helpers--ns3W2D7.js';
7
7
  import { a as AgentToolProvider } from '../registry-D-4fit9C.js';
8
- import { A as AppliedEffectInfo } from '../tools-y1M6O3UT.js';
8
+ import { A as AppliedEffectInfo } from '../tools-DPYerqeR.js';
9
9
  import '../easing-lM0Xo9Ni.js';
10
10
  import '../types-DsiXGmjo.js';
11
11
  import '../schema-Di0CS6Pe.js';
12
+ import '../provenance-uh5r2TQ8.js';
13
+ import '../sourcemap-DA1Evhrv.js';
14
+ import '../tokens-D7yXvUU6.js';
12
15
  import '../types-CwMPoRMU.js';
13
16
 
14
17
  /**
@@ -1,4 +1,4 @@
1
- import { B as BezierPath } from './bezier-J8i4uqSH.cjs';
1
+ import { B as BezierPath } from './bezier-CdccFsF8.cjs';
2
2
  import { W as WarpStyle, a as WarpMesh, V as Vec2, B as Box } from './types-CwMPoRMU.cjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { B as BezierPath } from './bezier-lNEOp0Jx.js';
1
+ import { B as BezierPath } from './bezier-DG9qNZQV.js';
2
2
  import { W as WarpStyle, a as WarpMesh, V as Vec2, B as Box } from './types-CwMPoRMU.js';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.134.0",
3
+ "version": "0.136.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -194,10 +194,9 @@ and colour conversions for print briefs: read [references/color-management.md](r
194
194
  ### Retouching
195
195
 
196
196
  Clone Stamp, Healing Brush, Spot Healing, Smudge, Dodge, Burn, Sponge, Blur, Sharpen and the
197
- History Brush: retouch on an empty
198
- layer with `sample: "current-below"`, pick `spot_heal` for small spots, `heal_brush` for larger
199
- flaws and `clone_stamp` to copy exactly, and keep strokes short and soft. Read
200
- [references/retouching.md](references/retouching.md) before retouching.
197
+ History Brush: retouch on an empty layer with `sample: "current-below"`, pick `spot_heal` for small
198
+ spots, `heal_brush` for larger flaws and `clone_stamp` to copy exactly (`set_clone_transform` scales,
199
+ rotates or flips the source), and keep strokes short and soft. Read [references/retouching.md](references/retouching.md) first.
201
200
 
202
201
  ### Photoshop files
203
202
 
@@ -403,6 +402,7 @@ in the source frame at the document's bit depth, colour mode and profile. Read
403
402
  | `get_retouch_options` | Read-only. The retouching defaults (`aligned`, `sample`, `spotType`, `range`, `exposure`, `protectTones`, `spongeMode`, `vibrance`, `strength`, `historySteps`) and the `cloneSource` `{x, y, offset}` or null (an aligned stroke samples at the brush plus `offset`; the editors show it as a crosshair). Call before a clone or heal stroke without `source`. |
404
403
  | `set_retouch_options` | Set those defaults (view state, not an undo step); each stroke tool can override them per call. Changing `aligned` clears the kept offset. Returns the options. |
405
404
  | `set_clone_source` | Set the clone source `{x, y}` in document px (the Alt-click), or remove it with `clear: true`. View state. The next `clone_stamp` / `heal_brush` fixes the offset from its first point. Returns the source. |
405
+ | `set_clone_transform` | The Clone Source panel: clone and heal strokes lay the source scaled (`scaleX` / `scaleY` in %, negative or `flipHorizontal` / `flipVertical` to mirror) and rotated (`rotate`°) about the stroke start; `reset: true` for 100 %, 0°. View state. Returns `{scaleX, scaleY, rotate}`. Use it for a reflection, a smaller copy or a tilted patch; read it back with `get_retouch_options`. |
406
406
  | `fill_pixels` | Fill the selection (or the canvas without one / with `useSelection: false`) on pixels or a mask with `color`, `opacity`, `blend`. Returns the changed bounds. |
407
407
  | `mix_colors` | Read-only. Mix 1 to 16 `colors` (`{color: #rrggbb, weight, strength?}`) like paint (Kubelka-Munk over reflectance spectra). Returns `mixed` (#rrggbb), `rgbLerp` (the plain RGB average, for comparison) and the normalised `weights`. Call it before `paint_stroke` / `fill_pixels` to pick a paint colour. |
408
408
  | `clear_pixels` | Remove the selected pixels (alpha to 0; a transparency-locked layer or a mask gets the background colour). Returns the changed bounds. |
@@ -175,6 +175,10 @@ Parameter details (gradient fields, effect parameters, width profiles, envelopes
175
175
  | Command | Use it to |
176
176
  | --- | --- |
177
177
  | `vector.traceImage` | Turn a PNG (data URL) into vector paths in one group: `threshold` mode for one-colour art (logos, scans, silhouettes; `channel: "alpha"` for cut-outs), `color` mode for a stacked path per colour (`colors` 2–32). Raise `tolerance` for fewer anchors, `cornerRoundness` 0 for sharp polygons. Place it with `x`, `y`, `width`. Returns `{ id, paths }`; check `subpaths` counts and simplify or delete specks after. |
178
+ | `vector.mosaicImage` | Stylise a PNG as mosaic tiles (`cell` px, `shape` square / circle, `gap`, `colors`): pixel art, tiled murals. Returns `{ id, paths }`, one compound path per colour. |
179
+ | `vector.halftoneImage` | Stylise a PNG as halftone dots on a turned screen (`cell`, `angle`, ink `color` or null for the picture's colours): comic and pop-art looks, print effects. |
180
+ | `vector.lowPolyImage` | Stylise a PNG as low-poly triangles (`cell`, `jitter`, `seed`, `colors`): geometric portraits and backdrops. |
181
+ | `vector.hatchImage` | Stylise a PNG as engraving lines that swell where it is dark (`cell` spacing, `angle`, ink `color`): banknote, woodcut and line-art looks. |
178
182
  | `vector.addPathByDimensions` | Draw a path the way a CAD user types it: from `start`, each step `{ length, angle }` (degrees counter-clockwise on the page: 0 right, 90 up), `{ dx, dy }` or `{ x, y }`; `closed` joins the ends. Use it for exact technical outlines (brackets, floor plans, given lengths and angles) instead of computing coordinates by hand. Returns `{ id, anchors }`. |
179
183
  | `vector.addShape` | Add a `kind` `rect`, `ellipse`, `polygon` (`sides`, at least 3), `star` (`points`, `innerRatio` 0 to 1) or `line` at `x`, `y`, `width`, `height` (all required; for a line, width and height are the end's offset). `cornerRadius` and `cornerKind` give live corners; any style field and `name` apply. Uses the editor's default style for anything not given. Returns `{ id }`. |
180
184
  | `vector.addPath` | Add a path from SVG path data `d` (absolute or relative M, L, H, V, C, S, Q, T, A, Z; arcs and quadratics become cubics) in document units, with `name` and style fields; unset style comes from the editor defaults. Fails when `d` has no points. Returns `{ id }`. |
@@ -401,16 +405,31 @@ contents whole while you work, without losing the mask.
401
405
  | `vector.cut` | Scissors: cut `nodeId` at the outline point nearest `x`, `y`, or cut at `anchors`. A closed path opens; an open one splits in two. Returns the ids. |
402
406
  | `vector.knife` | Cut closed paths along a polyline `points` (at least two `[x, y]`) wherever it crosses them edge to edge, leaving no gap. Cuts `ids`, else the selection, else every path crossed. Returns the pieces. |
403
407
  | `vector.erase` | Erase along a polyline `points` with a round eraser of diameter `size` (default the eraser setting, 10): fills lose the area, outlines are cut. Returns the changed ids. |
408
+ | `vector.smudgeBrush` | Push outlines along a stroke `points` (two or more) with a soft round brush (`radius`, `strength` 0–1): drips, tentacles, organic lobes. Returns `{ ids }`. |
409
+ | `vector.twirlBrush` | Twirl outlines about each point by `angle` degrees (default 15) at the brush centre: swirls, curls. |
410
+ | `vector.attractBrush` | Pinch outlines toward each point. |
411
+ | `vector.repelBrush` | Bloat outlines away from each point. |
412
+ | `vector.roughenBrush` | Spike the outlines under the brush (`seed` for repeatable spikes): fur, grass, torn paper. |
404
413
 
405
414
  ### Editor settings
406
415
 
407
416
  | Command | Use it to |
408
417
  | --- | --- |
409
- | `vector.setEditing` | Set editing behaviour: `keepShapeOnDelete`, `curvatureMoves`, `pencilSmoothing` (0 to 1), `recognizeShapes`, `eraserSize`, `pencilPressure` (pen, all, off). Returns the settings. |
418
+ | `vector.setEditing` | Set editing behaviour: `keepShapeOnDelete`, `curvatureMoves`, `pencilSmoothing` (0 to 1), `recognizeShapes`, `eraserSize`, `distortMode` / `distortSize` / `distortStrength` (the Distort Brush tool the user drags), `pencilPressure` (pen, all, off). Returns the settings. |
410
419
  | `vector.getSnapOptions` | Read how drawing snaps for people at the pointer: grid, objects, guides, threshold, polar `angles`, object snap `tracking`, `trackPolar`, `polarRelative`. |
411
420
  | `vector.setSnapOptions` | Set those options, e.g. `polarIncrement: 15` for 15° polar tracking, or a grid, before handing the canvas to the user. Moves nothing. Returns the options. |
412
421
  | `vector.setTool` | Switch the interactive tool (select, direct, pen, pencil, rect, ellipse, polygon, star, line, scissors, knife, eraser, width, shapeBuilder, paintBucket, blend, gradient, envelope, type, typePath, frame, connector). Only for handing the canvas to the user in a given mode; commands do not need a tool. |
413
422
 
423
+ ### Generative prompts
424
+
425
+ Only when the host registered the generation tools (they cost money; pass a fresh `idempotencyKey` each time, the same one only to retry).
426
+
427
+ | Tool | Use it to |
428
+ | --- | --- |
429
+ | `list_vector_art_models` | See which models can make vector art: image models (traced or stylised) and text models that write SVG. |
430
+ | `generate_vector_art` | Draw from a `prompt` into a box (`x`, `y`, `width`, `height`); `as` picks how pictures become vectors (color, threshold, mosaic, halftone, lowPoly, hatch). Returns `{ id, ids, model, adjustments }`: the art is ordinary paths in one group, ready to restyle or edit. |
431
+ | `regenerate_vector_art` | Make a generated group again in place with a new `seed` or `prompt`. |
432
+
414
433
  ### Provider effects
415
434
 
416
435
  From `createVectorEffectsToolProvider`, when the host has registered an effects provider (for
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/paint/heal.ts","../src/paint/retouch.ts"],"sourcesContent":["// Portions ported from photocraft/crates/algo/src/poisson.rs and inpaint.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\n\n/**\n * Gradient-domain (\"Poisson\") blending for the Healing Brush and the Spot Healing Brush.\n *\n * Method: P. Pérez, M. Gangnet, A. Blake, *Poisson Image Editing*, SIGGRAPH 2003. Seamless cloning\n * looks for `f` over a region Ω with `f = f*` (the destination) on its boundary and `∇f` as close\n * as possible to the source's `∇g`. The answer is `f = g + h`, where `h` is the membrane: the\n * harmonic function (`Δh = 0`) that equals `f* − g` on the boundary. So healed pixels keep the\n * source's texture while their colour and lighting are pulled to the pixels around the stroke.\n *\n * The Laplace equation is solved on the 4-connected grid by successive over-relaxation, started\n * from a recursively solved half-resolution grid (cascadic multigrid). Harmonic functions are\n * smooth, so the coarse guess is close and a few sweeps per level remove the rest.\n *\n * Buffers are interleaved `w × h × ch` floats in any units (the callers use 0..255). Pure maths:\n * no DOM, no framework.\n */\n\n/** Largest per-sweep update below which a solve has converged. */\nconst TOL = 2e-3;\n/** Sweeps (cap) and relaxation on every level above the coarsest. */\nconst FINE_ITERS = 30;\nconst FINE_OMEGA = 1.7;\n\n/**\n * Solves `Δv = 0` on the `unknown` pixels, with the known pixels of `v` as Dirichlet values\n * (neighbours off the grid are ignored: a free boundary). `v` holds the known values on entry and\n * the solution on exit.\n */\nexport function solveMembrane(w: number, h: number, unknown: ArrayLike<boolean | number>, v: Float32Array): void {\n if (unknown.length !== w * h || v.length !== w * h) throw new RangeError(`solveMembrane: expected ${w * h} cells, got ${unknown.length} and ${v.length}.`);\n const u = new Uint8Array(w * h);\n for (let i = 0; i < u.length; i++) u[i] = unknown[i] ? 1 : 0;\n solveLevel(w, h, u, v, 0);\n}\n\nfunction solveLevel(w: number, h: number, unknown: Uint8Array, v: Float32Array, depth: number): void {\n let nUnknown = 0;\n let knownSum = 0;\n let nKnown = 0;\n for (let i = 0; i < unknown.length; i++) {\n if (unknown[i]) nUnknown++;\n else {\n knownSum += v[i];\n nKnown++;\n }\n }\n if (nUnknown === 0 || nKnown === 0) return;\n if (w >= 8 && h >= 8 && nUnknown > 64 && depth < 16) {\n // Restrict: a coarse cell is known when any of its children is (the mean of those).\n const cw = Math.ceil(w / 2);\n const chh = Math.ceil(h / 2);\n const cu = new Uint8Array(cw * chh).fill(1);\n const cv = new Float32Array(cw * chh);\n for (let cy = 0; cy < chh; cy++) {\n for (let cx = 0; cx < cw; cx++) {\n let s = 0;\n let n = 0;\n for (let k = 0; k < 4; k++) {\n const x = cx * 2 + (k & 1);\n const y = cy * 2 + (k >> 1);\n if (x < w && y < h && !unknown[y * w + x]) {\n s += v[y * w + x];\n n++;\n }\n }\n if (n > 0) {\n cu[cy * cw + cx] = 0;\n cv[cy * cw + cx] = s / n;\n }\n }\n }\n solveLevel(cw, chh, cu, cv, depth + 1);\n // Prolong: a bilinear sample of the coarse solution is the starting guess.\n for (let y = 0; y < h; y++) {\n const fy = Math.min(chh - 1, Math.max(0, (y + 0.5) / 2 - 0.5));\n const y0 = Math.floor(fy);\n const y1 = Math.min(chh - 1, y0 + 1);\n const ty = fy - y0;\n for (let x = 0; x < w; x++) {\n if (!unknown[y * w + x]) continue;\n const fx = Math.min(cw - 1, Math.max(0, (x + 0.5) / 2 - 0.5));\n const x0 = Math.floor(fx);\n const x1 = Math.min(cw - 1, x0 + 1);\n const tx = fx - x0;\n const a = cv[y0 * cw + x0] + (cv[y0 * cw + x1] - cv[y0 * cw + x0]) * tx;\n const b = cv[y1 * cw + x0] + (cv[y1 * cw + x1] - cv[y1 * cw + x0]) * tx;\n v[y * w + x] = a + (b - a) * ty;\n }\n }\n sor(w, h, unknown, v, FINE_ITERS, FINE_OMEGA);\n } else {\n const mean = knownSum / nKnown;\n for (let i = 0; i < v.length; i++) if (unknown[i]) v[i] = mean;\n sor(w, h, unknown, v, 2000, 1.85);\n }\n}\n\n/** Over-relaxed Gauss-Seidel sweeps over the unknown cells until the largest update is below `TOL`. */\nfunction sor(w: number, h: number, unknown: Uint8Array, v: Float32Array, maxIter: number, omega: number): void {\n let n = 0;\n for (let i = 0; i < unknown.length; i++) if (unknown[i]) n++;\n const cells = new Uint32Array(n);\n const masks = new Uint8Array(n);\n for (let i = 0, k = 0; i < unknown.length; i++) {\n if (!unknown[i]) continue;\n const x = i % w;\n const y = (i - x) / w;\n cells[k] = i;\n masks[k++] = (x > 0 ? 1 : 0) | (x + 1 < w ? 2 : 0) | (y > 0 ? 4 : 0) | (y + 1 < h ? 8 : 0);\n }\n for (let it = 0; it < maxIter; it++) {\n let maxD = 0;\n for (let k = 0; k < n; k++) {\n const i = cells[k];\n const m = masks[k];\n let s: number;\n let c: number;\n if (m === 15) {\n s = v[i - 1] + v[i + 1] + v[i - w] + v[i + w];\n c = 4;\n } else {\n s = 0;\n c = 0;\n if (m & 1) (s += v[i - 1]), c++;\n if (m & 2) (s += v[i + 1]), c++;\n if (m & 4) (s += v[i - w]), c++;\n if (m & 8) (s += v[i + w]), c++;\n if (c === 0) continue;\n }\n const d = omega * (s / c - v[i]);\n v[i] += d;\n const ad = d < 0 ? -d : d;\n if (ad > maxD) maxD = ad;\n }\n if (maxD < TOL) break;\n }\n}\n\n/**\n * Seamless cloning: `dst` outside `mask`; inside, `src` plus the membrane that removes the\n * mismatch at the mask's edge. So the result keeps the source's texture and takes the\n * destination's colour and light. `src` and `dst` are interleaved `w × h × ch`; leave a one-pixel\n * unmasked margin for a fully fixed boundary.\n */\nexport function seamlessClone(w: number, h: number, ch: number, src: ArrayLike<number>, dst: ArrayLike<number>, mask: ArrayLike<boolean | number>): Float32Array {\n const n = w * h;\n if (src.length !== n * ch || dst.length !== n * ch || mask.length !== n) throw new RangeError('seamlessClone: src, dst and mask must cover w × h pixels.');\n const out = new Float32Array(n * ch);\n const hv = new Float32Array(n);\n for (let c = 0; c < ch; c++) {\n for (let i = 0; i < n; i++) hv[i] = mask[i] ? 0 : dst[i * ch + c] - src[i * ch + c];\n solveMembrane(w, h, mask, hv);\n for (let i = 0; i < n; i++) out[i * ch + c] = mask[i] ? src[i * ch + c] + hv[i] : dst[i * ch + c];\n }\n return out;\n}\n\n/** Membrane fill (no source texture): the known pixels interpolated smoothly into `hole`. */\nexport function membraneFill(w: number, h: number, ch: number, img: ArrayLike<number>, hole: ArrayLike<boolean | number>): Float32Array {\n const n = w * h;\n const out = new Float32Array(n * ch);\n const v = new Float32Array(n);\n for (let c = 0; c < ch; c++) {\n for (let i = 0; i < n; i++) v[i] = hole[i] ? 0 : img[i * ch + c];\n solveMembrane(w, h, hole, v);\n for (let i = 0; i < n; i++) out[i * ch + c] = v[i];\n }\n return out;\n}\n\n/** A mask grown by `r` pixels (square structuring element). */\nexport function dilateMask(w: number, h: number, mask: ArrayLike<boolean | number>, r: number): Uint8Array {\n const tmp = new Uint8Array(w * h);\n for (let y = 0; y < h; y++) {\n for (let x = 0; x < w; x++) {\n if (!mask[y * w + x]) continue;\n for (let xx = Math.max(0, x - r); xx <= Math.min(w - 1, x + r); xx++) tmp[y * w + xx] = 1;\n }\n }\n const out = new Uint8Array(w * h);\n for (let y = 0; y < h; y++) {\n for (let x = 0; x < w; x++) {\n if (!tmp[y * w + x]) continue;\n for (let yy = Math.max(0, y - r); yy <= Math.min(h - 1, y + r); yy++) out[yy * w + x] = 1;\n }\n }\n return out;\n}\n\n/** A summed-area table over a mask, for \"how many masked cells in this window\". */\nclass MaskIntegral {\n private readonly s: Uint32Array;\n constructor(\n private readonly w: number,\n private readonly h: number,\n mask: ArrayLike<boolean | number>\n ) {\n const W = w + 1;\n this.s = new Uint32Array(W * (h + 1));\n for (let y = 0; y < h; y++) {\n let row = 0;\n for (let x = 0; x < w; x++) {\n row += mask[y * w + x] ? 1 : 0;\n this.s[(y + 1) * W + x + 1] = this.s[y * W + x + 1] + row;\n }\n }\n }\n /** Masked cells in [x0, x1) × [y0, y1) (clipped to the grid). */\n count(x0: number, y0: number, x1: number, y1: number): number {\n const W = this.w + 1;\n const a = Math.max(0, Math.min(this.w, x0));\n const b = Math.max(0, Math.min(this.h, y0));\n const c = Math.max(0, Math.min(this.w, x1));\n const d = Math.max(0, Math.min(this.h, y1));\n if (c <= a || d <= b) return 0;\n return this.s[d * W + c] - this.s[b * W + c] - this.s[d * W + a] + this.s[b * W + a];\n }\n}\n\n/** Bounding box [x0, y0, x1, y1) of the set cells, or null. */\nexport function maskBounds(w: number, h: number, mask: ArrayLike<boolean | number>): [number, number, number, number] | null {\n let x0 = w;\n let y0 = h;\n let x1 = -1;\n let y1 = -1;\n for (let y = 0; y < h; y++) {\n for (let x = 0; x < w; x++) {\n if (!mask[y * w + x]) continue;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n }\n return x1 < 0 ? null : [x0, y0, x1 + 1, y1 + 1];\n}\n\n/**\n * Proximity match: the translation `(dx, dy)` (within `maxRadius`) whose pixels best match the\n * ring of `ring` pixels around the hole (sum of squared differences), so `img[p + (dx, dy)]` can\n * fill `p` in the hole. The source window must lie on the grid and hold no hole pixels. Nearer\n * sources win ties. Returns null when no translation fits.\n */\nexport function bestOffset(w: number, h: number, ch: number, img: ArrayLike<number>, hole: ArrayLike<boolean | number>, ring: number, maxRadius: number): [number, number] | null {\n const bb = maskBounds(w, h, hole);\n if (!bb) return null;\n const extent = Math.max(w, h);\n const R = Math.max(0, Math.min(extent, Math.floor(maxRadius)));\n if (R === 0) return null;\n const rg = Math.max(1, Math.min(extent, Math.floor(ring)));\n const hs = new MaskIntegral(w, h, hole);\n const x0 = bb[0] - rg;\n const y0 = bb[1] - rg;\n const x1 = bb[2] + rg;\n const y1 = bb[3] + rg;\n // Sample points: the ring around the hole, subsampled to about 2000.\n const pts: number[] = [];\n for (let y = Math.max(0, y0); y < Math.min(h, y1); y++) {\n for (let x = Math.max(0, x0); x < Math.min(w, x1); x++) {\n if (hole[y * w + x]) continue;\n if (hs.count(x - rg, y - rg, x + rg + 1, y + rg + 1) > 0) pts.push(x, y);\n }\n }\n const stride = Math.max(1, Math.floor(pts.length / 2 / 2000));\n const sx: number[] = [];\n const sy: number[] = [];\n for (let i = 0; i < pts.length; i += 2 * stride) {\n sx.push(pts[i]);\n sy.push(pts[i + 1]);\n }\n const n = Math.max(1, sx.length);\n const evalAt = (dx: number, dy: number, cutoff: number): number | null => {\n if (dx === 0 && dy === 0) return null;\n const hx0 = x0 + dx;\n const hy0 = y0 + dy;\n const hx1 = x1 + dx;\n const hy1 = y1 + dy;\n if (hx0 < 0 || hy0 < 0 || hx1 > w || hy1 > h) return null;\n if (hs.count(hx0, hy0, hx1, hy1) !== 0) return null;\n const penalty = 1 + 1e-3 * (Math.hypot(dx, dy) / R);\n let e = 0;\n for (let i = 0; i < sx.length; i++) {\n const a = (sy[i] * w + sx[i]) * ch;\n const b = ((sy[i] + dy) * w + sx[i] + dx) * ch;\n for (let c = 0; c < ch; c++) {\n const d = img[a + c] - img[b + c];\n e += d * d;\n }\n if ((i & 31) === 31 && (e / n) * penalty >= cutoff) return null;\n }\n return (e / n) * penalty;\n };\n const found: { best: [number, number] | null; e: number } = { best: null, e: Infinity };\n const consider = (dx: number, dy: number) => {\n const e = evalAt(dx, dy, found.e);\n if (e !== null && e < found.e) {\n found.e = e;\n found.best = [dx, dy];\n }\n };\n // A coarse grid over the search window, then every offset around the winner.\n const step = Math.max(1, Math.floor(R / 24));\n for (let dy = -R; dy <= R; dy += step) for (let dx = -R; dx <= R; dx += step) consider(dx, dy);\n if (step > 1 && found.best) {\n const [bx, by] = found.best;\n for (let dy = by - step; dy <= by + step; dy++) for (let dx = bx - step; dx <= bx + step; dx++) consider(dx, dy);\n }\n return found.best;\n}\n\n// ---------------------------------------------------------------------------\n// Content-aware fill (PatchMatch, coarse to fine)\n// ---------------------------------------------------------------------------\n\nconst PATCH_R = 3;\n\n/** A small deterministic generator (mulberry32). */\nfunction rng(seed: number): () => number {\n let a = seed >>> 0;\n return () => {\n a = (a + 0x6d2b79f5) >>> 0;\n let t = a;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\ninterface Level {\n w: number;\n h: number;\n img: Float32Array;\n hole: Uint8Array;\n}\n\n/** Half-size level: known pixels averaged, a block is hole when any of it is. */\nfunction downsample(l: Level, ch: number): Level {\n const w = Math.max(1, l.w >> 1);\n const h = Math.max(1, l.h >> 1);\n const img = new Float32Array(w * h * ch);\n const hole = new Uint8Array(w * h);\n for (let y = 0; y < h; y++) {\n for (let x = 0; x < w; x++) {\n let n = 0;\n const o = (y * w + x) * ch;\n for (let dy = 0; dy < 2; dy++) {\n for (let dx = 0; dx < 2; dx++) {\n const sx = Math.min(l.w - 1, 2 * x + dx);\n const sy = Math.min(l.h - 1, 2 * y + dy);\n const i = sy * l.w + sx;\n if (l.hole[i]) {\n hole[y * w + x] = 1;\n continue;\n }\n for (let c = 0; c < ch; c++) img[o + c] += l.img[i * ch + c];\n n++;\n }\n }\n if (n) for (let c = 0; c < ch; c++) img[o + c] /= n;\n }\n }\n return { w, h, img, hole };\n}\n\n/**\n * Fills `hole` in `img` (`w × h × ch` floats) from the rest of the image, so texture and edges\n * continue across it: PatchMatch nearest-neighbour fields over 7 × 7 patches with patch voting\n * (Wexler et al. / Barnes et al.), run coarse to fine from a smooth fill. Deterministic for the\n * same input. Returns the filled image; pixels outside `hole` are unchanged. Falls back to a\n * smooth fill when there is no whole patch to copy from.\n */\nexport function contentAwareFill(w: number, h: number, ch: number, img: ArrayLike<number>, hole: ArrayLike<boolean | number>, options: { iterations?: number; seed?: number } = {}): Float32Array {\n const iters = options.iterations ?? 4;\n const base: Level = { w, h, img: Float32Array.from(img), hole: Uint8Array.from(hole as ArrayLike<number>, (v) => (v ? 1 : 0)) };\n const levels: Level[] = [base];\n // Coarser levels while the hole is still more than a couple of patches across.\n while (levels.length < 4) {\n const top = levels[levels.length - 1];\n const b = maskBounds(top.w, top.h, top.hole);\n if (!b || Math.max(b[2] - b[0], b[3] - b[1]) < 4 * PATCH_R || top.w < 8 * PATCH_R || top.h < 8 * PATCH_R) break;\n levels.push(downsample(top, ch));\n }\n const random = rng(options.seed ?? w * 73856093 + h * 19349663);\n let prevFill: Float32Array | null = null;\n let prevNnf: Int32Array | null = null;\n let prevW = 0;\n for (let li = levels.length - 1; li >= 0; li--) {\n const { w: W, h: H, hole: holeL } = levels[li];\n const cur = new Float32Array(levels[li].img);\n // Start: the coarser fill scaled up, or a smooth fill at the coarsest level.\n if (prevFill) {\n for (let i = 0; i < W * H; i++) {\n if (!holeL[i]) continue;\n const x = Math.min(prevW - 1, (i % W) >> 1);\n const y = Math.min(Math.floor(prevFill.length / ch / prevW) - 1, Math.floor(i / W) >> 1);\n for (let c = 0; c < ch; c++) cur[i * ch + c] = prevFill[(y * prevW + x) * ch + c];\n }\n } else cur.set(membraneFill(W, H, ch, cur, holeL));\n // Valid sources: whole patches with no hole in them.\n const blocked = dilateMask(W, H, holeL, PATCH_R);\n const valid: number[] = [];\n for (let y = PATCH_R; y < H - PATCH_R; y++) for (let x = PATCH_R; x < W - PATCH_R; x++) if (!blocked[y * W + x]) valid.push(y * W + x);\n if (!valid.length) {\n prevFill = cur;\n prevNnf = null;\n prevW = W;\n continue;\n }\n // Targets: patch centres whose patch touches the hole (kept inside the image).\n const targets: number[] = [];\n for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) if (blocked[y * W + x]) targets.push(y * W + x);\n const nnf = new Int32Array(W * H).fill(-1);\n const cost = new Float64Array(W * H);\n const clampC = (v: number, n: number) => Math.min(n - 1 - PATCH_R, Math.max(PATCH_R, v));\n const dist = (t: number, s: number, limit: number) => {\n const tx = clampC(t % W, W);\n const ty = clampC(Math.floor(t / W), H);\n const sx = s % W;\n const sy = Math.floor(s / W);\n let d = 0;\n for (let dy = -PATCH_R; dy <= PATCH_R; dy++) {\n const tr = (ty + dy) * W;\n const sr = (sy + dy) * W;\n for (let dx = -PATCH_R; dx <= PATCH_R; dx++) {\n const a = (tr + tx + dx) * ch;\n const b = (sr + sx + dx) * ch;\n for (let c = 0; c < ch; c++) {\n const e = cur[a + c] - cur[b + c];\n d += e * e;\n }\n }\n if (d >= limit) return d;\n }\n return d;\n };\n const isValid = (s: number) => {\n const x = s % W;\n const y = Math.floor(s / W);\n return s >= 0 && x >= PATCH_R && y >= PATCH_R && x < W - PATCH_R && y < H - PATCH_R && !blocked[s];\n };\n for (const t of targets) {\n let s = -1;\n if (prevNnf) {\n const px = Math.min(prevW - 1, (t % W) >> 1);\n const py = Math.floor(t / W) >> 1;\n const ps = prevNnf[py * prevW + px];\n if (ps >= 0) {\n const cand = (Math.floor(ps / prevW) * 2 + (Math.floor(t / W) & 1)) * W + (ps % prevW) * 2 + ((t % W) & 1);\n if (isValid(cand)) s = cand;\n }\n }\n if (s < 0) s = valid[Math.floor(random() * valid.length)];\n nnf[t] = s;\n }\n for (let em = 0; em < iters; em++) {\n for (const t of targets) cost[t] = dist(t, nnf[t], Infinity);\n for (let pass = 0; pass < 4; pass++) {\n const fwd = pass % 2 === 0;\n const step = fwd ? 1 : -1;\n for (let k = 0; k < targets.length; k++) {\n const t = targets[fwd ? k : targets.length - 1 - k];\n const tx = t % W;\n const ty = Math.floor(t / W);\n // Propagation: a neighbour's match, shifted by one.\n for (const [nx, ny] of [[tx - step, ty], [tx, ty - step]]) {\n if (nx < 0 || ny < 0 || nx >= W || ny >= H) continue;\n const ns = nnf[ny * W + nx];\n if (ns < 0) continue;\n const cand = ns + step * (nx === tx ? W : 1);\n if (!isValid(cand) || cand === nnf[t]) continue;\n const d = dist(t, cand, cost[t]);\n if (d < cost[t]) {\n cost[t] = d;\n nnf[t] = cand;\n }\n }\n // Random search in shrinking windows around the current match.\n const bx = nnf[t] % W;\n const by = Math.floor(nnf[t] / W);\n for (let r = Math.max(W, H); r >= 1; r >>= 1) {\n const cx = Math.round(bx + (random() * 2 - 1) * r);\n const cy = Math.round(by + (random() * 2 - 1) * r);\n const cand = cy * W + cx;\n if (cx < 0 || cy < 0 || cx >= W || cy >= H || !isValid(cand)) continue;\n const d = dist(t, cand, cost[t]);\n if (d < cost[t]) {\n cost[t] = d;\n nnf[t] = cand;\n }\n }\n }\n }\n // Voting: each hole pixel averages what the patches covering it propose.\n const acc = new Float64Array(W * H * ch);\n const wsum = new Float64Array(W * H);\n for (const t of targets) {\n const tx = clampC(t % W, W);\n const ty = clampC(Math.floor(t / W), H);\n const s = nnf[t];\n const sx = s % W;\n const sy = Math.floor(s / W);\n for (let dy = -PATCH_R; dy <= PATCH_R; dy++) {\n for (let dx = -PATCH_R; dx <= PATCH_R; dx++) {\n const q = (ty + dy) * W + tx + dx;\n if (!holeL[q]) continue;\n const src = ((sy + dy) * W + sx + dx) * ch;\n for (let c = 0; c < ch; c++) acc[q * ch + c] += cur[src + c];\n wsum[q] += 1;\n }\n }\n }\n for (let q = 0; q < W * H; q++) if (holeL[q] && wsum[q] > 0) for (let c = 0; c < ch; c++) cur[q * ch + c] = acc[q * ch + c] / wsum[q];\n }\n prevFill = cur;\n prevNnf = nnf;\n prevW = W;\n }\n const out = Float32Array.from(img);\n for (let i = 0; i < w * h; i++) if (base.hole[i]) for (let c = 0; c < ch; c++) out[i * ch + c] = prevFill![i * ch + c];\n return out;\n}\n","// Portions ported from photocraft/crates/paint/src/retouch.rs, crates/algo/src/retouch.rs and crates/engine/src/retouch_cmds.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\n\n/**\n * The retouching tools on the shared brush engine: Clone Stamp, Healing Brush, Spot Healing\n * Brush, Smudge, Dodge, Burn and Sponge. Two stroke shapes cover them all:\n *\n * - **Accumulate, then composite** (Clone Stamp, Dodge, Burn; the Healing tools' result): the\n * stroke's dabs build up one `CoverageMap` (flow builds towards the dab's opacity ceiling), and\n * per-pixel paint taken from the pre-stroke state (a cloned source, a toned copy of the pixel,\n * a healed patch) is composited through it with `applyRetouchToTile`. Pixels painted earlier in\n * the stroke are never sampled again, and overlapping dabs never exceed the stroke's opacity.\n * - **Sequential dabs** (Smudge, Sponge): `RetouchDabStroke` runs each dab in order over live\n * tiles, so dab n sees what dab n − 1 did.\n *\n * The Healing Brush clones while it is drawn and, when the stroke ends, replaces the clone with a\n * seamless clone (`healPixels`, Poisson blending): the source's texture with the colour and light\n * of the pixels around the stroke. The Spot Healing Brush finds its own source (`spotHealPixels`).\n *\n * Tone curves (`dodgeBurnCurve`, `dodgeBurn`, `sponge`) are photocraft's, made to behave like\n * Photoshop's tools: the chosen range moves most, black and white stay put for midtones, and\n * Protect Tones works on luma so hue and saturation are kept. Data in, pixels out; no DOM.\n */\n\nimport { blendPixel, type BlendMode } from '../raster/blend';\nimport type { RasterRect } from '../raster/surface';\nimport { TILE, tileKey } from '../raster/surface';\nimport { srgbDecode, srgbEncode } from '../raster/deep';\nimport { DabWalker, dabRect, rasterizeDab, type BrushSettings, type CoverageMap, type Dab, type StrokePoint } from './brush';\nimport { SmudgeTip, type SmudgeSettings } from './blending';\nimport { TileMedium, put255, type PaintPixels, type PaintTileTarget } from './exchange';\nimport { bestOffset, contentAwareFill, dilateMask, maskBounds, membraneFill, seamlessClone } from './heal';\n\n// ---------------------------------------------------------------------------\n// Tone kernels\n// ---------------------------------------------------------------------------\n\n/** The tonal range Dodge and Burn work on most. */\nexport type ToneRange = 'shadows' | 'midtones' | 'highlights';\n\nexport const TONE_RANGES: readonly ToneRange[] = ['shadows', 'midtones', 'highlights'];\n\n/** Rec. 601 luma of straight RGB (0..1). */\nexport function luma(r: number, g: number, b: number): number {\n return 0.299 * r + 0.587 * g + 0.114 * b;\n}\n\n/** The dodge (or burn) transfer of one value `v` (0..1) at exposure `e` (0..1). */\nexport function dodgeBurnCurve(v: number, e: number, range: ToneRange, burn: boolean): number {\n const x = Math.max(0, v);\n const k = Math.min(1, Math.max(0, e));\n const c = Math.min(1, x);\n if (range === 'midtones') {\n // A gamma bend weighted to peak at mid-grey: 0 and 1 stay where they are.\n const w = Math.min(1, Math.max(0, 4 * x * (1 - x)));\n return x + w * (Math.pow(c, burn ? 1 + k : 1 / (1 + k)) - x);\n }\n // Shadows / highlights: `v + e·w·(target − v)`, weighted (1 − v)² or v², so that end moves most.\n const w = range === 'shadows' ? (1 - c) * (1 - c) : c * c;\n return burn ? x - k * w * x : x + k * w * (1 - c);\n}\n\n/** Brings RGB back into 0..1 keeping its luma (mixing towards grey) rather than clipping each channel. */\nfunction compressGamut(c: number[], l: number): void {\n const L = Math.min(1, Math.max(0, l));\n const lo = Math.min(c[0], c[1], c[2]);\n const hi = Math.max(c[0], c[1], c[2]);\n let t = 1;\n if (hi > 1 && hi - L > 1e-9) t = Math.min(t, (1 - L) / (hi - L));\n if (lo < 0 && L - lo > 1e-9) t = Math.min(t, L / (L - lo));\n for (let i = 0; i < 3; i++) c[i] = L + (c[i] - L) * t;\n}\n\n/**\n * Dodge (or burn) straight RGB `c` (0..1, written in place) at exposure `e`. With `protectTones`\n * the curve moves luma and the colour is scaled to it (hue and saturation kept); otherwise each\n * channel goes through the curve.\n */\nexport function dodgeBurn(c: number[], e: number, range: ToneRange, burn: boolean, protectTones: boolean): number[] {\n if (!(e > 0)) return c;\n if (protectTones) {\n const l = luma(c[0], c[1], c[2]);\n const nl = dodgeBurnCurve(l, e, range, burn);\n if (l > 1e-6) for (let i = 0; i < 3; i++) c[i] *= nl / l;\n else c[0] = c[1] = c[2] = nl;\n compressGamut(c, nl);\n } else for (let i = 0; i < 3; i++) c[i] = dodgeBurnCurve(c[i], e, range, burn);\n return c;\n}\n\n/** HSV saturation (chroma / max) of straight RGB. */\nexport function saturationOf(r: number, g: number, b: number): number {\n const lo = Math.min(r, g, b);\n const hi = Math.max(r, g, b);\n return hi <= 1e-6 ? 0 : Math.min(1, Math.max(0, (hi - lo) / hi));\n}\n\n/**\n * Sponge: moves straight RGB `c` (written in place) away from (`saturate`) or towards its luma\n * grey by `amount` (0..1). `vibrance` damps it where it would clip: saturating touches already\n * saturated colours less, desaturating touches near-greys less. Gamut-compressed, never clipped.\n */\nexport function sponge(c: number[], amount: number, saturate: boolean, vibrance: boolean): number[] {\n let a = Math.min(1, Math.max(0, amount));\n if (!(a > 0)) return c;\n if (vibrance) {\n const s = saturationOf(c[0], c[1], c[2]);\n a *= saturate ? 1 - s : 0.25 + 0.75 * s;\n }\n const l = luma(c[0], c[1], c[2]);\n const k = saturate ? 1 + a : 1 - a;\n for (let i = 0; i < 3; i++) c[i] = l + (c[i] - l) * k;\n compressGamut(c, l);\n return c;\n}\n\n/** Per-dab strength so that one pass over a point totals about `e`, whatever the spacing. */\nexport function perDabStrength(e: number, spacing: number): number {\n return 1 - Math.pow(1 - Math.min(1, Math.max(0, e)), Math.min(1, Math.max(0.01, spacing)));\n}\n\n// ---------------------------------------------------------------------------\n// Settings\n// ---------------------------------------------------------------------------\n\n/** Which pixels the Clone Stamp and the Healing tools sample. */\nexport type RetouchSample = 'current' | 'current-below' | 'all';\n\nexport const RETOUCH_SAMPLES: readonly RetouchSample[] = ['current', 'current-below', 'all'];\n\n/** How the Spot Healing Brush finds its source. */\nexport type SpotHealType = 'proximity-match' | 'content-aware' | 'smooth';\n\nexport const SPOT_HEAL_TYPES: readonly SpotHealType[] = ['proximity-match', 'content-aware', 'smooth'];\n\n/** The retouching tools' options. */\nexport interface RetouchSettings {\n /** Clone / heal: keep the source offset from stroke to stroke (default true); off, every stroke starts at the source point. */\n aligned: boolean;\n /** Clone / heal / spot heal: what is sampled (default `current`: the target layer). */\n sample: RetouchSample;\n /** Spot heal: `proximity-match` (default: the best matching patch nearby), `content-aware` (texture and edges synthesised from patches around it) or `smooth` (a smooth fill from the edges). */\n spotType: SpotHealType;\n /** Dodge / burn: the tonal range (default `midtones`). */\n range: ToneRange;\n /** Dodge / burn: exposure 0..1 (default 0.5). */\n exposure: number;\n /** Dodge / burn: tone luma only, keeping hue and saturation (default true). */\n protectTones: boolean;\n /** Sponge: `desaturate` (default) or `saturate`. */\n spongeMode: 'desaturate' | 'saturate';\n /** Sponge: damp the change where colours would clip (default true). */\n vibrance: boolean;\n /** Smudge: how strongly the finger carries and lays paint; Blur / Sharpen: how strongly they act, 0..1 (default 0.5). */\n strength: number;\n /** History Brush: how many undo steps back it paints from; 0 (default) is the oldest state history keeps. */\n historySteps: number;\n}\n\nexport const DEFAULT_RETOUCH: Readonly<RetouchSettings> = {\n aligned: true,\n sample: 'current',\n spotType: 'proximity-match',\n range: 'midtones',\n exposure: 0.5,\n protectTones: true,\n spongeMode: 'desaturate',\n vibrance: true,\n strength: 0.5,\n historySteps: 0,\n};\n\n/** Retouch settings with every field valid (missing or invalid fields from `base`). */\nexport function normalizeRetouch(raw: Partial<RetouchSettings> = {}, base: RetouchSettings = DEFAULT_RETOUCH): RetouchSettings {\n const unit = (v: unknown, d: number) => (typeof v === 'number' && Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : d);\n const bool = (v: unknown, d: boolean) => (typeof v === 'boolean' ? v : d);\n const pick = <T extends string>(v: unknown, all: readonly T[], d: T): T => (all.includes(v as T) ? (v as T) : d);\n return {\n aligned: bool(raw.aligned, base.aligned),\n sample: pick(raw.sample, RETOUCH_SAMPLES, base.sample),\n spotType: pick(raw.spotType, SPOT_HEAL_TYPES, base.spotType),\n range: pick(raw.range, TONE_RANGES, base.range),\n exposure: unit(raw.exposure, base.exposure),\n protectTones: bool(raw.protectTones, base.protectTones),\n spongeMode: pick(raw.spongeMode, ['desaturate', 'saturate'] as const, base.spongeMode),\n vibrance: bool(raw.vibrance, base.vibrance),\n strength: unit(raw.strength, base.strength),\n historySteps: typeof raw.historySteps === 'number' && Number.isFinite(raw.historySteps) ? Math.min(1000, Math.max(0, Math.round(raw.historySteps))) : base.historySteps,\n };\n}\n\n/**\n * Box blur of `data` (`w × h × n` floats) in place, `r` pixels each side, edges clamped. RGBA\n * blurs premultiplied, so transparent pixels lend no colour. Run twice for a near-Gaussian.\n */\nexport function boxBlurPixels(data: Float32Array, w: number, h: number, n: 1 | 4, r: number): void {\n if (r < 1) return;\n if (n === 4) for (let i = 0; i < data.length; i += 4) for (let c = 0; c < 3; c++) data[i + c] *= data[i + 3] / 255;\n const tmp = new Float32Array(data.length);\n const k = 1 / (2 * r + 1);\n for (let y = 0; y < h; y++) {\n for (let x = 0; x < w; x++) {\n for (let c = 0; c < n; c++) {\n let s = 0;\n for (let d = -r; d <= r; d++) s += data[(y * w + Math.min(w - 1, Math.max(0, x + d))) * n + c];\n tmp[(y * w + x) * n + c] = s * k;\n }\n }\n }\n for (let y = 0; y < h; y++) {\n for (let x = 0; x < w; x++) {\n for (let c = 0; c < n; c++) {\n let s = 0;\n for (let d = -r; d <= r; d++) s += tmp[(Math.min(h - 1, Math.max(0, y + d)) * w + x) * n + c];\n data[(y * w + x) * n + c] = s * k;\n }\n }\n }\n if (n === 4) {\n for (let i = 0; i < data.length; i += 4) {\n const a = data[i + 3] / 255;\n for (let c = 0; c < 3; c++) data[i + c] = a > 0 ? data[i + c] / a : 0;\n }\n }\n}\n\n/**\n * The Blur / Sharpen tools' filter over a padded region (`w × h × n` floats on the 0..255 scale,\n * in place): `blur` is two box passes of `radius`; `sharpen` is an unsharp mask of `amount`\n * over a radius-1 blur (colour only; alpha kept). Values stay at or above 0.\n */\nexport function retouchFilter(data: Float32Array, w: number, h: number, n: 1 | 4, kind: 'blur' | 'sharpen', radius = 2, amount = 1): void {\n if (kind === 'blur') {\n boxBlurPixels(data, w, h, n, radius);\n boxBlurPixels(data, w, h, n, radius);\n return;\n }\n const soft = data.slice();\n boxBlurPixels(soft, w, h, n, 1);\n for (let i = 0; i < data.length; i++) {\n if (n === 4 && (i & 3) === 3) continue;\n const v = data[i] + amount * (data[i] - soft[i]);\n data[i] = v > 0 ? v : 0;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Pixel sources\n// ---------------------------------------------------------------------------\n\n/** Pixels a retouching stroke samples, by document pixel. */\nexport interface PixelSource {\n /** Straight RGBA 0..255 of document pixel (x, y) into `out`; false (and `out` zeroed) where there is nothing. */\n sample(x: number, y: number, out: number[]): boolean;\n}\n\n/**\n * A source over raster tiles (layer pixels, a mask, or composite tiles): `readTile` gives tile\n * (tx, ty) in source space or `null` when it is empty; source pixel = document pixel − `offset`.\n * One-channel tiles read as grey (alpha 255). Tiles are cached, so make one per stroke.\n */\nexport class TilePixelSource implements PixelSource {\n private readonly cache = new Map<number, PaintPixels | null>();\n private lastKey = NaN;\n private last: PaintPixels | null = null;\n\n constructor(\n /** A tile's bytes, or a float working tile on the same 0..255 scale (16 / 32 bits). */\n private readonly readTile: (tx: number, ty: number) => PaintPixels | null,\n readonly channels: 1 | 4,\n readonly offset: { x: number; y: number } = { x: 0, y: 0 }\n ) {}\n\n sample(x: number, y: number, out: number[]): boolean {\n const lx = x - this.offset.x;\n const ly = y - this.offset.y;\n const tx = Math.floor(lx / TILE);\n const ty = Math.floor(ly / TILE);\n const key = tileKey(tx, ty);\n if (key !== this.lastKey) {\n let t = this.cache.get(key);\n if (t === undefined) {\n t = this.readTile(tx, ty);\n this.cache.set(key, t);\n }\n this.last = t;\n this.lastKey = key;\n }\n const t = this.last;\n if (!t) {\n out[0] = out[1] = out[2] = out[3] = 0;\n return false;\n }\n const p = (ly - ty * TILE) * TILE + (lx - tx * TILE);\n if (this.channels === 1) {\n out[0] = out[1] = out[2] = t[p];\n out[3] = 255;\n return true;\n }\n const i = p * 4;\n out[0] = t[i];\n out[1] = t[i + 1];\n out[2] = t[i + 2];\n out[3] = t[i + 3];\n return out[3] > 0;\n }\n}\n\n/** A source over a region of float RGBA pixels (0..255), e.g. a healed patch. */\nexport class RegionPixelSource implements PixelSource {\n constructor(\n readonly rect: RasterRect,\n readonly data: Float32Array\n ) {}\n\n sample(x: number, y: number, out: number[]): boolean {\n const r = this.rect;\n const lx = x - r.x;\n const ly = y - r.y;\n if (lx < 0 || ly < 0 || lx >= r.width || ly >= r.height) {\n out[0] = out[1] = out[2] = out[3] = 0;\n return false;\n }\n const i = (ly * r.width + lx) * 4;\n out[0] = this.data[i];\n out[1] = this.data[i + 1];\n out[2] = this.data[i + 2];\n out[3] = this.data[i + 3];\n return out[3] > 0;\n }\n}\n\n/** `rect` of a source, shifted by (dx, dy), as float RGBA 0..255 (`rect.width × rect.height × 4`). */\nexport function readSourceRegion(source: PixelSource, rect: RasterRect, dx = 0, dy = 0): Float32Array {\n const out = new Float32Array(rect.width * rect.height * 4);\n const px = [0, 0, 0, 0];\n for (let y = 0; y < rect.height; y++) {\n for (let x = 0; x < rect.width; x++) {\n source.sample(rect.x + x + dx, rect.y + y + dy, px);\n const i = (y * rect.width + x) * 4;\n out[i] = px[0];\n out[i + 1] = px[1];\n out[i + 2] = px[2];\n out[i + 3] = px[3];\n }\n }\n return out;\n}\n\n// ---------------------------------------------------------------------------\n// Accumulate, then composite\n// ---------------------------------------------------------------------------\n\n/** What a coverage-based retouching stroke lays through its coverage. */\nexport type RetouchPaint =\n /** Source pixels at document pixel + (dx, dy) (Clone Stamp, a healed patch). */\n | { kind: 'source'; source: PixelSource; dx: number; dy: number }\n /** The target pixel itself, toned (Dodge, Burn): `tone` edits straight RGB 0..1 in place. */\n | { kind: 'tone'; tone: (rgb: number[]) => void }\n /** A flat colour (the Spot Healing Brush's trail while it is drawn), RGBA 0..255. */\n | { kind: 'color'; color: readonly [number, number, number, number] };\n\n/** How a coverage-based retouching stroke composites. */\nexport interface RetouchApply {\n /** Stroke opacity 0..1. */\n opacity: number;\n /** Blend mode for source paint (default normal). */\n blend?: BlendMode;\n lockTransparency: boolean;\n /** Selection coverage (document space, canvas-sized), or `null`. */\n selection: { width: number; height: number; data: ArrayLike<number> } | null;\n /** Layer offset (target pixels are in layer space). */\n offset: { x: number; y: number };\n}\n\n/**\n * Composites `paint` through the stroke's coverage over `tileData` (target tile (tx, ty) as it was\n * before the stroke, layer space; RGBA, or one byte per pixel for masks) and returns the new tile.\n * With `into` (the previous result) and `region` (document space), only `region` is recomputed.\n * Tone paint keeps alpha; source and colour paint composite with `blend` (source-over by\n * default), keeping alpha on a locked layer.\n */\nexport function applyRetouchToTile<T extends PaintPixels>(\n coverage: CoverageMap,\n tileData: T,\n channels: 1 | 4,\n tx: number,\n ty: number,\n paint: RetouchPaint,\n s: RetouchApply,\n options: { into?: T; region?: RasterRect } = {}\n): T {\n // A float working tile (16 / 32 bits) stays float and keeps fractions; bytes round as ever.\n const out = (options.into ?? tileData).slice() as T;\n const ox = tx * TILE + s.offset.x;\n const oy = ty * TILE + s.offset.y;\n let x0 = 0;\n let y0 = 0;\n let x1 = TILE;\n let y1 = TILE;\n if (options.region) {\n const r = options.region;\n x0 = Math.max(0, Math.floor(r.x) - ox);\n y0 = Math.max(0, Math.floor(r.y) - oy);\n x1 = Math.min(TILE, Math.ceil(r.x + r.width) - ox);\n y1 = Math.min(TILE, Math.ceil(r.y + r.height) - oy);\n if (x1 <= x0 || y1 <= y0) return out;\n if (options.into) {\n for (let y = y0; y < y1; y++) out.set(tileData.subarray((y * TILE + x0) * channels, (y * TILE + x1) * channels), (y * TILE + x0) * channels);\n }\n }\n const sel = s.selection;\n const blend = s.blend ?? 'normal';\n const src = [0, 0, 0, 0];\n const rgb = [0, 0, 0];\n const cb = [0, 0, 0, 0];\n const cs = [0, 0, 0, 0];\n // The coverage tile under the pixel, looked up once per tile it crosses.\n let covKey = NaN;\n let covTile: Float32Array | undefined;\n for (let y = y0; y < y1; y++) {\n const dy = oy + y;\n const cty = Math.floor(dy / TILE);\n for (let x = x0; x < x1; x++) {\n const dx = ox + x;\n const ctx = Math.floor(dx / TILE);\n const key = tileKey(ctx, cty);\n if (key !== covKey) {\n covKey = key;\n covTile = coverage.tiles.get(key);\n }\n if (!covTile) continue;\n const c = covTile[(dy - cty * TILE) * TILE + (dx - ctx * TILE)];\n if (c <= 0) continue;\n let k = c * s.opacity;\n if (sel) {\n if (dx < 0 || dy < 0 || dx >= sel.width || dy >= sel.height) continue;\n k *= sel.data[dy * sel.width + dx] / 255;\n }\n if (k > 1) k = 1;\n if (k <= 0) continue;\n const p = y * TILE + x;\n if (channels === 1) {\n // Masks: grey values; the source's grey is its red channel.\n const g = out[p];\n let t: number;\n if (paint.kind === 'tone') {\n rgb[0] = rgb[1] = rgb[2] = g / 255;\n paint.tone(rgb);\n t = luma(rgb[0], rgb[1], rgb[2]) * 255;\n } else if (paint.kind === 'color') t = paint.color[0];\n else {\n if (!paint.source.sample(dx + paint.dx, dy + paint.dy, src)) continue;\n t = src[0];\n k *= src[3] / 255;\n }\n out[p] = Math.round(g + (t - g) * k);\n continue;\n }\n const i = p * 4;\n const a = out[i + 3];\n if (paint.kind === 'tone') {\n if (a === 0) continue;\n rgb[0] = out[i] / 255;\n rgb[1] = out[i + 1] / 255;\n rgb[2] = out[i + 2] / 255;\n const r0 = rgb[0];\n const g0 = rgb[1];\n const b0 = rgb[2];\n paint.tone(rgb);\n put255(out, i, r0 + (rgb[0] - r0) * k);\n put255(out, i + 1, g0 + (rgb[1] - g0) * k);\n put255(out, i + 2, b0 + (rgb[2] - b0) * k);\n continue;\n }\n if (s.lockTransparency && a === 0) continue;\n if (paint.kind === 'color') {\n src[0] = paint.color[0];\n src[1] = paint.color[1];\n src[2] = paint.color[2];\n src[3] = paint.color[3];\n } else if (!paint.source.sample(dx + paint.dx, dy + paint.dy, src)) continue;\n for (let ch = 0; ch < 4; ch++) {\n cb[ch] = out[i + ch] / 255;\n cs[ch] = src[ch] / 255;\n }\n // Source-over, as a brush lays paint: cloning transparency paints nothing.\n const o = blendPixel(blend, cb, cs, k);\n put255(out, i, o[0]);\n put255(out, i + 1, o[1]);\n put255(out, i + 2, o[2]);\n if (!s.lockTransparency) put255(out, i + 3, o[3]);\n }\n }\n return out;\n}\n\n/**\n * Dodge / Burn at 16 or 32 bits: `applyRetouchToTile`'s tone paint on a layer tile's deep samples\n * (`Uint16Array` sRGB-encoded, or `Float32Array` linear light, RGBA). The tone curves work on\n * encoded values as at 8 bits, so 32-bit samples are encoded, toned and decoded (colour above 1 is\n * toned at 1 and keeps its excess). Returns the new samples.\n */\nexport function applyToneToDeepTile(\n coverage: CoverageMap,\n samples: Uint16Array | Float32Array,\n tx: number,\n ty: number,\n tone: (rgb: number[]) => void,\n s: RetouchApply,\n options: { into?: Uint16Array | Float32Array; region?: RasterRect } = {}\n): Uint16Array | Float32Array {\n const linear = samples instanceof Float32Array;\n const out = (options.into ?? samples).slice() as Uint16Array | Float32Array;\n const ox = tx * TILE + s.offset.x;\n const oy = ty * TILE + s.offset.y;\n let x0 = 0;\n let y0 = 0;\n let x1 = TILE;\n let y1 = TILE;\n if (options.region) {\n const r = options.region;\n x0 = Math.max(0, Math.floor(r.x) - ox);\n y0 = Math.max(0, Math.floor(r.y) - oy);\n x1 = Math.min(TILE, Math.ceil(r.x + r.width) - ox);\n y1 = Math.min(TILE, Math.ceil(r.y + r.height) - oy);\n if (x1 <= x0 || y1 <= y0) return out;\n if (options.into) for (let y = y0; y < y1; y++) out.set(samples.subarray((y * TILE + x0) * 4, (y * TILE + x1) * 4), (y * TILE + x0) * 4);\n }\n const sel = s.selection;\n const rgb = [0, 0, 0];\n const before = [0, 0, 0];\n const excess = [0, 0, 0];\n let covKey = NaN;\n let covTile: Float32Array | undefined;\n for (let y = y0; y < y1; y++) {\n const dy = oy + y;\n const cty = Math.floor(dy / TILE);\n for (let x = x0; x < x1; x++) {\n const dx = ox + x;\n const ctx = Math.floor(dx / TILE);\n const key = tileKey(ctx, cty);\n if (key !== covKey) {\n covKey = key;\n covTile = coverage.tiles.get(key);\n }\n if (!covTile) continue;\n const c = covTile[(dy - cty * TILE) * TILE + (dx - ctx * TILE)];\n if (c <= 0) continue;\n let k = c * s.opacity;\n if (sel) {\n if (dx < 0 || dy < 0 || dx >= sel.width || dy >= sel.height) continue;\n k *= sel.data[dy * sel.width + dx] / 255;\n }\n if (k > 1) k = 1;\n if (k <= 0) continue;\n const i = (y * TILE + x) * 4;\n if (out[i + 3] === 0) continue;\n for (let ch = 0; ch < 3; ch++) {\n const v = out[i + ch];\n if (linear) {\n excess[ch] = v > 1 ? v - 1 : 0;\n rgb[ch] = srgbEncode(v > 1 ? 1 : v < 0 ? 0 : v);\n } else rgb[ch] = v / 65535;\n before[ch] = rgb[ch];\n }\n tone(rgb);\n for (let ch = 0; ch < 3; ch++) {\n const e = before[ch] + (rgb[ch] - before[ch]) * k;\n if (linear) out[i + ch] = srgbDecode(e) + excess[ch];\n else out[i + ch] = e <= 0 ? 0 : e >= 1 ? 65535 : Math.round(e * 65535);\n }\n }\n }\n return out;\n}\n\n/** The tone function of a Dodge or Burn stroke. */\nexport function toneOf(tool: 'dodge' | 'burn', settings: Pick<RetouchSettings, 'exposure' | 'range' | 'protectTones'>): (rgb: number[]) => void {\n const burn = tool === 'burn';\n return (rgb) => {\n dodgeBurn(rgb, settings.exposure, settings.range, burn, settings.protectTones);\n };\n}\n\n// ---------------------------------------------------------------------------\n// Healing\n// ---------------------------------------------------------------------------\n\n/**\n * Heals `src` into `dst` over `mask` (all `w × h`, RGBA floats 0..255): a seamless clone solved\n * only over the mask's bounds plus a one-pixel fixed ring; elsewhere the result is `dst`.\n */\nexport function healPixels(w: number, h: number, src: Float32Array, dst: Float32Array, mask: ArrayLike<boolean | number>): Float32Array {\n const out = new Float32Array(dst);\n const bb = maskBounds(w, h, mask);\n if (!bb) return out;\n const x0 = Math.max(0, bb[0] - 1);\n const y0 = Math.max(0, bb[1] - 1);\n const x1 = Math.min(w, bb[2] + 1);\n const y1 = Math.min(h, bb[3] + 1);\n const rw = x1 - x0;\n const rh = y1 - y0;\n const s = new Float32Array(rw * rh * 4);\n const d = new Float32Array(rw * rh * 4);\n const m = new Uint8Array(rw * rh);\n for (let y = 0; y < rh; y++) {\n for (let x = 0; x < rw; x++) {\n const gi = (y + y0) * w + x + x0;\n const li = y * rw + x;\n m[li] = mask[gi] ? 1 : 0;\n for (let c = 0; c < 4; c++) {\n s[li * 4 + c] = src[gi * 4 + c];\n d[li * 4 + c] = dst[gi * 4 + c];\n }\n }\n }\n const healed = seamlessClone(rw, rh, 4, s, d, m);\n for (let y = 0; y < rh; y++) {\n for (let x = 0; x < rw; x++) {\n const gi = ((y + y0) * w + x + x0) * 4;\n const li = (y * rw + x) * 4;\n for (let c = 0; c < 4; c++) out[gi + c] = Math.min(255, Math.max(0, healed[li + c]));\n }\n }\n return out;\n}\n\n/**\n * Spot healing: fills `hole` (`w × h`) of `img` (RGBA floats 0..255) with no given source, then\n * heals the fill into its surroundings. `proximity-match` copies the best matching nearby patch\n * (falling back to `smooth` when none fits); `smooth` interpolates the edges inwards. `size` is\n * the brush diameter in pixels. Returns the healed pixels over the whole grid.\n */\nexport function spotHealPixels(\n w: number,\n h: number,\n img: Float32Array,\n hole: ArrayLike<boolean | number>,\n size: number,\n type: SpotHealType,\n /** Told the patch offset it copied (`null`: a smooth fill). */\n onOffset?: (offset: [number, number] | null) => void\n): Float32Array {\n // Fill a slightly larger domain than the healed area, so the solve's boundary sees filled values\n // that differ from the untouched pixels: that mismatch is what the membrane corrects.\n const domain = dilateMask(w, h, hole, 2);\n const healMask = dilateMask(w, h, hole, 1);\n let filled: Float32Array | null = null;\n let bestFound: [number, number] | null = null;\n if (type === 'proximity-match') {\n const ring = Math.min(16, Math.max(3, Math.floor(size / 8)));\n const off = bestOffset(w, h, 4, img, domain, ring, Math.floor(Math.max(w, h) / 2));\n if (off) {\n bestFound = off;\n // Copy from the pre-healing pixels, never from what this loop already wrote.\n filled = new Float32Array(img);\n const [ddx, ddy] = off;\n for (let i = 0; i < w * h; i++) {\n if (!domain[i]) continue;\n const x = (i % w) + ddx;\n const y = Math.floor(i / w) + ddy;\n const j = (y * w + x) * 4;\n for (let c = 0; c < 4; c++) filled[i * 4 + c] = img[j + c];\n }\n }\n }\n onOffset?.(filled ? (bestFound as [number, number]) : null);\n // Content-aware: texture and edges synthesised from patches all around (PatchMatch).\n if (!filled && type === 'content-aware') filled = contentAwareFill(w, h, 4, img, domain);\n if (!filled) filled = membraneFill(w, h, 4, img, domain);\n return healPixels(w, h, filled, img, healMask);\n}\n\n/** The window a Spot Healing stroke over `bounds` looks for texture in: the bounds grown by their size, on the canvas. */\nexport function spotHealWindow(bounds: RasterRect, canvas: { width: number; height: number }): RasterRect {\n const g = Math.max(8, Math.ceil(Math.max(bounds.width, bounds.height)));\n const x0 = Math.max(0, bounds.x - g);\n const y0 = Math.max(0, bounds.y - g);\n const x1 = Math.min(canvas.width, bounds.x + bounds.width + g);\n const y1 = Math.min(canvas.height, bounds.y + bounds.height + g);\n return { x: x0, y: y0, width: Math.max(0, x1 - x0), height: Math.max(0, y1 - y0) };\n}\n\n// ---------------------------------------------------------------------------\n// Sequential dabs\n// ---------------------------------------------------------------------------\n\n/**\n * One dab of a sequential retouching stroke: `cov` is the tip's pure coverage over `rect`\n * (document space, 0..1); `d.alpha` is the flow and `d.opacity` the pressure opacity.\n */\nexport type RetouchDabEffect = (medium: TileMedium, d: Dab, rect: RasterRect, cov: Float32Array) => void;\n\n/**\n * A stroke whose dabs edit live tiles in order (Smudge, Sponge). Feed points with `push` (any\n * chunks give the same dabs), end with `finish`; each returns the document rectangles it touched.\n */\nexport class RetouchDabStroke {\n dabCount = 0;\n bounds: RasterRect | null = null;\n private readonly walker: DabWalker;\n private readonly medium: TileMedium;\n private smoothPos: StrokePoint | null = null;\n private buf = new Float32Array(0);\n\n constructor(\n readonly brush: BrushSettings,\n target: PaintTileTarget,\n private readonly effect: RetouchDabEffect\n ) {\n this.walker = new DabWalker(brush);\n this.medium = new TileMedium(target);\n }\n\n push(points: readonly StrokePoint[]): RasterRect[] {\n const dabs: Dab[] = [];\n for (const p of points) this.walker.push(this.smooth(p), dabs);\n return this.paint(dabs);\n }\n\n finish(last?: StrokePoint): RasterRect[] {\n const dabs: Dab[] = [];\n if (last && this.smoothPos && (this.smoothPos.x !== last.x || this.smoothPos.y !== last.y)) this.walker.push(last, dabs);\n this.walker.finish(dabs);\n return this.paint(dabs);\n }\n\n private smooth(p: StrokePoint): StrokePoint {\n const a = 1 - Math.min(0.95, Math.max(0, this.brush.smoothing));\n const cur = this.smoothPos;\n const n = cur && a < 1 ? { ...p, x: cur.x + (p.x - cur.x) * a, y: cur.y + (p.y - cur.y) * a } : p;\n this.smoothPos = n;\n return n;\n }\n\n private paint(dabs: Dab[]): RasterRect[] {\n const rects: RasterRect[] = [];\n for (const d of dabs) {\n const rect = dabRect(d, this.brush.hardness);\n const n = rect.width * rect.height;\n if (this.buf.length < n) this.buf = new Float32Array(n);\n const cov = this.buf.subarray(0, n);\n rasterizeDab({ ...d, alpha: 1 }, this.brush.hardness, rect, cov);\n this.medium.reset();\n this.effect(this.medium, d, rect, cov);\n rects.push(rect);\n this.bounds = unionRect(this.bounds, rect);\n this.dabCount++;\n }\n return rects;\n }\n}\n\n/** The Smudge's per-dab effect: a `SmudgeTip` whose strength carries and lays the paint. */\nexport function smudgeEffect(brush: BrushSettings, strength: number, mixing: SmudgeSettings['mixing'] = 'rgb'): RetouchDabEffect {\n const s = Math.min(1, Math.max(0, strength));\n const tip = new SmudgeTip({ strength: s, length: s, mixing }, brush.size);\n return (medium, d, rect, cov) => tip.dab(medium, { x: d.x, y: d.y, radius: d.radius, opacity: d.opacity * d.alpha }, rect, cov);\n}\n\n/** The Sponge's per-dab effect: each dab moves saturation by about half its flow, compounding over passes. */\nexport function spongeEffect(brush: BrushSettings, saturate: boolean, vibrance: boolean): RetouchDabEffect {\n const rgb = [0, 0, 0];\n return (medium, d, rect, cov) => {\n const w = rect.width;\n for (let yy = 0; yy < rect.height; yy++) {\n for (let xx = 0; xx < w; xx++) {\n const cv = cov[yy * w + xx];\n if (cv <= 0) continue;\n const dx = rect.x + xx;\n const dy = rect.y + yy;\n const k = perDabStrength(cv * d.alpha * d.opacity * 0.5, brush.spacing) * medium.selectionAt(dx, dy);\n if (k <= 0) continue;\n const ri = medium.locate(dx, dy, false);\n if (ri < 0 || medium.pixels[ri + 3] === 0) continue;\n const i = medium.locate(dx, dy, true);\n const px = medium.pixels;\n rgb[0] = px[i] / 255;\n rgb[1] = px[i + 1] / 255;\n rgb[2] = px[i + 2] / 255;\n sponge(rgb, k, saturate, vibrance);\n put255(px, i, rgb[0]);\n put255(px, i + 1, rgb[1]);\n put255(px, i + 2, rgb[2]);\n }\n }\n };\n}\n\n/**\n * An RGBA view of one-channel tiles (masks), for the sequential-dab tools: reads expand grey to\n * opaque RGB, writes land in RGBA copies, and `flush` writes their red channel back through\n * `target.writeTile`. Alpha is locked, so a mask's values are all a dab changes.\n */\nexport function rgbaViewOfGrey(target: PaintTileTarget): { target: PaintTileTarget; flush(): void } {\n const views = new Map<number, Uint8ClampedArray>();\n const dirty = new Map<number, { tx: number; ty: number; data: Uint8ClampedArray }>();\n const expand = (g: Uint8ClampedArray) => {\n const out = new Uint8ClampedArray(g.length * 4);\n for (let i = 0; i < g.length; i++) {\n out[i * 4] = out[i * 4 + 1] = out[i * 4 + 2] = g[i];\n out[i * 4 + 3] = 255;\n }\n return out;\n };\n const view: PaintTileTarget = {\n offset: target.offset,\n lockTransparency: true,\n selection: target.selection,\n readTile: (tx, ty) => {\n const key = tileKey(tx, ty);\n let v = views.get(key);\n if (!v) {\n // An empty mask tile is still values (0), not transparency: always give a tile.\n v = expand((target.readTile(tx, ty) as Uint8ClampedArray | null) ?? new Uint8ClampedArray(TILE * TILE));\n views.set(key, v);\n }\n return v;\n },\n writeTile: (tx, ty) => {\n const key = tileKey(tx, ty);\n let v = views.get(key);\n if (!v) {\n v = expand((target.readTile(tx, ty) as Uint8ClampedArray | null) ?? new Uint8ClampedArray(TILE * TILE));\n views.set(key, v);\n }\n dirty.set(key, { tx, ty, data: v });\n return v;\n },\n };\n return {\n target: view,\n flush: () => {\n for (const { tx, ty, data } of dirty.values()) {\n const g = target.writeTile(tx, ty);\n for (let i = 0; i < g.length; i++) g[i] = data[i * 4];\n }\n dirty.clear();\n },\n };\n}\n\nfunction unionRect(a: RasterRect | null, b: RasterRect): RasterRect {\n if (!a) return { ...b };\n const x = Math.min(a.x, b.x);\n const y = Math.min(a.y, b.y);\n return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,IAAM,MAAM;AAEZ,IAAM,aAAa;AACnB,IAAM,aAAa;AAOZ,SAAS,cAAc,GAAW,GAAW,SAAsC,GAAuB;AAC/G,MAAI,QAAQ,WAAW,IAAI,KAAK,EAAE,WAAW,IAAI,EAAG,OAAM,IAAI,WAAW,2BAA2B,IAAI,CAAC,eAAe,QAAQ,MAAM,QAAQ,EAAE,MAAM,GAAG;AACzJ,QAAM,IAAI,IAAI,WAAW,IAAI,CAAC;AAC9B,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,IAAK,GAAE,CAAC,IA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