@replohq/sandbox-runtime 1.20.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/_vendor/schemas/comments.d.ts +898 -0
  2. package/_vendor/schemas/commentsOverlayRpc.d.ts +348 -0
  3. package/_vendor/schemas/commentsOverlayRpc.mjs +92 -0
  4. package/_vendor/schemas/generated/comments.d.ts +237 -0
  5. package/_vendor/schemas/generated/commentsOverlayRpc.d.ts +18 -0
  6. package/_vendor/schemas/generated/selectMode.d.ts +3 -1
  7. package/_vendor/schemas/selectMode.d.ts +113 -0
  8. package/_vendor/schemas/selectMode.mjs +1 -1
  9. package/_vendor/schemas/selectModeIframeRpc.d.ts +226 -0
  10. package/_vendor/schemas/selectModeIframeRpc.mjs +1 -1
  11. package/buildMetadata.js +3 -3
  12. package/chunk-NVOBD46N.mjs +541 -0
  13. package/comments-overlay/CommentsOverlayMount.d.ts +1 -0
  14. package/comments-overlay/CommentsOverlayMount.js +44 -0
  15. package/comments-overlay/LICENSE-THIRD-PARTY.md +45 -0
  16. package/comments-overlay/bridge.d.ts +11 -0
  17. package/comments-overlay/bridge.js +136 -0
  18. package/comments-overlay/capture.d.ts +55 -0
  19. package/comments-overlay/capture.js +250 -0
  20. package/comments-overlay/originGate.d.ts +1 -0
  21. package/comments-overlay/originGate.js +11 -0
  22. package/comments-overlay/overlay.d.ts +52 -0
  23. package/comments-overlay/overlay.js +781 -0
  24. package/comments-overlay/resolve.d.ts +27 -0
  25. package/comments-overlay/resolve.js +201 -0
  26. package/comments-overlay/sourceLookup.d.ts +11 -0
  27. package/comments-overlay/sourceLookup.js +63 -0
  28. package/comments-overlay/textQuote.d.ts +17 -0
  29. package/comments-overlay/textQuote.js +87 -0
  30. package/comments-overlay/vendor/bippy.d.ts +53 -0
  31. package/comments-overlay/vendor/bippy.js +402 -0
  32. package/comments-overlay/vendor/elementAnchors.d.ts +9 -0
  33. package/comments-overlay/vendor/elementAnchors.js +144 -0
  34. package/comments-overlay/vendor/fiberElement.d.ts +21 -0
  35. package/comments-overlay/vendor/fiberElement.js +251 -0
  36. package/comments-overlay/vendor/htmlPreview.d.ts +13 -0
  37. package/comments-overlay/vendor/htmlPreview.js +179 -0
  38. package/comments-overlay/vendor/selector.d.ts +38 -0
  39. package/comments-overlay/vendor/selector.js +372 -0
  40. package/package.json +4 -4
  41. package/sandbox-runtime.js +2 -0
  42. package/select-mode/descriptor/elementDescriptor.d.ts +4 -3
  43. package/select-mode/descriptor/elementDescriptor.js +20 -30
  44. package/select-mode/iframeRpcChannel.d.ts +84 -0
  45. package/select-mode/symbolicate.js +25 -7
  46. package/chunk-QTGDSYSU.mjs +0 -249
@@ -0,0 +1,541 @@
1
+ import { exhaustiveSwitch } from './chunk-THOBCJJA.mjs';
2
+ import * as z from 'zod';
3
+
4
+ function parseJsonOrNull(json) {
5
+ try {
6
+ return JSON.parse(json);
7
+ } catch {
8
+ return null;
9
+ }
10
+ }
11
+
12
+ function parseSchemaOrNull(value, schema) {
13
+ const parseResult = schema.safeParse(value);
14
+ return parseResult.success ? parseResult.data : null;
15
+ }
16
+ var commentSourceSchema = z.enum(["ui", "agent", "mcp", "api"]).describe("CommentSource");
17
+ var unitIntervalSchema = z.number().min(0).max(1);
18
+ var anchorUrlSchema = z.string().max(2048);
19
+ var anchorLocaleSchema = z.string().max(35);
20
+ var anchorSelectorSchema = z.string().max(4e3);
21
+ var anchorIdSchema = z.string().max(256);
22
+ var commentAnchorContextSchema = z.object({
23
+ url: anchorUrlSchema,
24
+ locale: anchorLocaleSchema.nullish()
25
+ }).describe("CommentAnchorContext");
26
+ var commentAnchorNoneSchema = z.object({
27
+ type: z.literal("none"),
28
+ context: commentAnchorContextSchema.optional()
29
+ }).describe("CommentAnchorNone");
30
+ var commentAnchorElementSchema = z.object({
31
+ type: z.literal("element"),
32
+ semanticSelector: anchorSelectorSchema.optional(),
33
+ selector: anchorSelectorSchema,
34
+ nthOfTypePath: anchorSelectorSchema,
35
+ source: z.object({
36
+ filePath: z.string().max(1024),
37
+ componentChain: z.array(anchorIdSchema).max(50),
38
+ line: z.number().int().optional(),
39
+ col: z.number().int().optional()
40
+ }).optional(),
41
+ listKey: anchorIdSchema.optional(),
42
+ tagName: z.string().max(64),
43
+ textPreview: z.string().max(200),
44
+ quote: z.object({
45
+ exact: z.string().max(2e3),
46
+ prefix: z.string().max(80),
47
+ suffix: z.string().max(80)
48
+ }).optional(),
49
+ offset: z.object({ x: unitIntervalSchema, y: unitIntervalSchema }),
50
+ context: commentAnchorContextSchema.optional()
51
+ }).describe("CommentAnchorElement");
52
+ var commentAnchorCanvasSchema = z.object({
53
+ type: z.literal("canvas"),
54
+ nodeId: anchorIdSchema,
55
+ layerId: anchorIdSchema.optional(),
56
+ point: z.object({ x: z.number(), y: z.number() }),
57
+ world: z.object({ x: z.number(), y: z.number() }).optional().describe("Set only for free-floating pins that sit on no node.")
58
+ }).describe("CommentAnchorCanvas");
59
+ var commentAnchorPointSchema = z.object({
60
+ type: z.literal("point"),
61
+ page: z.number().int().min(0).optional(),
62
+ x: unitIntervalSchema,
63
+ y: unitIntervalSchema
64
+ }).describe("CommentAnchorPoint");
65
+ var commentAnchorSchema = z.discriminatedUnion("type", [
66
+ commentAnchorNoneSchema,
67
+ commentAnchorElementSchema,
68
+ commentAnchorCanvasSchema,
69
+ commentAnchorPointSchema
70
+ ]).describe("CommentAnchor");
71
+ var commentTargetSchema = z.discriminatedUnion("kind", [
72
+ z.object({
73
+ kind: z.literal("file"),
74
+ fileId: z.uuid(),
75
+ folderId: z.uuid().optional().describe(
76
+ "The artifact folder the comment was left from; the file must be one of its pages."
77
+ )
78
+ }),
79
+ z.object({
80
+ kind: z.literal("sitePage"),
81
+ siteId: z.uuid(),
82
+ url: anchorUrlSchema,
83
+ locale: anchorLocaleSchema.nullish(),
84
+ routePatternHint: anchorUrlSchema.optional(),
85
+ via: z.object({ fileId: z.uuid(), shareId: z.string() }).optional().describe(
86
+ "Set when the site preview is embedded in an artifact or canvas."
87
+ )
88
+ }),
89
+ z.object({ kind: z.literal("order"), orderId: z.uuid() }),
90
+ z.object({ kind: z.literal("asset"), assetId: z.uuid() })
91
+ ]).describe("CommentTarget");
92
+ z.enum([
93
+ "artifact",
94
+ "canvas",
95
+ "image",
96
+ "markdown",
97
+ "pdf",
98
+ "file",
99
+ "websiteBuilder",
100
+ "embeddedPreview",
101
+ "orders",
102
+ "assets"
103
+ ]).describe("CommentSurface");
104
+ var commentAuthorSchema = z.object({
105
+ id: z.string(),
106
+ name: z.string(),
107
+ avatarUrl: z.string().nullable(),
108
+ deleted: z.boolean()
109
+ }).describe("CommentAuthor");
110
+ var commentSchema = z.object({
111
+ id: z.string(),
112
+ threadId: z.string(),
113
+ authorUserId: z.string(),
114
+ source: commentSourceSchema,
115
+ body: z.string().describe("Empty when the comment is deleted."),
116
+ createdAt: z.iso.datetime(),
117
+ editedAt: z.iso.datetime().nullable(),
118
+ deletedAt: z.iso.datetime().nullable()
119
+ }).describe("Comment");
120
+ var commentReactionSchema = z.object({
121
+ commentId: z.string(),
122
+ userId: z.string(),
123
+ emoji: z.string(),
124
+ createdAt: z.iso.datetime()
125
+ }).describe("CommentReaction");
126
+ var commentThreadTargetSchema = z.object({
127
+ fileId: z.string().optional(),
128
+ siteId: z.string().optional(),
129
+ path: z.string().optional(),
130
+ orderId: z.string().optional(),
131
+ assetId: z.string().optional()
132
+ }).describe("CommentThreadTarget");
133
+ var commentThreadSchema = z.object({
134
+ id: z.string(),
135
+ projectId: z.string(),
136
+ target: commentThreadTargetSchema,
137
+ viaFileId: z.string().nullable(),
138
+ viaFileName: z.string().nullable(),
139
+ anchor: commentAnchorSchema,
140
+ resolvedAt: z.iso.datetime().nullable(),
141
+ resolvedByUserId: z.string().nullable(),
142
+ resolvedSource: commentSourceSchema.nullable(),
143
+ createdAt: z.iso.datetime(),
144
+ updatedAt: z.iso.datetime(),
145
+ deletedAt: z.iso.datetime().nullable()
146
+ }).describe("CommentThread");
147
+ var commentViewerSchema = z.object({
148
+ userId: z.string().nullable().describe("The signed-in caller; null for anonymous viewers."),
149
+ isMember: z.boolean().describe("Holds a role on the project, so object mentions are on."),
150
+ canComment: z.boolean(),
151
+ canModerate: z.boolean().describe("A workspace admin, who can delete anyone's comment (D-10).")
152
+ }).describe("CommentViewer");
153
+ z.object({
154
+ threads: z.array(commentThreadSchema),
155
+ comments: z.array(commentSchema),
156
+ reactions: z.array(commentReactionSchema),
157
+ authors: z.array(commentAuthorSchema),
158
+ viewer: commentViewerSchema
159
+ }).describe("CommentThreadBundle");
160
+ z.object({
161
+ id: z.uuid(),
162
+ target: commentTargetSchema,
163
+ anchor: commentAnchorSchema,
164
+ body: z.object({ id: z.uuid(), body: z.string() })
165
+ }).describe("CreateCommentThreadBody");
166
+ z.object({
167
+ resolved: z.boolean().optional(),
168
+ path: z.string().optional().describe("Moves the thread to another page and resets its anchor."),
169
+ anchor: commentAnchorSchema.optional()
170
+ }).refine(
171
+ (patch) => {
172
+ return patch.resolved !== void 0 || patch.path !== void 0 || patch.anchor !== void 0;
173
+ },
174
+ { message: "Pass at least one of resolved, path or anchor." }
175
+ ).refine((patch) => patch.path === void 0 || patch.anchor === void 0, {
176
+ message: "Move a thread or re-anchor it, not both at once."
177
+ }).describe("UpdateCommentThreadBody");
178
+ z.object({
179
+ id: z.uuid(),
180
+ body: z.string()
181
+ }).describe("CreateCommentBody");
182
+ z.object({
183
+ body: z.string()
184
+ }).describe("UpdateCommentBody");
185
+ var commentThreadStatusSchema = z.enum(["open", "resolved"]).describe("CommentThreadStatus");
186
+ z.object({
187
+ fileId: z.uuid().optional(),
188
+ folderId: z.uuid().optional().describe("Artifact folder: every page under it."),
189
+ siteId: z.uuid().optional(),
190
+ path: z.string().optional().describe(
191
+ "A concrete page path or a route pattern, normalized the same way a new comment's URL is."
192
+ ),
193
+ locale: z.string().optional().describe("The locale prefixed to `path`, which is stripped first."),
194
+ viaFileId: z.uuid().optional(),
195
+ orderId: z.uuid().optional(),
196
+ assetId: z.uuid().optional(),
197
+ status: commentThreadStatusSchema.optional()
198
+ }).refine(
199
+ (query) => {
200
+ return [
201
+ query.fileId,
202
+ query.folderId,
203
+ query.siteId,
204
+ query.orderId,
205
+ query.assetId
206
+ ].filter((value) => value !== void 0).length === 1;
207
+ },
208
+ {
209
+ message: "Exactly one of fileId, folderId, siteId, orderId or assetId is required."
210
+ }
211
+ ).refine(
212
+ (query) => {
213
+ return query.siteId !== void 0 || query.path === void 0 && query.locale === void 0 && query.viaFileId === void 0;
214
+ },
215
+ { message: "path, locale and viaFileId require siteId." }
216
+ ).describe("ListCommentThreadsQuery");
217
+ z.object({
218
+ kind: z.enum(["artifact", "miniapp", "commentsScreen", "gone"]),
219
+ url: z.string().optional(),
220
+ projectId: z.string().optional().describe(
221
+ "The thread's project, set for miniapp and commentsScreen locations so the dashboard can build the project route."
222
+ ),
223
+ miniappId: z.string().optional(),
224
+ miniappRoute: z.string().optional()
225
+ }).describe("CommentThreadLocation");
226
+ z.object({
227
+ target: commentTargetSchema,
228
+ contentType: z.string(),
229
+ contentLength: z.number().int().positive()
230
+ }).describe("PresignCommentAttachmentBody");
231
+ z.object({
232
+ objectKey: z.string(),
233
+ presignedPutUrl: z.string(),
234
+ publicUrl: z.string()
235
+ }).describe("PresignCommentAttachmentResponse");
236
+ z.object({
237
+ target: commentTargetSchema,
238
+ objectKey: z.string()
239
+ }).describe("CommitCommentAttachmentBody");
240
+ z.object({
241
+ publicUrl: z.string()
242
+ }).describe("CommitCommentAttachmentResponse");
243
+ z.object({
244
+ column: z.enum([
245
+ "page",
246
+ "excerpt",
247
+ "author",
248
+ "created",
249
+ "lastActivity",
250
+ "replies",
251
+ "status",
252
+ "from"
253
+ ]),
254
+ direction: z.enum(["asc", "desc"])
255
+ }).describe("CommentSiteThreadSort");
256
+ z.object({
257
+ threads: z.array(commentThreadSchema),
258
+ comments: z.array(commentSchema),
259
+ reactions: z.array(commentReactionSchema),
260
+ authors: z.array(commentAuthorSchema),
261
+ orphanedPaths: z.array(z.string()).nullable().describe(
262
+ "Paths on this page with no current site page; null when the site's pages couldn't be read."
263
+ ),
264
+ nextCursor: z.string().nullable()
265
+ }).describe("CommentSiteThreadPage");
266
+ z.object({
267
+ id: z.string(),
268
+ name: z.string(),
269
+ avatarUrl: z.string().nullable()
270
+ }).describe("CommentMentionPerson");
271
+ var mentionableDisplaySchema = z.object({
272
+ label: z.string(),
273
+ imageUrl: z.string().optional()
274
+ }).describe("MentionableDisplay");
275
+ z.discriminatedUnion("state", [
276
+ z.object({ state: z.literal("ok"), display: mentionableDisplaySchema }),
277
+ z.object({
278
+ state: z.literal("forbidden"),
279
+ category: z.string().describe(
280
+ `A category label such as "File", never the object's title.`
281
+ )
282
+ })
283
+ ]).describe("MentionableResolution");
284
+ var commentThreadTargetSummarySchema = z.object({
285
+ kind: z.enum(["file", "sitePage", "order", "asset"]),
286
+ fileId: z.string().optional(),
287
+ fileName: z.string().optional(),
288
+ filePath: z.string().optional().describe("The file's path from its project's root folder."),
289
+ artifactFolderId: z.string().optional().describe("Set when the file is a page of an artifact."),
290
+ fileDeleted: z.boolean().optional().describe("True when the commented file no longer exists."),
291
+ siteId: z.string().optional(),
292
+ path: z.string().optional().describe("The site route pattern."),
293
+ url: z.string().optional().describe("The concrete page URL the comment was left on."),
294
+ orderId: z.string().optional(),
295
+ assetId: z.string().optional()
296
+ }).describe("CommentThreadTargetSummary");
297
+ z.object({
298
+ thread: commentThreadSchema,
299
+ comments: z.array(commentSchema),
300
+ reactions: z.array(commentReactionSchema),
301
+ authors: z.array(commentAuthorSchema),
302
+ target: commentThreadTargetSummarySchema
303
+ }).describe("CommentThreadDetail");
304
+
305
+ var SELECT_MODE_SELECTABLE_ATTRIBUTE = "data-replo-selectable";
306
+ var SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE = "data-replo-selectable-payload";
307
+ var displayModeSchema = z.enum(["browse", "selection", "comment"]).describe("DisplayMode");
308
+ var selectModeInlineTextStatusSchema = z.enum(["editable", "dynamic", "translated"]).nullable().describe("SelectModeInlineTextStatus");
309
+ var selectModeTextMetricsSchema = z.object({
310
+ tightWidth: z.number(),
311
+ lineCount: z.number(),
312
+ lineHeight: z.number()
313
+ }).describe("SelectModeTextMetrics");
314
+ var selectModeClickPositionSchema = z.object({
315
+ x: z.number(),
316
+ y: z.number()
317
+ }).describe("SelectModeClickPosition");
318
+ var selectModeSourceLocationSchema = z.object({
319
+ filePath: z.string(),
320
+ lineNumber: z.number(),
321
+ columnNumber: z.number().optional(),
322
+ componentName: z.string().optional()
323
+ }).describe("SelectModeSourceLocation");
324
+ var selectModeFiberChainEntrySchema = z.object({
325
+ sourceLocation: selectModeSourceLocationSchema,
326
+ tagName: z.string().optional(),
327
+ componentName: z.string().optional(),
328
+ props: z.record(z.string(), z.unknown()).optional()
329
+ }).describe("SelectModeFiberChainEntry");
330
+ var selectModeBoundingRectSchema = z.object({
331
+ x: z.number(),
332
+ y: z.number(),
333
+ left: z.number(),
334
+ top: z.number(),
335
+ right: z.number(),
336
+ bottom: z.number(),
337
+ width: z.number(),
338
+ height: z.number()
339
+ }).describe("SelectModeBoundingRect");
340
+ var selectModeHoverRectSchema = selectModeBoundingRectSchema.extend({ isSection: z.boolean().optional() }).describe("SelectModeHoverRect");
341
+ var selectModeSelectionRectSchema = z.object({
342
+ id: z.string(),
343
+ rect: selectModeBoundingRectSchema
344
+ }).describe("SelectModeSelectionRect");
345
+ var selectModeStyleAtRuleSchema = z.object({
346
+ type: z.string(),
347
+ text: z.string()
348
+ }).describe("SelectModeStyleAtRule");
349
+ var selectModeStyleVariantSchema = z.object({
350
+ atRules: z.array(selectModeStyleAtRuleSchema),
351
+ pseudo: z.string().nullable()
352
+ }).describe("SelectModeStyleVariant");
353
+ var selectModeDefinedStyleSchema = z.object({
354
+ property: z.string(),
355
+ variant: selectModeStyleVariantSchema.nullable(),
356
+ className: z.string().nullable(),
357
+ raw: z.string(),
358
+ resolved: z.string()
359
+ }).describe("SelectModeDefinedStyle");
360
+ function transformRect({
361
+ rect,
362
+ offset,
363
+ scale = 1
364
+ }) {
365
+ return {
366
+ x: rect.x * scale + offset.left,
367
+ y: rect.y * scale + offset.top,
368
+ left: rect.left * scale + offset.left,
369
+ right: rect.right * scale + offset.left,
370
+ top: rect.top * scale + offset.top,
371
+ bottom: rect.bottom * scale + offset.top,
372
+ width: rect.width * scale,
373
+ height: rect.height * scale
374
+ };
375
+ }
376
+ function transformPoint({
377
+ point,
378
+ offset,
379
+ scale = 1
380
+ }) {
381
+ return {
382
+ x: point.x * scale + offset.left,
383
+ y: point.y * scale + offset.top
384
+ };
385
+ }
386
+ function getIframeOffset(iframe) {
387
+ if (!iframe) {
388
+ return { left: 0, top: 0 };
389
+ }
390
+ const iframeRect = iframe.getBoundingClientRect();
391
+ return { left: iframeRect.left, top: iframeRect.top };
392
+ }
393
+ var selectModeImageScopeSchema = z.discriminatedUnion("kind", [
394
+ z.object({ kind: z.literal("all") }),
395
+ z.object({ kind: z.literal("media"), media: z.string() })
396
+ ]).describe("SelectModeImageScope");
397
+ var selectModeImageSourceSchema = z.object({
398
+ srcSet: z.string(),
399
+ sizes: z.string(),
400
+ media: z.string(),
401
+ type: z.string(),
402
+ previewUrl: z.string().nullable()
403
+ }).describe("SelectModeImageSource");
404
+ var selectModeImageSchema = z.object({
405
+ src: z.string(),
406
+ currentSrc: z.string(),
407
+ srcSet: z.string(),
408
+ sizes: z.string(),
409
+ previewUrl: z.string().nullable(),
410
+ sources: z.array(selectModeImageSourceSchema)
411
+ }).describe("SelectModeImage");
412
+ var selectModeVideoSchema = z.object({
413
+ src: z.string(),
414
+ currentSrc: z.string()
415
+ }).describe("SelectModeVideo");
416
+ var selectedElementSchema = z.object({
417
+ kind: z.literal("react-element"),
418
+ selector: z.string(),
419
+ section: z.object({ selector: z.string() }).optional(),
420
+ tagName: z.string(),
421
+ elementType: z.string(),
422
+ textContent: z.string().nullable(),
423
+ sectionLabel: z.string().optional(),
424
+ rect: selectModeBoundingRectSchema,
425
+ textMetrics: selectModeTextMetricsSchema.nullable(),
426
+ outerHTML: z.string(),
427
+ image: selectModeImageSchema.optional(),
428
+ video: selectModeVideoSchema.optional(),
429
+ definedStyles: z.array(selectModeDefinedStyleSchema).default([]),
430
+ authoredStyles: z.record(z.string(), z.string()).default({}).describe(
431
+ "Authored CSS value of the winning declaration per control property, custom properties expanded (e.g. 1.5rem for text-2xl at a wide viewport)."
432
+ ),
433
+ inheritedStyles: z.record(z.string(), z.string()).default({}),
434
+ clickPosition: selectModeClickPositionSchema,
435
+ sourceLocation: selectModeSourceLocationSchema.optional(),
436
+ fiberChain: z.array(selectModeFiberChainEntrySchema).default([]),
437
+ siblingSelectors: z.array(z.string()).default([]),
438
+ anchor: commentAnchorElementSchema.optional().describe(
439
+ "The comments capture of the same element, so a selection can become a comment anchor."
440
+ )
441
+ }).describe("SelectedElement");
442
+ var selectablePlanDataSchema = z.object({
443
+ kind: z.literal("plan"),
444
+ planId: z.string(),
445
+ label: z.string(),
446
+ rect: selectModeBoundingRectSchema
447
+ }).describe("SelectablePlanData");
448
+ var selectablePlanPayloadSchema = selectablePlanDataSchema.omit({ rect: true }).describe("SelectablePlanPayload");
449
+ var selectableDataPayloadSchema = z.discriminatedUnion("kind", [selectablePlanPayloadSchema]).describe("SelectableDataPayload");
450
+ var selectableDataSchema = z.discriminatedUnion("kind", [selectedElementSchema, selectablePlanDataSchema]).describe("SelectableData");
451
+ function isSelectedSection(data) {
452
+ return data.kind === "react-element" && data.selector === data.section?.selector;
453
+ }
454
+ function transformSelectedElement({
455
+ element,
456
+ offset,
457
+ scale = 1
458
+ }) {
459
+ return {
460
+ ...element,
461
+ rect: transformRect({ rect: element.rect, offset, scale }),
462
+ clickPosition: transformPoint({
463
+ point: element.clickPosition,
464
+ offset,
465
+ scale
466
+ })
467
+ };
468
+ }
469
+ function transformSelectableData({
470
+ data,
471
+ offset
472
+ }) {
473
+ return exhaustiveSwitch(
474
+ data,
475
+ "kind"
476
+ )({
477
+ "react-element": (element) => transformSelectedElement({ element, offset }),
478
+ plan: (plan) => ({
479
+ ...plan,
480
+ rect: transformRect({ rect: plan.rect, offset })
481
+ })
482
+ });
483
+ }
484
+ function readSelectablePayload(rawPayload) {
485
+ if (!rawPayload) {
486
+ return null;
487
+ }
488
+ const parsedPayload = parseJsonOrNull(rawPayload);
489
+ if (!parsedPayload) {
490
+ return null;
491
+ }
492
+ return parseSchemaOrNull(parsedPayload, selectableDataPayloadSchema);
493
+ }
494
+ var selectModeOptimisticUpdatePayloadSchema = z.discriminatedUnion("kind", [
495
+ z.object({
496
+ kind: z.literal("image"),
497
+ image: selectModeImageSchema
498
+ }),
499
+ z.object({
500
+ kind: z.literal("css"),
501
+ fontSource: z.enum(["google", "site"]).optional(),
502
+ property: z.string(),
503
+ value: z.string().nullable()
504
+ }),
505
+ z.object({
506
+ kind: z.literal("content"),
507
+ innerHTML: z.string()
508
+ }),
509
+ z.object({
510
+ kind: z.literal("attribute"),
511
+ name: z.string(),
512
+ value: z.string()
513
+ })
514
+ ]).describe("SelectModeOptimisticUpdatePayload");
515
+ var selectModeTiptapActiveMarksSchema = z.object({
516
+ bold: z.boolean(),
517
+ italic: z.boolean(),
518
+ underline: z.boolean(),
519
+ strike: z.boolean()
520
+ }).describe("SelectModeTiptapActiveMarks");
521
+ var selectModeFormatCommandSchema = z.enum(["toggleBold", "toggleItalic", "toggleUnderline", "toggleStrike"]).describe("SelectModeFormatCommand");
522
+ var selectModeSelectionTypeSchema = z.enum(["none", "element", "area", "drag"]).describe("SelectModeSelectionType");
523
+ var selectModeSelectionSchema = z.discriminatedUnion("type", [
524
+ z.object({ type: z.literal("none") }),
525
+ z.object({
526
+ type: z.literal("element"),
527
+ data: selectableDataSchema
528
+ }),
529
+ z.object({
530
+ type: z.literal("area"),
531
+ rect: selectModeBoundingRectSchema,
532
+ items: z.array(selectableDataSchema)
533
+ }),
534
+ z.object({
535
+ type: z.literal("drag"),
536
+ dragRect: selectModeBoundingRectSchema,
537
+ selectionRects: z.array(selectModeSelectionRectSchema)
538
+ })
539
+ ]).describe("SelectModeSelection");
540
+
541
+ export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, commentAnchorElementSchema, commentAnchorSchema, displayModeSchema, getIframeOffset, isSelectedSection, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeHoverRectSchema, selectModeImageSchema, selectModeImageScopeSchema, selectModeImageSourceSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectModeVideoSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement };
@@ -0,0 +1 @@
1
+ export declare function CommentsOverlayMount(): null;
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ if (typeof window !== "undefined") {
3
+ void Promise.all([
4
+ import("./bridge"),
5
+ import("../select-mode/symbolicate")
6
+ ]).then(([bridge, symbolication]) => {
7
+ const symbolicate = async (locations) => {
8
+ const lined = locations.flatMap((location, index) => {
9
+ return location.line === void 0 ? [] : [
10
+ {
11
+ index,
12
+ location: {
13
+ filePath: location.filePath,
14
+ lineNumber: location.line,
15
+ columnNumber: location.col
16
+ }
17
+ }
18
+ ];
19
+ });
20
+ const resolved = await symbolication.symbolicateSourceLocations(
21
+ lined.map((entry) => entry.location)
22
+ );
23
+ const result = [...locations];
24
+ for (const [position, { index }] of lined.entries()) {
25
+ const location = resolved[position];
26
+ if (location) {
27
+ result[index] = {
28
+ filePath: location.filePath,
29
+ line: location.lineNumber,
30
+ col: location.columnNumber
31
+ };
32
+ }
33
+ }
34
+ return result;
35
+ };
36
+ bridge.startCommentsOverlay({ symbolicate });
37
+ });
38
+ }
39
+ function CommentsOverlayMount() {
40
+ return null;
41
+ }
42
+ export {
43
+ CommentsOverlayMount
44
+ };
@@ -0,0 +1,45 @@
1
+ # Third-party notices
2
+
3
+ Files under `comments-overlay/vendor/` are ported from the projects below. Each ported file carries a header naming its source.
4
+
5
+ ## react-grab
6
+
7
+ Source: https://github.com/aidenybai/react-grab at commit `ea4bbec` (`packages/react-grab/src`). Its selector search is modelled on `@medv/finder` (MIT).
8
+
9
+ ```
10
+ MIT License
11
+
12
+ Copyright (c) 2025 Aiden Bai
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ ```
32
+
33
+ ## bippy
34
+
35
+ Source: https://github.com/aidenybai/bippy at tag `bippy@0.7.2` (the version react-grab `ea4bbec` depends on), `packages/bippy/src`.
36
+
37
+ ```
38
+ Copyright 2024-present Aiden Bai
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
41
+
42
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
43
+
44
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45
+ ```
@@ -0,0 +1,11 @@
1
+ import type { SourceSymbolicator } from "./capture";
2
+ /**
3
+ * Boots the comments overlay inside an embedded frame and connects it to the
4
+ * host over its own RPC channel. Inbound messages must come from the parent
5
+ * window on an allowed origin (C-13); outbound ones go only to that verified
6
+ * origin, except the payload-free `overlayReady` announcement.
7
+ */
8
+ export declare function startCommentsOverlay({ symbolicate, }: {
9
+ /** Maps compiled source locations to original files (Next's dev endpoint). */
10
+ symbolicate: SourceSymbolicator;
11
+ }): () => void;