@embededitor/free 1.1.1 → 3.0.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.
package/react.d.ts CHANGED
@@ -1,9 +1,132 @@
1
- /*! Embed Editor Free 1.1.1 | © 2026 Rohde Softwares | Free license, commercial use included, on one condition: the Embed Editor badge stays visible and unaltered. Removing, hiding or covering it infringes the license, see https://embededitor.com/license */
1
+ /*! Embed Editor Free 3.0.0 | © 2026 Rohde Softwares | Free license, commercial use included, on one condition: the Embed Editor badge stays visible and unaltered. Removing, hiding or covering it infringes the license, see https://embededitor.com/license */
2
2
  import { ForwardRefExoticComponent } from 'react';
3
3
  import { RefAttributes } from 'react';
4
4
 
5
+ /**
6
+ * Where the AI works on the photo, by its `kind`: `'ALL'`, the whole photo; `'BACKGROUND'`, what Remove Background took away
7
+ * (once it did); `'MARK'`, the mark on screen (the brush, `retouch.mark`); `'POLYGON'`, a closed outline of 3
8
+ * `points` or more; `'RECT'`. Points and rects are in the photo's px, the state's.
9
+ */
10
+ export declare type AiArea = {
11
+ kind: 'ALL';
12
+ } | {
13
+ kind: 'BACKGROUND';
14
+ } | {
15
+ kind: 'MARK';
16
+ } | {
17
+ kind: 'POLYGON';
18
+ points: {
19
+ x: number;
20
+ y: number;
21
+ }[];
22
+ } | {
23
+ height: number;
24
+ kind: 'RECT';
25
+ width: number;
26
+ x: number;
27
+ y: number;
28
+ };
29
+
30
+ /** The widths in px of the borders an Expand adds on each side of the photo (`onAiEditImage`'s `GENERATE_BORDERS`). */
31
+ export declare type AiBorders = {
32
+ bottom: number;
33
+ left: number;
34
+ right: number;
35
+ top: number;
36
+ };
37
+
38
+ /**
39
+ * One thing `onAiDetectObjects` found: `box`, its rectangle as fractions from 0 to 1 of the image (`left` and `right` along
40
+ * its width, `top` and `bottom` along its height); `confidence`, from 0 to 1, when the model gives one; `text`, which of
41
+ * the `texts` asked for this find answers.
42
+ */
43
+ export declare type AiDetected = {
44
+ box: {
45
+ bottom: number;
46
+ left: number;
47
+ right: number;
48
+ top: number;
49
+ };
50
+ confidence?: number;
51
+ text: string;
52
+ };
53
+
54
+ /**
55
+ * What `onAiEditImage` is called with: the fill the person asked for, by its `operation`, each with its own fields alone.
56
+ * Every one gets `image`, the piece of the photo around the area, a PNG of at most 2048 px on its longer side, and a
57
+ * `signal` that aborts when the person stops or the editor closes; every one but `'EDIT_PHOTO'` gets `mask`, a PNG of the
58
+ * same size, white where to fill and black elsewhere. `'EDIT_PHOTO'`, the whole photo edited by words with nothing marked
59
+ * (`retouch.run` over `'ALL'`): `image` is the whole photo, no mask, `prompt` the edit in words and `referenceImage` an
60
+ * image for it, or `null`; the image back is the whole photo with the request done, what the words don't name as it was.
61
+ * `'ERASE_AREA'`, Remove Object's Remove: take away what is marked and fill it with what surrounds it.
62
+ * `'GENERATE_AREA'`, Generate on a mark: `prompt`, what to put there in words (`''` where the person gave only an image),
63
+ * and `referenceImage`, the image the person added to say what to put there, a PNG of at most 2048 px on its longer side,
64
+ * or `null`. `'GENERATE_BACKGROUND'`, the new background's Generate after Remove Background: `image` is the whole photo,
65
+ * transparent where the cut took the background away, `mask` white there, `prompt` the new background in words and
66
+ * `referenceImage` an image for it, or `null`, so a server can send a model made to put a subject on a new background.
67
+ * `'GENERATE_BORDERS'`, an Expand and its Generate Again: `image` is the bigger photo, its borders transparent, `mask`
68
+ * white on them, `borders` the widths in px of `image` of the borders it adds on each side, so a server can send a model
69
+ * that takes the photo and the borders, not a mask, and `prompt` the editor's own words, asking to continue the scene
70
+ * into the borders (the host's `aiPrompts.expandBorders` in their place).
71
+ */
72
+ export declare type AiEditImageInput = {
73
+ image: Blob;
74
+ operation: 'EDIT_PHOTO';
75
+ prompt: string;
76
+ referenceImage: Blob | null;
77
+ signal: AbortSignal;
78
+ } | {
79
+ image: Blob;
80
+ mask: Blob;
81
+ operation: 'ERASE_AREA';
82
+ signal: AbortSignal;
83
+ } | {
84
+ image: Blob;
85
+ mask: Blob;
86
+ operation: 'GENERATE_AREA';
87
+ prompt: string;
88
+ referenceImage: Blob | null;
89
+ signal: AbortSignal;
90
+ } | {
91
+ image: Blob;
92
+ mask: Blob;
93
+ operation: 'GENERATE_BACKGROUND';
94
+ prompt: string;
95
+ referenceImage: Blob | null;
96
+ signal: AbortSignal;
97
+ } | {
98
+ borders: AiBorders;
99
+ image: Blob;
100
+ mask: Blob;
101
+ operation: 'GENERATE_BORDERS';
102
+ prompt: string;
103
+ signal: AbortSignal;
104
+ };
105
+
106
+ /**
107
+ * A prompt the editor sends a model, by its key: what `aiPrompts` can bring. The package's `ai-prompts.json` has each with
108
+ * the editor's own text. The guide, the system message of `onAiChooseCommands`'s conversation: `guideEditorAi`, the lines
109
+ * of the editor's own AI alone; `guideBase`, the rules every model meets; `guideArtDirector`, the art director's level,
110
+ * while Annotate's commands are offered; `guidePersonMark`, the person's mark, which only an agent linked from outside is
111
+ * told; `guideLanguage`, the editor's language, last. The lines a request adds to the person's words: `requestAnnotate`,
112
+ * before an Annotate-mode request's; `requestRecreate`, a composition asked again; `requestArea` and `requestAreas`, one
113
+ * area marked or several; `requestWholePhoto` and `requestBackground`, a request about the whole photo or the new
114
+ * background. The rules those lines and the person's mark end with: `ruleMark`, the person's mark; `ruleHostArea`, an
115
+ * area `ask.send` names. What the host's other functions get: `expandBorders`, `onAiEditImage`'s `prompt` for an Expand;
116
+ * `detectFace`, `detectLicensePlate`, `detectDocument` and `detectScreen`, `onAiDetectObjects`'s `texts`. Written out here
117
+ * (the d.ts carries no JSON), and held equal to the file's keys by src/types.spec.ts.
118
+ */
119
+ export declare type AiPromptKey = 'detectDocument' | 'detectFace' | 'detectLicensePlate' | 'detectScreen' | 'expandBorders' | 'guideArtDirector' | 'guideBase' | 'guideEditorAi' | 'guideLanguage' | 'guidePersonMark' | 'requestAnnotate' | 'requestArea' | 'requestAreas' | 'requestBackground' | 'requestRecreate' | 'requestWholePhoto' | 'ruleHostArea' | 'ruleMark';
120
+
121
+ /**
122
+ * The prompts a host brings (`aiPrompts`): any subset of the editor's prompts, by key, each one a string that replaces that
123
+ * prompt whole. A prompt with `{ name }` placeholders keeps exactly the placeholders of the editor's own, which it fills
124
+ * in. The package's `ai-prompts.json` lists every key with the editor's own text.
125
+ */
126
+ export declare type AiPrompts = Partial<Record<AiPromptKey, string>>;
127
+
5
128
  /** An annotation of `EditState`'s `annotations` as `annotate.add` takes it: no `id` (the editor gives it the next), its `color` optional. */
6
- declare type AnnotatePiece = Unsaved<Extract<SavedAnnotation, {
129
+ export declare type AnnotatePiece = Unsaved<Extract<SavedAnnotation, {
7
130
  type: 'LENS';
8
131
  }>> | Unsaved<Extract<SavedAnnotation, {
9
132
  type: 'LINE';
@@ -21,7 +144,7 @@ declare type AnnotatePiece = Unsaved<Extract<SavedAnnotation, {
21
144
  * `look`, `mark`, `padding` and `size`; a shape's `fill` and `kind`; a magnifier's `line`, `shape` and `zoom`; and the
22
145
  * color, a hex.
23
146
  */
24
- declare type AnnotateStyle = {
147
+ export declare type AnnotateStyle = {
25
148
  color?: string;
26
149
  corners?: 'ROUND' | 'SOFT' | 'SQUARE';
27
150
  end?: AnnotationCap;
@@ -42,7 +165,7 @@ declare type AnnotateStyle = {
42
165
  };
43
166
 
44
167
  /** Annotate's tools: what a tap or a drag on the photo makes. */
45
- declare type AnnotateTool = 'ARROW' | 'DRAW' | 'LENS' | 'NUMBER' | 'RULER' | 'SHAPE' | 'TEXT';
168
+ export declare type AnnotateTool = 'ARROW' | 'DRAW' | 'LENS' | 'NUMBER' | 'RULER' | 'SHAPE' | 'TEXT';
46
169
 
47
170
  /**
48
171
  * An arrow added to a text or to the Numbers' list, leaving its owner's box (a text's box, a Number's badge, the list's
@@ -89,6 +212,23 @@ declare type AnnotationAngle = number;
89
212
  */
90
213
  declare type AnnotationBend = number | null;
91
214
 
215
+ /**
216
+ * Where an annotation stands once laid out, in image px, as `read.screenshot` and the export draw it (whole px; the box
217
+ * round what turns): what the Annotate commands that place or move annotations resolve with, in `boxes`, one for the
218
+ * annotation each names and one for every other it moved. `id` is its id, `'LIST'` for the Numbers' list; `box` a text's
219
+ * card (its letters with the `PLAIN` and `CAPTION` looks), a Number's pill with its badge and words, a ruler's label, the
220
+ * list's block or a magnifier's rim; `badge` a Number's badge; `row` a Number's row in the list; `leader` a magnifier's
221
+ * line from its rim to its spot, a curve's start, middle and end or an elbow's corners. Each is `null` where it has none
222
+ * (a ruler with no label, a Number in the list with no pill, a magnifier on its own spot or with no line).
223
+ */
224
+ export declare type AnnotationBox = {
225
+ badge: Rect | null;
226
+ box: Rect | null;
227
+ id: string;
228
+ leader: AnnotationPoint[] | null;
229
+ row: Rect | null;
230
+ };
231
+
92
232
  /** How a line ends: nothing, an open head, a filled head, a dot or a bar. */
93
233
  declare type AnnotationCap = 'ARROW' | 'BAR' | 'DOT' | 'NONE' | 'TRIANGLE';
94
234
 
@@ -136,7 +276,10 @@ declare type AnnotationShare = {
136
276
  /** A side of an annotation's box, in its own frame. `null`: none. */
137
277
  declare type AnnotationSide = 'BOTTOM' | 'LEFT' | 'RIGHT' | 'TOP' | null;
138
278
 
139
- /** A text's or the list's size: a share of the image's shorter side, 0.02…0.065 (small 0.028, medium 0.036, large 0.05). */
279
+ /**
280
+ * A text's or the list's size: a share of the image's shorter side (the one `expandedFrom` holds, once `crop.expand` grew
281
+ * the image), 0.02…0.065 (small 0.028, medium 0.036, large 0.05).
282
+ */
140
283
  declare type AnnotationSize = number;
141
284
 
142
285
  /** A line's stroke: solid, dashed, dotted, hand-drawn or a highlighter's. */
@@ -152,15 +295,55 @@ declare type AnnotationStrokePoint = {
152
295
  /** What sits behind a label: light, dark, or the annotation's color. */
153
296
  declare type AnnotationTheme = 'ACCENT' | 'DARK' | 'LIGHT';
154
297
 
155
- /** A line's weight, seven steps from extra thin to extra thick: 0.45, 0.57, 0.7 (medium thin, the default), 0.9, 1.15, 1.45 and 1.85% of the photo's shorter side. */
298
+ /**
299
+ * A line's weight, seven steps from extra thin to extra thick: 0.45, 0.57, 0.7 (medium thin, the default), 0.9, 1.15, 1.45
300
+ * and 1.85% of the photo's shorter side (the one `expandedFrom` holds, once `crop.expand` grew the photo).
301
+ */
156
302
  declare type AnnotationWeight = 'EXTRA_THICK' | 'EXTRA_THIN' | 'MEDIUM' | 'MEDIUM_THICK' | 'MEDIUM_THIN' | 'THICK' | 'THIN';
157
303
 
304
+ export declare type ChatContentPart = {
305
+ text: string;
306
+ type: 'text';
307
+ } | {
308
+ image_url: {
309
+ url: string;
310
+ };
311
+ type: 'image_url';
312
+ };
313
+
314
+ export declare type ChatMessage = {
315
+ [key: string]: unknown;
316
+ content: string | ChatContentPart[] | null;
317
+ role: 'assistant' | 'system' | 'tool' | 'user';
318
+ tool_call_id?: string;
319
+ tool_calls?: ChatToolCall[];
320
+ };
321
+
322
+ export declare type ChatTool = {
323
+ function: {
324
+ description: string;
325
+ name: string;
326
+ parameters: Record<string, unknown>;
327
+ };
328
+ type: 'function';
329
+ };
330
+
331
+ export declare type ChatToolCall = {
332
+ function: {
333
+ arguments: string;
334
+ name: string;
335
+ };
336
+ id: string;
337
+ type: 'function';
338
+ };
339
+
158
340
  /**
159
341
  * The edits a host keeps (the `state` prop, and `onProcess`'s `state`), version 3, in the units the screen shows. The
160
342
  * editor writes every field, its default included (no turn is 0, no flip `false`, an adjustment at 0 is 0, Auto, the
161
- * filter, the frame and the list are `null` while off, no areas or annotations are `[]`, a free crop's `aspectRatio` is
162
- * `null`, `size` is `null` while none is set, `crop.scale` is 100 at the photo's largest window, `crop.intent` the
163
- * person's crop), so a later default never changes a kept state. A state you write may leave any field out: absent reads
343
+ * filter, the frame and the list are `null` while off, no areas or annotations are `[]`, `expandedFrom` is `null` while
344
+ * the image is its own, a free crop's `aspectRatio` is `null`, `size` is `null` while none is set,
345
+ * `crop.scale` is 100 at the photo's largest window, `crop.intent` the person's crop), so a later default never changes a
346
+ * kept state. A state you write may leave any field out: absent reads
164
347
  * as its default. Its image px are those of the size the editor works the image at (`onLoad`'s `size`).
165
348
  */
166
349
  export declare type EditState = {
@@ -180,9 +363,10 @@ export declare type EditState = {
180
363
  warmth?: number;
181
364
  };
182
365
  /**
183
- * The Numbers' list, one block: its center, the color of its badges, its letter, size and theme, its title, a
184
- * width set by hand (a fraction of the image's shorter side; `null`: as wide as its longest row), and how many of the
185
- * annotations, the last in their list, draw above it (absent: none, the list over them all). `null`: no list.
366
+ * The Numbers' list, one block: its center, the color of its badges, its letter, size and theme, its title, a width set
367
+ * by hand (a fraction of the image's shorter side, `expandedFrom`'s once an Expand grew it; `null`: as wide as its
368
+ * longest row), and how many of the annotations, the last in their list, draw above it (absent: none, the list over
369
+ * them all). `null`: no list.
186
370
  */
187
371
  annotationList?: {
188
372
  above?: number;
@@ -254,7 +438,10 @@ export declare type EditState = {
254
438
  from: AnnotationPoint;
255
439
  id: string;
256
440
  label?: string;
257
- /** Its label's size, a share of the image's shorter side, 0.02…0.065 (its line keeps its weight). Default 0.028, small. */
441
+ /**
442
+ * Its label's size, a share of the image's shorter side (`expandedFrom`'s once an Expand grew it), 0.02…0.065 (its
443
+ * line keeps its weight). Default 0.028, small.
444
+ */
258
445
  size?: number;
259
446
  stroke?: AnnotationStroke;
260
447
  theme?: AnnotationTheme;
@@ -322,7 +509,7 @@ export declare type EditState = {
322
509
  theme?: AnnotationTheme;
323
510
  title?: string;
324
511
  type: 'TEXT';
325
- /** Its largest width, set by hand: a fraction of the image's shorter side. `null`: automatic. */
512
+ /** Its largest width, set by hand: a fraction of the image's shorter side (`expandedFrom`'s once an Expand grew it). `null`: automatic. */
326
513
  width?: number | null;
327
514
  } | {
328
515
  angle?: AnnotationAngle;
@@ -402,6 +589,14 @@ export declare type EditState = {
402
589
  x: number;
403
590
  y: number;
404
591
  };
592
+ /**
593
+ * The image `crop.expand` grew: where it sits in the bigger one, in image px. Every length the edit takes from the image
594
+ * is measured on it, so the edit keeps its look on the bigger image, and a session opened again with `src` and the
595
+ * state draws the same: the annotations' sizes and strokes are shares of its shorter side; Obfuscate's blur and blocks
596
+ * (from its corner), the Sharpness and the local adjustments (Brilliance, Highlights, Shadows) reach as far as they did
597
+ * on it. `null`: the image is its own, no Expand's borders around it.
598
+ */
599
+ expandedFrom?: Rect | null;
405
600
  /** The filter and its intensity, 0…100. `null`: none. */
406
601
  filter?: {
407
602
  id: 'DRAMATIC' | 'DRAMATIC_COOL' | 'DRAMATIC_WARM' | 'MONO' | 'NOIR' | 'SILVERTONE' | 'VIVID' | 'VIVID_COOL' | 'VIVID_WARM';
@@ -515,15 +710,18 @@ export declare type EmbedEditorCommand = {
515
710
 
516
711
  /**
517
712
  * What a command of `EmbedEditorHandle` rejects with, besides the editor's own codes (`EmbedEditorErrorCode`: Save's
518
- * `EXPORT_FAILED` and `MARK_FAILED`): `INVALID_COMMAND`, `NOT_AVAILABLE` (a tool the props turned off or the edition
519
- * doesn't have, or the editor was destroyed or closed; each command names its own cases) or `NOT_FOUND` (no area at that
520
- * index, no annotation with that id). `INVALID_COMMAND` is of two kinds, its `props` naming each path from the input
521
- * (`input.item`) either way: an input off its schema, or a command the handle doesn't have (`props` `['command']`),
522
- * rejects at once, its `cause` the schema's own error (none for an unknown name); an input the command can't take where
523
- * the editor stands (an area no drag would draw, a key the annotation's kind doesn't take, a size off the watermark's
524
- * layout) rejects on the command's turn, with no `cause`. A rejected command changes nothing.
713
+ * `EXPORT_FAILED` and `MARK_FAILED`): `AI_FAILED` (a host function the AI called rejected, its error the `cause`, or
714
+ * answered what its contract doesn't take), `INVALID_COMMAND`, `NOT_AVAILABLE` (a tool the props turned off or the
715
+ * edition doesn't have, or the editor was destroyed or closed; each command names its own cases) or `NOT_FOUND` (no area
716
+ * at that index, no annotation with that id, nothing found by the host's `onAiDetectObjects` or `onAiRemoveBackground`, an edit the
717
+ * photo on screen doesn't hold, no composition for `annotate.recreate` to redo, an area the mark commands name that the
718
+ * photo's window doesn't show). `INVALID_COMMAND` is of two kinds, its `props` naming each path from the
719
+ * input (`input.item`) either way: an input off its schema, or a command the handle doesn't have (`props`
720
+ * `['command']`), rejects at once, its `cause` the schema's own error (none for an unknown name); an input the command
721
+ * can't take where the editor stands (an area no drag would draw, a key the annotation's kind doesn't take, a size off
722
+ * the watermark's layout) rejects on the command's turn, with no `cause`. A rejected command changes nothing.
525
723
  */
526
- export declare type EmbedEditorCommandErrorCode = 'INVALID_COMMAND' | 'NOT_AVAILABLE' | 'NOT_FOUND';
724
+ export declare type EmbedEditorCommandErrorCode = 'AI_FAILED' | 'INVALID_COMMAND' | 'NOT_AVAILABLE' | 'NOT_FOUND';
527
725
 
528
726
  /**
529
727
  * What `onLoadError` and `onProcessError` receive, and `processImage` and a command reject with: its `message` is its
@@ -575,9 +773,13 @@ export declare type EmbedEditorEvents = {
575
773
  file: File | null;
576
774
  size: Size;
577
775
  };
578
- /** A Save that went through (its button's or `output.save`), what `onProcess` gets. */
776
+ /**
777
+ * A Save that went through (its button's or `output.save`), what `onProcess` gets. `src` is `null` while the photo is
778
+ * still the one you passed (no AI edit, a session reopened on an earlier `src` included): keep the `src` you have.
779
+ */
579
780
  save: {
580
781
  dest: File;
782
+ src: File | null;
581
783
  state: EditState;
582
784
  };
583
785
  /** What is selected, once it changes (`EmbedEditorSelection`). */
@@ -594,7 +796,9 @@ export declare type EmbedEditorEvents = {
594
796
  * `EmbedEditorError` (`EmbedEditorCommandErrorCode`, or Save's own codes) and then changes nothing. Once the editor
595
797
  * leaves the page (unmounted, its `<Activity>` hidden, `destroy`, `close`), every command waiting and every one called
596
798
  * after rejects `NOT_AVAILABLE`, until it is back; a command running as it leaves rejects too, though what it already
597
- * changed stays, and changes nothing more, the editor back or not. Before the editor first mounts, a command waits for it.
799
+ * changed stays, and changes nothing more, the editor back or not. Before the editor first mounts, a command waits for it,
800
+ * except `ask.stop`, `ask.end`, `menu.closeCard`, `menu.foldCard` and `menu.unfoldCard`: they never queue, and reject `NOT_AVAILABLE` before
801
+ * the mount.
598
802
  */
599
803
  export declare type EmbedEditorHandle = {
600
804
  /**
@@ -615,21 +819,23 @@ export declare type EmbedEditorHandle = {
615
819
  };
616
820
  /**
617
821
  * Annotate (the Full's and the Trial's; elsewhere each command rejects `NOT_AVAILABLE`), as its controls do, in
618
- * `EditState`'s names and image px. An edit never opens Annotate, and selects what it made only while Annotate is open;
619
- * a verb of the action bar rejects `NOT_AVAILABLE` where the bar doesn't offer it for that annotation (`read.options`
620
- * lists what it offers), and an `id` the state lacks rejects `NOT_FOUND`. Every command rejects `NOT_AVAILABLE` while
621
- * the host turned Annotate off (`enableAnnotate: false`).
822
+ * `EditState`'s names and image px. An edit never opens Annotate, and selects what it made only while Annotate is open
823
+ * and no AI request or linked agent's call works; a verb of the action bar rejects `NOT_AVAILABLE` where the bar
824
+ * doesn't offer it for that annotation (`read.options` lists what it offers), and an `id` the state lacks rejects
825
+ * `NOT_FOUND`. Every command rejects `NOT_AVAILABLE` while the host turned Annotate off (`enableAnnotate: false`).
622
826
  */
623
827
  annotate: {
624
828
  /**
625
829
  * An annotation, as a tap or a drag of its tool makes one: a `LINE` (with `points` a drawing, with `role: 'SHAPE'` a
626
830
  * Shape's Line), a `RULER`, a `TEXT` (with `role: 'NUMBER'` a Number), a `SHAPE` or a `LENS`; what it leaves out
627
- * takes its tool's last style (`setStyle`), and a text's `title` and `body` (a ruler's `label`) are typed into it.
628
- * One undo step; resolves to its `id`. `NOT_AVAILABLE` once the photo holds the most annotations it takes.
831
+ * takes its tool's last style (`setStyle`), an arrow in a text's `arrows` an added arrow's default, and a text's
832
+ * `title` and `body` (a ruler's `label`) are typed into it. One undo step; resolves to its `id` and where it stands
833
+ * once laid out (`boxes`, AnnotationBox). `NOT_AVAILABLE` once the photo holds the most annotations it takes.
629
834
  */
630
835
  add: (input: {
631
836
  piece: AnnotatePiece;
632
837
  }) => Promise<{
838
+ boxes: AnnotationBox[];
633
839
  id: string;
634
840
  }>;
635
841
  /**
@@ -647,27 +853,50 @@ export declare type EmbedEditorHandle = {
647
853
  arrow: number;
648
854
  id: string;
649
855
  }>;
650
- /** The action bar's + Leader on a magnifier on its own spot: it moves to the free spot a tap's takes, its line showing. One undo step. */
856
+ /** The action bar's + Leader on a magnifier on its own spot: it moves to the free spot a tap's takes, its line showing. One undo step; resolves to where it stands (`boxes`). */
651
857
  addLeader: (input: {
652
858
  id: string;
653
- }) => Promise<null>;
859
+ }) => Promise<{
860
+ boxes: AnnotationBox[];
861
+ }>;
654
862
  /**
655
863
  * The action bar's + Text on an arrow, a line, a drawing, a shape or a magnifier: a text born touching it in the Text
656
- * tool's last style, `title` and `body` typed into it. One undo step; resolves to the text's `id`.
864
+ * tool's last style, `title` and `body` typed into it. One undo step; resolves to the text's `id` and where it
865
+ * stands (`boxes`).
657
866
  */
658
867
  addText: (input: {
659
868
  body?: string;
660
869
  id: string;
661
870
  title?: string;
662
871
  }) => Promise<{
872
+ boxes: AnnotationBox[];
663
873
  id: string;
664
874
  }>;
665
875
  /** The action bar's Bring to Front: the annotation, or the Numbers' list (`id: 'LIST'`), over the ones covering it. One undo step. */
666
876
  bringToFront: (input: {
667
877
  id: string;
668
878
  }) => Promise<null>;
669
- /** Annotate closed, as its button: what was selected lets go. */
879
+ /** Annotate closed, as its button: what was selected lets go, and the AI's Annotate mode with it (`ask.close`). */
670
880
  close: () => Promise<null>;
881
+ /**
882
+ * The AI's Annotate mode (with the host's `onAiChooseCommands`; without it each rejects `NOT_AVAILABLE`, as `ask.send`): the person
883
+ * gives the content in words and the AI composes the annotations, deciding the story, the style, where each piece goes
884
+ * and what each text says. The same request as `ask.send`, in the same conversation, Annotate opened first where it is
885
+ * closed (as `select` opens it, the photo's AI closing as `ask.close`) and the AI open in it on Annotate's mode, in its
886
+ * words, except that the model gets the person's words after the line "Annotate the photo for this request, as the art
887
+ * director:" (the host's `aiPrompts.requestAnnotate` in its place), takes no `area`, and is given none of the work of
888
+ * the host's other AI functions (Annotate changes no pixels). Resolves once the AI is done to the `ids` of the
889
+ * composition's annotations on the photo (the ones the conversation's Annotate-mode requests made and the edits of
890
+ * them, never one the person drew or copied: what `recreate` redoes) and its last words (`reply`); `ask.stop`, Stop or
891
+ * Escape resolve it at once with what it did so far. Everything it did is one undo step. Rejects as `ask.send` does,
892
+ * Annotate open or not (`NOT_AVAILABLE` where its screens fail to load).
893
+ */
894
+ create: (input: {
895
+ text: string;
896
+ }) => Promise<{
897
+ ids: string[];
898
+ reply: string;
899
+ }>;
671
900
  /**
672
901
  * The action bar's Detach: a line's glued ends, or the glued tip of the arrow `arrow` of a text or of the Numbers' list
673
902
  * (`id: 'LIST'`), let go where they are. One undo step.
@@ -676,19 +905,34 @@ export declare type EmbedEditorHandle = {
676
905
  arrow?: number;
677
906
  id: string;
678
907
  }) => Promise<null>;
679
- /** The action bar's Duplicate: a copy a step down and right on the screen, whatever the photo's turn or mirror, with its text. One undo step; resolves to the copy's `id`. */
908
+ /** The action bar's Duplicate: a copy a step down and right on the screen, whatever the photo's turn or mirror, with its text. One undo step; resolves to the copy's `id` and where it stands (`boxes`). */
680
909
  duplicate: (input: {
681
910
  id: string;
682
911
  }) => Promise<{
912
+ boxes: AnnotationBox[];
683
913
  id: string;
684
914
  }>;
685
- /** In a List: the Numbers' words in a list placed off the photo's subject (the one `unlist` took away, if any). One undo step. */
686
- list: () => Promise<null>;
915
+ /** In a List: the Numbers' words in a list placed off the photo's subject (the one `unlist` took away, if any). One undo step; resolves to where the list and the Numbers stand (`boxes`). */
916
+ list: () => Promise<{
917
+ boxes: AnnotationBox[];
918
+ }>;
687
919
  /**
688
- * Annotate opened, as its button: on the tool chosen last, nothing selected. Resolves once it is open (the view then
689
- * moves to its room). `NOT_AVAILABLE` where its screens fail to load.
920
+ * Annotate opened, as its button: on the tool chosen last, nothing selected, the AI closed first if open
921
+ * (`ask.close`). Resolves once it is open (the view then moves to its room). `NOT_AVAILABLE` where its screens fail
922
+ * to load.
690
923
  */
691
924
  open: () => Promise<null>;
925
+ /**
926
+ * The Annotate mode's Generate with the words of its last request: the composition's annotations go, with what they own (the ones on
927
+ * the photo now, the composition `history.undo` brought back too; never one the person drew or copied), and the AI
928
+ * composes again for the same request, in a different style, in the same conversation, Annotate opened first as for
929
+ * `create`. All of it is one undo step, so one `history.undo` brings the composition before back. Resolves as `create` does. `NOT_FOUND` with no composition to redo (no `create`
930
+ * in the conversation, or one `ask.end` ended), and rejects as `create` otherwise.
931
+ */
932
+ recreate: () => Promise<{
933
+ ids: string[];
934
+ reply: string;
935
+ }>;
692
936
  /**
693
937
  * The action bar's Delete: the annotation with what it owns, the Numbers' list (`id: 'LIST'`, its Numbers staying), or
694
938
  * only the arrow `arrow` of a text or of the list. One undo step.
@@ -699,16 +943,19 @@ export declare type EmbedEditorHandle = {
699
943
  }) => Promise<null>;
700
944
  /**
701
945
  * Annotate opened with an annotation selected, the Numbers' list (`id: 'LIST'`), or the arrow `arrow` of a text or of
702
- * the list, as a tap on it; `id: null` lets the selection go, and opens nothing.
946
+ * the list, as a tap on it; `id: null` lets the selection go, and opens nothing. Opening Annotate closes the AI first
947
+ * (as `ask.close`), as `open` does.
703
948
  */
704
949
  select: (input: {
705
950
  arrow?: number;
706
951
  id: string | null;
707
952
  }) => Promise<null>;
708
- /** The Numbers' list's title, as its own field writes it (trimmed). One undo step. `NOT_FOUND` with no list. */
953
+ /** The Numbers' list's title, as its own field writes it (trimmed). One undo step; resolves to where the list stands (`boxes`). `NOT_FOUND` with no list. */
709
954
  setListTitle: (input: {
710
955
  title: string;
711
- }) => Promise<null>;
956
+ }) => Promise<{
957
+ boxes: AnnotationBox[];
958
+ }>;
712
959
  /**
713
960
  * The style the next annotation of `tool` (left out: the one open on Annotate's carousel) is born in, as the rows
714
961
  * with nothing selected; `kind: 'LINE'` makes the Shape's next one a Line. `INVALID_COMMAND` for an option that
@@ -722,18 +969,30 @@ export declare type EmbedEditorHandle = {
722
969
  setTheme: (input: {
723
970
  theme: AnnotationTheme;
724
971
  }) => Promise<null>;
725
- /** The tool a tap or a drag on the photo makes, as Annotate's carousel: what was selected lets go. */
972
+ /**
973
+ * The tool a tap or a drag on the photo makes, as Annotate's carousel: what was selected lets go. Annotate opens on it
974
+ * if it is closed, as `open` opens it; resolves once it is open. `NOT_AVAILABLE` as `open`. Rejected, it changes nothing: the tool stays the one chosen before.
975
+ */
726
976
  setTool: (input: {
727
977
  tool: AnnotateTool;
728
978
  }) => Promise<null>;
729
- /** Beside: the Numbers' list taken away, each Number's words back by its badge; `list` brings it back. One undo step. */
730
- unlist: () => Promise<null>;
979
+ /** Beside: the Numbers' list taken away, each Number's words back by its badge; `list` brings it back. One undo step; resolves to where the Numbers stand (`boxes`). */
980
+ unlist: () => Promise<{
981
+ boxes: AnnotationBox[];
982
+ }>;
731
983
  /**
732
984
  * An annotation changed (or, with `arrow`, the arrow of a text or of the Numbers' list), as its style row, color row
733
985
  * and typing do: its style, a `theme`, its words (a text's `title` and `body`, a ruler's `label`) and its geometry
734
- * (`from`, `to`, `at`, `box`, `origin`, `radius`, `angle`, `bend`, `width`, written as given). The list (`id: 'LIST'`)
735
- * and a Number in it set the list's color, theme, font and size with every Number's; an arrow takes its owner's
736
- * color and no theme. One undo step. `INVALID_COMMAND` for what that annotation has none of.
986
+ * (`from`, `to`, `at`, `box`, `origin`, `radius`, `angle`, `bend`, `width`, written as given). Where it moves an
987
+ * annotation whole, it moves it as a drag of it does, the texts pinned to it and the tips glued to either with it: a
988
+ * text's, a Number's or a magnifier's `at` (one on its spot taking its `origin` along), a shape's `box` at its size,
989
+ * a line's or a ruler's `from` and `to` by as far (a line letting go of what its ends were glued to, an Elbow keeping
990
+ * its route as drawn). A Number's `at` takes its badge's point with it: in the list its badge goes onto `at`, standing
991
+ * alone its pill stands on `at`. The list (`id: 'LIST'`) and a Number in it set the
992
+ * list's color, theme, font and size with every Number's; the list takes its `at`, moved as a drag of it moves it, the
993
+ * tips glued to it with it, and its `angle` and `width`, written as a text's are (a turn leaves those tips where they
994
+ * are). An arrow takes its owner's color and no theme. One undo step; resolves to where what it moved stands
995
+ * (`boxes`). `INVALID_COMMAND` for what that annotation has none of.
737
996
  */
738
997
  update: (input: Flat<AnnotateStyle & {
739
998
  angle?: AnnotationAngle;
@@ -752,7 +1011,130 @@ export declare type EmbedEditorHandle = {
752
1011
  title?: string;
753
1012
  to?: AnnotationPoint;
754
1013
  width?: number | null;
755
- }>) => Promise<null>;
1014
+ }>) => Promise<{
1015
+ boxes: AnnotationBox[];
1016
+ }>;
1017
+ };
1018
+ /**
1019
+ * The conversation with the AI, as its circle, its field and its Stop: the host's `onAiChooseCommands` answers, and each tool the model
1020
+ * calls runs as one of these commands. The Full's and the Trial's; elsewhere every one rejects `NOT_AVAILABLE`. There, `send`
1021
+ * rejects it without `onAiChooseCommands`, `open` and `setText` without `onAiChooseCommands`, `onAiEditImage` or `onAiRemoveBackground`
1022
+ * (`onAiDetectObjects` alone opens none), `setAction` for an action the host's functions can't run, `setReferenceImage`
1023
+ * outside Generate or without `onAiEditImage`, and `close`, `stop` and `end` with none of the host's AI functions.
1024
+ */
1025
+ ask: {
1026
+ /**
1027
+ * Closes the AI, as a tap on its lit ✦, losing nothing: it opens again (`open`, `send`) with the conversation going on,
1028
+ * its field's words and the areas marked (unseen while it is closed) as they were; its last reply or
1029
+ * failure leaves its card. The menu comes back where it was as the AI opened, whichever of its modes were chosen
1030
+ * meanwhile: Annotate where the AI was opened in it (open again where a photo's action closed it), else Annotate closed
1031
+ * where it opened only for `setAction`'s `'ANNOTATE'`, the tool and its section as they were; what the AI made stays. It never
1032
+ * fails: where Annotate can't open again as the AI closes (`enableAnnotate` off, a gesture or a Save under way), the AI
1033
+ * closes and the menu lands on the tools, as a close from them does.
1034
+ * `menu.select`, `menu.openSection`, `menu.toggle`, `annotate.open`, `annotate.select` and `annotate.setTool` opening
1035
+ * Annotate, `annotate.close`, and `annotate.setTool` with Annotate's mode open close it first, losing nothing, and go on
1036
+ * where they go (the tools row and Annotate's button hide while it is open). Resolves to `null`; with the AI closed it
1037
+ * changes nothing. `NOT_AVAILABLE` without any of the host's AI functions.
1038
+ */
1039
+ close: () => Promise<null>;
1040
+ /**
1041
+ * Ends the conversation, the host's own (the person closes the AI with `close`'s ✦, losing nothing): a request or any
1042
+ * other work of the AI's under way stops first (as `stop`), the AI closes with the mark and the AI's card, and the next
1043
+ * `send` starts a new conversation (every image a fill landed stays on the photo, a step of the history).
1044
+ * Resolves to `null` at once while the AI works, even while a request holds the queue; with none under way, once a
1045
+ * gesture the person holds has ended.
1046
+ */
1047
+ end: () => Promise<null>;
1048
+ /**
1049
+ * Opens the AI, as a tap on its ✦: on the photo's action chosen out of Annotate, on Annotate's mode in it, as `close`
1050
+ * left them, its rows in the menu in place of the tools row and Annotate's button, which hide while it is open, the lit
1051
+ * ✦ at the right end of its selector's row. Resolves to `null` once it is open;
1052
+ * already open, it stays as it is. Rejects `NOT_AVAILABLE` without `onAiChooseCommands`, `onAiEditImage` or
1053
+ * `onAiRemoveBackground`, and in Annotate without `onAiChooseCommands`.
1054
+ */
1055
+ open: () => Promise<null>;
1056
+ /**
1057
+ * Asks the AI for something in words, as the person writes it and sends it: the AI's field opens if it is
1058
+ * closed, each tool the model calls runs in turn (selecting nothing it makes), and the editor takes no input
1059
+ * meanwhile but Close, Escape, which stops the work, and the AI's card (its Stop and its pill). The AI works the photo with the editor's tools (it adjusts, filters, crops,
1060
+ * hides, removes and generates in an area) and never annotates: it is offered none of Annotate's commands, and
1061
+ * `annotate.create` is the one way to annotate with it. With `area`, the request is about that place of the photo
1062
+ * (`'MARK'`: the mark there): it shows while the request's fill of it works, written into none of the person's
1063
+ * areas, and the model is told how many areas it is and their boxes in the photo's px, as `read.mark` gives them,
1064
+ * and to use `retouch_remove` or `retouch_run` with `{ kind: 'MARK' }`, which changes exactly the marked px, never
1065
+ * their boxes. `'ALL'` and `'BACKGROUND'`, which no Remove takes, are told by their own kind, never as a mark: the
1066
+ * whole photo or the background, its box, and `retouch_run` with `{ kind: 'ALL' }` or `{ kind: 'BACKGROUND' }`. An
1067
+ * area other than `'MARK'` is filled once in the request: once its fill lands, `read_mark` gives `[]` and another
1068
+ * fill of it there (`{ kind: 'MARK' }`, or the whole photo's or the background's own kind) rejects `INVALID_COMMAND`
1069
+ * (`input.area`), the person's areas never read by it. Resolves once the AI is done,
1070
+ * to its last words (`reply`), which the AI's card shows; `stop`, Stop or Escape resolve it at once with what it did
1071
+ * so far.
1072
+ * Everything it did is one undo step, and the next request goes on in the same conversation until `end`. Rejects
1073
+ * `NOT_AVAILABLE` for `'BACKGROUND'` with no background removed, while Annotate is open (the photo's AI is not on screen
1074
+ * then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first, or `setAction`), and when the editor leaves the page, is
1075
+ * destroyed or opens another image meanwhile; `INVALID_COMMAND` for a text with no words and for an area with
1076
+ * nothing of the photo in it (`'MARK'` with nothing marked); and `AI_FAILED` when `onAiChooseCommands` rejects (its error
1077
+ * the `cause`; what the AI did so far stays, one undo step).
1078
+ */
1079
+ send: (input: {
1080
+ area?: AiArea;
1081
+ text: string;
1082
+ }) => Promise<{
1083
+ reply: string;
1084
+ }>;
1085
+ /**
1086
+ * Chooses what the AI does, as a tap on its selector over the menu (Edit, Remove Object, Remove Background, Annotate):
1087
+ * `'GENERATE'` (Edit: the field and its Generate: words over the areas marked, or over the whole photo with nothing
1088
+ * marked, through `onAiChooseCommands` where given, else by `retouch.run` of `'ALL'`; a reference image over the areas
1089
+ * marked, or over the whole photo with nothing marked), `'REMOVE_OBJECT'` (the brush and Remove, which
1090
+ * removes what the areas cover) or `'REMOVE_BACKGROUND'` (Remove; the field of what to keep with
1091
+ * `enableAiRemoveBackgroundPrompt`; once the background is cut, the field of the new background with `onAiEditImage`) or
1092
+ * `'ANNOTATE'` (Annotate's mode: the field whose Generate composes Annotate's pieces, as `annotate.create`, Annotate
1093
+ * opening under it where it is closed, and closing with the AI where it opened only for it, the pieces it made staying;
1094
+ * a photo's action chosen from it closes Annotate first), each where the host gave what it runs: `onAiChooseCommands` or `onAiEditImage`, `onAiEditImage`,
1095
+ * `onAiRemoveBackground`, and `onAiChooseCommands` with Annotate on. The AI opens on it if it is closed, as `open` opens it; the
1096
+ * areas marked stay (unseen in Remove Background and Annotate's mode; shown while Remove Object is chosen, the ones a
1097
+ * Generate hid too) and so do each mode's words, and the photo's action chosen lasts while the editor is open. Resolves
1098
+ * to `null` once it shows. Rejects `NOT_AVAILABLE` for a choice the host's functions can't run.
1099
+ */
1100
+ setAction: (input: {
1101
+ action: 'ANNOTATE' | 'GENERATE' | 'REMOVE_BACKGROUND' | 'REMOVE_OBJECT';
1102
+ }) => Promise<null>;
1103
+ /**
1104
+ * Puts the reference image in the AI's Generate field, as Add Image does, or takes it away, as the X on its
1105
+ * thumbnail does: `referenceImage` is the image's URL (`http(s):`, `data:` or `blob:`, as `retouch.run` takes it), or
1106
+ * `null` for none. The AI opens on Generate if it is closed, as `open` opens it, and while the AI works it waits its turn
1107
+ * behind the work, as `setAction` does, and lands once it ends. The image fills the whole marked
1108
+ * area, and Generate sends it with the words, or alone. Resolves to `null` once the field shows it. Rejects
1109
+ * `NOT_AVAILABLE` outside Generate (another action chosen, or Annotate), and without `onAiEditImage`;
1110
+ * `INVALID_COMMAND` (`input.referenceImage`) for an image the editor can't read.
1111
+ */
1112
+ setReferenceImage: (input: {
1113
+ referenceImage: string | null;
1114
+ }) => Promise<null>;
1115
+ /**
1116
+ * Puts words in the AI's field, as a choice of its Examples does: `text` takes the place of what the field holds (`''`
1117
+ * empties it). It sends nothing and gives the field no focus, so a phone's keyboard stays down; the field's button
1118
+ * sends the words as the person's tap would. The AI of where the person is opens if it is closed, as `open` opens it
1119
+ * (on the photo's action out of Annotate, on Annotate's mode in it), and while the AI works it waits its turn behind the work, as
1120
+ * `setAction` does. Resolves to `null` once the field shows the words. Rejects `NOT_AVAILABLE` where there is no
1121
+ * field to fill: without `onAiChooseCommands`, `onAiEditImage` or `onAiRemoveBackground` (without `onAiChooseCommands` in Annotate), and
1122
+ * in Remove Object or a Remove Background with no field (its lone Remove); `INVALID_COMMAND` (`input.text`)
1123
+ * for words with a line break, as the field holds one line.
1124
+ */
1125
+ setText: (input: {
1126
+ text: string;
1127
+ }) => Promise<null>;
1128
+ /**
1129
+ * Stops the request under way, or any other work of the AI's (`retouch.run`, `retouch.remove`, `retouch.more`,
1130
+ * `retouch.removeBackground`, `crop.expand`, `crop.more`, `obfuscate.detect`), as the AI's Stop: what a request did so
1131
+ * far stays (one undo step) and `send` resolves with its words so far; `retouch.run`, `retouch.remove`,
1132
+ * `retouch.more` and `retouch.removeBackground` resolve with `{ id: null }`, `crop.expand` and `crop.more` with
1133
+ * `{ id: null }` and the photo as it was (no undo step) and `obfuscate.detect` with
1134
+ * `{ boxes: [], indexes: [] }`. Resolves to `null` at once, even while the work holds the queue; with none under way it changes
1135
+ * nothing, and resolves once a gesture the person holds has ended.
1136
+ */
1137
+ stop: () => Promise<null>;
756
1138
  };
757
1139
  /**
758
1140
  * Auto, as its ring, its Auto Enhance button and its ruler. Each is one undo step, none when nothing changes;
@@ -775,10 +1157,48 @@ export declare type EmbedEditorHandle = {
775
1157
  commands: () => EmbedEditorCommand[];
776
1158
  /** Adjust's crop, as its pill, its sections and its ruler set it. Each is one undo step, none when nothing changes. */
777
1159
  crop: {
1160
+ /**
1161
+ * The photo expanded to a ratio by its name, as Expand in the Aspect section: borders on two sides of the photo
1162
+ * as it shows, as wide as each other, which `onAiEditImage` fills with the scene continued (it gets the operation
1163
+ * `GENERATE_BORDERS`: the bigger photo with its borders transparent, 2048 px on its longer side at the most, its
1164
+ * mask, white on them, and the borders' widths). The
1165
+ * state moves with the photo, its edits keeping their look on it (`expandedFrom`), and the crop becomes the
1166
+ * ratio's largest window on its middle. The bigger photo shows with its borders and its edge glowing in the AI
1167
+ * brush's colors meanwhile, no AI field opens for it, the AI's card saying it expands with Stop (Escape and
1168
+ * Close stop it too), and the editor takes no input but Close, Escape, which stops the work, and the AI's card (its Stop and its pill). A ratio the Aspect section still waits
1169
+ * on, chosen before the call, never lands. The host's image lands in the borders as one undo step, and the AI's
1170
+ * card offers Generate Again (`more`) while the Aspect section shows; Expand again swaps the borders. A photo whose
1171
+ * background is cut, with none generated under it, keeps its borders transparent, with no call. Resolves to the
1172
+ * edit's `id`, its borders generated or transparent; `{ id: null }` where the photo already has the ratio (its crop
1173
+ * taking it, any borders going) and after `ask.stop`, the photo as it was. The Full's and the Trial's: `NOT_AVAILABLE` without
1174
+ * `onAiEditImage`, while the host locks the ratio, when the editor leaves the page, is destroyed or opens another
1175
+ * image meanwhile, and in the Free and the Lite; `AI_FAILED` when `onAiEditImage` rejects (its error the
1176
+ * `cause`), answers anything but one image (a list of them too) or one that changed nothing in the borders, the
1177
+ * photo as it was.
1178
+ */
1179
+ expand: (input: {
1180
+ ratio: '1:1' | '1:2' | '16:9' | '2:1' | '3:4' | '4:3' | '9:16';
1181
+ }) => Promise<{
1182
+ id: string | null;
1183
+ }>;
778
1184
  /** The image mirrored across (`'X'`, the pill's Flip) or up and down (`'Y'`), the window staying on the photo. */
779
1185
  flip: (input: {
780
1186
  axis: 'X' | 'Y';
781
1187
  }) => Promise<null>;
1188
+ /**
1189
+ * Asks `onAiEditImage` again for the Expand `id` on the photo (`expand`'s), as Generate Again on the AI's card: the same
1190
+ * bigger photo with its borders transparent, mask, words and borders' widths, in place as `expand` is. The host's
1191
+ * image lands in them as an Expand of its own in the edit's place, as one undo step: an Undo brings the borders
1192
+ * before it back. Resolves to the new edit's `id`; `ask.stop` resolves it with `{ id: null }`, the photo as it
1193
+ * was. `NOT_FOUND` for an edit the photo on screen doesn't hold (an
1194
+ * Undo took it off, an Expand again swapped it), one that is no Expand and an Expand whose borders stay transparent;
1195
+ * `AI_FAILED` as `expand`. The Full's and the Trial's: `NOT_AVAILABLE` in the Free and the Lite.
1196
+ */
1197
+ more: (input: {
1198
+ id: string;
1199
+ }) => Promise<{
1200
+ id: string | null;
1201
+ }>;
782
1202
  /**
783
1203
  * The image turned a quarter, `'LEFT'` (the pill's Rotate) or `'RIGHT'`: the whole photo turns with its window, any
784
1204
  * other window stays where it is on the screen.
@@ -813,10 +1233,20 @@ export declare type EmbedEditorHandle = {
813
1233
  setFocus: (input: {
814
1234
  focus: 'CENTER' | 'SUBJECT';
815
1235
  }) => Promise<null>;
1236
+ /**
1237
+ * What a ratio of the Aspect section does, as its Crop | Expand control: `'CROP'` crops to it, `'EXPAND'` expands the
1238
+ * photo to it as `expand` does once a ratio is tapped there (Free and Original crop either way), for as long as the
1239
+ * editor is open. It opens nothing; `setRatio` crops and `expand` expands whatever it is. No undo step. The Full's and
1240
+ * the Trial's: `NOT_AVAILABLE` without `onAiEditImage`, while the host locks the ratio, and in the Free and the Lite.
1241
+ */
1242
+ setMode: (input: {
1243
+ mode: 'CROP' | 'EXPAND';
1244
+ }) => Promise<null>;
816
1245
  /**
817
1246
  * The ratio, by its name in the Aspect section, as a tap on it there: its largest window, where Focus places it.
818
1247
  * `'ORIGINAL'` is the photo's own ratio as it is turned. `null` frees it, the window as it is, as Free there does.
819
- * The ratio in effect changes nothing. `NOT_AVAILABLE` while the host locks the ratio.
1248
+ * The ratio in effect changes nothing. A ratio the Aspect section still waits on never lands when it was chosen
1249
+ * before the call; one chosen after it lands after it. `NOT_AVAILABLE` while the host locks the ratio.
820
1250
  */
821
1251
  setRatio: (input: {
822
1252
  ratio: '1:1' | '1:2' | '16:9' | '2:1' | '3:4' | '4:3' | '9:16' | 'ORIGINAL' | null;
@@ -868,14 +1298,20 @@ export declare type EmbedEditorHandle = {
868
1298
  };
869
1299
  /** The history, as Undo, Redo and Reset on the toolbar. Each waits its turn; with nothing to take, it changes nothing. */
870
1300
  history: {
871
- /** The step undone last, again. */
1301
+ /**
1302
+ * The step undone last, again. Resolves once its picture is on screen: the AI's images of a step Undo alone reached are
1303
+ * held compressed, and made again first.
1304
+ */
872
1305
  redo: () => Promise<null>;
873
1306
  /**
874
1307
  * Every edit taken away, as the toolbar's Reset (no confirm asked): a `state` the editor opened with too, the crop
875
1308
  * ratio `aspectRatio` sets or `aspectRatioLocked` holds kept. One step undo takes back.
876
1309
  */
877
1310
  reset: () => Promise<null>;
878
- /** The last step taken back: the image and the view as they were before it. */
1311
+ /**
1312
+ * The last step taken back: the image and the view as they were before it. Resolves once its picture is on screen: the
1313
+ * AI's images of an earlier step are held compressed, and made again first.
1314
+ */
879
1315
  undo: () => Promise<null>;
880
1316
  };
881
1317
  /**
@@ -892,14 +1328,17 @@ export declare type EmbedEditorHandle = {
892
1328
  /**
893
1329
  * The signature at one of its 9 points (`position`), or with its center at a spot of the final image (`x` and `y`,
894
1330
  * 0…1): exactly one of them, as a drag on the stage drops it (a spot within 6% of the image's shorter side of a point
895
- * sticks to it, and the signature stays whole on the image). One undo step.
1331
+ * sticks to it, and the signature stays whole on the image). One undo step. Resolves to where it stands once drawn
1332
+ * (`boxes`, MarkBox).
896
1333
  */
897
1334
  place: (input: {
898
1335
  position?: 'BOTTOM' | 'BOTTOM_LEFT' | 'BOTTOM_RIGHT' | 'CENTER' | 'LEFT' | 'RIGHT' | 'TOP' | 'TOP_LEFT' | 'TOP_RIGHT';
899
1336
  role: 'SIGNATURE';
900
1337
  x?: number;
901
1338
  y?: number;
902
- }) => Promise<null>;
1339
+ }) => Promise<{
1340
+ boxes: MarkBox[];
1341
+ }>;
903
1342
  /** A free mark hidden by `hide` back on the image and the file. One undo step (none when it shows already). */
904
1343
  show: (input: {
905
1344
  role: 'SIGNATURE' | 'WATERMARK';
@@ -910,6 +1349,7 @@ export declare type EmbedEditorHandle = {
910
1349
  * `angle`; a signature's `size` (2…40) and `margin`; either's `opacity`, `color` (`'AUTO'` or a hex), `font` and `text`
911
1350
  * (as its field's Done writes it, trimmed). `INVALID_COMMAND` for a field the other mark takes (`margin` on the
912
1351
  * watermark, `angle`, `layout` or `spacing` on the signature), a size off its range, a spacing on a single watermark.
1352
+ * Resolves to where the mark stands once drawn (`boxes`, MarkBox).
913
1353
  */
914
1354
  update: (input: {
915
1355
  angle?: number;
@@ -922,24 +1362,52 @@ export declare type EmbedEditorHandle = {
922
1362
  size?: number;
923
1363
  spacing?: number;
924
1364
  text?: string;
925
- }) => Promise<null>;
1365
+ }) => Promise<{
1366
+ boxes: MarkBox[];
1367
+ }>;
926
1368
  };
927
- /** The menu's carousel, and Adjust's sections over it. */
1369
+ /** The menu's carousel, Adjust's sections over it, and the AI's card (`closeCard`, `foldCard`, `unfoldCard`). */
928
1370
  menu: {
929
- /** Adjust's Scale or Aspect section closed, back to the carousel, as its Done; a ratio it still waits on lands. */
1371
+ /**
1372
+ * The AI's card closed for good, as the ✕ in its corner and on its pill: its last reply or failure goes, an Expand's
1373
+ * Generate Again stays away until the next Expand, and the editor's line where an image's mark is a dot until what it
1374
+ * tells of ends and starts again (a new dot marked with the image). The next work, reply or failure opens it unfolded.
1375
+ * It resolves once the card is gone; with no work under way, once a gesture the person holds has ended.
1376
+ * `NOT_AVAILABLE` where nothing is on the AI's card to close, while the AI works on it (Stop is on the card), and
1377
+ * without any of the host's AI functions. The Full's and the Trial's: `NOT_AVAILABLE` in the Free and the Lite.
1378
+ */
1379
+ closeCard: () => Promise<null>;
1380
+ /**
1381
+ * Adjust's Scale or Aspect section closed, back to the carousel, as its Done; a ratio it still waits on lands first,
1382
+ * an Expand's only starting (its borders fill after the command resolves).
1383
+ */
930
1384
  closeSection: () => Promise<null>;
1385
+ /**
1386
+ * The AI's card folded, as the person folds it: the card the AI shows while it works, with its last reply or failure,
1387
+ * with an Expand's Generate Again over the Aspect section, or with the editor's line where an image's mark is a dot,
1388
+ * folded as by the ⌃ in its corner to a 28 px pill with the request's words (else the work's phrase, the reply,
1389
+ * "Expanded to {ratio}" or the line; a failure's red dot and its title; while the AI works, its words shimmer); only the
1390
+ * person or this command folds it, never a touch outside, and every new work, reply or failure opens unfolded. A card
1391
+ * already folded stays as it is. It resolves at once while the AI works, even while a request holds the queue; with
1392
+ * none under way, once a gesture the person holds has ended. `NOT_AVAILABLE` where the card is not there (nothing on
1393
+ * the AI's card to fold), and without any of the host's AI functions. The Full's and the Trial's: `NOT_AVAILABLE` in
1394
+ * the Free and the Lite.
1395
+ */
1396
+ foldCard: () => Promise<null>;
931
1397
  /**
932
1398
  * Adjust's Scale (its zoom slider) or Aspect (its ratios) section opened over the carousel, as the crop pill's buttons,
933
- * the menu going to Adjust first. The section open stays as it is. `NOT_AVAILABLE` for `'ASPECT'` while the host
934
- * locks the ratio, and for both while Annotate is open.
1399
+ * the menu going to Adjust first. With the AI open over the carousel, it closes the AI first (`ask.close`). The
1400
+ * section open stays as it is. `NOT_AVAILABLE` for `'ASPECT'` while the host locks the ratio, and for both while
1401
+ * Annotate is open.
935
1402
  */
936
1403
  openSection: (input: {
937
1404
  section: 'ASPECT' | 'SCALE';
938
1405
  }) => Promise<null>;
939
1406
  /**
940
1407
  * The item the menu shows, as a tap on it in the carousel (no name over the photo): its tool opens on the stage. The
941
- * item already shown stays as it is. `NOT_AVAILABLE` for an item the props turned off or the edition doesn't have,
942
- * and while Annotate is open (no carousel on screen then: `annotate.close` first).
1408
+ * item already shown stays as it is. With the AI open over the carousel, it closes the AI first (`ask.close`).
1409
+ * `NOT_AVAILABLE` for an item the props turned off or the edition doesn't have, and while Annotate is open (no
1410
+ * carousel on screen then: `annotate.close` first).
943
1411
  */
944
1412
  select: (input: {
945
1413
  item: EmbedEditorMenuItem;
@@ -947,12 +1415,23 @@ export declare type EmbedEditorHandle = {
947
1415
  /**
948
1416
  * An item with a ring turned off and back, as a tap on its ring: a value to zero (the straightening for `'ADJUST'`)
949
1417
  * and back to what it was, a filter, a frame or Auto off and back (Auto with nothing to come back to turns on at the
950
- * image's own amount, once it is read). One undo step. `NOT_AVAILABLE` as for `select`, and for `'AUTO'` when the
951
- * image can't be read or its reading takes too long (nothing changes then).
1418
+ * image's own amount, once it is read). One undo step. With the AI open over the carousel, it closes the AI once the
1419
+ * ring's tap lands (`ask.close`); with Annotate open, whose own carousel shows, the AI's Annotate mode stays open. `NOT_AVAILABLE` as
1420
+ * for `select`, and for `'AUTO'` when the image can't be read or its reading takes too long (nothing changes then,
1421
+ * the AI included).
952
1422
  */
953
1423
  toggle: (input: {
954
1424
  item: 'ADJUST' | 'AUTO' | 'BLACK_POINT' | 'BRIGHTNESS' | 'BRILLIANCE' | 'CONTRAST' | 'EXPOSURE' | 'FILTER' | 'FRAME' | 'HIGHLIGHTS' | 'SATURATION' | 'SHADOWS' | 'SHARPNESS' | 'VIBRANCE' | 'VIGNETTE' | 'WARMTH';
955
1425
  }) => Promise<null>;
1426
+ /**
1427
+ * The AI's card opened from its pill, as a tap on the pill: the card the AI shows while it works, with its last reply
1428
+ * or failure, an Expand's Generate Again or the editor's line. A card already open stays as it is. It resolves at once
1429
+ * while the AI works, even while a request holds the queue; with none under way, once a gesture the person holds has
1430
+ * ended. `NOT_AVAILABLE` where the card is not there (nothing on the AI's card), and without any of the host's AI
1431
+ * functions.
1432
+ * The Full's and the Trial's: `NOT_AVAILABLE` in the Free and the Lite.
1433
+ */
1434
+ unfoldCard: () => Promise<null>;
956
1435
  };
957
1436
  /**
958
1437
  * Obfuscate's areas (the Full's), each by its index in the state's `obfuscation` (an area has no id), in its units:
@@ -963,8 +1442,10 @@ export declare type EmbedEditorHandle = {
963
1442
  /**
964
1443
  * A new area, as a drawing on the stage makes one: the look it gives, the rest as the next area's (what Obfuscate's
965
1444
  * controls show with no area selected), born level on the screen unless `angle` turns it; selected once added while
966
- * Obfuscate is open. One undo step. Resolves to its index. `NOT_AVAILABLE` with 64 areas already; `INVALID_COMMAND`
967
- * for one a drawing never makes, a side under 1 px or nothing of it on the crop (its rect's paths in `props`).
1445
+ * Obfuscate is open and no AI request or linked agent's call works. One undo step. Resolves to its index, and where
1446
+ * it stands once drawn (`boxes`, ObfuscationBox).
1447
+ * `NOT_AVAILABLE` with 64 areas already; `INVALID_COMMAND` for one a drawing never makes, a side under 1 px or nothing
1448
+ * of it on the crop (its rect's paths in `props`).
968
1449
  */
969
1450
  add: (input: {
970
1451
  angle?: number;
@@ -977,16 +1458,39 @@ export declare type EmbedEditorHandle = {
977
1458
  x: number;
978
1459
  y: number;
979
1460
  }) => Promise<{
1461
+ boxes: ObfuscationBox[];
980
1462
  index: number;
981
1463
  }>;
982
- /** The area at `index` removed, as Delete removes the selected one: the areas after it move up, nothing stays selected. One undo step. `NOT_FOUND` for no area there. */
1464
+ /**
1465
+ * The faces, license plates, documents and screens of the photo covered with areas, as Detect in Obfuscate's pill (the
1466
+ * Full's and the Trial's AI): your `onAiDetectObjects` is asked for the four in one call, on the original photo with the
1467
+ * AI's edits alone, and each thing it finds becomes an area in the next area's look, level in the photo's frame
1468
+ * (`angle` 0), over its box grown 10 % of its width and of its height on each side. A find under 0.5 of `confidence`
1469
+ * is left out (one with none is kept), and one at least 80 % inside an area already on the photo, or one this Detect
1470
+ * just made, makes none, so a second Detect adds nothing; up to 64 areas in all. It selects nothing, and all its areas
1471
+ * are one undo step. While it searches the editor takes no input but Escape and Close, which stop it as `ask.stop`
1472
+ * does. Resolves to the new areas' indexes, in the order found, and where each stands once drawn (`boxes`,
1473
+ * ObfuscationBox): none where everything found was covered already, and on `ask.stop`. `NOT_AVAILABLE` without `onAiDetectObjects`, with 64 areas already, and when the editor leaves the page,
1474
+ * is destroyed or opens another image meanwhile; `NOT_FOUND` where your function found nothing, or nothing at 0.5 and
1475
+ * up; `AI_FAILED` when it rejects (its error the `cause`) or answers no list, and when the editor fails on the way (that
1476
+ * error the `cause`); `EXPORT_FAILED` when the photo can't be made.
1477
+ */
1478
+ detect: () => Promise<{
1479
+ boxes: ObfuscationBox[];
1480
+ indexes: number[];
1481
+ }>;
1482
+ /**
1483
+ * The area at `index` removed, as Delete removes the selected one: the areas after it move up, nothing stays selected
1484
+ * (but in an AI request or a linked agent's call, which keeps the person's selected area unless it removed that one).
1485
+ * One undo step. `NOT_FOUND` for no area there.
1486
+ */
983
1487
  remove: (input: {
984
1488
  index: number;
985
1489
  }) => Promise<null>;
986
1490
  /**
987
- * The area at `index` selected, as a tap on it, Obfuscate opened if it isn't; `null` lets the selection go. No undo
988
- * step. `NOT_FOUND` for no area there; `NOT_AVAILABLE` while Annotate is open (Obfuscate's stage is not on screen
989
- * then: `annotate.close` first).
1491
+ * The area at `index` selected, as a tap on it, Obfuscate opened if it isn't; `null` lets the selection go, Annotate
1492
+ * open or not. No undo step. `NOT_FOUND` for no area there; `NOT_AVAILABLE` for an `index` while Annotate is open
1493
+ * (Obfuscate's stage is not on screen then: `annotate.close` first).
990
1494
  */
991
1495
  select: (input: {
992
1496
  index: number | null;
@@ -1006,8 +1510,9 @@ export declare type EmbedEditorHandle = {
1006
1510
  /**
1007
1511
  * The area at `index` with what `input` gives of its rect, its turn and its look, the rest as it was. It lands where
1008
1512
  * its drags would hold it: turned, resized and moved only as far as a handle's worth of it stays on the crop (one the
1009
- * crop left out goes no further off). Selected once changed while Obfuscate is open. One undo step (none when nothing
1010
- * changes). `NOT_FOUND` for no area there.
1513
+ * crop left out goes no further off). Selected once changed while Obfuscate is open and no AI request or linked
1514
+ * agent's call works. One undo step (none when nothing changes). Resolves to where it stands once drawn (`boxes`,
1515
+ * ObfuscationBox). `NOT_FOUND` for no area there.
1011
1516
  */
1012
1517
  update: (input: {
1013
1518
  angle?: number;
@@ -1020,7 +1525,9 @@ export declare type EmbedEditorHandle = {
1020
1525
  width?: number;
1021
1526
  x?: number;
1022
1527
  y?: number;
1023
- }) => Promise<null>;
1528
+ }) => Promise<{
1529
+ boxes: ObfuscationBox[];
1530
+ }>;
1024
1531
  };
1025
1532
  /**
1026
1533
  * Calls `handler` with what each `name` event says (`EmbedEditorEvents`), until the function it returns is called. A
@@ -1044,6 +1551,7 @@ export declare type EmbedEditorHandle = {
1044
1551
  */
1045
1552
  save: () => Promise<{
1046
1553
  dest: File;
1554
+ src: File | null;
1047
1555
  state: EditState;
1048
1556
  }>;
1049
1557
  };
@@ -1065,14 +1573,29 @@ export declare type EmbedEditorHandle = {
1065
1573
  read: {
1066
1574
  /** The menu item shown. */
1067
1575
  item: () => EmbedEditorMenuItem | null;
1576
+ /**
1577
+ * The areas the person marked on the photo with the AI's brush or `retouch.mark`: each area's box, in the photo's px,
1578
+ * in their order, one for each area (the `index` `retouch.mark` resolves to, `retouch.moveMark` and
1579
+ * `retouch.removeMark` take). A box is the whole area's: one a move left partly off the photo runs past its edges
1580
+ * (`x` or `y` negative, or past its size), though only what lies on it is filled. `retouch.run` and `retouch.remove`
1581
+ * of `{ kind: 'MARK' }` work on them all together, and `ask.send` tells the model how many areas it is about and
1582
+ * each box. Areas a Generate hid are listed too. Inside an `ask.send` about an area other than `'MARK'`, the model's
1583
+ * read of it gives that area's box until the request's fill of it lands, and `[]` from then to the request's end.
1584
+ * `[]` with nothing marked (none yet, the Eraser over all of it, a mark of the photo before an Expand) and without
1585
+ * `onAiEditImage` and `onAiChooseCommands` (no brush); `null` in the Free and the Lite.
1586
+ */
1587
+ mark: () => Rect[] | null;
1068
1588
  /**
1069
1589
  * What Annotate offers `target`, an annotation (`id`), the Numbers' list (`id: 'LIST'`), the added arrow `arrow` of a text
1070
1590
  * or of the list, or a tool's next one (`tool`): the commands its action bar offers it (and `annotate.list` or
1071
1591
  * `annotate.unlist` for a Number, `annotate.unlist` for the list), and its style row's and
1072
1592
  * color row's options by `annotate.update`'s names (`annotate.setStyle`'s for a tool), each with its value now and
1073
- * the values it takes, or the `range` a slider takes it in. `null` until Annotate's screens are loaded (a moment
1074
- * after the image is on screen, or `annotate.open`), for an `id` the state lacks, and where Annotate is off or absent
1075
- * (the Free, the Lite).
1593
+ * the values it takes, or the `range` a slider takes it in; and `palettes`, every set of colors the color row's
1594
+ * palette menu offers, each `id` with its `colors` (`#rrggbb`), any of which `color` takes: `'VIBRANT'`, `'PASTEL'`
1595
+ * and `'EARTH'`, the editor's own, and `'PHOTO'`, `'PHOTO_PASTEL'` and `'PHOTO_VIVID'`, the photo's own colors and
1596
+ * its hues softer and brighter, none until read off the photo (a moment after it is on screen). `null` until
1597
+ * Annotate's screens are loaded (a moment after the image is on screen, or `annotate.open`), for an `id` the state
1598
+ * lacks, and where Annotate is off or absent (the Free, the Lite).
1076
1599
  */
1077
1600
  options: (input: {
1078
1601
  target: {
@@ -1083,6 +1606,10 @@ export declare type EmbedEditorHandle = {
1083
1606
  };
1084
1607
  }) => {
1085
1608
  commands: string[];
1609
+ palettes: {
1610
+ colors: string[];
1611
+ id: 'EARTH' | 'PASTEL' | 'PHOTO' | 'PHOTO_PASTEL' | 'PHOTO_VIVID' | 'VIBRANT';
1612
+ }[];
1086
1613
  style: Record<string, {
1087
1614
  range: {
1088
1615
  max: number;
@@ -1110,9 +1637,10 @@ export declare type EmbedEditorHandle = {
1110
1637
  /** The menu's section showing: the carousel (`'MAIN'`), or Adjust's Scale or Aspect. */
1111
1638
  section: () => 'ASPECT' | 'MAIN' | 'SCALE' | null;
1112
1639
  /**
1113
- * What is selected now, as the `select` event tells it: Annotate's piece, a text's added arrow or the Numbers' list
1114
- * while Annotate is open, Obfuscate's area by its index otherwise, `null` for nothing. A piece a tap just made is
1115
- * selected: its `id` is here for the commands that take one.
1640
+ * What is selected now, as the `select` event tells it: the AI's area its bar is on (`{ index, kind: 'MARK' }`) while
1641
+ * the AI shows its areas with the Brush, else Annotate's piece, a text's added arrow or the Numbers' list while
1642
+ * Annotate is open, Obfuscate's area by its index otherwise, `null` for nothing. A piece a tap just made is selected:
1643
+ * its `id` is here for the commands that take one.
1116
1644
  */
1117
1645
  selection: () => EmbedEditorSelection;
1118
1646
  /** The size the editor works the image at, in px: the px of the state's coordinates (`onLoad`'s `size`). */
@@ -1129,6 +1657,196 @@ export declare type EmbedEditorHandle = {
1129
1657
  * commands, but `ready` stays rejected.
1130
1658
  */
1131
1659
  ready: Promise<void>;
1660
+ /**
1661
+ * The AI's fill of an area of the photo and its cut of the background (the Full's and the Trial's, with the host's
1662
+ * `onAiEditImage` and `onAiRemoveBackground`; in the Lite and the Free each command rejects `NOT_AVAILABLE`), as its
1663
+ * brush, its field's Remove and Generate and Remove Background: the pixels they make are part of the photo, never of the
1664
+ * state a host keeps (`src` on Save holds them). Every image a Generate, a Remove or Remove Background lands is one undo
1665
+ * step, kept while the history holds it.
1666
+ */
1667
+ retouch: {
1668
+ /**
1669
+ * Takes a `'POLYGON'` or a `'RECT'` off the AI's mark, as the Eraser does: cut from every area it touches, an area it
1670
+ * leaves with nothing marked gone, the areas after it a place up. The photo's AI opens, where the brush shows
1671
+ * (a ratio the Aspect section still waits on landing first, a step of its own), and the areas show. No undo step.
1672
+ * `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands` and while Annotate is open (the photo's AI is not on screen then,
1673
+ * its ✦ there opening the AI on Annotate's mode: `annotate.close` first);
1674
+ * `INVALID_COMMAND` for the other kinds, off its schema (`input.area.kind`), and for an outline that fills less than
1675
+ * half of every photo px, as a canvas fills it (off the photo, or too thin; `input.area`), or with nothing on the
1676
+ * photo's window, the crop as it shows (`input.area`: as an Eraser stroke there erases nothing; one partly on it cuts
1677
+ * all it touches), the mark as it was.
1678
+ */
1679
+ erase: (input: {
1680
+ area: Extract<AiArea, {
1681
+ kind: 'POLYGON' | 'RECT';
1682
+ }>;
1683
+ }) => Promise<null>;
1684
+ /**
1685
+ * Adds a `'POLYGON'` or a `'RECT'` to the AI's mark, as a Brush outline closed on its start does, the photo's AI open
1686
+ * where the brush shows (a ratio the Aspect section still waits on landing first): an area of its own, or, where it
1687
+ * touches areas (or lies within 5 px of them on the screen, the view at rest in the tool open), joined to them into the first of them, selected,
1688
+ * the areas shown. Resolves to its `index` in `read.mark`'s list. No undo step. `NOT_AVAILABLE` without
1689
+ * `onAiEditImage` or `onAiChooseCommands`, while Annotate is open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode:
1690
+ * `annotate.close` first), and while the editor has no size on the page (inside an element with `display: none`,
1691
+ * or before its first layout); `INVALID_COMMAND` for the other kinds, off its schema (`input.area.kind`), and for an
1692
+ * outline that fills less than half of every photo px, as a canvas fills it (off the photo, or too thin;
1693
+ * `input.area`), or with nothing on the photo's window, the crop as it shows (`input.area`: as a Brush stroke there
1694
+ * marks nothing; one partly on it is taken whole), the editor as it was.
1695
+ */
1696
+ mark: (input: {
1697
+ area: Extract<AiArea, {
1698
+ kind: 'POLYGON' | 'RECT';
1699
+ }>;
1700
+ }) => Promise<{
1701
+ index: number;
1702
+ }>;
1703
+ /**
1704
+ * Asks `onAiEditImage` again for the Generate `id` on the photo (`run`'s), as Generate over its area: the same piece,
1705
+ * mask and image, with the words `prompt` or its own. The host's image lands on the photo in the edit's place, as one
1706
+ * undo step (an Undo brings the edit before it back). Resolves to the new edit's `id`; `ask.stop` resolves it with
1707
+ * `{ id: null }`.
1708
+ * `NOT_AVAILABLE` while Annotate is open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode:
1709
+ * `annotate.close` first); `NOT_FOUND` for an edit the photo on screen doesn't hold (one the memory limit drew into
1710
+ * the photo among them), an Expand's (`crop.more`'s), a Remove's and one an Expand again cut; `INVALID_COMMAND` where it would ask with neither words nor an image (`input.prompt`); `AI_FAILED` as
1711
+ * `run`.
1712
+ */
1713
+ more: (input: {
1714
+ id: string;
1715
+ prompt?: string;
1716
+ }) => Promise<{
1717
+ id: string | null;
1718
+ }>;
1719
+ /**
1720
+ * Moves the area `index` of the AI's mark whole, as its Move: its box's top-left corner (`read.mark`'s, the whole
1721
+ * area's, past the photo's edges too) to `x`, `y` in the photo's px, as far as a handle's worth of it (17.5 px on the
1722
+ * screen) stays on the photo's window, as an Annotate piece's drag stops; what of it lies off the photo is never
1723
+ * filled. The photo's AI opens, where the brush shows (a ratio the Aspect section still waits on landing first,
1724
+ * the area landing on the view it leaves), and the areas show. No undo step. `NOT_AVAILABLE` without `onAiEditImage` or
1725
+ * `onAiChooseCommands`, while Annotate is open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode: `annotate.close`
1726
+ * first), and while the editor has no size on the page (inside an
1727
+ * element with `display: none`, or before its first layout); `NOT_FOUND` for an index with no area, and for one with nothing
1728
+ * on the photo's window, the crop as it shows (`read.mark` still lists it).
1729
+ */
1730
+ moveMark: (input: {
1731
+ index: number;
1732
+ x: number;
1733
+ y: number;
1734
+ }) => Promise<null>;
1735
+ /**
1736
+ * Removes what `area` holds through `onAiEditImage`, as Remove: the host gets the piece of the photo round the area,
1737
+ * its mask, no words (`prompt` `''`) and no image (`null`), and fills the area with what surrounds it. The image it
1738
+ * gives lands in the area alone as one undo step. `area` is `'MARK'` (the
1739
+ * person's areas together, which a Remove that worked takes with it; in an `ask.send` that named another area, that
1740
+ * area, filled once in the request), a `'POLYGON'` or a `'RECT'` (written into no area of the person's, which stay
1741
+ * as they were whether the work lands, fails or is stopped). The AI's card says it removes, and the editor takes no
1742
+ * input but Close, Escape, which stops the work, and the AI's card (its Stop and its pill) meanwhile. Resolves to the edit's `id`; `ask.stop` resolves it with `{ id: null }`.
1743
+ * `NOT_AVAILABLE` without `onAiEditImage`, while Annotate is open (the photo's AI is not on screen then, its ✦ there
1744
+ * opening the AI on Annotate's mode: `annotate.close` first), and when the editor leaves the
1745
+ * page, is destroyed or opens another image meanwhile; `INVALID_COMMAND` for `'ALL'` and `'BACKGROUND'`, off its schema
1746
+ * (`input.area.kind`), and for a `'MARK'` with nothing of the photo in it (nothing marked, or a request's area
1747
+ * already filled) or that a request about the whole photo or the background makes that area (`input.area`), the
1748
+ * editor as it was; `AI_FAILED` when `onAiEditImage` rejects (its error the `cause`), answers anything but one image
1749
+ * (a list of them too) or one that changed nothing in the area (always, for an area too thin to mark a px of the
1750
+ * photo), and when the editor fails on the way (that error the `cause`).
1751
+ */
1752
+ remove: (input: {
1753
+ area: Extract<AiArea, {
1754
+ kind: 'MARK' | 'POLYGON' | 'RECT';
1755
+ }>;
1756
+ }) => Promise<{
1757
+ id: string | null;
1758
+ }>;
1759
+ /**
1760
+ * Takes the photo's background off through `onAiRemoveBackground`, as Remove Background: the host gets a JPEG of the
1761
+ * photo with the AI's edits alone, 2048 px on its longer side at the most, and `prompt`, what to keep, in words (`''`
1762
+ * with none; one only with `enableAiRemoveBackgroundPrompt`), and the editor keeps only the alpha it answers,
1763
+ * stretched over the photo, as one undo step; the AI's card says it removes the
1764
+ * background meanwhile, and the editor
1765
+ * takes no input but Close, Escape, which stops the work, and the AI's card (its Stop and its pill). The photo shows over a checkerboard where it is transparent, and Save
1766
+ * keeps the transparency in a PNG or a WebP. Resolves to the cut's `id`, as `remove` does; `ask.stop` resolves it
1767
+ * with `{ id: null }`, the photo as it was. `NOT_AVAILABLE`
1768
+ * without `onAiRemoveBackground`, for a `prompt` without `enableAiRemoveBackgroundPrompt`, once the background is cut,
1769
+ * while Annotate is open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first), and
1770
+ * when the editor leaves the page, is destroyed or
1771
+ * opens another image meanwhile; `NOT_FOUND` where the answer separates nothing (under 0.5 % of its px under alpha
1772
+ * 128, or under 0.5 % at 128 or more); `AI_FAILED` when `onAiRemoveBackground` rejects (its error the `cause`) or
1773
+ * answers no image, and when the editor fails on the way (that error the `cause`); `EXPORT_FAILED` when the photo
1774
+ * can't be made.
1775
+ */
1776
+ removeBackground: (input?: {
1777
+ prompt?: string;
1778
+ }) => Promise<{
1779
+ id: string | null;
1780
+ }>;
1781
+ /**
1782
+ * Deletes the area `index` of the AI's mark, as its Delete, the areas after it a place up. The photo's AI opens,
1783
+ * where the brush shows (a ratio the Aspect section still waits on landing first), and the areas show. No undo
1784
+ * step. `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands` and while Annotate is open (the photo's AI is not on screen
1785
+ * then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first); `NOT_FOUND` for an index with no area, and for one with
1786
+ * nothing on the photo's window, the crop as it
1787
+ * shows (`read.mark` still lists it).
1788
+ */
1789
+ removeMark: (input: {
1790
+ index: number;
1791
+ }) => Promise<null>;
1792
+ /**
1793
+ * Fills `area` through `onAiEditImage` with what `prompt` (words) or `referenceImage` (an image's URL) ask for, as
1794
+ * Generate (a Remove, neither, is `remove`'s): the area shows while its work runs, the AI's card says it generates, and
1795
+ * the editor takes no input but Close, Escape, which stops the work, and the AI's card (its Stop and its pill) meanwhile. The host gets the piece of the photo round the area (the
1796
+ * photo with the AI's edits alone), its mask, `prompt` and `referenceImage` (an image's URL, or `null`). The image it
1797
+ * gives lands in the area alone as one undo step, and `more` asks for another in its place. `'ALL'` edits the whole
1798
+ * photo by the words and the image (`onAiEditImage`'s `'EDIT_PHOTO'`): the host gets the whole photo with no mask,
1799
+ * and its image lands over the whole photo, what the words don't name kept as the model kept it. `'MARK'` fills the person's
1800
+ * areas together, which stay, hidden
1801
+ * (shown while Remove Object is chosen) until the person or a command of the mark's shows them (in an `ask.send` that
1802
+ * named another area, `'MARK'` is that area, filled once in the request, and so is `'ALL'` or `'BACKGROUND'` in one
1803
+ * about it); a `'POLYGON'`, a `'RECT'`, `'ALL'` or
1804
+ * `'BACKGROUND'` is written into no area of the person's, so their areas stay as they were whether the work lands,
1805
+ * fails or is stopped. Outside the area the photo stays as it is. Resolves to the edit's `id` (`'r1'`, `'r2'`…);
1806
+ * `ask.stop` resolves it with `{ id: null }`. `NOT_AVAILABLE` without `onAiEditImage`, for `'BACKGROUND'` with no background removed, while Annotate is open (the photo's AI is not on screen
1807
+ * then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first), and when the editor leaves
1808
+ * the page, is destroyed or opens another image meanwhile; `INVALID_COMMAND` for neither `prompt` nor `referenceImage`
1809
+ * (`input.prompt`), an area with nothing of the photo in it (`input.area`: a `'MARK'` with nothing marked, or a request's area already
1810
+ * filled) and a `referenceImage` that is no image, the editor as it was; `AI_FAILED` when `onAiEditImage` rejects (its
1811
+ * error the `cause`), answers anything but one image (a list of them too) or one that changed nothing in the area
1812
+ * (its px there less than 1 in 255 further from the piece's it was sent, on average, than the rest of the piece's;
1813
+ * always, for an area too thin to mark a px of the photo), and when the editor fails on the way (that error the
1814
+ * `cause`).
1815
+ */
1816
+ run: (input: {
1817
+ area: AiArea;
1818
+ prompt?: string;
1819
+ referenceImage?: string | null;
1820
+ }) => Promise<{
1821
+ id: string | null;
1822
+ }>;
1823
+ /**
1824
+ * Selects the area `index` of the AI's mark, as a still press inside it does with the Brush: its bar (Move and Delete)
1825
+ * shows, its Move, Delete and the arrow keys act on it, and `read.selection` tells it (`{ index, kind: 'MARK' }`). The
1826
+ * photo's AI opens, where the brush shows (a ratio the Aspect section still waits on landing first), and the
1827
+ * areas show; with the Eraser chosen the area stays selected, its bar shown once the Brush is. `null` lets it go and
1828
+ * opens nothing. No undo step. `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands` and, for an index, while Annotate is
1829
+ * open (the photo's AI is not on screen then, its ✦ there opening the AI on Annotate's mode: `annotate.close` first); `NOT_FOUND` for an
1830
+ * index with no area, and for one with nothing on the photo's window, the crop as it shows (`read.mark` still lists
1831
+ * it), which a press there never selects.
1832
+ */
1833
+ selectMark: (input: {
1834
+ index: number | null;
1835
+ }) => Promise<null>;
1836
+ /**
1837
+ * The brush's mode and size, as its Brush | Eraser capsule and its size's ruler: `mode` `'BRUSH'` or `'ERASER'`, and
1838
+ * `size` the diameter both paint at, 5…50 whole CSS px on the screen; what it gives of them, the rest kept, for as
1839
+ * long as the editor is open. It opens nothing; `mark` and `erase` take outlines whatever the brush. An empty input
1840
+ * changes nothing. No undo step. `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands`; `INVALID_COMMAND` for a size
1841
+ * off 5…50 or not whole (`input.size`).
1842
+ */
1843
+ setBrush: (input: {
1844
+ mode?: 'BRUSH' | 'ERASER';
1845
+ size?: number;
1846
+ }) => Promise<null>;
1847
+ /** Clears the AI's mark, every area of it, as the Eraser over all of it. No undo step. `NOT_AVAILABLE` without `onAiEditImage` or `onAiChooseCommands`. */
1848
+ unmark: () => Promise<null>;
1849
+ };
1132
1850
  /**
1133
1851
  * Any command by its name, `group.verb` as `commands()` lists it, with its input: `run({ command: 'menu.select', input:
1134
1852
  * { item: 'FILTER' } })` is `menu.select({ item: 'FILTER' })`. A read (`read.state`) runs in the queue here, after the
@@ -1206,6 +1924,26 @@ export declare type EmbedEditorMenuItem = 'ADJUST' | 'AUTO' | 'BLACK_POINT' | 'B
1206
1924
  * `EmbedEditor`, `data-*` and `aria-*` attributes go to its host element.
1207
1925
  */
1208
1926
  export declare type EmbedEditorProps = {
1927
+ /**
1928
+ * PROTOTYPE (the agent link isn't in a released edition yet): the origin of the agent link's relay, where
1929
+ * `enableAgent` makes its links. The hosted relay by default, which needs the license's `publicKey`; give the origin of
1930
+ * a relay of your own to run one (`@embededitor/relay`, docs.embededitor.com/agent-link/relay). The panel's How to
1931
+ * Connect shows the person `<agentRelay>/mcp`, the address to add to their agent once. Without `onAgentLink`, the
1932
+ * editor asks the relay for the link itself (`POST /sessions`), so on a relay of your own the page's origin must be one
1933
+ * its `allowedOrigins` names.
1934
+ * Default `'https://agent.embededitor.com'`.
1935
+ */
1936
+ agentRelay?: string;
1937
+ /**
1938
+ * The prompts the editor sends a model, any of them replaced by the host's own text, by key (`AiPromptKey`): in the
1939
+ * Full and the Trial, the guide `onAiChooseCommands` gets as its system message, the lines a request adds to the
1940
+ * person's words, Expand's words to `onAiEditImage` and Detect's `texts` to `onAiDetectObjects`; in every edition with the
1941
+ * agent link (the Lite, the Full, the Trial), the guide an agent linked from outside is told, the same text. A key left
1942
+ * out keeps the editor's own; a prompt with `{ name }` placeholders keeps exactly the editor's own placeholders. The
1943
+ * package's `ai-prompts.json` lists every key with the editor's own text. The Free, with no AI and no agent link, accepts
1944
+ * it and ignores it. Default `{}`.
1945
+ */
1946
+ aiPrompts?: AiPrompts;
1209
1947
  /**
1210
1948
  * The color the annotations start with (Annotate's first color), drawn opaque: a hex, `rgb()`, `hsl()` or a CSS color
1211
1949
  * name. Default: the accent the editor paints.
@@ -1224,16 +1962,25 @@ export declare type EmbedEditorProps = {
1224
1962
  * Given live, the locked ratio is where undo starts. Default `false`.
1225
1963
  */
1226
1964
  aspectRatioLocked?: boolean;
1227
- /**
1228
- * Whether Escape closes the editor (the modal, or inline and page with `onClose`). Off, only the Close button and Save
1229
- * close it; Escape keeps its other jobs (a Resize field's draft, Reset's confirm, Annotate).
1230
- * Default `true`.
1231
- */
1232
- closeOnEscape?: boolean;
1233
1965
  /** One base color per role. Default: yellow on zinc. */
1234
1966
  colors?: EmbedEditorColors;
1235
1967
  /** Shows the output size over the top right of the image for a moment after it changes. Default `true`. */
1236
1968
  displayBadge?: boolean;
1969
+ /**
1970
+ * PROTOTYPE (the agent link isn't in a released edition yet): an Agent button in the toolbar. It makes a link the
1971
+ * person pastes into an AI agent with the relay (`agentRelay`) connected as an MCP server, and the agent edits the
1972
+ * photo through the editor's commands while the person watches; the panel's How to Connect shows each agent's steps.
1973
+ * The photo goes to the person's agent through the relay. In every edition but the Free, which has no agent link: there
1974
+ * it shows nothing. Default `false`.
1975
+ */
1976
+ enableAgent?: boolean;
1977
+ /**
1978
+ * Full and Trial. Remove Background has a field of its own, "Describe what to keep", and its Remove sends
1979
+ * `onAiRemoveBackground` the words typed there as `prompt`, what to keep (`'the woman and her dog'`), for a background
1980
+ * remover that takes them; the tip on the photo says so, on every device: "Leave it blank to keep the main subject". Off,
1981
+ * Remove Background is its Remove alone and `prompt` is always `''`. Default `false`.
1982
+ */
1983
+ enableAiRemoveBackgroundPrompt?: boolean;
1237
1984
  /**
1238
1985
  * The Annotate button and its mode: arrows, texts, numbers, a ruler, shapes, drawing and a lens over the image. Turned
1239
1986
  * off, the annotations already in the state stay, are drawn and are saved. Default `true`.
@@ -1298,6 +2045,69 @@ export declare type EmbedEditorProps = {
1298
2045
  * both. The ratio is kept and the image is never enlarged. Default none.
1299
2046
  */
1300
2047
  maxWidth?: number;
2048
+ /**
2049
+ * PROTOTYPE (the agent link isn't in a released edition yet): makes the agent link through the host's backend, on
2050
+ * a relay of the host's own (`agentRelay`; the hosted one has no secret to share). Called at the person's tap on Agent
2051
+ * in place of the editor's own `POST /sessions` on `agentRelay`, it resolves with the `link` and the `token` the relay
2052
+ * answered the host's backend, which asked it with the relay's secret, `agentSessionSecret` (`Authorization: Bearer`), a secret
2053
+ * that never reaches the page. The relay's whole answer may be passed as it came: the editor reads only those two. Use
2054
+ * it to make links for the host's signed-in users only, or where the relay's `allowedOrigins` doesn't name the host's
2055
+ * page. The editor still opens the link's socket and ends it on `agentRelay`, and shows the Agent button only with
2056
+ * `enableAgent`. A rejection, or an answer without a `link` and a `token`, shows "Couldn’t Create the Link" with Try
2057
+ * Again. Default: none, the editor asks the relay itself.
2058
+ */
2059
+ onAgentLink?: () => Promise<{
2060
+ link: string;
2061
+ token: string;
2062
+ }>;
2063
+ /**
2064
+ * Full and Trial. The AI's model: called with the conversation so far, the tools the model may call and a signal that
2065
+ * aborts when the person stops or the editor closes. Gives back the model's next message, in OpenAI's Chat Completions
2066
+ * shape (`tool_calls`, `tool_call_id`, `image_url`), kept as returned, extra fields included. The editor never sees a key:
2067
+ * the site's server holds it. No default; without it there is no AI.
2068
+ */
2069
+ onAiChooseCommands?: (input: {
2070
+ messages: ChatMessage[];
2071
+ signal: AbortSignal;
2072
+ tools: ChatTool[];
2073
+ }) => Promise<ChatMessage>;
2074
+ /**
2075
+ * Full and Trial. Detect's, in Obfuscate: finds every face, license plate, document and screen in the photo, in one
2076
+ * call per Detect. Called with `image`, a JPEG of the original photo with the AI's edits alone (no crop, rotation,
2077
+ * adjustments, filter, frame, annotations, Obfuscate areas or marks), at most 1024 px on its longer side; `texts`, the
2078
+ * kinds to find, in English (`['face', 'license plate', 'document', 'screen']`, each the host's `aiPrompts` in its place
2079
+ * where it gives one: `detectFace`, `detectLicensePlate`, `detectDocument`, `detectScreen`); and a `signal` that aborts
2080
+ * when the person stops or the editor closes. Gives back every one found of every text, an empty list when nothing was
2081
+ * found; the editor covers each with an area. No default; without it Obfuscate has no Detect.
2082
+ */
2083
+ onAiDetectObjects?: (input: {
2084
+ image: Blob;
2085
+ signal: AbortSignal;
2086
+ texts: string[];
2087
+ }) => Promise<AiDetected[]>;
2088
+ /**
2089
+ * Full and Trial. Fills an area of the photo, or edits it whole: called with what the person asked (`AiEditImageInput`),
2090
+ * its `operation` and that operation's own fields: `'EDIT_PHOTO'`, `'ERASE_AREA'`, `'GENERATE_AREA'`,
2091
+ * `'GENERATE_BACKGROUND'` or `'GENERATE_BORDERS'`. Gives back the image it made, one `Blob` a call (anything else, a list
2092
+ * of them too, fails the work as a rejection does); the editor resizes it to `image` and pastes it where `mask` is white
2093
+ * alone: into the mark, or an Expand's borders, or, for the new background, whole under the cut; an `'EDIT_PHOTO'`'s
2094
+ * whole over the photo. For another image the person presses
2095
+ * Generate again, each image one undo step. No default; without it the AI cannot remove, generate or expand.
2096
+ */
2097
+ onAiEditImage?: (input: AiEditImageInput) => Promise<Blob>;
2098
+ /**
2099
+ * Full and Trial. Takes the background off the photo: called with `image`, a JPEG of the original photo with the AI's
2100
+ * edits alone (no crop, rotation, adjustments, filter, frame, annotations, Obfuscate areas or marks), at most 2048 px on
2101
+ * its longer side; `prompt`, what to keep, in words (the AI's field's, with
2102
+ * `enableAiRemoveBackgroundPrompt`; `''` with none and without it); and a `signal` that aborts when the person stops or
2103
+ * the editor closes. Gives back the photo as a PNG with the background transparent; the editor uses only its alpha,
2104
+ * resized to the photo. No default; without it the AI cannot remove the background.
2105
+ */
2106
+ onAiRemoveBackground?: (input: {
2107
+ image: Blob;
2108
+ prompt: string;
2109
+ signal: AbortSignal;
2110
+ }) => Promise<Blob>;
1301
2111
  /** Called when the editor closes. On `EmbedEditor` and `mountEditor`, the Close button shows only with it. */
1302
2112
  onClose?: () => void;
1303
2113
  /**
@@ -1316,19 +2126,36 @@ export declare type EmbedEditorProps = {
1316
2126
  */
1317
2127
  onLoadError?: (error: EmbedEditorError) => void;
1318
2128
  /**
1319
- * Called with what Save made and the state it was made with. Without it, Save downloads the file. If it throws, the error
1320
- * is logged with `console.error`, Save shows it failed and the modal stays open; `onProcessError` isn't called.
2129
+ * Called with what Save made and the state it was made with. `src` is the photo with the AI's edits, as a file at the
2130
+ * size the editor works it (a JPEG for a JPEG photo with no cut, else a PNG), to open the state again with it. It is
2131
+ * `null` while the photo is still the one you passed: no AI edit, a session reopened on an earlier `src` included. Store
2132
+ * `src` only when it isn't `null`, and keep the one you have otherwise. Without it, Save downloads the file. If it
2133
+ * throws, the error is logged with `console.error`, Save shows it failed and the modal stays open; `onProcessError`
2134
+ * isn't called.
1321
2135
  */
1322
2136
  onProcess?: (res: {
1323
2137
  dest: File;
2138
+ src: File | null;
1324
2139
  state: EditState;
1325
2140
  }) => void;
1326
- /** Called when Save can't make the file (`EXPORT_FAILED`) or can't draw a fixed or required mark (`MARK_FAILED`). The banner over the toolbar says so too. */
2141
+ /**
2142
+ * Called when Save can't make the file (`EXPORT_FAILED`) or can't draw a fixed or required mark (`MARK_FAILED`). The
2143
+ * banner under the toolbar says so too.
2144
+ */
1327
2145
  onProcessError?: (error: EmbedEditorError) => void;
1328
2146
  /** The JPEG and WebP quality, 0…100. Default `90`. */
1329
2147
  outputQuality?: number;
1330
2148
  /** The type Save and Share write. Default: the source's when it is one of these, a PNG otherwise. */
1331
2149
  outputType?: 'image/jpeg' | 'image/png' | 'image/webp';
2150
+ /**
2151
+ * PROTOTYPE (the agent link isn't in a released edition yet): the license's public key, `ee_pk_…`, the key for
2152
+ * Embed Editor's cloud services, today the agent link, whose hosted relay asks for it before it makes a link. Your
2153
+ * account at account.embededitor.com shows it on the license's card, under Cloud Services, and the license's e-mail
2154
+ * too. It's public, made for the page, unlike the license key that installs the package and never goes in a page;
2155
+ * restrict it to your domains in your account. Without it, on the hosted relay, the editor shows no Agent and says so
2156
+ * in the console. A relay of your own (`agentRelay`) needs none. Default `null`.
2157
+ */
2158
+ publicKey?: string | null;
1332
2159
  /** The signature over the photo. `null` or absent: none. Default `null`. */
1333
2160
  signature?: EmbedEditorSignature | null;
1334
2161
  /**
@@ -1350,7 +2177,8 @@ export declare type EmbedEditorProps = {
1350
2177
  /**
1351
2178
  * What is selected: an Obfuscate area, by its index in the state's `obfuscation`; in Annotate, an annotation
1352
2179
  * (`'PIECE'`, by its `id`), an arrow added to a text or to the Numbers' list (`'ARROW'`: its owner's `id`, `'LIST'` for
1353
- * the list, and the arrow's place in its `arrows`) or the list (`'LIST'`); or nothing (`null`).
2180
+ * the list, and the arrow's place in its `arrows`) or the list (`'LIST'`); an area of the AI's mark (`'MARK'`, by its
2181
+ * `index` in `read.mark`'s list) while the AI shows its areas with the Brush; or nothing (`null`).
1354
2182
  */
1355
2183
  export declare type EmbedEditorSelection = number | {
1356
2184
  id: string;
@@ -1361,6 +2189,9 @@ export declare type EmbedEditorSelection = number | {
1361
2189
  kind: 'PIECE';
1362
2190
  } | {
1363
2191
  kind: 'LIST';
2192
+ } | {
2193
+ index: number;
2194
+ kind: 'MARK';
1364
2195
  } | null;
1365
2196
 
1366
2197
  /**
@@ -1455,12 +2286,33 @@ export declare type Lang = 'en-us' | 'es-es' | 'pt-br';
1455
2286
  */
1456
2287
  export declare type LangTexts = Partial<Record<MessageKey, string>>;
1457
2288
 
2289
+ /**
2290
+ * Where a mark stands once drawn, in image px, as `read.screenshot` and the export draw it (whole px): what `marks.place`
2291
+ * and `marks.update` resolve with, in `boxes`. `role` names the mark; `box` is the box round what it draws on the photo
2292
+ * (round every tile of a grid watermark), `null` where it draws none (hidden, or its image or letter not loaded).
2293
+ */
2294
+ export declare type MarkBox = {
2295
+ box: Rect | null;
2296
+ role: 'SIGNATURE' | 'WATERMARK';
2297
+ };
2298
+
1458
2299
  /**
1459
2300
  * A message of the editor, by its key: what `lang.texts` can bring. The package's `i18n/en-us.json` has
1460
2301
  * each with its English text. Written out here (the d.ts carries no JSON), and held equal to the dictionary's keys by
1461
2302
  * src/types.spec.ts.
1462
2303
  */
1463
- export declare type MessageKey = 'annotateAddArrow' | 'annotateAddGuide' | 'annotateArrow' | 'annotateAttachText' | 'annotateBeside' | 'annotateBox' | 'annotateBringToFront' | 'annotateCapArrow' | 'annotateCapBar' | 'annotateCapDot' | 'annotateCapNone' | 'annotateCapTriangle' | 'annotateColorDefault' | 'annotateCorners' | 'annotateCornersRound' | 'annotateCornersSoft' | 'annotateCornersSquare' | 'annotateDetach' | 'annotateDraw' | 'annotateDuplicate' | 'annotateEnd' | 'annotateEnds' | 'annotateFieldDescription' | 'annotateFieldTitle' | 'annotateFill' | 'annotateFillMedium' | 'annotateFillOpaque' | 'annotateFillOutline' | 'annotateFillSoft' | 'annotateFont' | 'annotateFormat' | 'annotateInList' | 'annotateLens' | 'annotateLensCircle' | 'annotateLensRounded' | 'annotateLine' | 'annotateLineDashed' | 'annotateLineDotted' | 'annotateLineSketch' | 'annotateLineSolid' | 'annotateLineTransparent' | 'annotateList' | 'annotateListTitle' | 'annotateLook' | 'annotateLookBox' | 'annotateLookCaption' | 'annotateLookPlain' | 'annotateMark' | 'annotateMarkDot' | 'annotateMenuValue' | 'annotateMenuValues' | 'annotateNumber' | 'annotateOpenFailed' | 'annotatePadding' | 'annotatePaddingLoose' | 'annotatePaddingNormal' | 'annotatePaddingTight' | 'annotatePath' | 'annotatePathCurve' | 'annotatePathElbow' | 'annotatePathFree' | 'annotatePathRoundedElbow' | 'annotatePathStraight' | 'annotateRemove' | 'annotateRuler' | 'annotateRulerLabel' | 'annotateRulerPlaceholder' | 'annotateShape' | 'annotateShapeEllipse' | 'annotateShapeLine' | 'annotateShapeRect' | 'annotateShapeRounded' | 'annotateSize' | 'annotateSizeL' | 'annotateSizeM' | 'annotateSizeNameL' | 'annotateSizeNameM' | 'annotateSizeNameS' | 'annotateSizeS' | 'annotateStart' | 'annotateStroke' | 'annotateStrokeDashed' | 'annotateStrokeDotted' | 'annotateStrokeMarker' | 'annotateStrokeSketch' | 'annotateStrokeSolid' | 'annotateText' | 'annotateTextPlaceholder' | 'annotateTheme' | 'annotateThemeAccent' | 'annotateThemeDark' | 'annotateThemeLight' | 'annotateTools' | 'annotateType' | 'annotateTypeArrow' | 'annotateTypeCustom' | 'annotateTypeDashed' | 'annotateTypeDouble' | 'annotateTypeLeader' | 'annotateTypeLine' | 'annotateTypeTrail' | 'annotateWeight' | 'annotateWeightExtraThick' | 'annotateWeightExtraThin' | 'annotateWeightMedium' | 'annotateWeightMediumThick' | 'annotateWeightMediumThin' | 'annotateWeightThick' | 'annotateWeightThin' | 'annotateZoom' | 'annotateZoomValue' | 'aspectFree' | 'aspectOriginal' | 'autoFailed' | 'autoTimedOut' | 'autoTurnOn' | 'browserUnsupported' | 'buttonAnnotate' | 'buttonCancel' | 'buttonChooseAnother' | 'buttonChooseFile' | 'buttonClose' | 'buttonCopy' | 'buttonDone' | 'buttonFlip' | 'buttonFocus' | 'buttonRecenter' | 'buttonRedo' | 'buttonReset' | 'buttonResetConfirm' | 'buttonRotateLeft' | 'buttonSave' | 'buttonSaved' | 'buttonShare' | 'buttonUndo' | 'color' | 'colorBlack' | 'colorBlue' | 'colorCode' | 'colorCream' | 'colorCustom' | 'colorGreen' | 'colorKraft' | 'colorLavender' | 'colorMint' | 'colorMore' | 'colorNavy' | 'colorOchre' | 'colorOlive' | 'colorPaper' | 'colorPhoto' | 'colorPick' | 'colorPickFailed' | 'colorRed' | 'colorRose' | 'colorShades' | 'colorSky' | 'colorViolet' | 'colorWhite' | 'colorYellow' | 'compareOriginal' | 'cropAspectRatio' | 'cropScale' | 'dialogLabel' | 'errorCopyFailed' | 'errorExportFailed' | 'errorInvalidProps' | 'errorInvalidState' | 'errorLoadFailed' | 'errorMarkFailed' | 'errorShareFailed' | 'errorUnsupportedFormat' | 'errorWebglUnavailable' | 'filterDramatic' | 'filterDramaticCool' | 'filterDramaticWarm' | 'filterIntensity' | 'filterMono' | 'filterNoir' | 'filterOriginal' | 'filterSilvertone' | 'filterVivid' | 'filterVividCool' | 'filterVividWarm' | 'finetuneAuto' | 'finetuneBlackPoint' | 'finetuneBrightness' | 'finetuneBrilliance' | 'finetuneContrast' | 'finetuneExposure' | 'finetuneHighlights' | 'finetuneSaturation' | 'finetuneShadows' | 'finetuneSharpness' | 'finetuneVibrance' | 'finetuneVignette' | 'finetuneWarmth' | 'focusCenter' | 'focusFailed' | 'focusSubject' | 'frameCornerHooks' | 'frameEdgeCross' | 'frameEdgeOverlap' | 'frameEdgeSeparate' | 'frameFilm' | 'frameGallery' | 'frameLineMultiple' | 'frameLineSingle' | 'frameMatRound' | 'frameMatSharp' | 'frameNone' | 'framePhotoCorners' | 'framePolaroid' | 'frameRoundCorners' | 'imageCopied' | 'markAdjustment' | 'markAngle' | 'markColor' | 'markColorAuto' | 'markEditText' | 'markFailedSignature' | 'markFailedWatermark' | 'markFont' | 'markFontValue' | 'markGrid' | 'markLayout' | 'markMargin' | 'markOpacity' | 'markRetry' | 'markShow' | 'markSignature' | 'markSingle' | 'markSize' | 'markSkippedSignature' | 'markSkippedWatermark' | 'markSpacing' | 'markText' | 'markWatermark' | 'noticeAreasVisible' | 'noticeClose' | 'noticeDropped' | 'noticeDroppedAnnotations' | 'noticeDroppedAuto' | 'noticeDroppedFilter' | 'noticeDroppedFinetune' | 'noticeDroppedFrame' | 'noticeDroppedHiddenAreas' | 'noticeDroppedSignature' | 'noticeDroppedWatermark' | 'obfuscateDelete' | 'obfuscateHint' | 'obfuscateLimit' | 'obfuscateShape' | 'obfuscateShapeRound' | 'obfuscateShapeRounded' | 'obfuscateShapeSquare' | 'obfuscateStyle' | 'obfuscateStyleBlur' | 'obfuscateStylePixelate' | 'obfuscateStyleSolid' | 'palette' | 'paletteEarth' | 'palettePastel' | 'palettePhoto' | 'palettePhotoPastel' | 'palettePhotoVivid' | 'paletteVibrant' | 'pickerDescription' | 'pickerFormats' | 'pickerTitle' | 'pickerTitleTouch' | 'resetConfirmHint' | 'resizeHeight' | 'resizeWidth' | 'shareReady' | 'statusLoading' | 'toolAdjust' | 'toolFilter' | 'toolFrame' | 'toolObfuscate' | 'toolResize' | 'toolsLabel';
2304
+ export declare type MessageKey = 'agentAddRequest' | 'agentAskEdit' | 'agentBack' | 'agentButton' | 'agentCancel' | 'agentCheckRetry' | 'agentConnect' | 'agentConnectAgain' | 'agentConnected' | 'agentCopied' | 'agentCopy' | 'agentCopyFailed' | 'agentCreating' | 'agentDisconnect' | 'agentEndedCanceled' | 'agentEndedDisconnected' | 'agentEndedExpired' | 'agentEndedTabClosed' | 'agentEnding' | 'agentExamples' | 'agentExamplesCopy' | 'agentExamplesCopyWithLink' | 'agentFailed' | 'agentGuideAddress' | 'agentGuideAgents' | 'agentGuideChatGptConnector' | 'agentGuideChatGptDeveloper' | 'agentGuideClaudeConnector' | 'agentGuideClaudeSettings' | 'agentGuideCopyFailed' | 'agentGuideCursorChat' | 'agentGuideCursorFile' | 'agentGuideNewSession' | 'agentGuideTerminal' | 'agentGuideThen' | 'agentGuideVsCodeChat' | 'agentGuideVsCodeFile' | 'agentHidePanel' | 'agentHowToConnect' | 'agentLinkKept' | 'agentNotSetUp' | 'agentReconnecting' | 'agentRequestArrow' | 'agentRequestBlur' | 'agentRequestCrop' | 'agentRequestPlate' | 'agentRequestWarm' | 'agentRetry' | 'agentShowPanel' | 'agentStepAddress' | 'agentStepLink' | 'agentStepsTitle' | 'agentWaiting' | 'aiAction' | 'aiAnnotate' | 'aiAreaMove' | 'aiAreasByHand' | 'aiAsk' | 'aiBackgroundFailed' | 'aiBackgroundField' | 'aiBrush' | 'aiCardClose' | 'aiCardFold' | 'aiCardUnfold' | 'aiCreateField' | 'aiDetect' | 'aiDetectFailed' | 'aiEdit' | 'aiEraser' | 'aiExampleAreaBench' | 'aiExampleAreaBrick' | 'aiExampleAreaGrass' | 'aiExampleAreaPlant' | 'aiExampleAreaSky' | 'aiExampleAskBlackAndWhite' | 'aiExampleAskBlurFaces' | 'aiExampleAskFrame' | 'aiExampleAskFurnish' | 'aiExampleAskGoldenHour' | 'aiExampleAskRemoveBackground' | 'aiExampleAskRemovePeople' | 'aiExampleAskSleepingCat' | 'aiExampleAskSnowyEvening' | 'aiExampleAskSquare' | 'aiExampleAskWarmer' | 'aiExampleBackgroundBeach' | 'aiExampleBackgroundGradient' | 'aiExampleBackgroundMarble' | 'aiExampleBackgroundStreet' | 'aiExampleBackgroundStudio' | 'aiExampleCreateDetails' | 'aiExampleCreateFinePrint' | 'aiExampleCreateParts' | 'aiExampleCreateSteps' | 'aiExampleCreateTitle' | 'aiExampleKeepCar' | 'aiExampleKeepDog' | 'aiExampleKeepPeople' | 'aiExampleKeepPerson' | 'aiExampleKeepProduct' | 'aiExamples' | 'aiExpanded' | 'aiExpandFailed' | 'aiFailed' | 'aiField' | 'aiFieldMore' | 'aiFillFailed' | 'aiGenerate' | 'aiGenerateAgain' | 'aiKeepField' | 'aiKeepHint' | 'aiMarkByHand' | 'aiMarkedField' | 'aiMarkField' | 'aiNoSubject' | 'aiNothingFound' | 'aiReference' | 'aiReferenceHint' | 'aiReferencePhotoHint' | 'aiReferenceRemove' | 'aiRemove' | 'aiRemoveBackground' | 'aiRemoveBackgroundHint' | 'aiRemoveFailed' | 'aiRemoveObject' | 'aiRemoveObjectHint' | 'aiSlow' | 'aiStop' | 'aiTryAgain' | 'aiUnchanged' | 'aiUnchangedRetry' | 'aiWorkingAdjust' | 'aiWorkingAnnotate' | 'aiWorkingBackground' | 'aiWorkingCrop' | 'aiWorkingDetect' | 'aiWorkingExpand' | 'aiWorkingGenerate' | 'aiWorkingLook' | 'aiWorkingObfuscate' | 'aiWorkingRemove' | 'aiWorkingThink' | 'annotateAddArrow' | 'annotateAddGuide' | 'annotateArrow' | 'annotateAttachText' | 'annotateBeside' | 'annotateBox' | 'annotateBringToFront' | 'annotateCapArrow' | 'annotateCapBar' | 'annotateCapDot' | 'annotateCapNone' | 'annotateCapTriangle' | 'annotateColorDefault' | 'annotateCorners' | 'annotateCornersRound' | 'annotateCornersSoft' | 'annotateCornersSquare' | 'annotateDetach' | 'annotateDraw' | 'annotateDuplicate' | 'annotateEnd' | 'annotateEnds' | 'annotateFieldDescription' | 'annotateFieldTitle' | 'annotateFill' | 'annotateFillMedium' | 'annotateFillOpaque' | 'annotateFillOutline' | 'annotateFillSoft' | 'annotateFont' | 'annotateFormat' | 'annotateInList' | 'annotateLens' | 'annotateLensCircle' | 'annotateLensRounded' | 'annotateLimit' | 'annotateLine' | 'annotateLineDashed' | 'annotateLineDotted' | 'annotateLineSketch' | 'annotateLineSolid' | 'annotateLineTransparent' | 'annotateList' | 'annotateListTitle' | 'annotateLook' | 'annotateLookBox' | 'annotateLookCaption' | 'annotateLookPlain' | 'annotateMark' | 'annotateMarkDot' | 'annotateMenuValue' | 'annotateMenuValues' | 'annotateNumber' | 'annotateOpenFailed' | 'annotatePadding' | 'annotatePaddingLoose' | 'annotatePaddingNormal' | 'annotatePaddingTight' | 'annotatePath' | 'annotatePathCurve' | 'annotatePathElbow' | 'annotatePathFree' | 'annotatePathRoundedElbow' | 'annotatePathStraight' | 'annotateRemove' | 'annotateRuler' | 'annotateRulerLabel' | 'annotateRulerPlaceholder' | 'annotateShape' | 'annotateShapeEllipse' | 'annotateShapeLine' | 'annotateShapeRect' | 'annotateShapeRounded' | 'annotateSize' | 'annotateSizeL' | 'annotateSizeM' | 'annotateSizeNameL' | 'annotateSizeNameM' | 'annotateSizeNameS' | 'annotateSizeS' | 'annotateStart' | 'annotateStroke' | 'annotateStrokeDashed' | 'annotateStrokeDotted' | 'annotateStrokeMarker' | 'annotateStrokeSketch' | 'annotateStrokeSolid' | 'annotateText' | 'annotateTextPlaceholder' | 'annotateTheme' | 'annotateThemeAccent' | 'annotateThemeDark' | 'annotateThemeLight' | 'annotateTools' | 'annotateType' | 'annotateTypeArrow' | 'annotateTypeCustom' | 'annotateTypeDashed' | 'annotateTypeDouble' | 'annotateTypeLeader' | 'annotateTypeLine' | 'annotateTypeTrail' | 'annotateWeight' | 'annotateWeightExtraThick' | 'annotateWeightExtraThin' | 'annotateWeightMedium' | 'annotateWeightMediumThick' | 'annotateWeightMediumThin' | 'annotateWeightThick' | 'annotateWeightThin' | 'annotateZoom' | 'annotateZoomValue' | 'aspectFree' | 'aspectOriginal' | 'autoFailed' | 'autoTimedOut' | 'autoTurnOn' | 'browserUnsupported' | 'buttonAnnotate' | 'buttonCancel' | 'buttonChooseAnother' | 'buttonChooseFile' | 'buttonClose' | 'buttonCopy' | 'buttonDone' | 'buttonFlip' | 'buttonFocus' | 'buttonRecenter' | 'buttonRedo' | 'buttonReset' | 'buttonResetConfirm' | 'buttonRotateLeft' | 'buttonSave' | 'buttonSaved' | 'buttonShare' | 'buttonUndo' | 'color' | 'colorBlack' | 'colorBlue' | 'colorCode' | 'colorCream' | 'colorCustom' | 'colorGreen' | 'colorKraft' | 'colorLavender' | 'colorMint' | 'colorMore' | 'colorNavy' | 'colorOchre' | 'colorOlive' | 'colorPaper' | 'colorPhoto' | 'colorPick' | 'colorPickFailed' | 'colorRed' | 'colorRose' | 'colorShades' | 'colorSky' | 'colorViolet' | 'colorWhite' | 'colorYellow' | 'compareOriginal' | 'cropAspectRatio' | 'cropMode' | 'cropModeCrop' | 'cropModeExpand' | 'cropScale' | 'dialogLabel' | 'errorCopyFailed' | 'errorExportFailed' | 'errorInvalidProps' | 'errorInvalidState' | 'errorLoadFailed' | 'errorMarkFailed' | 'errorPhotoTooLarge' | 'errorShareFailed' | 'errorUnsupportedFormat' | 'errorWebglUnavailable' | 'filterDramatic' | 'filterDramaticCool' | 'filterDramaticWarm' | 'filterIntensity' | 'filterMono' | 'filterNoir' | 'filterOriginal' | 'filterSilvertone' | 'filterVivid' | 'filterVividCool' | 'filterVividWarm' | 'finetuneAuto' | 'finetuneBlackPoint' | 'finetuneBrightness' | 'finetuneBrilliance' | 'finetuneContrast' | 'finetuneExposure' | 'finetuneHighlights' | 'finetuneSaturation' | 'finetuneShadows' | 'finetuneSharpness' | 'finetuneVibrance' | 'finetuneVignette' | 'finetuneWarmth' | 'focusCenter' | 'focusFailed' | 'focusSubject' | 'frameCornerHooks' | 'frameEdgeCross' | 'frameEdgeOverlap' | 'frameEdgeSeparate' | 'frameFilm' | 'frameGallery' | 'frameLineMultiple' | 'frameLineSingle' | 'frameMatRound' | 'frameMatSharp' | 'frameNone' | 'framePhotoCorners' | 'framePolaroid' | 'frameRoundCorners' | 'imageCopied' | 'markAdjustment' | 'markAngle' | 'markColor' | 'markColorAuto' | 'markEditText' | 'markFailedSignature' | 'markFailedWatermark' | 'markFont' | 'markFontValue' | 'markGrid' | 'markLayout' | 'markMargin' | 'markOpacity' | 'markRetry' | 'markShow' | 'markSignature' | 'markSingle' | 'markSize' | 'markSkippedSignature' | 'markSkippedWatermark' | 'markSpacing' | 'markText' | 'markWatermark' | 'noticeAreasVisible' | 'noticeClose' | 'noticeCropReset' | 'noticeDropped' | 'noticeDroppedAnnotations' | 'noticeDroppedAuto' | 'noticeDroppedFilter' | 'noticeDroppedFinetune' | 'noticeDroppedFrame' | 'noticeDroppedHiddenAreas' | 'noticeDroppedSignature' | 'noticeDroppedWatermark' | 'obfuscateDelete' | 'obfuscateHint' | 'obfuscateLimit' | 'obfuscateShape' | 'obfuscateShapeRound' | 'obfuscateShapeRounded' | 'obfuscateShapeSquare' | 'obfuscateStyle' | 'obfuscateStyleBlur' | 'obfuscateStylePixelate' | 'obfuscateStyleSolid' | 'palette' | 'paletteEarth' | 'palettePastel' | 'palettePhoto' | 'palettePhotoPastel' | 'palettePhotoVivid' | 'paletteVibrant' | 'pickerDescription' | 'pickerFormats' | 'pickerTitle' | 'pickerTitleTouch' | 'resetConfirmHint' | 'resizeHeight' | 'resizeWidth' | 'shareReady' | 'statusLoading' | 'toolAdjust' | 'toolFilter' | 'toolFrame' | 'toolObfuscate' | 'toolResize' | 'toolsLabel';
2305
+
2306
+ /**
2307
+ * Where an Obfuscate area stands once drawn, in image px, as `read.screenshot` and the export draw it (whole px): what
2308
+ * `obfuscate.add`, `obfuscate.detect` and `obfuscate.update` resolve with, in `boxes`, one for each area they placed or
2309
+ * moved. `index` is its place in the state's `obfuscation`; `box` the box round its outline as its shape and its turn draw
2310
+ * it, past the photo's edges where it stands there.
2311
+ */
2312
+ export declare type ObfuscationBox = {
2313
+ box: Rect;
2314
+ index: number;
2315
+ };
1464
2316
 
1465
2317
  export declare const openEditor: (options?: Omit< EmbedEditorProps, "layout">) => EmbedEditorHandle & {
1466
2318
  close: () => void;