tiptap-markdown-react 1.2.1 → 1.3.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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Markdown, MarkdownManager } from "@tiptap/markdown";
3
- import { g as getLocaleBundle, d as renderOrUpdateChart, e as destroyChart, u as useIsMobile, E as EditorToc, h as sameTocItems$1 } from "./ReportContentWithCharts-BMpzNVsX.js";
4
- import { C, a, b, c, f, m, r, s } from "./ReportContentWithCharts-BMpzNVsX.js";
3
+ import { g as getLocaleBundle, S as SearchIcon, d as ChevronUpIcon, e as ChevronDownIcon, X as XIcon, h as ReplaceIcon, i as ReplaceAllIcon, j as renderOrUpdateChart, k as destroyChart, l as CheckIcon, T as TrashIcon, n as CopyIcon, o as ChevronsUpDownIcon, G as GripIcon, E as EraserIcon, D as DownloadIcon, u as useIsMobile, K as KeyboardIcon, p as EditorToc, I as ImagePreviewHost, q as sameTocItems$1, A as AlignRightIcon, t as AlignCenterIcon, v as AlignLeftIcon, w as CropIcon, x as CaptionsIcon, y as ExpandIcon, z as requestImagePreview, B as RotateCcwIcon, F as ExternalLinkIcon, H as TableDeleteIcon, J as ColumnBeforeIcon, L as ColumnAfterIcon, M as ColumnDeleteIcon, N as RowBeforeIcon, O as RowAfterIcon, P as RowDeleteIcon, U as UndoIcon, Q as RedoIcon, V as BoldIcon, W as ItalicIcon, Y as UnderlineIcon, Z as StrikethroughIcon, _ as CodeIcon, $ as LinkIcon, a0 as ImageIcon, a1 as DetailsIcon, a2 as AlignJustifyIcon, a3 as IndentIncreaseIcon, a4 as IndentDecreaseIcon, a5 as LineHeightIcon, a6 as ListUnorderedIcon, a7 as ListOrderedIcon, a8 as ListChecksIcon } from "./ReportContentWithCharts-B-K-EiAG.js";
4
+ import { C, a9, aa, a, ab, ac, ad, ae, b, c, af, ag, ah, f, m, r, s } from "./ReportContentWithCharts-B-K-EiAG.js";
5
5
  import { jsx, jsxs, Fragment as Fragment$2 } from "react/jsx-runtime";
6
6
  import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
7
7
  import FindAndReplace, { FindAndReplacePluginKey, createSearchRegex } from "@tiptap/extension-find-and-replace";
@@ -14,10 +14,10 @@ import { NodeViewWrapper, ReactNodeViewRenderer, useEditorState, ReactRenderer,
14
14
  import { Extension, Node as Node$1, mergeAttributes } from "@tiptap/core";
15
15
  import { createPortal } from "react-dom";
16
16
  import { useState, useEffect, useCallback, useRef, useMemo, useSyncExternalStore, useLayoutEffect, forwardRef, useId, useImperativeHandle, Fragment as Fragment$1, useContext, createContext } from "react";
17
- import { e as enrichMarkdownCitations, c as styles$d } from "./ReportContent-B7okwVW0.js";
18
- import { R, a as a2, b as b2, s as s2 } from "./ReportContent-B7okwVW0.js";
19
- import { C as CitationRef, i as mergeCommentIntervals, h as mapCommentAnchors, n as normalizeImageAlign, p as prepareChartMarkdown, j as reportChart, f as CommentMark, b as baseExtensions, l as lowlight, m as makeTocGetId, k as parseCodeTokenAsChartOrCodeBlock, o as imageMarkdownTokenizer, q as imageParseMarkdown, t as imageRenderMarkdown, u as imageNodeHtml, v as imageFigureParseRule, w as imageCaptionAttribute, x as imageAlignAttribute, y as normalizeImageCaption, a as pureCodeBlock, c as pureImage, z as renderMathInto, A as readCurrentNumberingFormat, B as subscribeMathClick, D as applyNumberingFormat, N as NUMBERING_FORMAT_IDS, E as NUMBERING_FORMAT_LABELS, F as NUMBERING_FORMAT_PREVIEWS, d as pureChart } from "./extractToc-B50WvHao.js";
20
- import { P, g, e, s as s3 } from "./extractToc-B50WvHao.js";
17
+ import { q as normalizeImageAlign, l as normalizeImageCrop, m as cropImageBox, e as enrichMarkdownCitations, o as styles$e, i as imageMarkdownTokenizer, c as imageParseMarkdown, d as imageRenderMarkdown, f as imageNodeHtml, g as imageFigureParseRule, h as imageCropAttribute, j as imageCaptionAttribute, k as imageAlignAttribute, r as normalizeImageCaption } from "./ReportContent-Cb67MCs9.js";
18
+ import { R, a as a2, b as b2, s as s2 } from "./ReportContent-Cb67MCs9.js";
19
+ import { C as CitationRef, i as mergeCommentIntervals, h as mapCommentAnchors, p as prepareChartMarkdown, j as reportChart, f as CommentMark, b as baseExtensions, l as lowlight, m as makeTocGetId, k as parseCodeTokenAsChartOrCodeBlock, a as pureCodeBlock, c as pureImage, n as renderMathInto, o as readCurrentNumberingFormat, q as subscribeMathClick, t as applyNumberingFormat, N as NUMBERING_FORMAT_IDS, u as NUMBERING_FORMAT_LABELS, v as NUMBERING_FORMAT_PREVIEWS, d as pureChart } from "./extractToc-H9otRa3G.js";
20
+ import { P, g, e, s as s3 } from "./extractToc-H9otRa3G.js";
21
21
  import { Slice, Fragment } from "@tiptap/pm/model";
22
22
  import { PluginKey, Plugin, Selection, TextSelection, NodeSelection } from "@tiptap/pm/state";
23
23
  import { DecorationSet, Decoration } from "@tiptap/pm/view";
@@ -364,301 +364,6 @@ function runFindCommand(run) {
364
364
  throw error;
365
365
  }
366
366
  }
367
- function Svg({ size = "1em", children, ...rest }) {
368
- return /* @__PURE__ */ jsx(
369
- "svg",
370
- {
371
- xmlns: "http://www.w3.org/2000/svg",
372
- width: size,
373
- height: size,
374
- viewBox: "0 0 24 24",
375
- fill: "none",
376
- stroke: "currentColor",
377
- strokeWidth: 2,
378
- strokeLinecap: "round",
379
- strokeLinejoin: "round",
380
- "aria-hidden": "true",
381
- focusable: "false",
382
- ...rest,
383
- children
384
- }
385
- );
386
- }
387
- const BoldIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
388
- /* @__PURE__ */ jsx("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
389
- /* @__PURE__ */ jsx("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
390
- ] });
391
- const ItalicIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
392
- /* @__PURE__ */ jsx("line", { x1: "19", x2: "10", y1: "4", y2: "4" }),
393
- /* @__PURE__ */ jsx("line", { x1: "14", x2: "5", y1: "20", y2: "20" }),
394
- /* @__PURE__ */ jsx("line", { x1: "15", x2: "9", y1: "4", y2: "20" })
395
- ] });
396
- const UnderlineIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
397
- /* @__PURE__ */ jsx("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
398
- /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "20", y2: "20" })
399
- ] });
400
- const StrikethroughIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
401
- /* @__PURE__ */ jsx("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
402
- /* @__PURE__ */ jsx("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
403
- /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "12", y2: "12" })
404
- ] });
405
- const CodeIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
406
- /* @__PURE__ */ jsx("polyline", { points: "16 18 22 12 16 6" }),
407
- /* @__PURE__ */ jsx("polyline", { points: "8 6 2 12 8 18" })
408
- ] });
409
- const LinkIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
410
- /* @__PURE__ */ jsx("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
411
- /* @__PURE__ */ jsx("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
412
- ] });
413
- const EraserIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
414
- /* @__PURE__ */ jsx("path", { d: "m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21" }),
415
- /* @__PURE__ */ jsx("path", { d: "M22 21H7" }),
416
- /* @__PURE__ */ jsx("path", { d: "m5 11 9 9" })
417
- ] });
418
- const RotateCcwIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
419
- /* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
420
- /* @__PURE__ */ jsx("path", { d: "M3 3v5h5" })
421
- ] });
422
- const ExternalLinkIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
423
- /* @__PURE__ */ jsx("path", { d: "M15 3h6v6" }),
424
- /* @__PURE__ */ jsx("path", { d: "M10 14 21 3" }),
425
- /* @__PURE__ */ jsx("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
426
- ] });
427
- const ImageIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
428
- /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2" }),
429
- /* @__PURE__ */ jsx("circle", { cx: "9", cy: "9", r: "2" }),
430
- /* @__PURE__ */ jsx("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
431
- ] });
432
- const BlockSvg = ({ size = "1em", children, ...rest }) => /* @__PURE__ */ jsx(
433
- "svg",
434
- {
435
- xmlns: "http://www.w3.org/2000/svg",
436
- width: size,
437
- height: size,
438
- viewBox: "0 0 24 24",
439
- fill: "currentColor",
440
- stroke: "none",
441
- "aria-hidden": "true",
442
- focusable: "false",
443
- ...rest,
444
- children
445
- }
446
- );
447
- const AlignLeftIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
448
- /* @__PURE__ */ jsx("rect", { x: "3", y: "3.4", width: "18", height: "2.4", rx: "1.2" }),
449
- /* @__PURE__ */ jsx("rect", { x: "3", y: "8.6", width: "12", height: "2.4", rx: "1.2" }),
450
- /* @__PURE__ */ jsx("rect", { x: "3", y: "13.8", width: "18", height: "2.4", rx: "1.2" }),
451
- /* @__PURE__ */ jsx("rect", { x: "3", y: "19", width: "12", height: "2.4", rx: "1.2" })
452
- ] });
453
- const AlignCenterIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
454
- /* @__PURE__ */ jsx("rect", { x: "3", y: "3.4", width: "18", height: "2.4", rx: "1.2" }),
455
- /* @__PURE__ */ jsx("rect", { x: "6", y: "8.6", width: "12", height: "2.4", rx: "1.2" }),
456
- /* @__PURE__ */ jsx("rect", { x: "3", y: "13.8", width: "18", height: "2.4", rx: "1.2" }),
457
- /* @__PURE__ */ jsx("rect", { x: "6", y: "19", width: "12", height: "2.4", rx: "1.2" })
458
- ] });
459
- const AlignRightIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
460
- /* @__PURE__ */ jsx("rect", { x: "3", y: "3.4", width: "18", height: "2.4", rx: "1.2" }),
461
- /* @__PURE__ */ jsx("rect", { x: "9", y: "8.6", width: "12", height: "2.4", rx: "1.2" }),
462
- /* @__PURE__ */ jsx("rect", { x: "3", y: "13.8", width: "18", height: "2.4", rx: "1.2" }),
463
- /* @__PURE__ */ jsx("rect", { x: "9", y: "19", width: "12", height: "2.4", rx: "1.2" })
464
- ] });
465
- const AlignJustifyIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
466
- /* @__PURE__ */ jsx("rect", { x: "3", y: "3.4", width: "18", height: "2.4", rx: "1.2" }),
467
- /* @__PURE__ */ jsx("rect", { x: "3", y: "8.6", width: "18", height: "2.4", rx: "1.2" }),
468
- /* @__PURE__ */ jsx("rect", { x: "3", y: "13.8", width: "18", height: "2.4", rx: "1.2" }),
469
- /* @__PURE__ */ jsx("rect", { x: "3", y: "19", width: "18", height: "2.4", rx: "1.2" })
470
- ] });
471
- const IndentIncreaseIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
472
- /* @__PURE__ */ jsx("path", { d: "M3 6.6 8.5 10.8 3 15 Z" }),
473
- /* @__PURE__ */ jsx("rect", { x: "10.5", y: "3.6", width: "10.5", height: "2.4", rx: "1.2" }),
474
- /* @__PURE__ */ jsx("rect", { x: "10.5", y: "10.8", width: "10.5", height: "2.4", rx: "1.2" }),
475
- /* @__PURE__ */ jsx("rect", { x: "10.5", y: "18", width: "10.5", height: "2.4", rx: "1.2" })
476
- ] });
477
- const IndentDecreaseIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
478
- /* @__PURE__ */ jsx("path", { d: "M8.5 6.6 3 10.8 8.5 15 Z" }),
479
- /* @__PURE__ */ jsx("rect", { x: "10.5", y: "3.6", width: "10.5", height: "2.4", rx: "1.2" }),
480
- /* @__PURE__ */ jsx("rect", { x: "10.5", y: "10.8", width: "10.5", height: "2.4", rx: "1.2" }),
481
- /* @__PURE__ */ jsx("rect", { x: "10.5", y: "18", width: "10.5", height: "2.4", rx: "1.2" })
482
- ] });
483
- const LineHeightIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
484
- /* @__PURE__ */ jsx("rect", { x: "1.8", y: "4.4", width: "2.4", height: "15.2", rx: "1.2" }),
485
- /* @__PURE__ */ jsx("path", { d: "M3 2.4 5.4 5.8 H0.6 Z" }),
486
- /* @__PURE__ */ jsx("path", { d: "M3 21.6 0.6 18.2 H5.4 Z" }),
487
- /* @__PURE__ */ jsx("rect", { x: "9", y: "5.6", width: "12", height: "2.4", rx: "1.2" }),
488
- /* @__PURE__ */ jsx("rect", { x: "9", y: "16", width: "12", height: "2.4", rx: "1.2" })
489
- ] });
490
- const CaptionsIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
491
- /* @__PURE__ */ jsx("rect", { width: "18", height: "14", x: "3", y: "5", rx: "2", ry: "2" }),
492
- /* @__PURE__ */ jsx("path", { d: "M7 15h4" }),
493
- /* @__PURE__ */ jsx("path", { d: "M15 15h2" }),
494
- /* @__PURE__ */ jsx("path", { d: "M7 11h2" }),
495
- /* @__PURE__ */ jsx("path", { d: "M13 11h4" })
496
- ] });
497
- const ImportIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
498
- /* @__PURE__ */ jsx("path", { d: "M12 3v12" }),
499
- /* @__PURE__ */ jsx("path", { d: "m8 11 4 4 4-4" }),
500
- /* @__PURE__ */ jsx("path", { d: "M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4" })
501
- ] });
502
- const ListUnorderedIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
503
- /* @__PURE__ */ jsx("line", { x1: "8", x2: "21", y1: "6", y2: "6" }),
504
- /* @__PURE__ */ jsx("line", { x1: "8", x2: "21", y1: "12", y2: "12" }),
505
- /* @__PURE__ */ jsx("line", { x1: "8", x2: "21", y1: "18", y2: "18" }),
506
- /* @__PURE__ */ jsx("line", { x1: "3", x2: "3.01", y1: "6", y2: "6" }),
507
- /* @__PURE__ */ jsx("line", { x1: "3", x2: "3.01", y1: "12", y2: "12" }),
508
- /* @__PURE__ */ jsx("line", { x1: "3", x2: "3.01", y1: "18", y2: "18" })
509
- ] });
510
- const ListOrderedIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
511
- /* @__PURE__ */ jsx("line", { x1: "10", x2: "21", y1: "6", y2: "6" }),
512
- /* @__PURE__ */ jsx("line", { x1: "10", x2: "21", y1: "12", y2: "12" }),
513
- /* @__PURE__ */ jsx("line", { x1: "10", x2: "21", y1: "18", y2: "18" }),
514
- /* @__PURE__ */ jsx("path", { d: "M4 6h1v4" }),
515
- /* @__PURE__ */ jsx("path", { d: "M4 10h2" }),
516
- /* @__PURE__ */ jsx("path", { d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1" })
517
- ] });
518
- const DetailsIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
519
- /* @__PURE__ */ jsx("path", { d: "m9 7 4 5-4 5" }),
520
- /* @__PURE__ */ jsx("path", { d: "M15 7h5" }),
521
- /* @__PURE__ */ jsx("path", { d: "M15 12h5" }),
522
- /* @__PURE__ */ jsx("path", { d: "M15 17h5" })
523
- ] });
524
- const ListChecksIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
525
- /* @__PURE__ */ jsx("path", { d: "m3 17 2 2 4-4" }),
526
- /* @__PURE__ */ jsx("path", { d: "m3 7 2 2 4-4" }),
527
- /* @__PURE__ */ jsx("path", { d: "M13 6h8" }),
528
- /* @__PURE__ */ jsx("path", { d: "M13 12h8" }),
529
- /* @__PURE__ */ jsx("path", { d: "M13 18h8" })
530
- ] });
531
- const UndoIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
532
- /* @__PURE__ */ jsx("path", { d: "M9 14 4 9l5-5" }),
533
- /* @__PURE__ */ jsx("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5 5.5 5.5 0 0 1-5.5 5.5H11" })
534
- ] });
535
- const RedoIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
536
- /* @__PURE__ */ jsx("path", { d: "m15 14 5-5-5-5" }),
537
- /* @__PURE__ */ jsx("path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5 5.5 5.5 0 0 0 9.5 20H13" })
538
- ] });
539
- const ChevronDownIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) });
540
- const CheckIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) });
541
- const TrashIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
542
- /* @__PURE__ */ jsx("path", { d: "M3 6h18" }),
543
- /* @__PURE__ */ jsx("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
544
- /* @__PURE__ */ jsx("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
545
- /* @__PURE__ */ jsx("line", { x1: "10", x2: "10", y1: "11", y2: "17" }),
546
- /* @__PURE__ */ jsx("line", { x1: "14", x2: "14", y1: "11", y2: "17" })
547
- ] });
548
- const LockIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
549
- /* @__PURE__ */ jsx("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
550
- /* @__PURE__ */ jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
551
- ] });
552
- const MenuIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
553
- /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "12", y2: "12" }),
554
- /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "6", y2: "6" }),
555
- /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "18", y2: "18" })
556
- ] });
557
- const SearchIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
558
- /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
559
- /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
560
- ] });
561
- const XIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
562
- /* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
563
- /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
564
- ] });
565
- const ChevronUpIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" }) });
566
- const ReplaceIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
567
- /* @__PURE__ */ jsx("path", { d: "M14 4a1 1 0 0 1 1-1" }),
568
- /* @__PURE__ */ jsx("path", { d: "M15 10a1 1 0 0 1-1-1" }),
569
- /* @__PURE__ */ jsx("path", { d: "M21 4a1 1 0 0 0-1-1" }),
570
- /* @__PURE__ */ jsx("path", { d: "M21 9a1 1 0 0 1-1 1" }),
571
- /* @__PURE__ */ jsx("path", { d: "m3 7 3 3 3-3" }),
572
- /* @__PURE__ */ jsx("path", { d: "M6 10V5a2 2 0 0 1 2-2h2" }),
573
- /* @__PURE__ */ jsx("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" })
574
- ] });
575
- const ReplaceAllIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
576
- /* @__PURE__ */ jsx("path", { d: "M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1" }),
577
- /* @__PURE__ */ jsx("path", { d: "M14 4a1 1 0 0 1 1-1" }),
578
- /* @__PURE__ */ jsx("path", { d: "M15 10a1 1 0 0 1-1-1" }),
579
- /* @__PURE__ */ jsx("path", { d: "M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1" }),
580
- /* @__PURE__ */ jsx("path", { d: "M21 4a1 1 0 0 0-1-1" }),
581
- /* @__PURE__ */ jsx("path", { d: "M21 9a1 1 0 0 1-1 1" }),
582
- /* @__PURE__ */ jsx("path", { d: "m3 7 3 3 3-3" }),
583
- /* @__PURE__ */ jsx("path", { d: "M6 10V5a2 2 0 0 1 2-2h2" }),
584
- /* @__PURE__ */ jsx("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" })
585
- ] });
586
- const ColumnBeforeIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
587
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "11", height: "16", rx: "1" }),
588
- /* @__PURE__ */ jsx("path", { d: "M14 4v16" }),
589
- /* @__PURE__ */ jsx("path", { d: "M5 9v6" }),
590
- /* @__PURE__ */ jsx("path", { d: "M2 12h6" })
591
- ] });
592
- const ColumnAfterIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
593
- /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "11", height: "16", rx: "1" }),
594
- /* @__PURE__ */ jsx("path", { d: "M10 4v16" }),
595
- /* @__PURE__ */ jsx("path", { d: "M19 9v6" }),
596
- /* @__PURE__ */ jsx("path", { d: "M16 12h6" })
597
- ] });
598
- const ColumnDeleteIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
599
- /* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
600
- /* @__PURE__ */ jsx("path", { d: "M12 4v16" }),
601
- /* @__PURE__ */ jsx("path", { d: "m8 9 8 6" }),
602
- /* @__PURE__ */ jsx("path", { d: "m16 9-8 6" })
603
- ] });
604
- const RowBeforeIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
605
- /* @__PURE__ */ jsx("rect", { x: "4", y: "10", width: "16", height: "11", rx: "1" }),
606
- /* @__PURE__ */ jsx("path", { d: "M4 14h16" }),
607
- /* @__PURE__ */ jsx("path", { d: "M9 5h6" }),
608
- /* @__PURE__ */ jsx("path", { d: "M12 2v6" })
609
- ] });
610
- const RowAfterIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
611
- /* @__PURE__ */ jsx("rect", { x: "4", y: "3", width: "16", height: "11", rx: "1" }),
612
- /* @__PURE__ */ jsx("path", { d: "M4 10h16" }),
613
- /* @__PURE__ */ jsx("path", { d: "M9 19h6" }),
614
- /* @__PURE__ */ jsx("path", { d: "M12 16v6" })
615
- ] });
616
- const RowDeleteIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
617
- /* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
618
- /* @__PURE__ */ jsx("path", { d: "M4 12h16" }),
619
- /* @__PURE__ */ jsx("path", { d: "m9 8 6 8" }),
620
- /* @__PURE__ */ jsx("path", { d: "m15 8-6 8" })
621
- ] });
622
- const TableDeleteIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
623
- /* @__PURE__ */ jsx("rect", { x: "3", y: "5", width: "18", height: "14", rx: "1" }),
624
- /* @__PURE__ */ jsx("path", { d: "M3 9h18" }),
625
- /* @__PURE__ */ jsx("path", { d: "M9 5v14" }),
626
- /* @__PURE__ */ jsx("path", { d: "M15 5v14" }),
627
- /* @__PURE__ */ jsx("path", { d: "m7 2 10 20" })
628
- ] });
629
- const CopyIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
630
- /* @__PURE__ */ jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
631
- /* @__PURE__ */ jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
632
- ] });
633
- const ChevronsUpDownIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
634
- /* @__PURE__ */ jsx("path", { d: "m7 15 5 5 5-5" }),
635
- /* @__PURE__ */ jsx("path", { d: "m7 9 5-5 5 5" })
636
- ] });
637
- const GripIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, fill: "currentColor", strokeWidth: 0, children: [
638
- /* @__PURE__ */ jsx("circle", { cx: "9", cy: "6", r: "1.25" }),
639
- /* @__PURE__ */ jsx("circle", { cx: "15", cy: "6", r: "1.25" }),
640
- /* @__PURE__ */ jsx("circle", { cx: "9", cy: "12", r: "1.25" }),
641
- /* @__PURE__ */ jsx("circle", { cx: "15", cy: "12", r: "1.25" }),
642
- /* @__PURE__ */ jsx("circle", { cx: "9", cy: "18", r: "1.25" }),
643
- /* @__PURE__ */ jsx("circle", { cx: "15", cy: "18", r: "1.25" })
644
- ] });
645
- const DownloadIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
646
- /* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
647
- /* @__PURE__ */ jsx("polyline", { points: "7 10 12 15 17 10" }),
648
- /* @__PURE__ */ jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
649
- ] });
650
- const KeyboardIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
651
- /* @__PURE__ */ jsx("rect", { width: "20", height: "16", x: "2", y: "4", rx: "2" }),
652
- /* @__PURE__ */ jsx("path", { d: "M6 8h.01" }),
653
- /* @__PURE__ */ jsx("path", { d: "M10 8h.01" }),
654
- /* @__PURE__ */ jsx("path", { d: "M14 8h.01" }),
655
- /* @__PURE__ */ jsx("path", { d: "M18 8h.01" }),
656
- /* @__PURE__ */ jsx("path", { d: "M6 12h.01" }),
657
- /* @__PURE__ */ jsx("path", { d: "M10 12h.01" }),
658
- /* @__PURE__ */ jsx("path", { d: "M14 12h.01" }),
659
- /* @__PURE__ */ jsx("path", { d: "M18 12h.01" }),
660
- /* @__PURE__ */ jsx("path", { d: "M7 16h10" })
661
- ] });
662
367
  const bar$1 = "_bar_1h61e_3";
663
368
  const row$1 = "_row_1h61e_25";
664
369
  const field$1 = "_field_1h61e_43";
@@ -672,7 +377,7 @@ const toggleOn = "_toggleOn_1h61e_135";
672
377
  const iconGroup = "_iconGroup_1h61e_29";
673
378
  const spacer = "_spacer_1h61e_150";
674
379
  const readOnly = "_readOnly_1h61e_155";
675
- const styles$c = {
380
+ const styles$d = {
676
381
  bar: bar$1,
677
382
  row: row$1,
678
383
  field: field$1,
@@ -796,11 +501,11 @@ function FindReplaceBar({
796
501
  });
797
502
  };
798
503
  if (!hasExtension) return null;
799
- const toggleClass = (on) => `${styles$c.btn} ${styles$c.toggle}${on ? ` ${styles$c.toggleOn}` : ""}`;
504
+ const toggleClass = (on) => `${styles$d.btn} ${styles$d.toggle}${on ? ` ${styles$d.toggleOn}` : ""}`;
800
505
  return /* @__PURE__ */ jsxs(
801
506
  "div",
802
507
  {
803
- className: className ? `${styles$c.bar} ${className}` : styles$c.bar,
508
+ className: className ? `${styles$d.bar} ${className}` : styles$d.bar,
804
509
  style,
805
510
  "data-find-bar": "",
806
511
  role: "dialog",
@@ -813,14 +518,14 @@ function FindReplaceBar({
813
518
  onClose();
814
519
  },
815
520
  children: [
816
- /* @__PURE__ */ jsxs("div", { className: styles$c.row, children: [
817
- /* @__PURE__ */ jsxs("span", { className: styles$c.field, children: [
818
- /* @__PURE__ */ jsx(SearchIcon, { size: 14, className: styles$c.fieldIcon }),
521
+ /* @__PURE__ */ jsxs("div", { className: styles$d.row, children: [
522
+ /* @__PURE__ */ jsxs("span", { className: styles$d.field, children: [
523
+ /* @__PURE__ */ jsx(SearchIcon, { size: 14, className: styles$d.fieldIcon }),
819
524
  /* @__PURE__ */ jsx(
820
525
  "input",
821
526
  {
822
527
  ref: inputRef,
823
- className: styles$c.input,
528
+ className: styles$d.input,
824
529
  "data-find-field": "search",
825
530
  value: term,
826
531
  onChange: (e2) => setTerm(e2.target.value),
@@ -834,7 +539,7 @@ function FindReplaceBar({
834
539
  /* @__PURE__ */ jsx(
835
540
  "span",
836
541
  {
837
- className: `${styles$c.counter}${invalidPattern ? ` ${styles$c.counterInvalid}` : ""}`,
542
+ className: `${styles$d.counter}${invalidPattern ? ` ${styles$d.counterInvalid}` : ""}`,
838
543
  "data-find-counter": "",
839
544
  "aria-live": "polite",
840
545
  title: invalidPattern ? t.invalidRegex : void 0,
@@ -870,13 +575,13 @@ function FindReplaceBar({
870
575
  children: "ab"
871
576
  }
872
577
  ),
873
- /* @__PURE__ */ jsx("span", { className: styles$c.spacer }),
874
- /* @__PURE__ */ jsxs("span", { className: styles$c.iconGroup, children: [
578
+ /* @__PURE__ */ jsx("span", { className: styles$d.spacer }),
579
+ /* @__PURE__ */ jsxs("span", { className: styles$d.iconGroup, children: [
875
580
  /* @__PURE__ */ jsx(
876
581
  "button",
877
582
  {
878
583
  type: "button",
879
- className: styles$c.btn,
584
+ className: styles$d.btn,
880
585
  "data-find-action": "previous",
881
586
  title: t.previous,
882
587
  "aria-label": t.previous,
@@ -890,7 +595,7 @@ function FindReplaceBar({
890
595
  "button",
891
596
  {
892
597
  type: "button",
893
- className: styles$c.btn,
598
+ className: styles$d.btn,
894
599
  "data-find-action": "next",
895
600
  title: t.next,
896
601
  "aria-label": t.next,
@@ -904,7 +609,7 @@ function FindReplaceBar({
904
609
  "button",
905
610
  {
906
611
  type: "button",
907
- className: styles$c.btn,
612
+ className: styles$d.btn,
908
613
  "data-find-action": "close",
909
614
  title: t.close,
910
615
  "aria-label": t.close,
@@ -914,11 +619,11 @@ function FindReplaceBar({
914
619
  )
915
620
  ] })
916
621
  ] }),
917
- editor.isEditable ? /* @__PURE__ */ jsxs("div", { className: styles$c.row, children: [
918
- /* @__PURE__ */ jsx("span", { className: styles$c.field, children: /* @__PURE__ */ jsx(
622
+ editor.isEditable ? /* @__PURE__ */ jsxs("div", { className: styles$d.row, children: [
623
+ /* @__PURE__ */ jsx("span", { className: styles$d.field, children: /* @__PURE__ */ jsx(
919
624
  "input",
920
625
  {
921
- className: styles$c.input,
626
+ className: styles$d.input,
922
627
  "data-find-field": "replace",
923
628
  value: replaceTerm,
924
629
  onChange: (e2) => setReplaceTerm(e2.target.value),
@@ -928,12 +633,12 @@ function FindReplaceBar({
928
633
  spellCheck: false
929
634
  }
930
635
  ) }),
931
- /* @__PURE__ */ jsx("span", { className: styles$c.spacer }),
636
+ /* @__PURE__ */ jsx("span", { className: styles$d.spacer }),
932
637
  /* @__PURE__ */ jsx(
933
638
  "button",
934
639
  {
935
640
  type: "button",
936
- className: styles$c.btn,
641
+ className: styles$d.btn,
937
642
  "data-find-action": "replace",
938
643
  title: t.replaceOne,
939
644
  "aria-label": t.replaceOne,
@@ -947,7 +652,7 @@ function FindReplaceBar({
947
652
  "button",
948
653
  {
949
654
  type: "button",
950
- className: styles$c.btn,
655
+ className: styles$d.btn,
951
656
  "data-find-action": "replace-all",
952
657
  title: t.replaceAll,
953
658
  "aria-label": t.replaceAll,
@@ -957,7 +662,7 @@ function FindReplaceBar({
957
662
  children: /* @__PURE__ */ jsx(ReplaceAllIcon, { size: 16 })
958
663
  }
959
664
  )
960
- ] }) : /* @__PURE__ */ jsx("div", { className: styles$c.row, children: /* @__PURE__ */ jsx("span", { className: styles$c.readOnly, children: t.readOnly }) })
665
+ ] }) : /* @__PURE__ */ jsx("div", { className: styles$d.row, children: /* @__PURE__ */ jsx("span", { className: styles$d.readOnly, children: t.readOnly }) })
961
666
  ]
962
667
  }
963
668
  );
@@ -1128,7 +833,7 @@ const fileName = "_fileName_1k6n1_205";
1128
833
  const actions = "_actions_1k6n1_215";
1129
834
  const progressText = "_progressText_1k6n1_222";
1130
835
  const remove = "_remove_1k6n1_228";
1131
- const styles$b = {
836
+ const styles$c = {
1132
837
  wrap,
1133
838
  dropzone,
1134
839
  dragActive,
@@ -1303,14 +1008,14 @@ function ImageUploadView(props) {
1303
1008
  const hasFiles = items.length > 0;
1304
1009
  const maxSizeMb = maxSize > 0 ? toMb(maxSize) : null;
1305
1010
  const dropzoneClass = [
1306
- styles$b.dropzone,
1307
- dragActive2 ? styles$b.dragActive : "",
1308
- dragOver2 ? styles$b.dragOver : ""
1011
+ styles$c.dropzone,
1012
+ dragActive2 ? styles$c.dragActive : "",
1013
+ dragOver2 ? styles$c.dragOver : ""
1309
1014
  ].filter(Boolean).join(" ");
1310
1015
  return /* @__PURE__ */ jsxs(
1311
1016
  NodeViewWrapper,
1312
1017
  {
1313
- className: styles$b.wrap,
1018
+ className: styles$c.wrap,
1314
1019
  "data-image-upload": "",
1315
1020
  tabIndex: editable ? 0 : void 0,
1316
1021
  onClick: openPicker,
@@ -1342,28 +1047,28 @@ function ImageUploadView(props) {
1342
1047
  },
1343
1048
  onDrop,
1344
1049
  children: [
1345
- /* @__PURE__ */ jsxs("span", { className: styles$b.fileShape, "aria-hidden": true, children: [
1050
+ /* @__PURE__ */ jsxs("span", { className: styles$c.fileShape, "aria-hidden": true, children: [
1346
1051
  /* @__PURE__ */ jsx(FileDocIcon, {}),
1347
1052
  /* @__PURE__ */ jsx(FileCornerIcon, {}),
1348
- /* @__PURE__ */ jsx("span", { className: styles$b.fileBadge, children: /* @__PURE__ */ jsx(CloudUploadIcon, {}) })
1053
+ /* @__PURE__ */ jsx("span", { className: styles$c.fileBadge, children: /* @__PURE__ */ jsx(CloudUploadIcon, {}) })
1349
1054
  ] }),
1350
- /* @__PURE__ */ jsxs("span", { className: styles$b.text, children: [
1351
- /* @__PURE__ */ jsxs("span", { className: styles$b.textMain, children: [
1352
- /* @__PURE__ */ jsx("em", { className: styles$b.textEm, children: labels.dropzoneClick }),
1055
+ /* @__PURE__ */ jsxs("span", { className: styles$c.text, children: [
1056
+ /* @__PURE__ */ jsxs("span", { className: styles$c.textMain, children: [
1057
+ /* @__PURE__ */ jsx("em", { className: styles$c.textEm, children: labels.dropzoneClick }),
1353
1058
  labels.dropzoneRest
1354
1059
  ] }),
1355
- /* @__PURE__ */ jsx("span", { className: styles$b.subtext, children: labels.dropzoneLimits(limit, maxSizeMb) })
1060
+ /* @__PURE__ */ jsx("span", { className: styles$c.subtext, children: labels.dropzoneLimits(limit, maxSizeMb) })
1356
1061
  ] })
1357
1062
  ]
1358
1063
  }
1359
- ) : /* @__PURE__ */ jsxs("div", { className: styles$b.previews, "data-image-upload-list": "", children: [
1360
- items.length > 1 && /* @__PURE__ */ jsxs("div", { className: styles$b.header, children: [
1064
+ ) : /* @__PURE__ */ jsxs("div", { className: styles$c.previews, "data-image-upload-list": "", children: [
1065
+ items.length > 1 && /* @__PURE__ */ jsxs("div", { className: styles$c.header, children: [
1361
1066
  /* @__PURE__ */ jsx("span", { children: labels.uploadingCount(items.length) }),
1362
1067
  /* @__PURE__ */ jsx(
1363
1068
  "button",
1364
1069
  {
1365
1070
  type: "button",
1366
- className: styles$b.clearAll,
1071
+ className: styles$c.clearAll,
1367
1072
  onClick: (e2) => {
1368
1073
  e2.stopPropagation();
1369
1074
  clearAll2();
@@ -1375,27 +1080,27 @@ function ImageUploadView(props) {
1375
1080
  items.map((it) => /* @__PURE__ */ jsxs(
1376
1081
  "div",
1377
1082
  {
1378
- className: styles$b.preview,
1083
+ className: styles$c.preview,
1379
1084
  "data-image-upload-item": "",
1380
1085
  children: [
1381
1086
  it.status === "uploading" && /* @__PURE__ */ jsx(
1382
1087
  "div",
1383
1088
  {
1384
- className: styles$b.progress,
1089
+ className: styles$c.progress,
1385
1090
  style: { width: `${it.progress}%` },
1386
1091
  "aria-hidden": true
1387
1092
  }
1388
1093
  ),
1389
- /* @__PURE__ */ jsxs("div", { className: styles$b.previewContent, children: [
1390
- /* @__PURE__ */ jsxs("span", { className: styles$b.fileInfo, children: [
1391
- /* @__PURE__ */ jsx("span", { className: styles$b.fileIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CloudUploadIcon, {}) }),
1392
- /* @__PURE__ */ jsxs("span", { className: styles$b.details, children: [
1393
- /* @__PURE__ */ jsx("span", { className: styles$b.fileName, children: it.file.name }),
1394
- /* @__PURE__ */ jsx("span", { className: styles$b.subtext, children: it.status === "error" ? labels.failed : formatFileSize(it.file.size) })
1094
+ /* @__PURE__ */ jsxs("div", { className: styles$c.previewContent, children: [
1095
+ /* @__PURE__ */ jsxs("span", { className: styles$c.fileInfo, children: [
1096
+ /* @__PURE__ */ jsx("span", { className: styles$c.fileIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CloudUploadIcon, {}) }),
1097
+ /* @__PURE__ */ jsxs("span", { className: styles$c.details, children: [
1098
+ /* @__PURE__ */ jsx("span", { className: styles$c.fileName, children: it.file.name }),
1099
+ /* @__PURE__ */ jsx("span", { className: styles$c.subtext, children: it.status === "error" ? labels.failed : formatFileSize(it.file.size) })
1395
1100
  ] })
1396
1101
  ] }),
1397
- /* @__PURE__ */ jsxs("span", { className: styles$b.actions, children: [
1398
- it.status === "uploading" && /* @__PURE__ */ jsxs("span", { className: styles$b.progressText, children: [
1102
+ /* @__PURE__ */ jsxs("span", { className: styles$c.actions, children: [
1103
+ it.status === "uploading" && /* @__PURE__ */ jsxs("span", { className: styles$c.progressText, children: [
1399
1104
  Math.round(it.progress),
1400
1105
  "%"
1401
1106
  ] }),
@@ -1403,7 +1108,7 @@ function ImageUploadView(props) {
1403
1108
  "button",
1404
1109
  {
1405
1110
  type: "button",
1406
- className: styles$b.remove,
1111
+ className: styles$c.remove,
1407
1112
  "data-image-upload-remove": "",
1408
1113
  title: labels.remove,
1409
1114
  "aria-label": labels.remove,
@@ -1462,7 +1167,7 @@ function FileDocIcon() {
1462
1167
  viewBox: "0 0 43 57",
1463
1168
  fill: "none",
1464
1169
  "aria-hidden": true,
1465
- className: styles$b.fileShapeDoc,
1170
+ className: styles$c.fileShapeDoc,
1466
1171
  children: /* @__PURE__ */ jsx(
1467
1172
  "path",
1468
1173
  {
@@ -1485,7 +1190,7 @@ function FileCornerIcon() {
1485
1190
  viewBox: "0 0 10 10",
1486
1191
  fill: "currentColor",
1487
1192
  "aria-hidden": true,
1488
- className: styles$b.fileShapeCorner,
1193
+ className: styles$c.fileShapeCorner,
1489
1194
  children: /* @__PURE__ */ jsx("path", { d: "M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z" })
1490
1195
  }
1491
1196
  );
@@ -1608,6 +1313,208 @@ function setImageAlignAt(editor, imageElement, align) {
1608
1313
  return false;
1609
1314
  }
1610
1315
  }
1316
+ const frames = /* @__PURE__ */ new WeakMap();
1317
+ const cropEditing = /* @__PURE__ */ new WeakSet();
1318
+ function pixel(value) {
1319
+ if (value == null || value === "") return null;
1320
+ const n = Number(value);
1321
+ return Number.isFinite(n) && n > 0 ? n : null;
1322
+ }
1323
+ function applyCropImageStyle(img, crop) {
1324
+ const box2 = cropImageBox(crop);
1325
+ img.style.position = "absolute";
1326
+ img.style.margin = "0";
1327
+ img.style.maxWidth = "none";
1328
+ img.style.pointerEvents = "none";
1329
+ img.style.width = box2.width;
1330
+ img.style.height = box2.height;
1331
+ img.style.left = box2.left;
1332
+ img.style.top = box2.top;
1333
+ }
1334
+ function clearCropStyles(img) {
1335
+ img.style.position = "";
1336
+ img.style.margin = "";
1337
+ img.style.maxWidth = "";
1338
+ img.style.pointerEvents = "";
1339
+ img.style.width = "";
1340
+ img.style.height = "";
1341
+ img.style.left = "";
1342
+ img.style.top = "";
1343
+ }
1344
+ function detachLoad(img, state) {
1345
+ if (!state.loadHandler) return;
1346
+ img.removeEventListener("load", state.loadHandler);
1347
+ state.loadHandler = void 0;
1348
+ }
1349
+ function syncResizableImageCrop(host, img, attrs) {
1350
+ var _a;
1351
+ if (cropEditing.has(img)) return;
1352
+ const crop = normalizeImageCrop(attrs.crop);
1353
+ const width = pixel(attrs.width);
1354
+ const height = pixel(attrs.height);
1355
+ const state = frames.get(img);
1356
+ if (!crop) {
1357
+ if (state == null ? void 0 : state.installed) {
1358
+ detachLoad(img, state);
1359
+ state.frame.replaceWith(img);
1360
+ host.element = img;
1361
+ host.onResize = state.originalOnResize;
1362
+ state.installed = false;
1363
+ }
1364
+ clearCropStyles(img);
1365
+ img.style.width = width ? `${width}px` : "";
1366
+ img.style.height = height ? `${height}px` : "";
1367
+ return;
1368
+ }
1369
+ const frameState = state ?? {
1370
+ frame: document.createElement("div"),
1371
+ installed: false
1372
+ };
1373
+ if (!state) frames.set(img, frameState);
1374
+ const { frame } = frameState;
1375
+ frame.className = "tmr-image-crop";
1376
+ frame.style.position = "relative";
1377
+ frame.style.overflow = "hidden";
1378
+ frame.style.display = "block";
1379
+ frame.style.maxWidth = "100%";
1380
+ frame.style.lineHeight = "0";
1381
+ frame.style.marginLeft = "";
1382
+ frame.style.marginTop = "";
1383
+ if (!frameState.installed) {
1384
+ frameState.originalOnResize = host.onResize;
1385
+ (_a = img.parentElement) == null ? void 0 : _a.insertBefore(frame, img);
1386
+ frame.appendChild(img);
1387
+ host.element = frame;
1388
+ frameState.installed = true;
1389
+ }
1390
+ host.onResize = () => applyCropImageStyle(img, crop);
1391
+ host.element = frame;
1392
+ if (width && height) {
1393
+ detachLoad(img, frameState);
1394
+ frame.style.width = `${width}px`;
1395
+ frame.style.height = `${height}px`;
1396
+ frame.style.aspectRatio = `${width} / ${height}`;
1397
+ } else {
1398
+ frame.style.width = "";
1399
+ frame.style.height = "";
1400
+ frame.style.aspectRatio = "";
1401
+ detachLoad(img, frameState);
1402
+ const fitToNatural = () => {
1403
+ const w = Math.round(img.naturalWidth * crop.w);
1404
+ const h = Math.round(img.naturalHeight * crop.h);
1405
+ if (w <= 0 || h <= 0) return;
1406
+ frame.style.width = `${w}px`;
1407
+ frame.style.height = `${h}px`;
1408
+ frame.style.aspectRatio = `${w} / ${h}`;
1409
+ };
1410
+ frameState.loadHandler = fitToNatural;
1411
+ if (img.complete && img.naturalWidth > 0) fitToNatural();
1412
+ else img.addEventListener("load", fitToNatural);
1413
+ }
1414
+ applyCropImageStyle(img, crop);
1415
+ }
1416
+ function openCropSurface(img, crop) {
1417
+ const frame = img.closest(".tmr-image-crop");
1418
+ const framed = frame instanceof HTMLElement ? frame : null;
1419
+ const host = framed ?? img;
1420
+ const displayWidth = host.clientWidth;
1421
+ const displayHeight = host.clientHeight;
1422
+ const frameSnap = framed ? {
1423
+ width: framed.style.width,
1424
+ height: framed.style.height,
1425
+ aspectRatio: framed.style.aspectRatio,
1426
+ overflow: framed.style.overflow,
1427
+ maxWidth: framed.style.maxWidth
1428
+ } : null;
1429
+ const imgSnap = {
1430
+ position: img.style.position,
1431
+ margin: img.style.margin,
1432
+ maxWidth: img.style.maxWidth,
1433
+ pointerEvents: img.style.pointerEvents,
1434
+ width: img.style.width,
1435
+ height: img.style.height,
1436
+ left: img.style.left,
1437
+ top: img.style.top
1438
+ };
1439
+ const reflow = framed != null && crop != null && displayWidth >= 1 && displayHeight >= 1 && crop.w > 0 && crop.h > 0;
1440
+ if (reflow && framed && crop) {
1441
+ const fullW = displayWidth / crop.w;
1442
+ const fullH = displayHeight / crop.h;
1443
+ framed.style.width = `${fullW}px`;
1444
+ framed.style.height = "auto";
1445
+ framed.style.aspectRatio = `${fullW} / ${fullH}`;
1446
+ framed.style.overflow = "hidden";
1447
+ framed.style.maxWidth = "100%";
1448
+ img.style.position = "absolute";
1449
+ img.style.margin = "0";
1450
+ img.style.maxWidth = "none";
1451
+ img.style.pointerEvents = "none";
1452
+ img.style.width = "100%";
1453
+ img.style.height = "100%";
1454
+ img.style.left = "0";
1455
+ img.style.top = "0";
1456
+ }
1457
+ const parent = framed ?? img.parentElement ?? img;
1458
+ let parentPosition = null;
1459
+ if (!framed && parent !== img && getComputedStyle(parent).position === "static") {
1460
+ parentPosition = parent.style.position;
1461
+ parent.style.position = "relative";
1462
+ }
1463
+ const overlay = document.createElement("div");
1464
+ overlay.className = "tmr-image-crop-edit";
1465
+ overlay.dataset.imageCrop = "";
1466
+ overlay.style.position = "absolute";
1467
+ overlay.style.zIndex = "3";
1468
+ if (reflow) {
1469
+ overlay.style.inset = "0";
1470
+ } else {
1471
+ overlay.style.left = `${img.offsetLeft}px`;
1472
+ overlay.style.top = `${img.offsetTop}px`;
1473
+ overlay.style.width = `${Math.max(img.offsetWidth, 0)}px`;
1474
+ overlay.style.height = `${Math.max(img.offsetHeight, 0)}px`;
1475
+ }
1476
+ parent.appendChild(overlay);
1477
+ const container = img.closest("[data-resize-container]");
1478
+ if (container instanceof HTMLElement) container.dataset.imageCropping = "";
1479
+ cropEditing.add(img);
1480
+ let alive = true;
1481
+ let keepStyles = false;
1482
+ const teardown = () => {
1483
+ if (!alive) return;
1484
+ alive = false;
1485
+ cropEditing.delete(img);
1486
+ overlay.remove();
1487
+ if (container instanceof HTMLElement) delete container.dataset.imageCropping;
1488
+ if (keepStyles) return;
1489
+ if (framed && frameSnap) {
1490
+ framed.style.width = frameSnap.width;
1491
+ framed.style.height = frameSnap.height;
1492
+ framed.style.aspectRatio = frameSnap.aspectRatio;
1493
+ framed.style.overflow = frameSnap.overflow;
1494
+ framed.style.maxWidth = frameSnap.maxWidth;
1495
+ }
1496
+ img.style.position = imgSnap.position;
1497
+ img.style.margin = imgSnap.margin;
1498
+ img.style.maxWidth = imgSnap.maxWidth;
1499
+ img.style.pointerEvents = imgSnap.pointerEvents;
1500
+ img.style.width = imgSnap.width;
1501
+ img.style.height = imgSnap.height;
1502
+ img.style.left = imgSnap.left;
1503
+ img.style.top = imgSnap.top;
1504
+ if (parentPosition !== null && parent !== img) parent.style.position = parentPosition;
1505
+ };
1506
+ return {
1507
+ overlay,
1508
+ displayWidth,
1509
+ discard() {
1510
+ keepStyles = true;
1511
+ teardown();
1512
+ },
1513
+ restore() {
1514
+ teardown();
1515
+ }
1516
+ };
1517
+ }
1611
1518
  const popupHost$1 = "_popupHost_xhti8_5";
1612
1519
  const panel$1 = "_panel_xhti8_11";
1613
1520
  const menu$3 = "_menu_xhti8_22";
@@ -1616,7 +1523,7 @@ const tab = "_tab_xhti8_32";
1616
1523
  const tabActive = "_tabActive_xhti8_40";
1617
1524
  const cell = "_cell_xhti8_71";
1618
1525
  const cellActive = "_cellActive_xhti8_72";
1619
- const styles$a = {
1526
+ const styles$b = {
1620
1527
  popupHost: popupHost$1,
1621
1528
  panel: panel$1,
1622
1529
  menu: menu$3,
@@ -1756,13 +1663,13 @@ const EmojiSuggestionPopup = forwardRef(function EmojiSuggestionPopup2({ items,
1756
1663
  [visible, index, command]
1757
1664
  );
1758
1665
  if (!visible.length) return null;
1759
- return /* @__PURE__ */ jsxs("div", { className: styles$a.panel, children: [
1666
+ return /* @__PURE__ */ jsxs("div", { className: styles$b.panel, children: [
1760
1667
  /* @__PURE__ */ jsx(
1761
1668
  "div",
1762
1669
  {
1763
1670
  id: gridId,
1764
1671
  ref: menuRef,
1765
- className: styles$a.menu,
1672
+ className: styles$b.menu,
1766
1673
  role: "listbox",
1767
1674
  "aria-label": menuLabel,
1768
1675
  children: visible.map((item2, i) => {
@@ -1778,7 +1685,7 @@ const EmojiSuggestionPopup = forwardRef(function EmojiSuggestionPopup2({ items,
1778
1685
  "aria-label": shortcode,
1779
1686
  "aria-selected": i === index,
1780
1687
  title: shortcode,
1781
- className: i === index ? styles$a.cellActive : styles$a.cell,
1688
+ className: i === index ? styles$b.cellActive : styles$b.cell,
1782
1689
  tabIndex: -1,
1783
1690
  onMouseEnter: () => setIndex(i),
1784
1691
  onMouseDown: (event) => {
@@ -1792,7 +1699,7 @@ const EmojiSuggestionPopup = forwardRef(function EmojiSuggestionPopup2({ items,
1792
1699
  })
1793
1700
  }
1794
1701
  ),
1795
- browsing ? /* @__PURE__ */ jsx("div", { className: styles$a.tabs, role: "tablist", "aria-label": menuLabel, children: categories.map((category) => {
1702
+ browsing ? /* @__PURE__ */ jsx("div", { className: styles$b.tabs, role: "tablist", "aria-label": menuLabel, children: categories.map((category) => {
1796
1703
  const selected = category.id === activeId;
1797
1704
  return /* @__PURE__ */ jsx(
1798
1705
  "button",
@@ -1803,7 +1710,7 @@ const EmojiSuggestionPopup = forwardRef(function EmojiSuggestionPopup2({ items,
1803
1710
  "aria-controls": gridId,
1804
1711
  "aria-label": category.label,
1805
1712
  title: category.label,
1806
- className: selected ? styles$a.tabActive : styles$a.tab,
1713
+ className: selected ? styles$b.tabActive : styles$b.tab,
1807
1714
  tabIndex: -1,
1808
1715
  onMouseDown: (event) => {
1809
1716
  event.preventDefault();
@@ -1850,7 +1757,7 @@ function configureEmojiSuggestion(extension, enabled) {
1850
1757
  menuLabel: getEditorBundle(props.editor).emoji.menuLabel,
1851
1758
  command: props.command
1852
1759
  },
1853
- className: styles$a.popupHost
1760
+ className: styles$b.popupHost
1854
1761
  });
1855
1762
  copyThemeVars(props.editor.view.dom, renderer.element);
1856
1763
  unmountPopup = props.mount(renderer.element);
@@ -1896,7 +1803,7 @@ const item$1 = "_item_1noza_53";
1896
1803
  const itemActive$1 = "_itemActive_1noza_54";
1897
1804
  const itemIcon$1 = "_itemIcon_1noza_79";
1898
1805
  const itemTitle = "_itemTitle_1noza_102";
1899
- const styles$9 = {
1806
+ const styles$a = {
1900
1807
  popupHost,
1901
1808
  menu: menu$2,
1902
1809
  groupLabel: groupLabel$1,
@@ -2097,11 +2004,11 @@ const SlashMenuPopup = forwardRef(function SlashMenuPopup2({ items, query, menuL
2097
2004
  );
2098
2005
  if (!items.length) return null;
2099
2006
  let optionIndex = -1;
2100
- return /* @__PURE__ */ jsx("div", { className: styles$9.menu, role: "listbox", "aria-label": menuLabel, children: withGroupHeaders(items).map(([header2, item2]) => {
2007
+ return /* @__PURE__ */ jsx("div", { className: styles$a.menu, role: "listbox", "aria-label": menuLabel, children: withGroupHeaders(items).map(([header2, item2]) => {
2101
2008
  optionIndex += 1;
2102
2009
  const i = optionIndex;
2103
2010
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2104
- header2 !== null ? /* @__PURE__ */ jsx("div", { className: styles$9.groupLabel, "aria-hidden": "true", children: header2 }) : null,
2011
+ header2 !== null ? /* @__PURE__ */ jsx("div", { className: styles$a.groupLabel, "aria-hidden": "true", children: header2 }) : null,
2105
2012
  /* @__PURE__ */ jsxs(
2106
2013
  "button",
2107
2014
  {
@@ -2109,7 +2016,7 @@ const SlashMenuPopup = forwardRef(function SlashMenuPopup2({ items, query, menuL
2109
2016
  role: "option",
2110
2017
  "aria-selected": i === index,
2111
2018
  title: item2.title,
2112
- className: i === index ? styles$9.itemActive : styles$9.item,
2019
+ className: i === index ? styles$a.itemActive : styles$a.item,
2113
2020
  tabIndex: -1,
2114
2021
  onMouseEnter: () => setIndex(i),
2115
2022
  onMouseDown: (e2) => {
@@ -2117,8 +2024,8 @@ const SlashMenuPopup = forwardRef(function SlashMenuPopup2({ items, query, menuL
2117
2024
  command(item2);
2118
2025
  },
2119
2026
  children: [
2120
- item2.icon != null ? /* @__PURE__ */ jsx("span", { className: styles$9.itemIcon, "aria-hidden": "true", children: item2.icon }) : /* @__PURE__ */ jsx("span", { className: styles$9.itemIcon, "aria-hidden": "true" }),
2121
- /* @__PURE__ */ jsx("span", { className: styles$9.itemTitle, children: item2.title })
2027
+ item2.icon != null ? /* @__PURE__ */ jsx("span", { className: styles$a.itemIcon, "aria-hidden": "true", children: item2.icon }) : /* @__PURE__ */ jsx("span", { className: styles$a.itemIcon, "aria-hidden": "true" }),
2028
+ /* @__PURE__ */ jsx("span", { className: styles$a.itemTitle, children: item2.title })
2122
2029
  ]
2123
2030
  }
2124
2031
  )
@@ -2170,7 +2077,7 @@ const SlashMenu = Extension.create({
2170
2077
  menuLabel: getEditorBundle(props.editor).slashMenu.menuLabel,
2171
2078
  command: props.command
2172
2079
  },
2173
- className: styles$9.popupHost
2080
+ className: styles$a.popupHost
2174
2081
  }
2175
2082
  );
2176
2083
  const pmStyle = getComputedStyle(props.editor.view.dom);
@@ -2223,7 +2130,7 @@ const rowKeys = "_rowKeys_ljnq6_127";
2223
2130
  const rowMd = "_rowMd_ljnq6_128";
2224
2131
  const keycap = "_keycap_ljnq6_138";
2225
2132
  const none = "_none_ljnq6_163";
2226
- const styles$8 = {
2133
+ const styles$9 = {
2227
2134
  drawer,
2228
2135
  closeBtn,
2229
2136
  head,
@@ -2327,7 +2234,7 @@ function ShortcutPanel({
2327
2234
  return /* @__PURE__ */ jsxs(
2328
2235
  "aside",
2329
2236
  {
2330
- className: styles$8.drawer,
2237
+ className: styles$9.drawer,
2331
2238
  role: "dialog",
2332
2239
  "aria-modal": "false",
2333
2240
  "aria-label": t.panelTitle,
@@ -2336,27 +2243,27 @@ function ShortcutPanel({
2336
2243
  "button",
2337
2244
  {
2338
2245
  type: "button",
2339
- className: styles$8.closeBtn,
2246
+ className: styles$9.closeBtn,
2340
2247
  title: t.close,
2341
2248
  "aria-label": t.close,
2342
2249
  onClick: onClose,
2343
2250
  children: /* @__PURE__ */ jsx(XIcon, { size: 16 })
2344
2251
  }
2345
2252
  ),
2346
- /* @__PURE__ */ jsxs("div", { className: styles$8.head, children: [
2347
- /* @__PURE__ */ jsx("span", { className: styles$8.colFormat, children: t.colFormat }),
2348
- /* @__PURE__ */ jsx("span", { className: styles$8.colShortcut, children: t.colShortcut }),
2349
- /* @__PURE__ */ jsx("span", { className: styles$8.colMarkdown, children: t.colMarkdown })
2253
+ /* @__PURE__ */ jsxs("div", { className: styles$9.head, children: [
2254
+ /* @__PURE__ */ jsx("span", { className: styles$9.colFormat, children: t.colFormat }),
2255
+ /* @__PURE__ */ jsx("span", { className: styles$9.colShortcut, children: t.colShortcut }),
2256
+ /* @__PURE__ */ jsx("span", { className: styles$9.colMarkdown, children: t.colMarkdown })
2350
2257
  ] }),
2351
- /* @__PURE__ */ jsx("div", { className: styles$8.body, children: groups.map((group2) => /* @__PURE__ */ jsxs("section", { className: styles$8.group, children: [
2352
- /* @__PURE__ */ jsx("h3", { className: styles$8.groupTitle, children: group2.title }),
2353
- group2.entries.map((entry) => /* @__PURE__ */ jsxs("div", { className: styles$8.row, children: [
2354
- /* @__PURE__ */ jsx("span", { className: styles$8.rowLabel, children: entry.label }),
2355
- /* @__PURE__ */ jsx("span", { className: styles$8.rowKeys, children: entry.keys ? entry.keys.map((key, i) => /* @__PURE__ */ jsx("kbd", { className: styles$8.keycap, children: keycapText(key, mac) }, i)) : /* @__PURE__ */ jsx("span", { className: styles$8.none, children: "—" }) }),
2356
- /* @__PURE__ */ jsx("span", { className: styles$8.rowMd, children: entry.markdown ? /* @__PURE__ */ jsxs(Fragment$2, { children: [
2357
- /* @__PURE__ */ jsx("kbd", { className: styles$8.keycap, children: entry.markdown.marker }),
2358
- entry.markdown.terminator ? /* @__PURE__ */ jsx("kbd", { className: styles$8.keycap, children: entry.markdown.terminator }) : null
2359
- ] }) : /* @__PURE__ */ jsx("span", { className: styles$8.none, children: "—" }) })
2258
+ /* @__PURE__ */ jsx("div", { className: styles$9.body, children: groups.map((group2) => /* @__PURE__ */ jsxs("section", { className: styles$9.group, children: [
2259
+ /* @__PURE__ */ jsx("h3", { className: styles$9.groupTitle, children: group2.title }),
2260
+ group2.entries.map((entry) => /* @__PURE__ */ jsxs("div", { className: styles$9.row, children: [
2261
+ /* @__PURE__ */ jsx("span", { className: styles$9.rowLabel, children: entry.label }),
2262
+ /* @__PURE__ */ jsx("span", { className: styles$9.rowKeys, children: entry.keys ? entry.keys.map((key, i) => /* @__PURE__ */ jsx("kbd", { className: styles$9.keycap, children: keycapText(key, mac) }, i)) : /* @__PURE__ */ jsx("span", { className: styles$9.none, children: "—" }) }),
2263
+ /* @__PURE__ */ jsx("span", { className: styles$9.rowMd, children: entry.markdown ? /* @__PURE__ */ jsxs(Fragment$2, { children: [
2264
+ /* @__PURE__ */ jsx("kbd", { className: styles$9.keycap, children: entry.markdown.marker }),
2265
+ entry.markdown.terminator ? /* @__PURE__ */ jsx("kbd", { className: styles$9.keycap, children: entry.markdown.terminator }) : null
2266
+ ] }) : /* @__PURE__ */ jsx("span", { className: styles$9.none, children: "—" }) })
2360
2267
  ] }, entry.id))
2361
2268
  ] }, group2.id)) })
2362
2269
  ]
@@ -2656,7 +2563,7 @@ const gutterLine = "_gutterLine_k8th1_184";
2656
2563
  const readonlyActions = "_readonlyActions_k8th1_188";
2657
2564
  const actionBtn = "_actionBtn_k8th1_194";
2658
2565
  const langBraces = "_langBraces_k8th1_213";
2659
- const styles$7 = {
2566
+ const styles$8 = {
2660
2567
  wrapper,
2661
2568
  header,
2662
2569
  langTrigger,
@@ -2751,29 +2658,29 @@ function CodeBlockView({
2751
2658
  ta.remove();
2752
2659
  };
2753
2660
  const wrapperClass = [
2754
- styles$7.wrapper,
2755
- readonly2 ? styles$7.readonly : "",
2756
- folded2 ? styles$7.folded : ""
2661
+ styles$8.wrapper,
2662
+ readonly2 ? styles$8.readonly : "",
2663
+ folded2 ? styles$8.folded : ""
2757
2664
  ].filter(Boolean).join(" ");
2758
2665
  return /* @__PURE__ */ jsxs(NodeViewWrapper, { className: wrapperClass, children: [
2759
- editable ? /* @__PURE__ */ jsxs("div", { className: styles$7.header, contentEditable: false, children: [
2666
+ editable ? /* @__PURE__ */ jsxs("div", { className: styles$8.header, contentEditable: false, children: [
2760
2667
  /* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [
2761
2668
  /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
2762
2669
  "button",
2763
2670
  {
2764
2671
  type: "button",
2765
- className: styles$7.langTrigger,
2672
+ className: styles$8.langTrigger,
2766
2673
  "aria-label": labels.language,
2767
2674
  children: [
2768
2675
  /* @__PURE__ */ jsx("span", { children: currentLabel }),
2769
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 14, className: styles$7.langChevron })
2676
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 14, className: styles$8.langChevron })
2770
2677
  ]
2771
2678
  }
2772
2679
  ) }),
2773
2680
  /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(
2774
2681
  DropdownMenu.Content,
2775
2682
  {
2776
- className: styles$7.langMenu,
2683
+ className: styles$8.langMenu,
2777
2684
  sideOffset: 4,
2778
2685
  align: "end",
2779
2686
  children: LANGUAGES.map((l) => {
@@ -2782,10 +2689,10 @@ function CodeBlockView({
2782
2689
  return /* @__PURE__ */ jsxs(
2783
2690
  DropdownMenu.Item,
2784
2691
  {
2785
- className: `${styles$7.langItem}${selected ? ` ${styles$7.langItemSelected}` : ""}`,
2692
+ className: `${styles$8.langItem}${selected ? ` ${styles$8.langItemSelected}` : ""}`,
2786
2693
  onSelect: () => updateAttributes({ language: l.value }),
2787
2694
  children: [
2788
- /* @__PURE__ */ jsx("span", { className: styles$7.langItemCheck, children: selected ? /* @__PURE__ */ jsx(CheckIcon, { size: 14 }) : null }),
2695
+ /* @__PURE__ */ jsx("span", { className: styles$8.langItemCheck, children: selected ? /* @__PURE__ */ jsx(CheckIcon, { size: 14 }) : null }),
2789
2696
  optionLabel
2790
2697
  ]
2791
2698
  },
@@ -2799,7 +2706,7 @@ function CodeBlockView({
2799
2706
  "button",
2800
2707
  {
2801
2708
  type: "button",
2802
- className: styles$7.deleteBtn,
2709
+ className: styles$8.deleteBtn,
2803
2710
  title: labels.delete,
2804
2711
  "aria-label": labels.delete,
2805
2712
  onClick: () => deleteNode(),
@@ -2808,17 +2715,17 @@ function CodeBlockView({
2808
2715
  )
2809
2716
  ] }) : (
2810
2717
  // 只读头部:左侧语言标签,右侧复制 + 展开收起(展开后按钮保留,供收回)
2811
- /* @__PURE__ */ jsxs("div", { className: styles$7.readonlyHeader, contentEditable: false, children: [
2812
- /* @__PURE__ */ jsxs("span", { className: styles$7.langBadge, children: [
2813
- /* @__PURE__ */ jsx("span", { className: styles$7.langBraces, children: "{}" }),
2718
+ /* @__PURE__ */ jsxs("div", { className: styles$8.readonlyHeader, contentEditable: false, children: [
2719
+ /* @__PURE__ */ jsxs("span", { className: styles$8.langBadge, children: [
2720
+ /* @__PURE__ */ jsx("span", { className: styles$8.langBraces, children: "{}" }),
2814
2721
  currentLabel
2815
2722
  ] }),
2816
- /* @__PURE__ */ jsxs("span", { className: styles$7.readonlyActions, children: [
2723
+ /* @__PURE__ */ jsxs("span", { className: styles$8.readonlyActions, children: [
2817
2724
  /* @__PURE__ */ jsx(
2818
2725
  "button",
2819
2726
  {
2820
2727
  type: "button",
2821
- className: styles$7.actionBtn,
2728
+ className: styles$8.actionBtn,
2822
2729
  onClick: handleCopy,
2823
2730
  "aria-label": labels.copy,
2824
2731
  title: labels.copy,
@@ -2829,7 +2736,7 @@ function CodeBlockView({
2829
2736
  "button",
2830
2737
  {
2831
2738
  type: "button",
2832
- className: styles$7.actionBtn,
2739
+ className: styles$8.actionBtn,
2833
2740
  onClick: () => setFolded((v) => !v),
2834
2741
  "aria-label": folded2 ? labels.expand : labels.collapse,
2835
2742
  title: folded2 ? labels.expand : labels.collapse,
@@ -2840,14 +2747,14 @@ function CodeBlockView({
2840
2747
  ] })
2841
2748
  ] })
2842
2749
  ),
2843
- /* @__PURE__ */ jsxs("pre", { ref: preRef, className: styles$7.pre, children: [
2750
+ /* @__PURE__ */ jsxs("pre", { ref: preRef, className: styles$8.pre, children: [
2844
2751
  readonly2 ? /* @__PURE__ */ jsx(
2845
2752
  "span",
2846
2753
  {
2847
- className: styles$7.gutter,
2754
+ className: styles$8.gutter,
2848
2755
  contentEditable: false,
2849
2756
  "aria-hidden": "true",
2850
- children: Array.from({ length: lineCount }, (_, i) => /* @__PURE__ */ jsx("span", { className: styles$7.gutterLine, children: i + 1 }, i))
2757
+ children: Array.from({ length: lineCount }, (_, i) => /* @__PURE__ */ jsx("span", { className: styles$8.gutterLine, children: i + 1 }, i))
2851
2758
  }
2852
2759
  ) : null,
2853
2760
  /* @__PURE__ */ jsx(NodeViewContent, { as: "code" })
@@ -3284,7 +3191,7 @@ const item = "_item_5edcs_100";
3284
3191
  const itemActive = "_itemActive_5edcs_118";
3285
3192
  const itemDanger = "_itemDanger_5edcs_123";
3286
3193
  const itemIcon = "_itemIcon_5edcs_132";
3287
- const styles$6 = {
3194
+ const styles$7 = {
3288
3195
  cluster,
3289
3196
  clusterOnTable,
3290
3197
  button,
@@ -3477,14 +3384,14 @@ function BlockDragHandle({ editor }) {
3477
3384
  children: /* @__PURE__ */ jsx(
3478
3385
  "div",
3479
3386
  {
3480
- className: `${styles$6.cluster} ${(target == null ? void 0 : target.node.type.name) === "table" ? styles$6.clusterOnTable : ""}`,
3387
+ className: `${styles$7.cluster} ${(target == null ? void 0 : target.node.type.name) === "table" ? styles$7.clusterOnTable : ""}`,
3481
3388
  "data-block-drag": "",
3482
3389
  children: /* @__PURE__ */ jsx(
3483
3390
  "div",
3484
3391
  {
3485
3392
  role: "button",
3486
3393
  tabIndex: 0,
3487
- className: `${styles$6.button} ${styles$6.grip}`,
3394
+ className: `${styles$7.button} ${styles$7.grip}`,
3488
3395
  "data-block-drag-grip": "",
3489
3396
  title: t.dragHandle,
3490
3397
  "aria-label": t.dragHandle,
@@ -3516,7 +3423,7 @@ function BlockDragHandle({ editor }) {
3516
3423
  "div",
3517
3424
  {
3518
3425
  ref: menuRef,
3519
- className: styles$6.menu,
3426
+ className: styles$7.menu,
3520
3427
  "data-block-drag-menu": "",
3521
3428
  role: "menu",
3522
3429
  "aria-label": t.menuLabel,
@@ -3524,37 +3431,37 @@ function BlockDragHandle({ editor }) {
3524
3431
  onMouseDown: (event) => event.stopPropagation(),
3525
3432
  children: [
3526
3433
  showTurn ? /* @__PURE__ */ jsxs(Fragment$2, { children: [
3527
- /* @__PURE__ */ jsx("div", { className: styles$6.groupLabel, children: t.turnInto }),
3434
+ /* @__PURE__ */ jsx("div", { className: styles$7.groupLabel, children: t.turnInto }),
3528
3435
  TURN_INTO_KINDS.map((kind) => /* @__PURE__ */ jsxs(
3529
3436
  "button",
3530
3437
  {
3531
3438
  type: "button",
3532
3439
  role: "menuitem",
3533
- className: kind === activeKind ? `${styles$6.item} ${styles$6.itemActive}` : styles$6.item,
3440
+ className: kind === activeKind ? `${styles$7.item} ${styles$7.itemActive}` : styles$7.item,
3534
3441
  "data-block-drag-action": kind,
3535
3442
  onClick: () => run(() => turnBlockInto(editor, menu2.pos, kind)),
3536
3443
  children: [
3537
- /* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: TURN_ICON[kind] }),
3444
+ /* @__PURE__ */ jsx("span", { className: styles$7.itemIcon, "aria-hidden": true, children: TURN_ICON[kind] }),
3538
3445
  /* @__PURE__ */ jsx("span", { children: turnLabel(kind) })
3539
3446
  ]
3540
3447
  },
3541
3448
  kind
3542
3449
  )),
3543
- /* @__PURE__ */ jsx("div", { className: styles$6.divider })
3450
+ /* @__PURE__ */ jsx("div", { className: styles$7.divider })
3544
3451
  ] }) : null,
3545
3452
  /* @__PURE__ */ jsxs(
3546
3453
  "button",
3547
3454
  {
3548
3455
  type: "button",
3549
3456
  role: "menuitem",
3550
- className: styles$6.item,
3457
+ className: styles$7.item,
3551
3458
  "data-block-drag-action": "copy",
3552
3459
  onClick: () => run(() => {
3553
3460
  const markdown = blockMarkdown(editor, menu2.pos);
3554
3461
  if (markdown != null) void copyMarkdown(markdown);
3555
3462
  }),
3556
3463
  children: [
3557
- /* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CopyIcon, {}) }),
3464
+ /* @__PURE__ */ jsx("span", { className: styles$7.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CopyIcon, {}) }),
3558
3465
  /* @__PURE__ */ jsx("span", { children: t.copy })
3559
3466
  ]
3560
3467
  }
@@ -3564,11 +3471,11 @@ function BlockDragHandle({ editor }) {
3564
3471
  {
3565
3472
  type: "button",
3566
3473
  role: "menuitem",
3567
- className: styles$6.item,
3474
+ className: styles$7.item,
3568
3475
  "data-block-drag-action": "duplicate",
3569
3476
  onClick: () => run(() => duplicateBlock(editor, menu2.pos)),
3570
3477
  children: [
3571
- /* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CopyIcon, {}) }),
3478
+ /* @__PURE__ */ jsx("span", { className: styles$7.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CopyIcon, {}) }),
3572
3479
  /* @__PURE__ */ jsx("span", { children: t.duplicate })
3573
3480
  ]
3574
3481
  }
@@ -3578,11 +3485,11 @@ function BlockDragHandle({ editor }) {
3578
3485
  {
3579
3486
  type: "button",
3580
3487
  role: "menuitem",
3581
- className: styles$6.item,
3488
+ className: styles$7.item,
3582
3489
  "data-block-drag-action": "reset",
3583
3490
  onClick: () => run(() => resetBlockFormatting(editor, menu2.pos)),
3584
3491
  children: [
3585
- /* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(EraserIcon, {}) }),
3492
+ /* @__PURE__ */ jsx("span", { className: styles$7.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(EraserIcon, {}) }),
3586
3493
  /* @__PURE__ */ jsx("span", { children: t.resetFormatting })
3587
3494
  ]
3588
3495
  }
@@ -3592,26 +3499,26 @@ function BlockDragHandle({ editor }) {
3592
3499
  {
3593
3500
  type: "button",
3594
3501
  role: "menuitem",
3595
- className: styles$6.item,
3502
+ className: styles$7.item,
3596
3503
  "data-block-drag-action": "download",
3597
3504
  onClick: () => run(() => downloadImageBlock(menu2.node)),
3598
3505
  children: [
3599
- /* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(DownloadIcon, {}) }),
3506
+ /* @__PURE__ */ jsx("span", { className: styles$7.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(DownloadIcon, {}) }),
3600
3507
  /* @__PURE__ */ jsx("span", { children: t.downloadImage })
3601
3508
  ]
3602
3509
  }
3603
3510
  ) : null,
3604
- /* @__PURE__ */ jsx("div", { className: styles$6.divider }),
3511
+ /* @__PURE__ */ jsx("div", { className: styles$7.divider }),
3605
3512
  /* @__PURE__ */ jsxs(
3606
3513
  "button",
3607
3514
  {
3608
3515
  type: "button",
3609
3516
  role: "menuitem",
3610
- className: `${styles$6.item} ${styles$6.itemDanger}`,
3517
+ className: `${styles$7.item} ${styles$7.itemDanger}`,
3611
3518
  "data-block-drag-action": "delete",
3612
3519
  onClick: () => run(() => deleteBlock(editor, menu2.pos)),
3613
3520
  children: [
3614
- /* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(TrashIcon, {}) }),
3521
+ /* @__PURE__ */ jsx("span", { className: styles$7.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(TrashIcon, {}) }),
3615
3522
  /* @__PURE__ */ jsx("span", { children: t.delete })
3616
3523
  ]
3617
3524
  }
@@ -3659,7 +3566,8 @@ const ImageWithConfirmDelete = Image.extend({
3659
3566
  return {
3660
3567
  ...((_a = Image.config.addAttributes) == null ? void 0 : _a.call(this)) ?? {},
3661
3568
  align: imageAlignAttribute,
3662
- caption: imageCaptionAttribute
3569
+ caption: imageCaptionAttribute,
3570
+ crop: imageCropAttribute
3663
3571
  };
3664
3572
  },
3665
3573
  parseHTML() {
@@ -3731,7 +3639,9 @@ const ImageWithConfirmDelete = Image.extend({
3731
3639
  captionEl.dataset.imageCaption = "";
3732
3640
  (element.parentElement ?? container).appendChild(captionEl);
3733
3641
  const syncHandleTop = () => {
3734
- const height = element.offsetHeight;
3642
+ const frame = element.closest(".tmr-image-crop");
3643
+ const box2 = frame instanceof HTMLElement ? frame : element;
3644
+ const height = box2.offsetHeight;
3735
3645
  if (height > 0) {
3736
3646
  container.style.setProperty("--tmr-image-h", `${height}px`);
3737
3647
  } else {
@@ -3748,17 +3658,21 @@ const ImageWithConfirmDelete = Image.extend({
3748
3658
  element.addEventListener("load", syncHandleTop);
3749
3659
  container.addEventListener("mousedown", applyMaxSize, true);
3750
3660
  }
3751
- if (resizable.element) {
3752
- const { element } = resizable;
3661
+ if (resizable.element instanceof HTMLImageElement) {
3662
+ const img = resizable.element;
3663
+ const host = resizable;
3664
+ const sync = (attrs) => {
3665
+ syncResizableImageCrop(host, img, attrs);
3666
+ syncCaption == null ? void 0 : syncCaption(attrs);
3667
+ };
3668
+ sync(props.node.attrs);
3753
3669
  const originalUpdate = (_b = nodeView.update) == null ? void 0 : _b.bind(nodeView);
3754
3670
  if (originalUpdate) {
3755
3671
  nodeView.update = (...args) => {
3756
3672
  const ok = originalUpdate(...args);
3757
3673
  if (ok) {
3758
3674
  const attrs = args[0].attrs;
3759
- element.style.width = attrs.width ? `${attrs.width}px` : "";
3760
- element.style.height = attrs.height ? `${attrs.height}px` : "";
3761
- syncCaption == null ? void 0 : syncCaption(attrs);
3675
+ sync(attrs);
3762
3676
  }
3763
3677
  return ok;
3764
3678
  };
@@ -3798,14 +3712,14 @@ function CharacterCountStatus({
3798
3712
  return /* @__PURE__ */ jsxs(
3799
3713
  "div",
3800
3714
  {
3801
- className: styles$d.charCount,
3715
+ className: styles$e.charCount,
3802
3716
  role: "group",
3803
3717
  "aria-label": t.label,
3804
3718
  "data-characters": counts.characters,
3805
3719
  "data-words": counts.words,
3806
3720
  children: [
3807
3721
  /* @__PURE__ */ jsx("span", { children: t.characters(counts.characters) }),
3808
- /* @__PURE__ */ jsx("span", { className: styles$d.charCountSep, "aria-hidden": "true", children: "·" }),
3722
+ /* @__PURE__ */ jsx("span", { className: styles$e.charCountSep, "aria-hidden": "true", children: "·" }),
3809
3723
  /* @__PURE__ */ jsx("span", { children: t.words(counts.words) })
3810
3724
  ]
3811
3725
  }
@@ -3960,7 +3874,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
3960
3874
  immediatelyRender: false,
3961
3875
  editorProps: {
3962
3876
  attributes: {
3963
- class: styles$d.editorContent
3877
+ class: styles$e.editorContent
3964
3878
  }
3965
3879
  }
3966
3880
  });
@@ -4160,7 +4074,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
4160
4074
  locale,
4161
4075
  onClose: closeFind,
4162
4076
  inputRef: findInputRef,
4163
- className: styles$d.findBar,
4077
+ className: styles$e.findBar,
4164
4078
  style: findBarOffsetStyle(findBarOffset)
4165
4079
  }
4166
4080
  ) : null;
@@ -4177,7 +4091,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
4177
4091
  "button",
4178
4092
  {
4179
4093
  type: "button",
4180
- className: shortcutFabTarget ? `${styles$d.shortcutFab} ${styles$d.shortcutFabHosted}` : styles$d.shortcutFab,
4094
+ className: shortcutFabTarget ? `${styles$e.shortcutFab} ${styles$e.shortcutFabHosted}` : styles$e.shortcutFab,
4181
4095
  title: shortcutT.panelTitle,
4182
4096
  "aria-label": shortcutT.panelTitle,
4183
4097
  "aria-expanded": shortcutsOpen,
@@ -4188,10 +4102,10 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
4188
4102
  return /* @__PURE__ */ jsxs(
4189
4103
  "div",
4190
4104
  {
4191
- className: styles$d.editorHost,
4105
+ className: styles$e.editorHost,
4192
4106
  "data-block-drag-gutter": showBlockDrag ? "" : void 0,
4193
4107
  children: [
4194
- findBarNode && !findBarTarget ? /* @__PURE__ */ jsx("div", { className: styles$d.findBarAnchor, children: findBarNode }) : null,
4108
+ findBarNode && !findBarTarget ? /* @__PURE__ */ jsx("div", { className: styles$e.findBarAnchor, children: findBarNode }) : null,
4195
4109
  findBarNode && findBarTarget ? createPortal(findBarNode, findBarTarget) : null,
4196
4110
  editor && toc && !blockDragMobile && tocItems.length > 0 ? /* @__PURE__ */ jsx(
4197
4111
  EditorToc,
@@ -4201,20 +4115,20 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
4201
4115
  locale
4202
4116
  }
4203
4117
  ) : null,
4204
- /* @__PURE__ */ jsx(
4118
+ /* @__PURE__ */ jsx(ImagePreviewHost, { locale, activate: editable ? "dblclick" : "click", children: /* @__PURE__ */ jsx(
4205
4119
  EditorContent,
4206
4120
  {
4207
4121
  editor,
4208
4122
  className: [
4209
- styles$d.editorScroll,
4210
- showBlockDrag ? styles$d.withBlockDrag : "",
4211
- toc && !blockDragMobile && tocItems.length > 0 ? styles$d.withToc : "",
4123
+ styles$e.editorScroll,
4124
+ showBlockDrag ? styles$e.withBlockDrag : "",
4125
+ toc && !blockDragMobile && tocItems.length > 0 ? styles$e.withToc : "",
4212
4126
  className ?? ""
4213
4127
  ].filter(Boolean).join(" ")
4214
4128
  }
4215
- ),
4129
+ ) }),
4216
4130
  editor && showBlockDrag ? /* @__PURE__ */ jsx(BlockDragHandle, { editor }) : null,
4217
- editor && characterCount ? /* @__PURE__ */ jsxs("div", { className: styles$d.editorStatus, children: [
4131
+ editor && characterCount ? /* @__PURE__ */ jsxs("div", { className: styles$e.editorStatus, children: [
4218
4132
  /* @__PURE__ */ jsx(CharacterCountStatus, { editor, locale }),
4219
4133
  shortcutFabNode && !shortcutFabTarget ? shortcutFabNode : null
4220
4134
  ] }) : shortcutFabNode && !shortcutFabTarget ? shortcutFabNode : null,
@@ -4288,7 +4202,7 @@ function MarkdownPreview({
4288
4202
  editable: false,
4289
4203
  immediatelyRender: false,
4290
4204
  editorProps: {
4291
- attributes: { class: styles$d.editorContent }
4205
+ attributes: { class: styles$e.editorContent }
4292
4206
  }
4293
4207
  },
4294
4208
  [extensions]
@@ -4299,15 +4213,15 @@ function MarkdownPreview({
4299
4213
  editor.commands.setContent(prepared, { contentType: "markdown" });
4300
4214
  }, [editor, prepared]);
4301
4215
  const showToc = Boolean(editor && toc && !mobile && tocItems.length > 0);
4302
- return /* @__PURE__ */ jsxs("div", { className: styles$d.editorHost, children: [
4216
+ return /* @__PURE__ */ jsxs("div", { className: styles$e.editorHost, children: [
4303
4217
  showToc && editor ? /* @__PURE__ */ jsx(EditorToc, { items: tocItems, editorDom: editor.view.dom, locale }) : null,
4304
- /* @__PURE__ */ jsx(
4218
+ /* @__PURE__ */ jsx(ImagePreviewHost, { locale, activate: "click", children: /* @__PURE__ */ jsx(
4305
4219
  EditorContent,
4306
4220
  {
4307
4221
  editor,
4308
- className: [className ?? styles$d.editorScroll, showToc ? styles$d.withToc : ""].filter(Boolean).join(" ")
4222
+ className: [className ?? styles$e.editorScroll, showToc ? styles$e.withToc : ""].filter(Boolean).join(" ")
4309
4223
  }
4310
- )
4224
+ ) })
4311
4225
  ] });
4312
4226
  }
4313
4227
  const MD_FILE_RE = /\.(md|markdown)$/i;
@@ -4429,7 +4343,7 @@ const mathFieldBlock = "_mathFieldBlock_1l6t0_531";
4429
4343
  const mathInput = "_mathInput_1l6t0_538";
4430
4344
  const mathDone = "_mathDone_1l6t0_556";
4431
4345
  const mathDoneKbd = "_mathDoneKbd_1l6t0_581";
4432
- const styles$5 = {
4346
+ const styles$6 = {
4433
4347
  toolbar,
4434
4348
  inner,
4435
4349
  btn: btn$2,
@@ -4486,17 +4400,17 @@ const palette = "_palette_x5lrq_2";
4486
4400
  const noneRow = "_noneRow_x5lrq_11";
4487
4401
  const noneIcon = "_noneIcon_x5lrq_23";
4488
4402
  const noneLabel = "_noneLabel_x5lrq_43";
4489
- const grid = "_grid_x5lrq_48";
4403
+ const grid$1 = "_grid_x5lrq_48";
4490
4404
  const swatch = "_swatch_x5lrq_54";
4491
4405
  const swatchActive = "_swatchActive_x5lrq_70";
4492
4406
  const themeLabel = "_themeLabel_x5lrq_76";
4493
4407
  const themeRow = "_themeRow_x5lrq_84";
4494
- const styles$4 = {
4408
+ const styles$5 = {
4495
4409
  palette,
4496
4410
  noneRow,
4497
4411
  noneIcon,
4498
4412
  noneLabel,
4499
- grid,
4413
+ grid: grid$1,
4500
4414
  swatch,
4501
4415
  swatchActive,
4502
4416
  themeLabel,
@@ -4514,25 +4428,25 @@ const THEME_COLORS = ["#ff6719", "#ff5500"];
4514
4428
  function ColorPalette({ value, onPick, locale = "en" }) {
4515
4429
  const t = getLocaleBundle(locale).palette;
4516
4430
  const current = value == null ? void 0 : value.toLowerCase();
4517
- return /* @__PURE__ */ jsxs("div", { className: styles$4.palette, children: [
4431
+ return /* @__PURE__ */ jsxs("div", { className: styles$5.palette, children: [
4518
4432
  /* @__PURE__ */ jsxs(
4519
4433
  "button",
4520
4434
  {
4521
4435
  type: "button",
4522
- className: styles$4.noneRow,
4436
+ className: styles$5.noneRow,
4523
4437
  onMouseDown: (e2) => e2.preventDefault(),
4524
4438
  onClick: () => onPick(null),
4525
4439
  children: [
4526
- /* @__PURE__ */ jsx("span", { className: styles$4.noneIcon, "aria-hidden": true }),
4527
- /* @__PURE__ */ jsx("span", { className: styles$4.noneLabel, children: t.none })
4440
+ /* @__PURE__ */ jsx("span", { className: styles$5.noneIcon, "aria-hidden": true }),
4441
+ /* @__PURE__ */ jsx("span", { className: styles$5.noneLabel, children: t.none })
4528
4442
  ]
4529
4443
  }
4530
4444
  ),
4531
- /* @__PURE__ */ jsx("div", { className: styles$4.grid, children: PALETTE.flat().map((c2) => /* @__PURE__ */ jsx(
4445
+ /* @__PURE__ */ jsx("div", { className: styles$5.grid, children: PALETTE.flat().map((c2) => /* @__PURE__ */ jsx(
4532
4446
  "button",
4533
4447
  {
4534
4448
  type: "button",
4535
- className: `${styles$4.swatch} ${current === c2.toLowerCase() ? styles$4.swatchActive : ""}`,
4449
+ className: `${styles$5.swatch} ${current === c2.toLowerCase() ? styles$5.swatchActive : ""}`,
4536
4450
  style: { background: c2 },
4537
4451
  title: c2,
4538
4452
  "aria-label": c2,
@@ -4541,12 +4455,12 @@ function ColorPalette({ value, onPick, locale = "en" }) {
4541
4455
  },
4542
4456
  c2
4543
4457
  )) }),
4544
- /* @__PURE__ */ jsx("div", { className: styles$4.themeLabel, children: t.theme }),
4545
- /* @__PURE__ */ jsx("div", { className: styles$4.themeRow, children: THEME_COLORS.map((c2) => /* @__PURE__ */ jsx(
4458
+ /* @__PURE__ */ jsx("div", { className: styles$5.themeLabel, children: t.theme }),
4459
+ /* @__PURE__ */ jsx("div", { className: styles$5.themeRow, children: THEME_COLORS.map((c2) => /* @__PURE__ */ jsx(
4546
4460
  "button",
4547
4461
  {
4548
4462
  type: "button",
4549
- className: `${styles$4.swatch} ${current === c2.toLowerCase() ? styles$4.swatchActive : ""}`,
4463
+ className: `${styles$5.swatch} ${current === c2.toLowerCase() ? styles$5.swatchActive : ""}`,
4550
4464
  style: { background: c2 },
4551
4465
  title: c2,
4552
4466
  "aria-label": c2,
@@ -4571,19 +4485,266 @@ function setImageCaption(editor, caption) {
4571
4485
  if (pos == null) return false;
4572
4486
  return setImageCaptionAtPos(editor, pos, caption);
4573
4487
  }
4574
- const bar = "_bar_mp2o5_7";
4575
- const divider$1 = "_divider_mp2o5_24";
4576
- const captionRow = "_captionRow_mp2o5_13";
4577
- const captionInput = "_captionInput_mp2o5_40";
4578
- const btn$1 = "_btn_mp2o5_58";
4579
- const btnActive = "_btnActive_mp2o5_76";
4488
+ const MIN_CROP = 0.05;
4489
+ function moveCrop(start, dx, dy) {
4490
+ return tidy({
4491
+ x: clamp(start.x + dx, 0, 1 - start.w),
4492
+ y: clamp(start.y + dy, 0, 1 - start.h),
4493
+ w: start.w,
4494
+ h: start.h
4495
+ });
4496
+ }
4497
+ function resizeCrop(start, handle2, dx, dy) {
4498
+ let left = start.x;
4499
+ let top = start.y;
4500
+ let right = start.x + start.w;
4501
+ let bottom = start.y + start.h;
4502
+ if (handle2.includes("w")) left += dx;
4503
+ if (handle2.includes("e")) right += dx;
4504
+ if (handle2.includes("n")) top += dy;
4505
+ if (handle2.includes("s")) bottom += dy;
4506
+ if (right - left < MIN_CROP) {
4507
+ if (handle2.includes("w") && !handle2.includes("e")) left = right - MIN_CROP;
4508
+ else right = left + MIN_CROP;
4509
+ }
4510
+ if (bottom - top < MIN_CROP) {
4511
+ if (handle2.includes("n") && !handle2.includes("s")) top = bottom - MIN_CROP;
4512
+ else bottom = top + MIN_CROP;
4513
+ }
4514
+ left = clamp(left, 0, 1 - MIN_CROP);
4515
+ top = clamp(top, 0, 1 - MIN_CROP);
4516
+ right = clamp(right, left + MIN_CROP, 1);
4517
+ bottom = clamp(bottom, top + MIN_CROP, 1);
4518
+ return tidy({ x: left, y: top, w: right - left, h: bottom - top });
4519
+ }
4520
+ function croppedDisplaySize(args) {
4521
+ const { naturalWidth, naturalHeight, displayWidth, from, to } = args;
4522
+ if (!(naturalWidth > 0) || !(naturalHeight > 0) || !(displayWidth > 0)) return null;
4523
+ const scale = displayWidth / (naturalWidth * ((from == null ? void 0 : from.w) ?? 1));
4524
+ if (!(scale > 0) || !Number.isFinite(scale)) return null;
4525
+ const fractionW = (to == null ? void 0 : to.w) ?? 1;
4526
+ const fractionH = (to == null ? void 0 : to.h) ?? 1;
4527
+ return {
4528
+ width: Math.max(1, Math.round(naturalWidth * fractionW * scale)),
4529
+ height: Math.max(1, Math.round(naturalHeight * fractionH * scale))
4530
+ };
4531
+ }
4532
+ function clamp(value, min, max) {
4533
+ return Math.min(Math.max(value, min), max);
4534
+ }
4535
+ function round6(n) {
4536
+ return Math.round(n * 1e6) / 1e6;
4537
+ }
4538
+ function tidy(crop) {
4539
+ return { x: round6(crop.x), y: round6(crop.y), w: round6(crop.w), h: round6(crop.h) };
4540
+ }
4541
+ function sameCrop(a3, b3) {
4542
+ if (a3 == null || b3 == null) return a3 == null && b3 == null;
4543
+ return a3.x === b3.x && a3.y === b3.y && a3.w === b3.w && a3.h === b3.h;
4544
+ }
4545
+ function setImageCropAtPos(editor, pos, crop, metrics) {
4546
+ const node = editor.state.doc.nodeAt(pos);
4547
+ if (!node || node.type.name !== "image") return false;
4548
+ const next = normalizeImageCrop(crop);
4549
+ const current = normalizeImageCrop(node.attrs.crop);
4550
+ const sized = metrics ? croppedDisplaySize({ ...metrics, from: current, to: next }) : null;
4551
+ const width = (sized == null ? void 0 : sized.width) ?? node.attrs.width;
4552
+ const height = (sized == null ? void 0 : sized.height) ?? node.attrs.height;
4553
+ if (sameCrop(current, next) && width === node.attrs.width && height === node.attrs.height) {
4554
+ return true;
4555
+ }
4556
+ let tr = editor.state.tr.setNodeAttribute(pos, "crop", next);
4557
+ if (sized && sized.width !== node.attrs.width) {
4558
+ tr = tr.setNodeAttribute(pos, "width", sized.width);
4559
+ }
4560
+ if (sized && sized.height !== node.attrs.height) {
4561
+ tr = tr.setNodeAttribute(pos, "height", sized.height);
4562
+ }
4563
+ editor.view.dispatch(tr);
4564
+ return true;
4565
+ }
4566
+ function setImageCrop(editor, crop, metrics) {
4567
+ const pos = findImagePos(editor);
4568
+ if (pos == null) return false;
4569
+ return setImageCropAtPos(editor, pos, crop, metrics);
4570
+ }
4571
+ const surface = "_surface_1ihfb_3";
4572
+ const dim = "_dim_1ihfb_11";
4573
+ const box = "_box_1ihfb_18";
4574
+ const grid = "_grid_1ihfb_25";
4575
+ const handle$1 = "_handle_1ihfb_34";
4576
+ const styles$4 = {
4577
+ surface,
4578
+ dim,
4579
+ box,
4580
+ grid,
4581
+ handle: handle$1
4582
+ };
4583
+ const HANDLES = ["nw", "n", "ne", "e", "se", "s", "sw", "w"];
4584
+ const FULL = { x: 0, y: 0, w: 1, h: 1 };
4585
+ function isHandle(value) {
4586
+ return !!value && HANDLES.includes(value);
4587
+ }
4588
+ const ImageCropStage = forwardRef(
4589
+ function ImageCropStage2({ overlay, crop, label, onApply, onCancel }, ref) {
4590
+ const dragRef = useRef(null);
4591
+ const [draft, setDraft] = useState(crop ?? FULL);
4592
+ const draftRef = useRef(draft);
4593
+ draftRef.current = draft;
4594
+ useImperativeHandle(ref, () => ({
4595
+ apply() {
4596
+ onApply(draftRef.current);
4597
+ }
4598
+ }));
4599
+ const pointOf = (event) => {
4600
+ const rect = overlay.getBoundingClientRect();
4601
+ if (rect.width < 1 || rect.height < 1) return null;
4602
+ return {
4603
+ x: (event.clientX - rect.left) / rect.width,
4604
+ y: (event.clientY - rect.top) / rect.height
4605
+ };
4606
+ };
4607
+ const onPointerDown = (event) => {
4608
+ var _a, _b, _c, _d;
4609
+ event.preventDefault();
4610
+ event.stopPropagation();
4611
+ const point = pointOf(event);
4612
+ if (!point) return;
4613
+ const handle2 = (_a = event.target) == null ? void 0 : _a.dataset.cropHandle;
4614
+ const onBox = (_b = event.target) == null ? void 0 : _b.closest("[data-crop-box]");
4615
+ if (!isHandle(handle2) && !onBox) return;
4616
+ (_d = (_c = event.currentTarget).setPointerCapture) == null ? void 0 : _d.call(_c, event.pointerId);
4617
+ dragRef.current = {
4618
+ mode: isHandle(handle2) ? handle2 : "move",
4619
+ start: draft,
4620
+ pointerX: point.x,
4621
+ pointerY: point.y
4622
+ };
4623
+ };
4624
+ const onPointerMove = (event) => {
4625
+ const drag = dragRef.current;
4626
+ const point = pointOf(event);
4627
+ if (!drag || !point) return;
4628
+ const dx = point.x - drag.pointerX;
4629
+ const dy = point.y - drag.pointerY;
4630
+ setDraft(
4631
+ drag.mode === "move" ? moveCrop(drag.start, dx, dy) : resizeCrop(drag.start, drag.mode, dx, dy)
4632
+ );
4633
+ };
4634
+ const endDrag = () => {
4635
+ dragRef.current = null;
4636
+ };
4637
+ useEffect(() => {
4638
+ const onKey = (event) => {
4639
+ if (event.key !== "Escape") return;
4640
+ event.preventDefault();
4641
+ event.stopPropagation();
4642
+ onCancel();
4643
+ };
4644
+ document.addEventListener("keydown", onKey, true);
4645
+ return () => document.removeEventListener("keydown", onKey, true);
4646
+ }, [onCancel]);
4647
+ return createPortal(
4648
+ /* @__PURE__ */ jsxs(
4649
+ "div",
4650
+ {
4651
+ className: styles$4.surface,
4652
+ role: "application",
4653
+ "aria-label": label,
4654
+ onPointerDown,
4655
+ onPointerMove,
4656
+ onPointerUp: endDrag,
4657
+ onPointerCancel: endDrag,
4658
+ children: [
4659
+ /* @__PURE__ */ jsx(
4660
+ "div",
4661
+ {
4662
+ className: styles$4.dim,
4663
+ style: { top: 0, left: 0, right: 0, height: `${draft.y * 100}%` }
4664
+ }
4665
+ ),
4666
+ /* @__PURE__ */ jsx(
4667
+ "div",
4668
+ {
4669
+ className: styles$4.dim,
4670
+ style: {
4671
+ left: 0,
4672
+ right: 0,
4673
+ bottom: 0,
4674
+ height: `${(1 - draft.y - draft.h) * 100}%`
4675
+ }
4676
+ }
4677
+ ),
4678
+ /* @__PURE__ */ jsx(
4679
+ "div",
4680
+ {
4681
+ className: styles$4.dim,
4682
+ style: {
4683
+ top: `${draft.y * 100}%`,
4684
+ left: 0,
4685
+ width: `${draft.x * 100}%`,
4686
+ height: `${draft.h * 100}%`
4687
+ }
4688
+ }
4689
+ ),
4690
+ /* @__PURE__ */ jsx(
4691
+ "div",
4692
+ {
4693
+ className: styles$4.dim,
4694
+ style: {
4695
+ top: `${draft.y * 100}%`,
4696
+ right: 0,
4697
+ width: `${(1 - draft.x - draft.w) * 100}%`,
4698
+ height: `${draft.h * 100}%`
4699
+ }
4700
+ }
4701
+ ),
4702
+ /* @__PURE__ */ jsxs(
4703
+ "div",
4704
+ {
4705
+ className: styles$4.box,
4706
+ "data-crop-box": "",
4707
+ style: {
4708
+ left: `${draft.x * 100}%`,
4709
+ top: `${draft.y * 100}%`,
4710
+ width: `${draft.w * 100}%`,
4711
+ height: `${draft.h * 100}%`
4712
+ },
4713
+ children: [
4714
+ /* @__PURE__ */ jsx("div", { className: styles$4.grid }),
4715
+ HANDLES.map((handle2) => /* @__PURE__ */ jsx(
4716
+ "span",
4717
+ {
4718
+ className: styles$4.handle,
4719
+ "data-crop-handle": handle2
4720
+ },
4721
+ handle2
4722
+ ))
4723
+ ]
4724
+ }
4725
+ )
4726
+ ]
4727
+ }
4728
+ ),
4729
+ overlay
4730
+ );
4731
+ }
4732
+ );
4733
+ const bar = "_bar_1gju7_7";
4734
+ const divider$1 = "_divider_1gju7_24";
4735
+ const captionRow = "_captionRow_1gju7_13";
4736
+ const captionInput = "_captionInput_1gju7_40";
4737
+ const btn$1 = "_btn_1gju7_58";
4738
+ const btnActive = "_btnActive_1gju7_76";
4739
+ const btnApply = "_btnApply_1gju7_86";
4580
4740
  const styles$3 = {
4581
4741
  bar,
4582
4742
  divider: divider$1,
4583
4743
  captionRow,
4584
4744
  captionInput,
4585
4745
  btn: btn$1,
4586
- btnActive
4746
+ btnActive,
4747
+ btnApply
4587
4748
  };
4588
4749
  const TOOLBAR_HEIGHT = 34;
4589
4750
  const TOOLBAR_GAP = 8;
@@ -4604,7 +4765,8 @@ function measureImage(editor, img) {
4604
4765
  }
4605
4766
  const node = editor.state.doc.nodeAt(pos);
4606
4767
  if (!node || node.type.name !== "image") return null;
4607
- const rect = img.getBoundingClientRect();
4768
+ const frame = img.closest(".tmr-image-crop");
4769
+ const rect = (frame instanceof HTMLElement ? frame : img).getBoundingClientRect();
4608
4770
  return {
4609
4771
  pos,
4610
4772
  img,
@@ -4621,11 +4783,19 @@ function ImageAlignTools({ editor, labels }) {
4621
4783
  const [captionDraft, setCaptionDraft] = useState(null);
4622
4784
  const captionDraftRef = useRef(null);
4623
4785
  captionDraftRef.current = captionDraft;
4786
+ const [cropping, setCropping] = useState(false);
4787
+ const cropOpenRef = useRef(false);
4788
+ cropOpenRef.current = cropping;
4789
+ const cropSessionRef = useRef(null);
4790
+ const cropStageRef = useRef(null);
4791
+ const [cropOverlay, setCropOverlay] = useState(null);
4624
4792
  const clearHover = useCallback(() => {
4625
4793
  if (!hoverRef.current) return;
4626
4794
  hoverRef.current = null;
4627
4795
  setHover(null);
4628
4796
  setCaptionDraft(null);
4797
+ cropOpenRef.current = false;
4798
+ setCropping(false);
4629
4799
  }, []);
4630
4800
  const remeasureHover = useCallback(() => {
4631
4801
  const current = hoverRef.current;
@@ -4651,9 +4821,10 @@ function ImageAlignTools({ editor, labels }) {
4651
4821
  cancelPendingClear();
4652
4822
  return;
4653
4823
  }
4654
- const img = target && editor.view.dom.contains(target) ? target.closest("img") : null;
4824
+ const cropHost = target && editor.view.dom.contains(target) ? target.closest(".tmr-image-crop") : null;
4825
+ const img = target && editor.view.dom.contains(target) ? cropHost instanceof HTMLElement ? cropHost.querySelector("img") : target.closest("img") : null;
4655
4826
  if (!img) {
4656
- if (captionDraftRef.current !== null) return;
4827
+ if (captionDraftRef.current !== null || cropOpenRef.current) return;
4657
4828
  if (hoverRef.current && clearTimerRef.current === null) {
4658
4829
  clearTimerRef.current = setTimeout(() => {
4659
4830
  clearTimerRef.current = null;
@@ -4664,6 +4835,7 @@ function ImageAlignTools({ editor, labels }) {
4664
4835
  }
4665
4836
  cancelPendingClear();
4666
4837
  if (((_b = hoverRef.current) == null ? void 0 : _b.img) === img) return;
4838
+ setCropping(false);
4667
4839
  const next = measureImage(editor, img);
4668
4840
  hoverRef.current = next;
4669
4841
  setHover(next);
@@ -4691,12 +4863,34 @@ function ImageAlignTools({ editor, labels }) {
4691
4863
  editor.off("update", onUpdate);
4692
4864
  };
4693
4865
  }, [editor, remeasureHover]);
4866
+ useEffect(() => {
4867
+ var _a2;
4868
+ if (!cropping) return;
4869
+ const current = hoverRef.current;
4870
+ if (!current) return;
4871
+ const dom = editor.view.nodeDOM(current.pos);
4872
+ const img = dom instanceof HTMLImageElement ? dom : dom instanceof HTMLElement ? dom.querySelector("img") : null;
4873
+ if (!(img instanceof HTMLImageElement)) return;
4874
+ const crop2 = normalizeImageCrop(
4875
+ (_a2 = editor.state.doc.nodeAt(current.pos)) == null ? void 0 : _a2.attrs.crop
4876
+ );
4877
+ const session = openCropSurface(img, crop2);
4878
+ cropSessionRef.current = session;
4879
+ setCropOverlay(session.overlay);
4880
+ remeasureHover();
4881
+ return () => {
4882
+ session.restore();
4883
+ if (cropSessionRef.current === session) cropSessionRef.current = null;
4884
+ setCropOverlay(null);
4885
+ };
4886
+ }, [cropping, editor, remeasureHover]);
4694
4887
  if (typeof document === "undefined") return null;
4695
4888
  if (!hover || !editor.isEditable) return null;
4696
4889
  const above = hover.top - TOOLBAR_HEIGHT - TOOLBAR_GAP >= 8;
4697
4890
  const nodeAttrs = (_a = editor.state.doc.nodeAt(hover.pos)) == null ? void 0 : _a.attrs;
4698
4891
  const active = normalizeImageAlign(nodeAttrs == null ? void 0 : nodeAttrs.align);
4699
4892
  const caption = normalizeImageCaption(nodeAttrs == null ? void 0 : nodeAttrs.caption);
4893
+ const crop = normalizeImageCrop(nodeAttrs == null ? void 0 : nodeAttrs.crop);
4700
4894
  const labelOf = {
4701
4895
  left: labels.imageAlignLeft,
4702
4896
  center: labels.imageAlignCenter,
@@ -4708,6 +4902,25 @@ function ImageAlignTools({ editor, labels }) {
4708
4902
  setCaptionDraft(null);
4709
4903
  remeasureHover();
4710
4904
  };
4905
+ const commitCrop = (next) => {
4906
+ const pos = hover.pos;
4907
+ const session = cropSessionRef.current;
4908
+ const dom = editor.view.nodeDOM(pos);
4909
+ const img = dom instanceof HTMLImageElement ? dom : dom instanceof HTMLElement ? dom.querySelector("img") : null;
4910
+ const naturalWidth = (img == null ? void 0 : img.naturalWidth) ?? 0;
4911
+ const naturalHeight = (img == null ? void 0 : img.naturalHeight) ?? 0;
4912
+ const attrWidth = Number(nodeAttrs == null ? void 0 : nodeAttrs.width);
4913
+ const displayWidth = (session && session.displayWidth > 0 ? session.displayWidth : 0) || (Number.isFinite(attrWidth) && attrWidth > 0 ? attrWidth : 0) || naturalWidth;
4914
+ session == null ? void 0 : session.discard();
4915
+ setImageCropAtPos(
4916
+ editor,
4917
+ pos,
4918
+ next,
4919
+ naturalWidth > 0 && naturalHeight > 0 && displayWidth > 0 ? { naturalWidth, naturalHeight, displayWidth } : null
4920
+ );
4921
+ setCropping(false);
4922
+ remeasureHover();
4923
+ };
4711
4924
  return createPortal(
4712
4925
  /* @__PURE__ */ jsxs(
4713
4926
  "div",
@@ -4747,6 +4960,25 @@ function ImageAlignTools({ editor, labels }) {
4747
4960
  );
4748
4961
  }),
4749
4962
  /* @__PURE__ */ jsx("span", { className: styles$3.divider, "aria-hidden": true }),
4963
+ /* @__PURE__ */ jsx(
4964
+ "button",
4965
+ {
4966
+ type: "button",
4967
+ "data-image-align-action": "crop",
4968
+ className: `${styles$3.btn} ${crop || cropping ? styles$3.btnActive : ""}`,
4969
+ title: labels.imageCrop,
4970
+ "aria-label": labels.imageCrop,
4971
+ "aria-pressed": !!crop || cropping,
4972
+ onClick: () => {
4973
+ setCaptionDraft(null);
4974
+ setCropping((open) => {
4975
+ cropOpenRef.current = !open;
4976
+ return !open;
4977
+ });
4978
+ },
4979
+ children: /* @__PURE__ */ jsx(CropIcon, { size: 14 })
4980
+ }
4981
+ ),
4750
4982
  /* @__PURE__ */ jsx(
4751
4983
  "button",
4752
4984
  {
@@ -4758,11 +4990,72 @@ function ImageAlignTools({ editor, labels }) {
4758
4990
  "aria-pressed": !!caption,
4759
4991
  onClick: () => {
4760
4992
  if (captionDraftRef.current !== null) return;
4993
+ cropOpenRef.current = false;
4994
+ setCropping(false);
4761
4995
  setCaptionDraft(caption ?? "");
4762
4996
  },
4763
4997
  children: /* @__PURE__ */ jsx(CaptionsIcon, { size: 14 })
4764
4998
  }
4765
4999
  ),
5000
+ cropping ? null : /* @__PURE__ */ jsx(
5001
+ "button",
5002
+ {
5003
+ type: "button",
5004
+ "data-image-align-action": "preview",
5005
+ className: styles$3.btn,
5006
+ title: labels.imagePreview,
5007
+ "aria-label": labels.imagePreview,
5008
+ onClick: () => {
5009
+ const dom = editor.view.nodeDOM(hover.pos);
5010
+ const img = dom instanceof HTMLImageElement ? dom : dom instanceof HTMLElement ? dom.querySelector("img") : null;
5011
+ if (img instanceof HTMLImageElement) requestImagePreview(img);
5012
+ },
5013
+ children: /* @__PURE__ */ jsx(ExpandIcon, { size: 14 })
5014
+ }
5015
+ ),
5016
+ cropping ? /* @__PURE__ */ jsxs(Fragment$2, { children: [
5017
+ /* @__PURE__ */ jsx("span", { className: styles$3.divider, "aria-hidden": true }),
5018
+ /* @__PURE__ */ jsx(
5019
+ "button",
5020
+ {
5021
+ type: "button",
5022
+ className: styles$3.btn,
5023
+ "data-image-crop-reset": "",
5024
+ title: labels.imageCropReset,
5025
+ "aria-label": labels.imageCropReset,
5026
+ disabled: !crop,
5027
+ onClick: () => commitCrop(null),
5028
+ children: /* @__PURE__ */ jsx(RotateCcwIcon, { size: 14 })
5029
+ }
5030
+ ),
5031
+ /* @__PURE__ */ jsx(
5032
+ "button",
5033
+ {
5034
+ type: "button",
5035
+ className: styles$3.btn,
5036
+ "data-image-crop-cancel": "",
5037
+ title: labels.imageCropCancel,
5038
+ "aria-label": labels.imageCropCancel,
5039
+ onClick: () => setCropping(false),
5040
+ children: /* @__PURE__ */ jsx(XIcon, { size: 14 })
5041
+ }
5042
+ ),
5043
+ /* @__PURE__ */ jsx(
5044
+ "button",
5045
+ {
5046
+ type: "button",
5047
+ className: `${styles$3.btn} ${styles$3.btnApply}`,
5048
+ "data-image-crop-apply": "",
5049
+ title: labels.imageCropApply,
5050
+ "aria-label": labels.imageCropApply,
5051
+ onClick: () => {
5052
+ var _a2;
5053
+ return (_a2 = cropStageRef.current) == null ? void 0 : _a2.apply();
5054
+ },
5055
+ children: /* @__PURE__ */ jsx(CheckIcon, { size: 14 })
5056
+ }
5057
+ )
5058
+ ] }) : null,
4766
5059
  captionDraft !== null ? /* @__PURE__ */ jsx("div", { className: styles$3.captionRow, children: /* @__PURE__ */ jsx(
4767
5060
  "input",
4768
5061
  {
@@ -4779,7 +5072,18 @@ function ImageAlignTools({ editor, labels }) {
4779
5072
  },
4780
5073
  onBlur: commitCaption
4781
5074
  }
4782
- ) }) : null
5075
+ ) }) : null,
5076
+ cropOverlay ? /* @__PURE__ */ jsx(
5077
+ ImageCropStage,
5078
+ {
5079
+ ref: cropStageRef,
5080
+ overlay: cropOverlay,
5081
+ crop,
5082
+ label: labels.imageCrop,
5083
+ onApply: commitCrop,
5084
+ onCancel: () => setCropping(false)
5085
+ }
5086
+ ) : null
4783
5087
  ]
4784
5088
  }
4785
5089
  ),
@@ -5768,7 +6072,7 @@ function MathEditorPopover({
5768
6072
  "textarea",
5769
6073
  {
5770
6074
  ref: inputRef,
5771
- className: styles$5.mathInput,
6075
+ className: styles$6.mathInput,
5772
6076
  value: draft,
5773
6077
  placeholder,
5774
6078
  rows: Math.max(3, draft.split("\n").length),
@@ -5780,7 +6084,7 @@ function MathEditorPopover({
5780
6084
  "input",
5781
6085
  {
5782
6086
  ref: inputRef,
5783
- className: styles$5.mathInput,
6087
+ className: styles$6.mathInput,
5784
6088
  value: draft,
5785
6089
  placeholder,
5786
6090
  "aria-labelledby": titleId,
@@ -5794,7 +6098,7 @@ function MathEditorPopover({
5794
6098
  "div",
5795
6099
  {
5796
6100
  ref: rootRef,
5797
- className: styles$5.mathLayer,
6101
+ className: styles$6.mathLayer,
5798
6102
  style: layerStyle,
5799
6103
  role: "dialog",
5800
6104
  "aria-modal": "false",
@@ -5802,15 +6106,15 @@ function MathEditorPopover({
5802
6106
  children: /* @__PURE__ */ jsxs(
5803
6107
  "div",
5804
6108
  {
5805
- className: isBlock ? `${styles$5.mathStack} ${styles$5.mathStackBlock}` : styles$5.mathStack,
6109
+ className: isBlock ? `${styles$6.mathStack} ${styles$6.mathStackBlock}` : styles$6.mathStack,
5806
6110
  children: [
5807
6111
  showHint ? /* @__PURE__ */ jsxs(
5808
6112
  "div",
5809
6113
  {
5810
6114
  id: titleId,
5811
- className: isBlock ? `${styles$5.mathHint} ${styles$5.mathHintBlock}` : styles$5.mathHint,
6115
+ className: isBlock ? `${styles$6.mathHint} ${styles$6.mathHintBlock}` : styles$6.mathHint,
5812
6116
  children: [
5813
- /* @__PURE__ */ jsx("span", { className: styles$5.mathHintIcon, "aria-hidden": true, children: isBlock ? "TeX" : "√x" }),
6117
+ /* @__PURE__ */ jsx("span", { className: styles$6.mathHintIcon, "aria-hidden": true, children: isBlock ? "TeX" : "√x" }),
5814
6118
  newLabel
5815
6119
  ]
5816
6120
  }
@@ -5819,20 +6123,20 @@ function MathEditorPopover({
5819
6123
  "div",
5820
6124
  {
5821
6125
  id: showHint ? void 0 : titleId,
5822
- className: isBlock ? `${styles$5.mathField} ${styles$5.mathFieldBlock}` : styles$5.mathField,
6126
+ className: isBlock ? `${styles$6.mathField} ${styles$6.mathFieldBlock}` : styles$6.mathField,
5823
6127
  children: [
5824
6128
  field2,
5825
6129
  /* @__PURE__ */ jsxs(
5826
6130
  "button",
5827
6131
  {
5828
6132
  type: "button",
5829
- className: styles$5.mathDone,
6133
+ className: styles$6.mathDone,
5830
6134
  disabled: !canSubmit,
5831
6135
  title: isBlock ? `${doneLabel} (⌘/Ctrl+Enter)` : `${doneLabel} (Enter)`,
5832
6136
  onClick: submit,
5833
6137
  children: [
5834
6138
  doneLabel,
5835
- /* @__PURE__ */ jsx("span", { className: styles$5.mathDoneKbd, "aria-hidden": true, children: "↵" })
6139
+ /* @__PURE__ */ jsx("span", { className: styles$6.mathDoneKbd, "aria-hidden": true, children: "↵" })
5836
6140
  ]
5837
6141
  }
5838
6142
  )
@@ -5859,7 +6163,7 @@ const ToolbarButton = forwardRef(function ToolbarButton2({ title, active, disabl
5859
6163
  "aria-pressed": active,
5860
6164
  "aria-busy": busy,
5861
6165
  disabled,
5862
- className: `${styles$5.btn} ${active ? styles$5.btnActive : ""}${className ? ` ${className}` : ""}`,
6166
+ className: `${styles$6.btn} ${active ? styles$6.btnActive : ""}${className ? ` ${className}` : ""}`,
5863
6167
  onMouseDown: (e2) => e2.preventDefault(),
5864
6168
  onClick,
5865
6169
  children
@@ -5867,7 +6171,7 @@ const ToolbarButton = forwardRef(function ToolbarButton2({ title, active, disabl
5867
6171
  );
5868
6172
  });
5869
6173
  function Divider() {
5870
- return /* @__PURE__ */ jsx("span", { className: styles$5.divider, "aria-hidden": true });
6174
+ return /* @__PURE__ */ jsx("span", { className: styles$6.divider, "aria-hidden": true });
5871
6175
  }
5872
6176
  const LINE_HEIGHTS = ["1", "1.15", "1.5", "2", "2.5", "3"];
5873
6177
  function readParaAttr(editor, name) {
@@ -5888,7 +6192,7 @@ function MenuPopover({
5888
6192
  /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(
5889
6193
  Popover.Content,
5890
6194
  {
5891
- className: contentClassName ? `${styles$5.menu} ${contentClassName}` : styles$5.menu,
6195
+ className: contentClassName ? `${styles$6.menu} ${contentClassName}` : styles$6.menu,
5892
6196
  sideOffset: 4,
5893
6197
  align,
5894
6198
  onOpenAutoFocus: (e2) => e2.preventDefault(),
@@ -5910,7 +6214,7 @@ function MenuItem({
5910
6214
  {
5911
6215
  type: "button",
5912
6216
  disabled,
5913
- className: `${styles$5.menuItem} ${selected ? styles$5.menuItemSelected : ""}`,
6217
+ className: `${styles$6.menuItem} ${selected ? styles$6.menuItemSelected : ""}`,
5914
6218
  onMouseDown: (e2) => e2.preventDefault(),
5915
6219
  onClick: () => {
5916
6220
  onSelect();
@@ -5925,7 +6229,7 @@ function NumberingFormatGrid({
5925
6229
  onSelect
5926
6230
  }) {
5927
6231
  const close = useContext(MenuCloseCtx);
5928
- return /* @__PURE__ */ jsx("div", { className: styles$5.numberingGrid, role: "group", "aria-label": "Numbering formats", children: NUMBERING_FORMAT_IDS.map((format) => {
6232
+ return /* @__PURE__ */ jsx("div", { className: styles$6.numberingGrid, role: "group", "aria-label": "Numbering formats", children: NUMBERING_FORMAT_IDS.map((format) => {
5929
6233
  const active = current === format;
5930
6234
  return /* @__PURE__ */ jsx(
5931
6235
  "button",
@@ -5934,20 +6238,20 @@ function NumberingFormatGrid({
5934
6238
  role: "menuitem",
5935
6239
  "aria-label": NUMBERING_FORMAT_LABELS[format],
5936
6240
  "aria-pressed": active,
5937
- className: `${styles$5.numberingOption}${active ? ` ${styles$5.numberingOptionActive}` : ""}`,
6241
+ className: `${styles$6.numberingOption}${active ? ` ${styles$6.numberingOptionActive}` : ""}`,
5938
6242
  onMouseDown: (e2) => e2.preventDefault(),
5939
6243
  onClick: () => {
5940
6244
  onSelect(format);
5941
6245
  close();
5942
6246
  },
5943
- children: /* @__PURE__ */ jsx("span", { className: styles$5.numberingPreview, children: NUMBERING_FORMAT_PREVIEWS[format].map((row2, index) => /* @__PURE__ */ jsxs(
6247
+ children: /* @__PURE__ */ jsx("span", { className: styles$6.numberingPreview, children: NUMBERING_FORMAT_PREVIEWS[format].map((row2, index) => /* @__PURE__ */ jsxs(
5944
6248
  "span",
5945
6249
  {
5946
- className: styles$5.numberingPreviewRow,
6250
+ className: styles$6.numberingPreviewRow,
5947
6251
  "data-depth": row2.depth,
5948
6252
  children: [
5949
- /* @__PURE__ */ jsx("span", { className: styles$5.numberingPreviewMarker, children: row2.marker }),
5950
- /* @__PURE__ */ jsx("span", { className: styles$5.numberingPreviewLine })
6253
+ /* @__PURE__ */ jsx("span", { className: styles$6.numberingPreviewMarker, children: row2.marker }),
6254
+ /* @__PURE__ */ jsx("span", { className: styles$6.numberingPreviewLine })
5951
6255
  ]
5952
6256
  },
5953
6257
  `${format}-${index}`
@@ -5982,21 +6286,21 @@ function TableInsertItem({
5982
6286
  {
5983
6287
  type: "button",
5984
6288
  disabled,
5985
- className: `${styles$5.menuItem} ${open ? styles$5.menuItemSelected : ""}`,
6289
+ className: `${styles$6.menuItem} ${open ? styles$6.menuItemSelected : ""}`,
5986
6290
  onMouseDown: (e2) => e2.preventDefault(),
5987
6291
  children: [
5988
- /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
5989
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "⊞" }),
6292
+ /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6293
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "⊞" }),
5990
6294
  labels.tableInsert
5991
6295
  ] }),
5992
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$5.tableInsertCaret })
6296
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.tableInsertCaret })
5993
6297
  ]
5994
6298
  }
5995
6299
  ) }),
5996
6300
  /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsxs(
5997
6301
  Popover.Content,
5998
6302
  {
5999
- className: styles$5.tableSizePicker,
6303
+ className: styles$6.tableSizePicker,
6000
6304
  side: "right",
6001
6305
  align: "start",
6002
6306
  sideOffset: 6,
@@ -6006,7 +6310,7 @@ function TableInsertItem({
6006
6310
  /* @__PURE__ */ jsx(
6007
6311
  "div",
6008
6312
  {
6009
- className: styles$5.tableSizeGrid,
6313
+ className: styles$6.tableSizeGrid,
6010
6314
  style: {
6011
6315
  gridTemplateColumns: `repeat(${TABLE_PICKER_COLS}, 1fr)`
6012
6316
  },
@@ -6020,7 +6324,7 @@ function TableInsertItem({
6020
6324
  {
6021
6325
  type: "button",
6022
6326
  "aria-label": labels.tableSizeSelected(col, row2),
6023
- className: `${styles$5.tableSizeCell} ${active ? styles$5.tableSizeCellActive : ""}`,
6327
+ className: `${styles$6.tableSizeCell} ${active ? styles$6.tableSizeCellActive : ""}`,
6024
6328
  onMouseDown: (e2) => e2.preventDefault(),
6025
6329
  onMouseEnter: () => setHover({ cols: col, rows: row2 }),
6026
6330
  onClick: () => {
@@ -6035,7 +6339,7 @@ function TableInsertItem({
6035
6339
  })
6036
6340
  }
6037
6341
  ),
6038
- /* @__PURE__ */ jsx("div", { className: styles$5.tableSizeLabel, children: hover.cols > 0 ? labels.tableSizeSelected(hover.cols, hover.rows) : labels.tableInsert })
6342
+ /* @__PURE__ */ jsx("div", { className: styles$6.tableSizeLabel, children: hover.cols > 0 ? labels.tableSizeSelected(hover.cols, hover.rows) : labels.tableInsert })
6039
6343
  ]
6040
6344
  }
6041
6345
  ) })
@@ -6057,20 +6361,20 @@ function ColorPopover({
6057
6361
  "button",
6058
6362
  {
6059
6363
  type: "button",
6060
- className: styles$5.btn,
6364
+ className: styles$6.btn,
6061
6365
  title,
6062
6366
  "aria-label": title,
6063
6367
  onMouseDown: (e2) => e2.preventDefault(),
6064
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.colorIcon, children: [
6065
- /* @__PURE__ */ jsx("span", { className: styles$5.colorIconGlyph, children: glyph }),
6066
- /* @__PURE__ */ jsx("span", { className: styles$5.colorIconBar, style: { background: bar2 } })
6368
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.colorIcon, children: [
6369
+ /* @__PURE__ */ jsx("span", { className: styles$6.colorIconGlyph, children: glyph }),
6370
+ /* @__PURE__ */ jsx("span", { className: styles$6.colorIconBar, style: { background: bar2 } })
6067
6371
  ] })
6068
6372
  }
6069
6373
  ) }),
6070
6374
  /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(
6071
6375
  Popover.Content,
6072
6376
  {
6073
- className: styles$5.popoverContent,
6377
+ className: styles$6.popoverContent,
6074
6378
  sideOffset: 4,
6075
6379
  align: "start",
6076
6380
  onOpenAutoFocus: (e2) => e2.preventDefault(),
@@ -6336,8 +6640,8 @@ function EditorToolbar({
6336
6640
  /* @__PURE__ */ jsx(
6337
6641
  "div",
6338
6642
  {
6339
- className: className ? `${styles$5.toolbar} ${className}` : styles$5.toolbar,
6340
- children: /* @__PURE__ */ jsxs("div", { className: styles$5.inner, children: [
6643
+ className: className ? `${styles$6.toolbar} ${className}` : styles$6.toolbar,
6644
+ children: /* @__PURE__ */ jsxs("div", { className: styles$6.inner, children: [
6341
6645
  /* @__PURE__ */ jsx(
6342
6646
  ToolbarButton,
6343
6647
  {
@@ -6364,12 +6668,12 @@ function EditorToolbar({
6364
6668
  "button",
6365
6669
  {
6366
6670
  type: "button",
6367
- className: styles$5.styleTrigger,
6671
+ className: styles$6.styleTrigger,
6368
6672
  title: t.style,
6369
6673
  onMouseDown: (e2) => e2.preventDefault(),
6370
6674
  children: [
6371
- /* @__PURE__ */ jsx("span", { className: styles$5.styleTriggerLabel, children: t.style }),
6372
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$5.styleTriggerCaret })
6675
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleTriggerLabel, children: t.style }),
6676
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6373
6677
  ]
6374
6678
  }
6375
6679
  ),
@@ -6379,8 +6683,8 @@ function EditorToolbar({
6379
6683
  {
6380
6684
  selected: (state.headingLevel ?? 0) === 0,
6381
6685
  onSelect: () => setBlockStyle(0),
6382
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6383
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "¶" }),
6686
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6687
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "¶" }),
6384
6688
  t.normalText
6385
6689
  ] })
6386
6690
  }
@@ -6390,8 +6694,8 @@ function EditorToolbar({
6390
6694
  {
6391
6695
  selected: state.headingLevel === lv,
6392
6696
  onSelect: () => setBlockStyle(lv),
6393
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6394
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: `H${lv}` }),
6697
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6698
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: `H${lv}` }),
6395
6699
  t.headingLabel(lv)
6396
6700
  ] })
6397
6701
  },
@@ -6407,14 +6711,14 @@ function EditorToolbar({
6407
6711
  "button",
6408
6712
  {
6409
6713
  type: "button",
6410
- className: styles$5.styleTrigger,
6714
+ className: styles$6.styleTrigger,
6411
6715
  title: t.fontSize,
6412
6716
  "aria-label": t.fontSize,
6413
6717
  disabled: !canEditFontSize,
6414
6718
  onMouseDown: (e2) => e2.preventDefault(),
6415
6719
  children: [
6416
- /* @__PURE__ */ jsx("span", { className: styles$5.styleTriggerLabel, children: state.fontSize || t.fontSize }),
6417
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$5.styleTriggerCaret })
6720
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleTriggerLabel, children: state.fontSize || t.fontSize }),
6721
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6418
6722
  ]
6419
6723
  }
6420
6724
  ),
@@ -6424,8 +6728,8 @@ function EditorToolbar({
6424
6728
  {
6425
6729
  selected: !state.fontSize,
6426
6730
  onSelect: () => applyFontSize(""),
6427
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6428
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "A" }),
6731
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6732
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "A" }),
6429
6733
  t.fontSizeDefault
6430
6734
  ] })
6431
6735
  }
@@ -6435,8 +6739,8 @@ function EditorToolbar({
6435
6739
  {
6436
6740
  selected: state.fontSize === size,
6437
6741
  onSelect: () => applyFontSize(size),
6438
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6439
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: parseInt(size, 10) }),
6742
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6743
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: parseInt(size, 10) }),
6440
6744
  size
6441
6745
  ] })
6442
6746
  },
@@ -6520,13 +6824,13 @@ function EditorToolbar({
6520
6824
  "button",
6521
6825
  {
6522
6826
  type: "button",
6523
- className: `${styles$5.scriptTrigger} ${scriptActive !== "normal" ? styles$5.btnActive : ""}`,
6827
+ className: `${styles$6.scriptTrigger} ${scriptActive !== "normal" ? styles$6.btnActive : ""}`,
6524
6828
  title: t.scriptMenu,
6525
6829
  "aria-label": t.scriptMenu,
6526
6830
  onMouseDown: (e2) => e2.preventDefault(),
6527
6831
  children: [
6528
- /* @__PURE__ */ jsx("span", { className: styles$5.scriptTriggerGlyph, children: "A" }),
6529
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$5.styleTriggerCaret })
6832
+ /* @__PURE__ */ jsx("span", { className: styles$6.scriptTriggerGlyph, children: "A" }),
6833
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6530
6834
  ]
6531
6835
  }
6532
6836
  ),
@@ -6536,8 +6840,8 @@ function EditorToolbar({
6536
6840
  {
6537
6841
  selected: scriptActive === "normal",
6538
6842
  onSelect: () => chain().unsetSuperscript().unsetSubscript().run(),
6539
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6540
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "A" }),
6843
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6844
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "A" }),
6541
6845
  t.scriptNormal
6542
6846
  ] })
6543
6847
  }
@@ -6547,8 +6851,8 @@ function EditorToolbar({
6547
6851
  {
6548
6852
  selected: scriptActive === "superscript",
6549
6853
  onSelect: () => chain().unsetSubscript().toggleSuperscript().run(),
6550
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6551
- /* @__PURE__ */ jsxs("span", { className: `${styles$5.styleIcon} ${styles$5.scriptGlyph}`, children: [
6854
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6855
+ /* @__PURE__ */ jsxs("span", { className: `${styles$6.styleIcon} ${styles$6.scriptGlyph}`, children: [
6552
6856
  "x",
6553
6857
  /* @__PURE__ */ jsx("sup", { children: "2" })
6554
6858
  ] }),
@@ -6561,8 +6865,8 @@ function EditorToolbar({
6561
6865
  {
6562
6866
  selected: scriptActive === "subscript",
6563
6867
  onSelect: () => chain().unsetSuperscript().toggleSubscript().run(),
6564
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6565
- /* @__PURE__ */ jsxs("span", { className: `${styles$5.styleIcon} ${styles$5.scriptGlyph}`, children: [
6868
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6869
+ /* @__PURE__ */ jsxs("span", { className: `${styles$6.styleIcon} ${styles$6.scriptGlyph}`, children: [
6566
6870
  "x",
6567
6871
  /* @__PURE__ */ jsx("sub", { children: "2" })
6568
6872
  ] }),
@@ -6602,19 +6906,19 @@ function EditorToolbar({
6602
6906
  "button",
6603
6907
  {
6604
6908
  type: "button",
6605
- className: styles$5.styleTrigger,
6909
+ className: styles$6.styleTrigger,
6606
6910
  title: importTitle,
6607
6911
  "aria-label": importTitle,
6608
6912
  "aria-busy": !!importing,
6609
6913
  disabled: !!importing,
6610
6914
  onMouseDown: (e2) => e2.preventDefault(),
6611
6915
  children: [
6612
- /* @__PURE__ */ jsx("span", { className: styles$5.styleTriggerLabel, children: t.importDocument }),
6916
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleTriggerLabel, children: t.importDocument }),
6613
6917
  /* @__PURE__ */ jsx(
6614
6918
  ChevronDownIcon,
6615
6919
  {
6616
6920
  size: 12,
6617
- className: styles$5.styleTriggerCaret
6921
+ className: styles$6.styleTriggerCaret
6618
6922
  }
6619
6923
  )
6620
6924
  ]
@@ -6636,7 +6940,7 @@ function EditorToolbar({
6636
6940
  title: t.blockquote,
6637
6941
  active: state.blockquote,
6638
6942
  onClick: () => chain().toggleBlockquote().run(),
6639
- children: /* @__PURE__ */ jsx("span", { className: styles$5.txtIcon, children: "❝" })
6943
+ children: /* @__PURE__ */ jsx("span", { className: styles$6.txtIcon, children: "❝" })
6640
6944
  }
6641
6945
  ),
6642
6946
  /* @__PURE__ */ jsx(
@@ -6660,13 +6964,13 @@ function EditorToolbar({
6660
6964
  "button",
6661
6965
  {
6662
6966
  type: "button",
6663
- className: `${styles$5.styleTrigger} ${styles$5.iconTrigger}`,
6967
+ className: `${styles$6.styleTrigger} ${styles$6.iconTrigger}`,
6664
6968
  title: t.align,
6665
6969
  "aria-label": t.align,
6666
6970
  onMouseDown: (e2) => e2.preventDefault(),
6667
6971
  children: [
6668
6972
  state.textAlign === "center" ? /* @__PURE__ */ jsx(AlignCenterIcon, {}) : state.textAlign === "right" ? /* @__PURE__ */ jsx(AlignRightIcon, {}) : state.textAlign === "justify" ? /* @__PURE__ */ jsx(AlignJustifyIcon, {}) : /* @__PURE__ */ jsx(AlignLeftIcon, {}),
6669
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$5.styleTriggerCaret })
6973
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6670
6974
  ]
6671
6975
  }
6672
6976
  ),
@@ -6680,8 +6984,8 @@ function EditorToolbar({
6680
6984
  {
6681
6985
  selected: state.textAlign === value,
6682
6986
  onSelect: () => chain().setTextAlign(value).run(),
6683
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6684
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: /* @__PURE__ */ jsx(Icon, { size: 14 }) }),
6987
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
6988
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: /* @__PURE__ */ jsx(Icon, { size: 14 }) }),
6685
6989
  label
6686
6990
  ] })
6687
6991
  },
@@ -6696,23 +7000,23 @@ function EditorToolbar({
6696
7000
  "button",
6697
7001
  {
6698
7002
  type: "button",
6699
- className: `${styles$5.styleTrigger} ${styles$5.iconTrigger}`,
7003
+ className: `${styles$6.styleTrigger} ${styles$6.iconTrigger}`,
6700
7004
  title: t.indent,
6701
7005
  "aria-label": t.indent,
6702
7006
  onMouseDown: (e2) => e2.preventDefault(),
6703
7007
  children: [
6704
7008
  /* @__PURE__ */ jsx(IndentIncreaseIcon, {}),
6705
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$5.styleTriggerCaret })
7009
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6706
7010
  ]
6707
7011
  }
6708
7012
  ),
6709
7013
  children: [
6710
- /* @__PURE__ */ jsx(MenuItem, { onSelect: () => chain().increaseIndent().run(), children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6711
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: /* @__PURE__ */ jsx(IndentIncreaseIcon, { size: 14 }) }),
7014
+ /* @__PURE__ */ jsx(MenuItem, { onSelect: () => chain().increaseIndent().run(), children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7015
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: /* @__PURE__ */ jsx(IndentIncreaseIcon, { size: 14 }) }),
6712
7016
  t.indentIncrease
6713
7017
  ] }) }),
6714
- /* @__PURE__ */ jsx(MenuItem, { onSelect: () => chain().decreaseIndent().run(), children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6715
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: /* @__PURE__ */ jsx(IndentDecreaseIcon, { size: 14 }) }),
7018
+ /* @__PURE__ */ jsx(MenuItem, { onSelect: () => chain().decreaseIndent().run(), children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7019
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: /* @__PURE__ */ jsx(IndentDecreaseIcon, { size: 14 }) }),
6716
7020
  t.indentDecrease
6717
7021
  ] }) })
6718
7022
  ]
@@ -6725,13 +7029,13 @@ function EditorToolbar({
6725
7029
  "button",
6726
7030
  {
6727
7031
  type: "button",
6728
- className: `${styles$5.styleTrigger} ${styles$5.iconTrigger}`,
7032
+ className: `${styles$6.styleTrigger} ${styles$6.iconTrigger}`,
6729
7033
  title: t.lineHeight,
6730
7034
  "aria-label": t.lineHeight,
6731
7035
  onMouseDown: (e2) => e2.preventDefault(),
6732
7036
  children: [
6733
7037
  /* @__PURE__ */ jsx(LineHeightIcon, {}),
6734
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$5.styleTriggerCaret })
7038
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6735
7039
  ]
6736
7040
  }
6737
7041
  ),
@@ -6741,8 +7045,8 @@ function EditorToolbar({
6741
7045
  {
6742
7046
  selected: !state.lineHeight,
6743
7047
  onSelect: () => chain().setLineHeight(null).run(),
6744
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6745
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "—" }),
7048
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7049
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "—" }),
6746
7050
  t.lineHeightDefault
6747
7051
  ] })
6748
7052
  }
@@ -6752,8 +7056,8 @@ function EditorToolbar({
6752
7056
  {
6753
7057
  selected: state.lineHeight === Number(value),
6754
7058
  onSelect: () => chain().setLineHeight(Number(value)).run(),
6755
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6756
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "≡" }),
7059
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7060
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "≡" }),
6757
7061
  value
6758
7062
  ] })
6759
7063
  },
@@ -6775,7 +7079,7 @@ function EditorToolbar({
6775
7079
  /* @__PURE__ */ jsxs(
6776
7080
  "span",
6777
7081
  {
6778
- className: `${styles$5.listSplit}${state.orderedList ? ` ${styles$5.listSplitActive}` : ""}`,
7082
+ className: `${styles$6.listSplit}${state.orderedList ? ` ${styles$6.listSplitActive}` : ""}`,
6779
7083
  children: [
6780
7084
  /* @__PURE__ */ jsx(
6781
7085
  ToolbarButton,
@@ -6790,12 +7094,12 @@ function EditorToolbar({
6790
7094
  MenuPopover,
6791
7095
  {
6792
7096
  align: "end",
6793
- contentClassName: styles$5.numberingMenu,
7097
+ contentClassName: styles$6.numberingMenu,
6794
7098
  trigger: /* @__PURE__ */ jsx(
6795
7099
  "button",
6796
7100
  {
6797
7101
  type: "button",
6798
- className: `${styles$5.numberingCaret}${state.numberingFormat ? ` ${styles$5.numberingCaretActive}` : ""}`,
7102
+ className: `${styles$6.numberingCaret}${state.numberingFormat ? ` ${styles$6.numberingCaretActive}` : ""}`,
6799
7103
  title: t.numberingFormat,
6800
7104
  "aria-label": t.numberingFormat,
6801
7105
  onMouseDown: (e2) => e2.preventDefault(),
@@ -6840,30 +7144,30 @@ function EditorToolbar({
6840
7144
  "button",
6841
7145
  {
6842
7146
  type: "button",
6843
- className: styles$5.styleTrigger,
7147
+ className: styles$6.styleTrigger,
6844
7148
  title: t.more,
6845
7149
  onMouseDown: (e2) => e2.preventDefault(),
6846
7150
  children: [
6847
- /* @__PURE__ */ jsx("span", { className: styles$5.styleTriggerLabel, children: t.more }),
6848
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$5.styleTriggerCaret })
7151
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleTriggerLabel, children: t.more }),
7152
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6849
7153
  ]
6850
7154
  }
6851
7155
  ),
6852
7156
  children: [
6853
- /* @__PURE__ */ jsx(MenuItem, { onSelect: () => chain().toggleCodeBlock().run(), children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6854
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "{ }" }),
7157
+ /* @__PURE__ */ jsx(MenuItem, { onSelect: () => chain().toggleCodeBlock().run(), children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7158
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "{ }" }),
6855
7159
  t.codeBlock
6856
7160
  ] }) }),
6857
- /* @__PURE__ */ jsx(MenuItem, { onSelect: () => openInsertMath("inline"), children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6858
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "√x" }),
7161
+ /* @__PURE__ */ jsx(MenuItem, { onSelect: () => openInsertMath("inline"), children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7162
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "√x" }),
6859
7163
  t.inlineMath
6860
7164
  ] }) }),
6861
- /* @__PURE__ */ jsx(MenuItem, { onSelect: () => openInsertMath("block"), children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6862
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "∑" }),
7165
+ /* @__PURE__ */ jsx(MenuItem, { onSelect: () => openInsertMath("block"), children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7166
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "∑" }),
6863
7167
  t.blockMath
6864
7168
  ] }) }),
6865
- /* @__PURE__ */ jsx(MenuItem, { onSelect: () => chain().setHorizontalRule().run(), children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6866
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: "—" }),
7169
+ /* @__PURE__ */ jsx(MenuItem, { onSelect: () => chain().setHorizontalRule().run(), children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7170
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: "—" }),
6867
7171
  t.hr
6868
7172
  ] }) }),
6869
7173
  /* @__PURE__ */ jsx(
@@ -6879,8 +7183,8 @@ function EditorToolbar({
6879
7183
  {
6880
7184
  disabled: item2.disabled,
6881
7185
  onSelect: () => item2.onSelect(editor),
6882
- children: /* @__PURE__ */ jsxs("span", { className: styles$5.styleItem, children: [
6883
- /* @__PURE__ */ jsx("span", { className: styles$5.styleIcon, children: item2.icon }),
7186
+ children: /* @__PURE__ */ jsxs("span", { className: styles$6.styleItem, children: [
7187
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleIcon, children: item2.icon }),
6884
7188
  item2.label
6885
7189
  ] })
6886
7190
  },
@@ -6924,7 +7228,7 @@ function EditorToolbar({
6924
7228
  function resetImageSize(editor) {
6925
7229
  const pos = findImagePos(editor);
6926
7230
  if (pos == null) return false;
6927
- return editor.chain().focus().setNodeSelection(pos).updateAttributes("image", { width: null, height: null }).run();
7231
+ return editor.chain().focus().setNodeSelection(pos).updateAttributes("image", { width: null, height: null, crop: null }).run();
6928
7232
  }
6929
7233
  const popoverAnchor = "_popoverAnchor_9y5t0_55";
6930
7234
  const popoverContent = "_popoverContent_9y5t0_62";
@@ -7104,6 +7408,8 @@ export {
7104
7408
  C as ChartMount,
7105
7409
  CheckIcon,
7106
7410
  ChevronDownIcon,
7411
+ a9 as ChevronLeftIcon,
7412
+ aa as ChevronRightIcon,
7107
7413
  ChevronUpIcon,
7108
7414
  ChevronsUpDownIcon,
7109
7415
  a as CitationInteractive,
@@ -7117,19 +7423,22 @@ export {
7117
7423
  CommentMark,
7118
7424
  CommentPopover,
7119
7425
  CopyIcon,
7426
+ CropIcon,
7120
7427
  DetailsIcon,
7121
7428
  DownloadIcon,
7122
7429
  EditorToolbar,
7123
7430
  EraserIcon,
7431
+ ExpandIcon,
7124
7432
  ExternalLinkIcon,
7125
7433
  FIND_DEBOUNCE_MS,
7126
7434
  default2 as FindAndReplace,
7127
7435
  FindReplaceBar,
7436
+ ab as FitIcon,
7128
7437
  GripIcon,
7129
7438
  ImageAlignTools,
7130
7439
  ImageIcon,
7131
7440
  ImageUploadNode,
7132
- ImportIcon,
7441
+ ac as ImportIcon,
7133
7442
  ImportPlaceholder,
7134
7443
  IndentDecreaseIcon,
7135
7444
  IndentIncreaseIcon,
@@ -7141,12 +7450,12 @@ export {
7141
7450
  ListChecksIcon,
7142
7451
  ListOrderedIcon,
7143
7452
  ListUnorderedIcon,
7144
- LockIcon,
7453
+ ad as LockIcon,
7145
7454
  MarkdownFileDrop,
7146
7455
  MarkdownPaste,
7147
7456
  MarkdownPreview,
7148
7457
  MarkdownWysiwygEditor,
7149
- MenuIcon,
7458
+ ae as MenuIcon,
7150
7459
  PENDING_ANCHOR_CLASS,
7151
7460
  P as ParagraphStyles,
7152
7461
  RedoIcon,
@@ -7156,6 +7465,7 @@ export {
7156
7465
  b as ReportContentInteractive,
7157
7466
  c as ReportContentWithCharts,
7158
7467
  RotateCcwIcon,
7468
+ af as RotateCwIcon,
7159
7469
  RowAfterIcon,
7160
7470
  RowBeforeIcon,
7161
7471
  RowDeleteIcon,
@@ -7168,6 +7478,8 @@ export {
7168
7478
  UnderlineIcon,
7169
7479
  UndoIcon,
7170
7480
  XIcon,
7481
+ ag as ZoomInIcon,
7482
+ ah as ZoomOutIcon,
7171
7483
  a2 as applyCitationSources,
7172
7484
  applyCommentAnchorsToEditor,
7173
7485
  applyLink,
@@ -7208,6 +7520,7 @@ export {
7208
7520
  nextComment,
7209
7521
  normalizeImageAlign,
7210
7522
  normalizeImageCaption,
7523
+ normalizeImageCrop,
7211
7524
  normalizeLinkHref,
7212
7525
  normalizeMarkdown,
7213
7526
  openLinkUrl,
@@ -7230,6 +7543,8 @@ export {
7230
7543
  setImageAlignAt,
7231
7544
  setImageCaption,
7232
7545
  setImageCaptionAtPos,
7546
+ setImageCrop,
7547
+ setImageCropAtPos,
7233
7548
  s3 as stabilizeMarkdown,
7234
7549
  stripCommentAnchorMarks,
7235
7550
  useIsMobile