@embedpdf/plugin-annotation 2.12.1 → 2.14.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 (41) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1912 -1456
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/handlers/callout-free-text.handler.d.ts +3 -0
  6. package/dist/lib/handlers/index.d.ts +1 -0
  7. package/dist/lib/handlers/types.d.ts +7 -1
  8. package/dist/lib/patching/index.d.ts +1 -0
  9. package/dist/lib/patching/patch-utils.d.ts +38 -1
  10. package/dist/lib/patching/patches/callout-freetext.patch.d.ts +3 -0
  11. package/dist/lib/patching/patches/index.d.ts +1 -0
  12. package/dist/lib/tools/default-tools.d.ts +35 -0
  13. package/dist/preact/index.cjs +1 -1
  14. package/dist/preact/index.cjs.map +1 -1
  15. package/dist/preact/index.js +395 -14
  16. package/dist/preact/index.js.map +1 -1
  17. package/dist/react/index.cjs +1 -1
  18. package/dist/react/index.cjs.map +1 -1
  19. package/dist/react/index.js +395 -14
  20. package/dist/react/index.js.map +1 -1
  21. package/dist/shared/components/annotations/callout-free-text-preview.d.ts +15 -0
  22. package/dist/shared/components/annotations/callout-free-text.d.ts +15 -0
  23. package/dist/shared-preact/components/annotations/callout-free-text-preview.d.ts +15 -0
  24. package/dist/shared-preact/components/annotations/callout-free-text.d.ts +15 -0
  25. package/dist/shared-react/components/annotations/callout-free-text-preview.d.ts +15 -0
  26. package/dist/shared-react/components/annotations/callout-free-text.d.ts +15 -0
  27. package/dist/svelte/components/annotations/CalloutFreeText.svelte.d.ts +15 -0
  28. package/dist/svelte/components/annotations/CalloutFreeTextPreview.svelte.d.ts +10 -0
  29. package/dist/svelte/components/renderers/CalloutFreeTextRenderer.svelte.d.ts +5 -0
  30. package/dist/svelte/index.cjs +1 -1
  31. package/dist/svelte/index.cjs.map +1 -1
  32. package/dist/svelte/index.js +497 -86
  33. package/dist/svelte/index.js.map +1 -1
  34. package/dist/vue/components/annotations/callout-free-text-preview.vue.d.ts +10 -0
  35. package/dist/vue/components/annotations/callout-free-text.vue.d.ts +25 -0
  36. package/dist/vue/components/renderers/callout-free-text-renderer.vue.d.ts +6 -0
  37. package/dist/vue/index.cjs +1 -1
  38. package/dist/vue/index.cjs.map +1 -1
  39. package/dist/vue/index.js +544 -170
  40. package/dist/vue/index.js.map +1 -1
  41. package/package.json +12 -12
@@ -1276,7 +1276,7 @@ function createRenderer(entry) {
1276
1276
  renderLocked: entry.renderLocked ? (props) => entry.renderLocked(props) : void 0
1277
1277
  };
1278
1278
  }
1279
- const MIN_HIT_AREA_SCREEN_PX$5 = 20;
1279
+ const MIN_HIT_AREA_SCREEN_PX$6 = 20;
1280
1280
  function Ink({
1281
1281
  isSelected,
1282
1282
  strokeColor,
@@ -1302,7 +1302,7 @@ function Ink({
1302
1302
  }, [inkList, rect]);
1303
1303
  const width = rect.size.width * scale;
1304
1304
  const height = rect.size.height * scale;
1305
- const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$5 / scale);
1305
+ const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$6 / scale);
1306
1306
  return /* @__PURE__ */ jsxs(
1307
1307
  "svg",
1308
1308
  {
@@ -1355,7 +1355,7 @@ function Ink({
1355
1355
  }
1356
1356
  );
1357
1357
  }
1358
- const MIN_HIT_AREA_SCREEN_PX$4 = 20;
1358
+ const MIN_HIT_AREA_SCREEN_PX$5 = 20;
1359
1359
  function Square({
1360
1360
  isSelected,
1361
1361
  color = "#000000",
@@ -1395,7 +1395,7 @@ function Square({
1395
1395
  }, [isCloudy, rect, rectangleDifferences, cloudyBorderIntensity, strokeWidth]);
1396
1396
  const svgWidth = rect.size.width * scale;
1397
1397
  const svgHeight = rect.size.height * scale;
1398
- const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$4 / scale);
1398
+ const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$5 / scale);
1399
1399
  return /* @__PURE__ */ jsxs(
1400
1400
  "svg",
1401
1401
  {
@@ -1477,7 +1477,7 @@ function Square({
1477
1477
  }
1478
1478
  );
1479
1479
  }
1480
- const MIN_HIT_AREA_SCREEN_PX$3 = 20;
1480
+ const MIN_HIT_AREA_SCREEN_PX$4 = 20;
1481
1481
  function Circle({
1482
1482
  color = "#000000",
1483
1483
  strokeColor,
@@ -1519,7 +1519,7 @@ function Circle({
1519
1519
  }, [isCloudy, rect, rectangleDifferences, cloudyBorderIntensity, strokeWidth]);
1520
1520
  const svgWidth = width * scale;
1521
1521
  const svgHeight = height * scale;
1522
- const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$3 / scale);
1522
+ const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$4 / scale);
1523
1523
  return /* @__PURE__ */ jsxs(
1524
1524
  "svg",
1525
1525
  {
@@ -1601,7 +1601,7 @@ function Circle({
1601
1601
  }
1602
1602
  );
1603
1603
  }
1604
- const MIN_HIT_AREA_SCREEN_PX$2 = 20;
1604
+ const MIN_HIT_AREA_SCREEN_PX$3 = 20;
1605
1605
  function Line({
1606
1606
  color = "transparent",
1607
1607
  opacity = 1,
@@ -1634,7 +1634,7 @@ function Line({
1634
1634
  }, [lineEndings, strokeWidth, x1, y1, x2, y2]);
1635
1635
  const width = rect.size.width * scale;
1636
1636
  const height = rect.size.height * scale;
1637
- const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$2 / scale);
1637
+ const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$3 / scale);
1638
1638
  return /* @__PURE__ */ jsxs(
1639
1639
  "svg",
1640
1640
  {
@@ -1758,7 +1758,7 @@ function Line({
1758
1758
  }
1759
1759
  );
1760
1760
  }
1761
- const MIN_HIT_AREA_SCREEN_PX$1 = 20;
1761
+ const MIN_HIT_AREA_SCREEN_PX$2 = 20;
1762
1762
  function Polyline({
1763
1763
  rect,
1764
1764
  vertices,
@@ -1806,7 +1806,7 @@ function Polyline({
1806
1806
  }, [localPts, lineEndings, strokeWidth]);
1807
1807
  const width = rect.size.width * scale;
1808
1808
  const height = rect.size.height * scale;
1809
- const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$1 / scale);
1809
+ const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$2 / scale);
1810
1810
  return /* @__PURE__ */ jsxs(
1811
1811
  "svg",
1812
1812
  {
@@ -1928,7 +1928,7 @@ function Polyline({
1928
1928
  }
1929
1929
  );
1930
1930
  }
1931
- const MIN_HIT_AREA_SCREEN_PX = 20;
1931
+ const MIN_HIT_AREA_SCREEN_PX$1 = 20;
1932
1932
  function Polygon({
1933
1933
  rect,
1934
1934
  vertices,
@@ -1965,7 +1965,7 @@ function Polygon({
1965
1965
  const isPreviewing = currentVertex && vertices.length > 0;
1966
1966
  const width = rect.size.width * scale;
1967
1967
  const height = rect.size.height * scale;
1968
- const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX / scale);
1968
+ const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$1 / scale);
1969
1969
  return /* @__PURE__ */ jsxs(
1970
1970
  "svg",
1971
1971
  {
@@ -2205,6 +2205,339 @@ function FreeText({
2205
2205
  }
2206
2206
  );
2207
2207
  }
2208
+ const MIN_HIT_AREA_SCREEN_PX = 20;
2209
+ function CalloutFreeText({
2210
+ documentId,
2211
+ isSelected,
2212
+ isEditing,
2213
+ annotation,
2214
+ pageIndex,
2215
+ scale,
2216
+ onClick,
2217
+ appearanceActive = false
2218
+ }) {
2219
+ const editorRef = useRef(null);
2220
+ const editingRef = useRef(false);
2221
+ const { provides: annotationCapability } = useAnnotationCapability();
2222
+ const annotationProvides = (annotationCapability == null ? void 0 : annotationCapability.forDocument(documentId)) ?? null;
2223
+ const obj = annotation.object;
2224
+ const rect = obj.rect;
2225
+ const rd = obj.rectangleDifferences;
2226
+ const calloutLine = obj.calloutLine;
2227
+ const strokeWidth = obj.strokeWidth ?? 1;
2228
+ const strokeColor = obj.strokeColor ?? "#000000";
2229
+ const textBox = useMemo(() => patching.computeTextBoxFromRD(rect, rd), [rect, rd]);
2230
+ const textBoxRelative = useMemo(
2231
+ () => ({
2232
+ left: (textBox.origin.x - rect.origin.x + strokeWidth / 2) * scale,
2233
+ top: (textBox.origin.y - rect.origin.y + strokeWidth / 2) * scale,
2234
+ width: (textBox.size.width - strokeWidth) * scale,
2235
+ height: (textBox.size.height - strokeWidth) * scale
2236
+ }),
2237
+ [textBox, rect, scale, strokeWidth]
2238
+ );
2239
+ const lineCoords = useMemo(() => {
2240
+ if (!calloutLine || calloutLine.length < 3) return null;
2241
+ return calloutLine.map((p) => ({
2242
+ x: p.x - rect.origin.x,
2243
+ y: p.y - rect.origin.y
2244
+ }));
2245
+ }, [calloutLine, rect]);
2246
+ const ending = useMemo(() => {
2247
+ if (!lineCoords || lineCoords.length < 2) return null;
2248
+ const angle = Math.atan2(lineCoords[1].y - lineCoords[0].y, lineCoords[1].x - lineCoords[0].x);
2249
+ return patching.createEnding(
2250
+ obj.lineEnding,
2251
+ strokeWidth,
2252
+ angle + Math.PI,
2253
+ lineCoords[0].x,
2254
+ lineCoords[0].y
2255
+ );
2256
+ }, [lineCoords, obj.lineEnding, strokeWidth]);
2257
+ const visualLineCoords = useMemo(() => {
2258
+ if (!lineCoords || lineCoords.length < 2) return lineCoords;
2259
+ const pts = lineCoords.map((p) => ({ ...p }));
2260
+ const last = pts.length - 1;
2261
+ const prev = last - 1;
2262
+ const dx = pts[last].x - pts[prev].x;
2263
+ const dy = pts[last].y - pts[prev].y;
2264
+ const len = Math.sqrt(dx * dx + dy * dy);
2265
+ if (len > 0) {
2266
+ const halfBw = strokeWidth / 2;
2267
+ pts[last].x += dx / len * halfBw;
2268
+ pts[last].y += dy / len * halfBw;
2269
+ }
2270
+ return pts;
2271
+ }, [lineCoords, strokeWidth]);
2272
+ const { adjustedFontPx, wrapperStyle } = useIOSZoomPrevention(obj.fontSize * scale, isEditing);
2273
+ useEffect(() => {
2274
+ var _a;
2275
+ if (isEditing && editorRef.current) {
2276
+ editingRef.current = true;
2277
+ const editor = editorRef.current;
2278
+ editor.focus();
2279
+ const tool = annotationProvides == null ? void 0 : annotationProvides.findToolForAnnotation(obj);
2280
+ const isDefaultContent = ((_a = tool == null ? void 0 : tool.defaults) == null ? void 0 : _a.contents) != null && obj.contents === tool.defaults.contents;
2281
+ const selection = window.getSelection();
2282
+ if (selection) {
2283
+ const range = document.createRange();
2284
+ range.selectNodeContents(editor);
2285
+ if (!isDefaultContent) {
2286
+ range.collapse(false);
2287
+ }
2288
+ selection.removeAllRanges();
2289
+ selection.addRange(range);
2290
+ }
2291
+ }
2292
+ }, [isEditing]);
2293
+ const handleBlur = () => {
2294
+ if (!editingRef.current) return;
2295
+ editingRef.current = false;
2296
+ if (!annotationProvides) return;
2297
+ if (!editorRef.current) return;
2298
+ annotationProvides.updateAnnotation(pageIndex, obj.id, {
2299
+ contents: editorRef.current.innerText.replace(/\u00A0/g, " ")
2300
+ });
2301
+ };
2302
+ const width = rect.size.width * scale;
2303
+ const height = rect.size.height * scale;
2304
+ const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX / scale);
2305
+ return /* @__PURE__ */ jsxs(
2306
+ "div",
2307
+ {
2308
+ style: {
2309
+ position: "absolute",
2310
+ width,
2311
+ height,
2312
+ cursor: isSelected && !isEditing ? "move" : "default",
2313
+ pointerEvents: "none",
2314
+ zIndex: 2,
2315
+ opacity: appearanceActive ? 0 : 1
2316
+ },
2317
+ children: [
2318
+ /* @__PURE__ */ jsxs(
2319
+ "svg",
2320
+ {
2321
+ style: {
2322
+ position: "absolute",
2323
+ width,
2324
+ height,
2325
+ pointerEvents: "none",
2326
+ overflow: "visible"
2327
+ },
2328
+ width,
2329
+ height,
2330
+ viewBox: `0 0 ${rect.size.width} ${rect.size.height}`,
2331
+ children: [
2332
+ lineCoords && /* @__PURE__ */ jsxs(Fragment, { children: [
2333
+ /* @__PURE__ */ jsx(
2334
+ "polyline",
2335
+ {
2336
+ points: lineCoords.map((p) => `${p.x},${p.y}`).join(" "),
2337
+ fill: "none",
2338
+ stroke: "transparent",
2339
+ strokeWidth: hitStrokeWidth,
2340
+ onPointerDown: onClick ? (e) => onClick(e) : void 0,
2341
+ style: {
2342
+ cursor: isSelected ? "move" : onClick ? "pointer" : "default",
2343
+ pointerEvents: !onClick ? "none" : isSelected ? "none" : "visibleStroke"
2344
+ }
2345
+ }
2346
+ ),
2347
+ ending && /* @__PURE__ */ jsx(
2348
+ "path",
2349
+ {
2350
+ d: ending.d,
2351
+ transform: ending.transform,
2352
+ fill: "transparent",
2353
+ stroke: "transparent",
2354
+ strokeWidth: hitStrokeWidth,
2355
+ onPointerDown: onClick ? (e) => onClick(e) : void 0,
2356
+ style: {
2357
+ cursor: isSelected ? "move" : onClick ? "pointer" : "default",
2358
+ pointerEvents: !onClick ? "none" : isSelected ? "none" : ending.filled ? "visible" : "visibleStroke"
2359
+ }
2360
+ }
2361
+ )
2362
+ ] }),
2363
+ !appearanceActive && /* @__PURE__ */ jsxs(Fragment, { children: [
2364
+ visualLineCoords && /* @__PURE__ */ jsxs(Fragment, { children: [
2365
+ /* @__PURE__ */ jsx(
2366
+ "polyline",
2367
+ {
2368
+ points: visualLineCoords.map((p) => `${p.x},${p.y}`).join(" "),
2369
+ fill: "none",
2370
+ stroke: strokeColor,
2371
+ strokeWidth,
2372
+ opacity: obj.opacity,
2373
+ style: { pointerEvents: "none" }
2374
+ }
2375
+ ),
2376
+ ending && /* @__PURE__ */ jsx(
2377
+ "path",
2378
+ {
2379
+ d: ending.d,
2380
+ transform: ending.transform,
2381
+ stroke: strokeColor,
2382
+ fill: ending.filled ? obj.color ?? "transparent" : "none",
2383
+ strokeWidth,
2384
+ opacity: obj.opacity,
2385
+ style: { pointerEvents: "none" }
2386
+ }
2387
+ )
2388
+ ] }),
2389
+ /* @__PURE__ */ jsx(
2390
+ "rect",
2391
+ {
2392
+ x: textBox.origin.x - rect.origin.x + strokeWidth / 2,
2393
+ y: textBox.origin.y - rect.origin.y + strokeWidth / 2,
2394
+ width: textBox.size.width - strokeWidth,
2395
+ height: textBox.size.height - strokeWidth,
2396
+ fill: obj.color ?? obj.backgroundColor ?? "transparent",
2397
+ stroke: strokeColor,
2398
+ strokeWidth,
2399
+ opacity: obj.opacity,
2400
+ style: { pointerEvents: "none" }
2401
+ }
2402
+ )
2403
+ ] })
2404
+ ]
2405
+ }
2406
+ ),
2407
+ /* @__PURE__ */ jsx(
2408
+ "div",
2409
+ {
2410
+ onPointerDown: onClick ? (e) => onClick(e) : void 0,
2411
+ style: {
2412
+ position: "absolute",
2413
+ left: (textBox.origin.x - rect.origin.x) * scale,
2414
+ top: (textBox.origin.y - rect.origin.y) * scale,
2415
+ width: textBox.size.width * scale,
2416
+ height: textBox.size.height * scale,
2417
+ cursor: isSelected && !isEditing ? "move" : onClick ? "pointer" : "default",
2418
+ pointerEvents: !onClick ? "none" : isSelected && !isEditing ? "none" : "auto"
2419
+ }
2420
+ }
2421
+ ),
2422
+ /* @__PURE__ */ jsx(
2423
+ "span",
2424
+ {
2425
+ ref: editorRef,
2426
+ onBlur: handleBlur,
2427
+ tabIndex: 0,
2428
+ style: {
2429
+ position: "absolute",
2430
+ left: textBoxRelative.left,
2431
+ top: textBoxRelative.top,
2432
+ width: textBoxRelative.width,
2433
+ height: textBoxRelative.height,
2434
+ color: obj.fontColor,
2435
+ fontSize: adjustedFontPx,
2436
+ ...standardFontCssProperties(obj.fontFamily),
2437
+ textAlign: textAlignmentToCss(obj.textAlign),
2438
+ flexDirection: "column",
2439
+ justifyContent: obj.verticalAlign === PdfVerticalAlignment.Top ? "flex-start" : obj.verticalAlign === PdfVerticalAlignment.Middle ? "center" : "flex-end",
2440
+ display: "flex",
2441
+ padding: strokeWidth * scale / 2 + 2 * scale,
2442
+ opacity: obj.opacity,
2443
+ lineHeight: "1.18",
2444
+ overflow: "hidden",
2445
+ cursor: isEditing ? "text" : "default",
2446
+ outline: "none",
2447
+ pointerEvents: isEditing ? "auto" : "none",
2448
+ ...wrapperStyle
2449
+ },
2450
+ contentEditable: isEditing,
2451
+ ...suppressContentEditableWarningProps,
2452
+ children: obj.contents
2453
+ }
2454
+ )
2455
+ ]
2456
+ }
2457
+ );
2458
+ }
2459
+ function CalloutFreeTextPreview({
2460
+ calloutLine,
2461
+ textBox,
2462
+ bounds,
2463
+ scale,
2464
+ strokeColor,
2465
+ strokeWidth,
2466
+ color,
2467
+ backgroundColor,
2468
+ opacity,
2469
+ lineEnding
2470
+ }) {
2471
+ if (!calloutLine || calloutLine.length < 2) return /* @__PURE__ */ jsx(Fragment$1, {});
2472
+ const sw = strokeWidth ?? 1;
2473
+ const sc = strokeColor ?? "#000000";
2474
+ const op = opacity ?? 1;
2475
+ const w = bounds.size.width;
2476
+ const h = bounds.size.height;
2477
+ const ox = bounds.origin.x;
2478
+ const oy = bounds.origin.y;
2479
+ const lineCoords = calloutLine.map((p) => ({ x: p.x - ox, y: p.y - oy }));
2480
+ const angle = Math.atan2(lineCoords[1].y - lineCoords[0].y, lineCoords[1].x - lineCoords[0].x);
2481
+ const ending = patching.createEnding(
2482
+ lineEnding,
2483
+ sw,
2484
+ angle + Math.PI,
2485
+ lineCoords[0].x,
2486
+ lineCoords[0].y
2487
+ );
2488
+ const halfSw = sw / 2;
2489
+ return /* @__PURE__ */ jsxs(
2490
+ "svg",
2491
+ {
2492
+ style: {
2493
+ position: "absolute",
2494
+ width: w * scale,
2495
+ height: h * scale,
2496
+ pointerEvents: "none",
2497
+ overflow: "visible"
2498
+ },
2499
+ width: w * scale,
2500
+ height: h * scale,
2501
+ viewBox: `0 0 ${w} ${h}`,
2502
+ children: [
2503
+ /* @__PURE__ */ jsx(
2504
+ "polyline",
2505
+ {
2506
+ points: lineCoords.map((p) => `${p.x},${p.y}`).join(" "),
2507
+ fill: "none",
2508
+ stroke: sc,
2509
+ strokeWidth: sw,
2510
+ opacity: op
2511
+ }
2512
+ ),
2513
+ ending && /* @__PURE__ */ jsx(
2514
+ "path",
2515
+ {
2516
+ d: ending.d,
2517
+ transform: ending.transform,
2518
+ stroke: sc,
2519
+ fill: ending.filled ? color ?? "transparent" : "none",
2520
+ strokeWidth: sw,
2521
+ opacity: op
2522
+ }
2523
+ ),
2524
+ textBox && /* @__PURE__ */ jsx(
2525
+ "rect",
2526
+ {
2527
+ x: textBox.origin.x - ox + halfSw,
2528
+ y: textBox.origin.y - oy + halfSw,
2529
+ width: textBox.size.width - sw,
2530
+ height: textBox.size.height - sw,
2531
+ fill: color ?? backgroundColor ?? "transparent",
2532
+ stroke: sc,
2533
+ strokeWidth: sw,
2534
+ opacity: op
2535
+ }
2536
+ )
2537
+ ]
2538
+ }
2539
+ );
2540
+ }
2208
2541
  function RenderAnnotation({
2209
2542
  documentId,
2210
2543
  pageIndex,
@@ -2897,11 +3230,59 @@ const builtInRenderers = [
2897
3230
  ),
2898
3231
  interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false }
2899
3232
  }),
3233
+ // --- Callout FreeText (must appear before regular FreeText to match first) ---
3234
+ createRenderer({
3235
+ id: "freeTextCallout",
3236
+ matches: (a) => a.type === PdfAnnotationSubtype.FREETEXT && a.intent === "FreeTextCallout",
3237
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.FREETEXT && !!p.data.calloutLine,
3238
+ render: ({
3239
+ annotation,
3240
+ currentObject,
3241
+ isSelected,
3242
+ isEditing,
3243
+ scale,
3244
+ pageIndex,
3245
+ documentId,
3246
+ onClick,
3247
+ appearanceActive
3248
+ }) => /* @__PURE__ */ jsx(
3249
+ CalloutFreeText,
3250
+ {
3251
+ documentId,
3252
+ isSelected,
3253
+ isEditing,
3254
+ annotation: { ...annotation, object: currentObject },
3255
+ pageIndex,
3256
+ scale,
3257
+ onClick,
3258
+ appearanceActive
3259
+ }
3260
+ ),
3261
+ renderPreview: ({ data, bounds, scale }) => /* @__PURE__ */ jsx(
3262
+ CalloutFreeTextPreview,
3263
+ {
3264
+ calloutLine: data.calloutLine,
3265
+ textBox: data.textBox,
3266
+ bounds,
3267
+ scale,
3268
+ strokeColor: data.strokeColor,
3269
+ strokeWidth: data.strokeWidth,
3270
+ color: data.color,
3271
+ backgroundColor: data.backgroundColor,
3272
+ opacity: data.opacity,
3273
+ lineEnding: data.lineEnding
3274
+ }
3275
+ ),
3276
+ vertexConfig: patching.calloutVertexConfig,
3277
+ interactionDefaults: { isDraggable: true, isResizable: false, isRotatable: false },
3278
+ isDraggable: (toolDraggable, { isEditing }) => toolDraggable && !isEditing,
3279
+ onDoubleClick: (id, setEditingId) => setEditingId(id)
3280
+ }),
2900
3281
  // --- FreeText ---
2901
3282
  createRenderer({
2902
3283
  id: "freeText",
2903
- matches: (a) => a.type === PdfAnnotationSubtype.FREETEXT,
2904
- matchesPreview: (p) => p.type === PdfAnnotationSubtype.FREETEXT,
3284
+ matches: (a) => a.type === PdfAnnotationSubtype.FREETEXT && a.intent !== "FreeTextCallout",
3285
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.FREETEXT && !p.data.calloutLine,
2905
3286
  render: ({
2906
3287
  annotation,
2907
3288
  currentObject,