patent-editor 0.2.5 → 0.2.6

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/lib.js CHANGED
@@ -2,8 +2,8 @@ var Sn = Object.defineProperty;
2
2
  var En = (e, t, n) => t in e ? Sn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Se = (e, t, n) => En(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as m, jsxs as L, Fragment as je } from "react/jsx-runtime";
5
- import Ee, { forwardRef as _t, useState as $, useEffect as M, useCallback as ae, useImperativeHandle as It, useRef as j, useMemo as Nt } from "react";
6
- import { Extension as Oe, ReactRenderer as kn, Node as Z, mergeAttributes as ie, NodeViewWrapper as _n, ReactNodeViewRenderer as At, EditorContent as In, useEditor as Nn } from "@tiptap/react";
5
+ import Ee, { forwardRef as It, useState as $, useEffect as M, useCallback as ae, useImperativeHandle as Nt, useRef as W, useMemo as At } from "react";
6
+ import { Extension as Oe, ReactRenderer as kn, Node as Z, mergeAttributes as ie, NodeViewWrapper as _n, ReactNodeViewRenderer as Lt, EditorContent as In, useEditor as Nn } from "@tiptap/react";
7
7
  import An from "@tiptap/extension-document";
8
8
  import Ln from "@tiptap/extension-paragraph";
9
9
  import Pn from "@tiptap/extension-text";
@@ -31,7 +31,7 @@ import Qn from "@tiptap/suggestion";
31
31
  import er from "tippy.js";
32
32
  import { create as tr } from "zustand";
33
33
  import { DecorationSet as be, Decoration as re } from "@tiptap/pm/view";
34
- import { diff_match_patch as Lt } from "diff-match-patch";
34
+ import { diff_match_patch as Pt } from "diff-match-patch";
35
35
  import nr from "@tiptap/extension-bold";
36
36
  import rr from "@tiptap/extension-italic";
37
37
  import ar from "@tiptap/extension-underline";
@@ -49,10 +49,10 @@ import "mathlive";
49
49
  import { findWrapping as fr } from "@tiptap/pm/transform";
50
50
  import { Slice as pr, Fragment as hr } from "@tiptap/pm/model";
51
51
  import { createPortal as yr } from "react-dom";
52
- import { Undo2 as br, Redo2 as vr, Bold as Pt, Italic as Dt, Underline as Rt, Strikethrough as Mt, Code as Ft, Superscript as $t, Subscript as zt, Pilcrow as wr, Heading1 as xr, Heading2 as Cr, Heading3 as Tr, AlignLeft as Sr, AlignCenter as Er, AlignRight as kr, AlignJustify as _r, List as Ir, ListOrdered as Nr, Quote as Ar, FileCode2 as Lr, Table as Pr, Minus as Dr, CheckSquare as Rr, Image as Ot, Link2 as Bt, FileText as Ht, Box as Mr, Workflow as Fr, FunctionSquare as $r, Sigma as zr, GitGraph as Or, Square as ut, ChevronDown as qt, Trash2 as Br, Highlighter as Hr, Sparkles as qr, CaseSensitive as Ur, ChevronUp as Wr, Replace as mt, X as jr, ReplaceAll as Gr, PanelLeft as Vr, PanelLeftClose as Jr } from "lucide-react";
52
+ import { Undo2 as br, Redo2 as vr, Bold as Dt, Italic as Rt, Underline as Mt, Strikethrough as Ft, Code as $t, Superscript as zt, Subscript as Ot, Pilcrow as wr, Heading1 as xr, Heading2 as Cr, Heading3 as Tr, AlignLeft as Sr, AlignCenter as Er, AlignRight as kr, AlignJustify as _r, List as Ir, ListOrdered as Nr, Quote as Ar, FileCode2 as Lr, Table as Pr, Minus as Dr, CheckSquare as Rr, Image as Bt, Link2 as Ht, FileText as qt, Box as Mr, Workflow as Fr, FunctionSquare as $r, Sigma as zr, GitGraph as Or, Square as mt, ChevronDown as Ut, Trash2 as Br, Highlighter as Hr, Sparkles as qr, CaseSensitive as Ur, ChevronUp as Wr, Replace as gt, X as jr, ReplaceAll as Gr, PanelLeft as Vr, PanelLeftClose as Jr } from "lucide-react";
53
53
  import Y from "clsx";
54
54
  import { BubbleMenu as Kr } from "@tiptap/react/menus";
55
- import { convertMillimetersToTwip as he, Document as Xr, Packer as Yr, Paragraph as He, AlignmentType as at, TextRun as qe } from "docx";
55
+ import { convertMillimetersToTwip as he, Document as Xr, Packer as Yr, Paragraph as He, AlignmentType as it, TextRun as qe } from "docx";
56
56
  import { saveAs as Zr } from "file-saver";
57
57
  const Qr = new we("slashCommand"), ea = Oe.create({
58
58
  name: "slashCommand",
@@ -162,7 +162,7 @@ const Qr = new we("slashCommand"), ea = Oe.create({
162
162
  setPendingChatMessage: (t) => e((n) => ({
163
163
  rightPanel: { ...n.rightPanel, pendingChatMessage: t }
164
164
  }))
165
- })), Ut = _t(
165
+ })), Wt = It(
166
166
  ({ items: e, command: t }, n) => {
167
167
  const [r, a] = $(0);
168
168
  M(() => {
@@ -175,7 +175,7 @@ const Qr = new we("slashCommand"), ea = Oe.create({
175
175
  },
176
176
  [e, t]
177
177
  );
178
- return It(n, () => ({
178
+ return Nt(n, () => ({
179
179
  onKeyDown: ({ event: o }) => o.key === "ArrowUp" ? (a((c) => (c + e.length - 1) % e.length), !0) : o.key === "ArrowDown" ? (a((c) => (c + 1) % e.length), !0) : o.key === "Enter" ? (i(r), !0) : !1
180
180
  })), e.length ? /* @__PURE__ */ m("div", { className: "slash-menu", children: e.map((o, c) => /* @__PURE__ */ L(
181
181
  "button",
@@ -195,7 +195,7 @@ const Qr = new we("slashCommand"), ea = Oe.create({
195
195
  )) }) : /* @__PURE__ */ m("div", { className: "slash-menu", children: /* @__PURE__ */ m("div", { className: "slash-menu-empty", children: "No results" }) });
196
196
  }
197
197
  );
198
- Ut.displayName = "SlashMenuList";
198
+ Wt.displayName = "SlashMenuList";
199
199
  function na(e) {
200
200
  const t = e === "zh";
201
201
  return [
@@ -313,7 +313,7 @@ function ra() {
313
313
  let e = null, t = null;
314
314
  return {
315
315
  onStart: (n) => {
316
- e = new kn(Ut, {
316
+ e = new kn(Wt, {
317
317
  props: n,
318
318
  editor: n.editor
319
319
  }), n.clientRect && (t = er("body", {
@@ -353,17 +353,17 @@ function ke(e, t, n) {
353
353
  const s = o.indexOf(i, c);
354
354
  if (s === -1) break;
355
355
  let l = 0, d = -1, g = -1;
356
- e.descendants((u, p) => {
356
+ e.descendants((u, f) => {
357
357
  if (d !== -1 && g !== -1) return !1;
358
358
  if (u.isText) {
359
- const f = u.text || "";
360
- for (let b = 0; b < f.length; b++) {
361
- if (l === s && (d = p + b), l === s + i.length)
362
- return g = p + b, !1;
359
+ const p = u.text || "";
360
+ for (let b = 0; b < p.length; b++) {
361
+ if (l === s && (d = f + b), l === s + i.length)
362
+ return g = f + b, !1;
363
363
  l++;
364
364
  }
365
- l === s + i.length && g === -1 && (g = p + f.length);
366
- } else u.isBlock && l > 0 && (l === s && (d = p), l++);
365
+ l === s + i.length && g === -1 && (g = f + p.length);
366
+ } else u.isBlock && l > 0 && (l === s && (d = f), l++);
367
367
  return !0;
368
368
  }), d !== -1 && g !== -1 && r.push({ from: d, to: g }), c = s + 1;
369
369
  }
@@ -389,13 +389,13 @@ const ia = Oe.create({
389
389
  if (this.storage.results.length === 0) return !1;
390
390
  this.storage.currentIndex = (this.storage.currentIndex + 1) % this.storage.results.length;
391
391
  const t = this.storage.results[this.storage.currentIndex];
392
- return t && (e.commands.setTextSelection(t), gt(e)), e.view.dispatch(e.state.tr), !0;
392
+ return t && (e.commands.setTextSelection(t), ft(e)), e.view.dispatch(e.state.tr), !0;
393
393
  },
394
394
  previousSearchResult: () => ({ editor: e }) => {
395
395
  if (this.storage.results.length === 0) return !1;
396
396
  this.storage.currentIndex = (this.storage.currentIndex - 1 + this.storage.results.length) % this.storage.results.length;
397
397
  const t = this.storage.results[this.storage.currentIndex];
398
- return t && (e.commands.setTextSelection(t), gt(e)), e.view.dispatch(e.state.tr), !0;
398
+ return t && (e.commands.setTextSelection(t), ft(e)), e.view.dispatch(e.state.tr), !0;
399
399
  },
400
400
  replaceCurrent: () => ({ editor: e }) => {
401
401
  if (this.storage.results.length === 0 || this.storage.currentIndex < 0) return !1;
@@ -449,7 +449,7 @@ const ia = Oe.create({
449
449
  ];
450
450
  }
451
451
  });
452
- function gt(e) {
452
+ function ft(e) {
453
453
  requestAnimationFrame(() => {
454
454
  const t = e.view.domAtPos(e.state.selection.from);
455
455
  if (t != null && t.node) {
@@ -458,17 +458,17 @@ function gt(e) {
458
458
  }
459
459
  });
460
460
  }
461
- const sa = -1, oa = 1, ft = 0;
461
+ const sa = -1, oa = 1, pt = 0;
462
462
  let Ge = null;
463
463
  function ca() {
464
- return Ge || (Ge = new Lt()), Ge;
464
+ return Ge || (Ge = new Pt()), Ge;
465
465
  }
466
- const Wt = new we("patchDiff");
466
+ const jt = new we("patchDiff");
467
467
  function la(e, t) {
468
468
  let n = null;
469
469
  return e.state.doc.descendants((r, a) => n ? !1 : r.type.name === "patent_section" && r.attrs.sectionType === t ? (n = { from: a + 1, to: a + r.nodeSize - 1 }, !1) : !0), n;
470
470
  }
471
- function jt(e, t, n) {
471
+ function Gt(e, t, n) {
472
472
  const r = [];
473
473
  let a = "", i = !0;
474
474
  return e.state.doc.nodesBetween(t, n, (o, c) => {
@@ -482,10 +482,17 @@ function ye(e, t) {
482
482
  for (const n of e)
483
483
  if (t >= n.textIdx && t <= n.textIdx + n.len)
484
484
  return n.docPos + (t - n.textIdx);
485
+ for (const n of e)
486
+ if (n.textIdx > t)
487
+ return n.docPos;
488
+ if (e.length > 0) {
489
+ const n = e[e.length - 1];
490
+ return n.docPos + n.len;
491
+ }
485
492
  return -1;
486
493
  }
487
- function pt(e, t, n, r, a) {
488
- const { text: i, segments: o } = jt(e, n, r);
494
+ function ht(e, t, n, r, a) {
495
+ const { text: i, segments: o } = Gt(e, n, r);
489
496
  let c = 0;
490
497
  for (; c <= i.length - t.length; ) {
491
498
  const s = i.indexOf(t, c);
@@ -511,11 +518,11 @@ function Rs(e, t, n, r, a) {
511
518
  else if (i.type === "ref" && i.refIndex != null) {
512
519
  const d = n[i.refIndex];
513
520
  (d == null ? void 0 : d.from) != null && (d == null ? void 0 : d.to) != null && (o = { from: d.from, to: d.to });
514
- } else i.type === "search" && i.searchText && (o = pt(e, i.searchText, 0, e.state.doc.content.size, c));
521
+ } else i.type === "search" && i.searchText && (o = ht(e, i.searchText, 0, e.state.doc.content.size, c));
515
522
  if (!o) return null;
516
523
  let s = o;
517
524
  if (t.search) {
518
- const d = pt(e, t.search, o.from, o.to, c);
525
+ const d = ht(e, t.search, o.from, o.to, c);
519
526
  d && (s = d);
520
527
  }
521
528
  const l = s.from < s.to ? e.state.doc.textBetween(s.from, s.to, " ", "\0") : "";
@@ -530,7 +537,8 @@ function Rs(e, t, n, r, a) {
530
537
  status: "pending"
531
538
  };
532
539
  }
533
- let H = [], De = [];
540
+ const j = /* @__PURE__ */ new Map();
541
+ let De = [];
534
542
  function Ms(e) {
535
543
  return De.push(e), () => {
536
544
  De = De.filter((t) => t !== e);
@@ -539,61 +547,61 @@ function Ms(e) {
539
547
  function ue() {
540
548
  De.forEach((e) => e());
541
549
  }
542
- function Fs() {
543
- return [...H];
550
+ function Fs(e = "default") {
551
+ return [...j.get(e) || []];
544
552
  }
545
- function $s(e) {
546
- H = e, ue();
553
+ function $s(e, t = "default") {
554
+ j.set(t, e), ue();
547
555
  }
548
- function zs() {
549
- H = [], ue();
556
+ function zs(e = "default") {
557
+ j.delete(e), ue();
550
558
  }
551
- function Os(e, t) {
552
- const n = H.find((i) => i.id === t);
553
- if (!n || n.status !== "pending") return !1;
554
- n.status = "accepted";
555
- const { tr: r } = e.state;
556
- if (n.type === "delete")
557
- r.delete(n.from, n.to);
558
- else if (n.type === "insert")
559
- r.insertText(n.content, n.from);
560
- else if (Gt(e, n.from, n.to)) {
561
- const o = Vt(e, n.content);
562
- r.replaceWith(n.from, n.to, o);
559
+ function Os(e, t, n = "default") {
560
+ const r = j.get(n) || [], a = r.find((c) => c.id === t);
561
+ if (!a || a.status !== "pending") return !1;
562
+ a.status = "accepted";
563
+ const { tr: i } = e.state;
564
+ if (a.type === "delete")
565
+ i.delete(a.from, a.to);
566
+ else if (a.type === "insert")
567
+ i.insertText(a.content, a.from);
568
+ else if (Vt(e, a.from, a.to)) {
569
+ const s = Jt(e, a.content);
570
+ i.replaceWith(a.from, a.to, s);
563
571
  } else
564
- r.insertText(n.content, n.from, n.to);
565
- e.view.dispatch(r);
566
- const a = r.mapping;
567
- for (const i of H) {
568
- if (i.id === t || i.status !== "pending") continue;
569
- const o = a.map(i.from, 1), c = a.map(i.to, -1);
570
- o >= c && i.type !== "insert" ? i.status = "rejected" : (i.from = o, i.to = i.type === "insert" ? o : c);
572
+ i.insertText(a.content, a.from, a.to);
573
+ e.view.dispatch(i);
574
+ const o = i.mapping;
575
+ for (const c of r) {
576
+ if (c.id === t || c.status !== "pending") continue;
577
+ const s = o.map(c.from, 1), l = o.map(c.to, -1);
578
+ s >= l && c.type !== "insert" ? c.status = "rejected" : (c.from = s, c.to = c.type === "insert" ? s : l);
571
579
  }
572
- return H = H.filter((i) => i.id !== t && i.status === "pending"), Ue(e), ue(), !0;
580
+ return j.set(n, r.filter((c) => c.id !== t && c.status === "pending")), Ue(e), ue(), !0;
573
581
  }
574
- function Bs(e, t) {
575
- const n = H.find((r) => r.id === t);
576
- return !n || n.status !== "pending" ? !1 : (n.status = "rejected", H = H.filter((r) => r.id !== t), Ue(e), ue(), !0);
582
+ function Bs(e, t, n = "default") {
583
+ const r = j.get(n) || [], a = r.find((i) => i.id === t);
584
+ return !a || a.status !== "pending" ? !1 : (a.status = "rejected", j.set(n, r.filter((i) => i.id !== t)), Ue(e), ue(), !0);
577
585
  }
578
- function Hs(e) {
579
- const n = [...H.filter((a) => a.status === "pending")].sort((a, i) => i.from - a.from), { tr: r } = e.state;
580
- for (const a of n)
581
- if (a.type === "delete")
582
- r.delete(a.from, a.to);
583
- else if (a.type === "insert")
584
- r.insertText(a.content, a.from);
585
- else if (Gt(e, a.from, a.to)) {
586
- const o = Vt(e, a.content);
587
- r.replaceWith(a.from, a.to, o);
586
+ function Hs(e, t = "default") {
587
+ const a = [...(j.get(t) || []).filter((o) => o.status === "pending")].sort((o, c) => c.from - o.from), { tr: i } = e.state;
588
+ for (const o of a)
589
+ if (o.type === "delete")
590
+ i.delete(o.from, o.to);
591
+ else if (o.type === "insert")
592
+ i.insertText(o.content, o.from);
593
+ else if (Vt(e, o.from, o.to)) {
594
+ const s = Jt(e, o.content);
595
+ i.replaceWith(o.from, o.to, s);
588
596
  } else
589
- r.insertText(a.content, a.from, a.to);
590
- e.view.dispatch(r), H = [], Ue(e), ue();
597
+ i.insertText(o.content, o.from, o.to);
598
+ e.view.dispatch(i), j.delete(t), Ue(e), ue();
591
599
  }
592
- function qs(e) {
593
- H = [], Ue(e), ue();
600
+ function qs(e, t = "default") {
601
+ j.delete(t), Ue(e), ue();
594
602
  }
595
603
  function Ue(e) {
596
- e.view.dispatch(e.state.tr.setMeta(Wt, !0));
604
+ e.view.dispatch(e.state.tr.setMeta(jt, !0));
597
605
  }
598
606
  function da(e, t, n) {
599
607
  const r = [];
@@ -615,12 +623,12 @@ function ua(e, t) {
615
623
  }
616
624
  const n = ca(), r = n.diff_main(t.originalText, t.content);
617
625
  n.diff_cleanupSemantic(r);
618
- const a = r.filter(([c]) => c === ft).reduce((c, [, s]) => c + s.length, 0);
626
+ const a = r.filter(([c]) => c === pt).reduce((c, [, s]) => c + s.length, 0);
619
627
  if (t.originalText.length > 0 && a / t.originalText.length < 0.3) return null;
620
628
  const i = [];
621
629
  let o = t.from;
622
630
  for (const [c, s] of r)
623
- if (c === ft)
631
+ if (c === pt)
624
632
  o += s.length;
625
633
  else if (c === sa) {
626
634
  const l = o + s.length;
@@ -638,60 +646,60 @@ function ua(e, t) {
638
646
  );
639
647
  return i;
640
648
  }
641
- function ma() {
649
+ function ma(e = "default") {
642
650
  return new Be({
643
- key: Wt,
651
+ key: jt,
644
652
  props: {
645
- decorations(e) {
646
- const t = H.filter((r) => r.status === "pending");
647
- if (t.length === 0) return be.empty;
648
- const n = [];
649
- for (const r of t) {
650
- if (r.type === "replace") {
651
- const a = ua(e.doc, r);
652
- if (a) {
653
- n.push(...a);
653
+ decorations(t) {
654
+ const n = (j.get(e) || []).filter((a) => a.status === "pending");
655
+ if (n.length === 0) return be.empty;
656
+ const r = [];
657
+ for (const a of n) {
658
+ if (a.type === "replace") {
659
+ const i = ua(t.doc, a);
660
+ if (i) {
661
+ r.push(...i);
654
662
  continue;
655
663
  }
656
664
  }
657
- if (r.type === "delete" || r.type === "replace") {
658
- const a = da(e.doc, r.from, r.to);
659
- for (const i of a)
660
- n.push(
661
- re.inline(i.from, i.to, {
665
+ if (a.type === "delete" || a.type === "replace") {
666
+ const i = da(t.doc, a.from, a.to);
667
+ for (const o of i)
668
+ r.push(
669
+ re.inline(o.from, o.to, {
662
670
  class: "patch-diff-delete",
663
- "data-patch-id": r.id
671
+ "data-patch-id": a.id
664
672
  })
665
673
  );
666
- if (r.type === "replace") {
667
- const i = a.length > 0 ? a[a.length - 1].to : r.to, o = r.content.length > 120 || r.content.includes(`
674
+ if (a.type === "replace") {
675
+ const o = i.length > 0 ? i[i.length - 1].to : a.to, c = a.content.length > 120 || a.content.includes(`
668
676
  `);
669
- n.push(
670
- re.widget(i, () => {
671
- const c = document.createElement(o ? "div" : "span");
672
- return c.className = o ? "patch-diff-insert-inline patch-diff-insert-block" : "patch-diff-insert-inline", c.textContent = r.content, c.setAttribute("data-patch-id", r.id), c;
677
+ r.push(
678
+ re.widget(o, () => {
679
+ const s = document.createElement(c ? "div" : "span");
680
+ return s.className = c ? "patch-diff-insert-inline patch-diff-insert-block" : "patch-diff-insert-inline", s.textContent = a.content, s.setAttribute("data-patch-id", a.id), s;
673
681
  }, { side: 1 })
674
682
  );
675
683
  }
676
684
  } else
677
- n.push(
678
- re.widget(r.from, () => {
679
- const a = document.createElement("span");
680
- return a.className = "patch-diff-insert-inline", a.textContent = r.content, a.setAttribute("data-patch-id", r.id), a;
685
+ r.push(
686
+ re.widget(a.from, () => {
687
+ const i = document.createElement("span");
688
+ return i.className = "patch-diff-insert-inline", i.textContent = a.content, i.setAttribute("data-patch-id", a.id), i;
681
689
  })
682
690
  );
683
691
  }
684
- return be.create(e.doc, n);
692
+ return be.create(t.doc, r);
685
693
  }
686
694
  }
687
695
  });
688
696
  }
689
- function Gt(e, t, n) {
697
+ function Vt(e, t, n) {
690
698
  var i;
691
699
  const r = e.state.doc.resolve(t);
692
700
  return !!((i = r.parent.type.spec.content) != null && i.includes("block") && t === r.start() && n === r.end());
693
701
  }
694
- function Vt(e, t) {
702
+ function Jt(e, t) {
695
703
  const n = e.state.schema;
696
704
  return t.split(/\n\n+/).filter((a) => a.trim().length > 0).map((a) => {
697
705
  const i = a.replace(/\n/g, " ").trim();
@@ -833,7 +841,7 @@ class va {
833
841
  return !r || !r.isActive ? !1 : r.isActive(n);
834
842
  }
835
843
  async execute(t, n, r, a = {}) {
836
- var d, g, u, p;
844
+ var d, g, u, f;
837
845
  const i = Date.now(), o = a.transaction ?? !0, c = a.rollbackOnFail ?? !0, s = o ? n.editor.getJSON() : null, l = this.commands.get(t);
838
846
  if (!l)
839
847
  return console.warn(`Command "${t}" not found.`), (d = a.onComplete) == null || d.call(a, {
@@ -856,15 +864,15 @@ class va {
856
864
  durationMs: Date.now() - i
857
865
  };
858
866
  return (u = a.onComplete) == null || u.call(a, h), b;
859
- } catch (f) {
867
+ } catch (p) {
860
868
  s && c && n.editor.commands.setContent(s);
861
869
  const b = {
862
870
  name: t,
863
871
  success: !1,
864
872
  durationMs: Date.now() - i,
865
- error: f
873
+ error: p
866
874
  };
867
- return (p = a.onComplete) == null || p.call(a, b), !1;
875
+ return (f = a.onComplete) == null || f.call(a, b), !1;
868
876
  }
869
877
  }
870
878
  getCommand(t) {
@@ -960,7 +968,7 @@ class wa {
960
968
  });
961
969
  }
962
970
  }
963
- const B = new wa(), ht = {
971
+ const B = new wa(), yt = {
964
972
  zh: {
965
973
  language: "语言",
966
974
  bold: "加粗",
@@ -1207,7 +1215,7 @@ const B = new wa(), ht = {
1207
1215
  insertMathBlock: "Insert math block",
1208
1216
  insertDrawioDiagram: "Insert Draw.io diagram"
1209
1217
  }
1210
- }, q = (e) => e === "en" ? ht.en : ht.zh;
1218
+ }, H = (e) => e === "en" ? yt.en : yt.zh;
1211
1219
  let _e = 0;
1212
1220
  const Ie = () => {
1213
1221
  document.querySelectorAll('body > svg[id^="standalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
@@ -1247,10 +1255,10 @@ const Ie = () => {
1247
1255
  g.className = "mermaid-edit-toolbar";
1248
1256
  const u = document.createElement("span");
1249
1257
  u.className = "mermaid-error-msg";
1250
- const p = document.createElement("button");
1251
- p.className = "mermaid-cancel-btn", p.type = "button";
1252
1258
  const f = document.createElement("button");
1253
- f.className = "mermaid-save-btn", f.type = "button", g.append(u, p, f), l.append(d, g), i.append(o, l);
1259
+ f.className = "mermaid-cancel-btn", f.type = "button";
1260
+ const p = document.createElement("button");
1261
+ p.className = "mermaid-save-btn", p.type = "button", g.append(u, f, p), l.append(d, g), i.append(o, l);
1254
1262
  const b = (C) => {
1255
1263
  const N = typeof n == "function" ? n() : null;
1256
1264
  typeof N == "number" && e.commands.command(({ tr: A, dispatch: D }) => (A.setNodeMarkup(N, void 0, { ...r.attrs, ...C }), D && D(A), !0));
@@ -1298,14 +1306,14 @@ const Ie = () => {
1298
1306
  };
1299
1307
  o.addEventListener("dblclick", (C) => {
1300
1308
  C.preventDefault(), C.stopPropagation(), E();
1301
- }), f.addEventListener("click", (C) => {
1302
- C.stopPropagation(), w();
1303
1309
  }), p.addEventListener("click", (C) => {
1310
+ C.stopPropagation(), w();
1311
+ }), f.addEventListener("click", (C) => {
1304
1312
  C.stopPropagation(), x();
1305
1313
  }), d.addEventListener("mousedown", (C) => C.stopPropagation()), d.addEventListener("keydown", (C) => C.stopPropagation()), d.addEventListener("keypress", (C) => C.stopPropagation());
1306
1314
  const T = () => {
1307
- const C = I.getState().editorLanguage, N = q(C), A = typeof r.attrs.code == "string" ? r.attrs.code : "";
1308
- o.style.display = a ? "none" : "block", l.style.display = a ? "block" : "none", f.textContent = N.mermaidSaveAndRender || "保存并渲染", p.textContent = N.mermaidCancel || "取消";
1315
+ const C = I.getState().editorLanguage, N = H(C), A = typeof r.attrs.code == "string" ? r.attrs.code : "";
1316
+ o.style.display = a ? "none" : "block", l.style.display = a ? "block" : "none", p.textContent = N.mermaidSaveAndRender || "保存并渲染", f.textContent = N.mermaidCancel || "取消";
1309
1317
  const D = A.trim().length > 0, z = c.querySelector("svg") !== null;
1310
1318
  a || (D && z ? (s.textContent = N.mermaidDoubleClickToEdit || "双击编辑", s.className = "mermaid-view-hint mermaid-view-hint--subtle") : (s.textContent = N.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", s.className = "mermaid-view-hint mermaid-view-hint--empty")), !a && A.trim() !== h && y(A);
1311
1319
  };
@@ -1387,7 +1395,7 @@ const Ie = () => {
1387
1395
  typeof x == "number" && e.commands.command(({ tr: w, dispatch: T }) => (w.setNodeMarkup(x, void 0, { ...r.attrs, ...E }), T && T(w), !0));
1388
1396
  };
1389
1397
  let d = null, g = null, u = null;
1390
- const p = () => {
1398
+ const f = () => {
1391
1399
  if (a) return;
1392
1400
  a = !0, g = document.createElement("div"), g.className = "drawio-modal-overlay";
1393
1401
  const E = document.createElement("div");
@@ -1397,7 +1405,7 @@ const Ie = () => {
1397
1405
  const w = I.getState().editorLanguage, T = document.createElement("span");
1398
1406
  T.textContent = w === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", T.className = "drawio-modal-title";
1399
1407
  const v = document.createElement("button");
1400
- v.className = "drawio-modal-close-btn", v.textContent = "✕", v.type = "button", v.addEventListener("click", () => f()), x.append(T, v), u = document.createElement("iframe"), u.className = "drawio-modal-iframe", u.setAttribute("frameborder", "0"), E.append(x, u), g.appendChild(E), document.body.appendChild(g);
1408
+ v.className = "drawio-modal-close-btn", v.textContent = "✕", v.type = "button", v.addEventListener("click", () => p()), x.append(T, v), u = document.createElement("iframe"), u.className = "drawio-modal-iframe", u.setAttribute("frameborder", "0"), E.append(x, u), g.appendChild(E), document.body.appendChild(g);
1401
1409
  const _ = w === "en" ? "en" : "zh";
1402
1410
  u.src = `${Ve}/?embed=1&proto=json&spin=1&lang=${_}`;
1403
1411
  const C = u;
@@ -1424,17 +1432,17 @@ const Ie = () => {
1424
1432
  ), l({ xml: Q });
1425
1433
  } else if (A.event === "export") {
1426
1434
  const Q = A.data || "";
1427
- l({ svg: Q }), f();
1428
- } else A.event === "exit" && f();
1435
+ l({ svg: Q }), p();
1436
+ } else A.event === "exit" && p();
1429
1437
  }, window.addEventListener("message", d);
1430
- }, f = () => {
1438
+ }, p = () => {
1431
1439
  a = !1, d && (window.removeEventListener("message", d), d = null), u && (u.src = "about:blank", u = null), g && (g.remove(), g = null), b();
1432
1440
  };
1433
1441
  o.addEventListener("dblclick", (E) => {
1434
- E.preventDefault(), E.stopPropagation(), p();
1442
+ E.preventDefault(), E.stopPropagation(), f();
1435
1443
  });
1436
1444
  const b = () => {
1437
- const E = I.getState().editorLanguage, x = q(E), w = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
1445
+ const E = I.getState().editorLanguage, x = H(E), w = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
1438
1446
  w ? (c.src = w, c.style.display = "block") : (c.src = "", c.style.display = "none"), w ? (s.textContent = x.mermaidDoubleClickToEdit || "双击编辑", s.className = "drawio-view-hint drawio-view-hint--subtle") : (s.textContent = x.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", s.className = "drawio-view-hint drawio-view-hint--empty");
1439
1447
  };
1440
1448
  let h = I.getState().editorLanguage;
@@ -1479,13 +1487,13 @@ const Ie = () => {
1479
1487
  }
1480
1488
  }
1481
1489
  }
1482
- }, Jt = ({
1490
+ }, Kt = ({
1483
1491
  node: e,
1484
1492
  updateAttributes: t,
1485
1493
  selected: n,
1486
1494
  editor: r
1487
1495
  }) => {
1488
- const a = j(null), [i, o] = $(!1), c = e.type.name === "math_block", s = j(!1), l = j(t), d = j(e.attrs.latex ?? "");
1496
+ const a = W(null), [i, o] = $(!1), c = e.type.name === "math_block", s = W(!1), l = W(t), d = W(e.attrs.latex ?? "");
1489
1497
  M(() => {
1490
1498
  l.current = t;
1491
1499
  }, [t]), M(() => {
@@ -1497,23 +1505,23 @@ const Ie = () => {
1497
1505
  var b, h;
1498
1506
  if (!s.current) return;
1499
1507
  s.current = !1;
1500
- const f = ((b = a.current) == null ? void 0 : b.value) ?? d.current;
1501
- l.current({ latex: f }), o(!1), (h = globalThis.mathVirtualKeyboard) == null || h.hide({ animate: !0 });
1508
+ const p = ((b = a.current) == null ? void 0 : b.value) ?? d.current;
1509
+ l.current({ latex: p }), o(!1), (h = globalThis.mathVirtualKeyboard) == null || h.hide({ animate: !0 });
1502
1510
  }, []);
1503
1511
  M(() => {
1504
1512
  var b, h, y;
1505
- const f = !!((y = (h = (b = r == null ? void 0 : r.view) == null ? void 0 : b.state) == null ? void 0 : h.selection) != null && y.empty);
1506
- n && f && g();
1513
+ const p = !!((y = (h = (b = r == null ? void 0 : r.view) == null ? void 0 : b.state) == null ? void 0 : h.selection) != null && y.empty);
1514
+ n && p && g();
1507
1515
  }, [n, g]), M(() => {
1508
1516
  i && requestAnimationFrame(() => {
1509
1517
  var b;
1510
- const f = a.current;
1511
- f && (f.virtualKeyboardMode = "onfocus", (b = f.focus) == null || b.call(f));
1518
+ const p = a.current;
1519
+ p && (p.virtualKeyboardMode = "onfocus", (b = p.focus) == null || b.call(p));
1512
1520
  });
1513
1521
  }, [i]), M(() => {
1514
1522
  if (!i) return;
1515
- const f = a.current;
1516
- if (!f) return;
1523
+ const p = a.current;
1524
+ if (!p) return;
1517
1525
  const b = () => {
1518
1526
  setTimeout(() => {
1519
1527
  var E, x, w;
@@ -1524,20 +1532,20 @@ const Ie = () => {
1524
1532
  }, h = (y) => {
1525
1533
  y.key === "Escape" && u();
1526
1534
  };
1527
- return f.addEventListener("focusout", b), f.addEventListener("keydown", h), () => {
1528
- f.removeEventListener("focusout", b), f.removeEventListener("keydown", h);
1535
+ return p.addEventListener("focusout", b), p.addEventListener("keydown", h), () => {
1536
+ p.removeEventListener("focusout", b), p.removeEventListener("keydown", h);
1529
1537
  };
1530
1538
  }, [i, u]), M(() => {
1531
1539
  !i && a.current && a.current.value !== e.attrs.latex && (a.current.value = e.attrs.latex ?? "");
1532
1540
  }, [e.attrs.latex, i]);
1533
- let p = "";
1541
+ let f = "";
1534
1542
  try {
1535
- p = gr.renderToString(e.attrs.latex || "", {
1543
+ f = gr.renderToString(e.attrs.latex || "", {
1536
1544
  throwOnError: !1,
1537
1545
  displayMode: c
1538
1546
  });
1539
1547
  } catch {
1540
- p = e.attrs.latex || "";
1548
+ f = e.attrs.latex || "";
1541
1549
  }
1542
1550
  return /* @__PURE__ */ m(
1543
1551
  _n,
@@ -1552,7 +1560,7 @@ const Ie = () => {
1552
1560
  children: e.attrs.latex
1553
1561
  }
1554
1562
  ) : /* @__PURE__ */ L("span", { className: "math-preview", onClick: g, children: [
1555
- /* @__PURE__ */ m("span", { dangerouslySetInnerHTML: { __html: p } }),
1563
+ /* @__PURE__ */ m("span", { dangerouslySetInnerHTML: { __html: f } }),
1556
1564
  /* @__PURE__ */ m("span", { className: "math-tooltip", children: "点击编辑" })
1557
1565
  ] })
1558
1566
  }
@@ -1583,7 +1591,7 @@ const Ie = () => {
1583
1591
  return ["span", ie(e, { "data-type": "math_inline" })];
1584
1592
  },
1585
1593
  addNodeView() {
1586
- return At(Jt, {
1594
+ return Lt(Kt, {
1587
1595
  stopEvent: ({ event: e }) => {
1588
1596
  const t = e.target;
1589
1597
  return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
@@ -1606,7 +1614,7 @@ const Ie = () => {
1606
1614
  return ["div", ie(e, { "data-type": "math_block" })];
1607
1615
  },
1608
1616
  addNodeView() {
1609
- return At(Jt, {
1617
+ return Lt(Kt, {
1610
1618
  stopEvent: ({ event: e }) => {
1611
1619
  const t = e.target;
1612
1620
  return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
@@ -1661,11 +1669,11 @@ const Ie = () => {
1661
1669
  }
1662
1670
  }
1663
1671
  }
1664
- }, it = (e, t, n = {}) => {
1672
+ }, st = (e, t, n = {}) => {
1665
1673
  const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size;
1666
1674
  let i = null;
1667
1675
  return e.state.doc.nodesBetween(r, a, (o, c) => i ? !1 : o.type.name === t ? (i = { node: o, pos: c }, !1) : !0), i;
1668
- }, Kt = (e, t, n = {}) => {
1676
+ }, Xt = (e, t, n = {}) => {
1669
1677
  const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size, i = [];
1670
1678
  return e.state.doc.nodesBetween(r, a, (o, c) => (t(o, c) && i.push({ node: o, pos: c }), !0)), i;
1671
1679
  }, Re = (e, t) => {
@@ -1697,12 +1705,12 @@ const Ie = () => {
1697
1705
  attrs: e.attrs,
1698
1706
  content: t
1699
1707
  };
1700
- }, Xt = (e, t) => {
1708
+ }, Yt = (e, t) => {
1701
1709
  const n = Aa(t);
1702
1710
  return typeof t.position == "number" ? e.chain().focus().insertContentAt(t.position, n).run() : e.chain().focus().insertContent(n).run();
1703
1711
  }, ze = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1704
1712
  var s;
1705
- const i = typeof t.position == "number" ? t.position : (s = it(e, t.type || "")) == null ? void 0 : s.pos;
1713
+ const i = typeof t.position == "number" ? t.position : (s = st(e, t.type || "")) == null ? void 0 : s.pos;
1706
1714
  if (typeof i != "number")
1707
1715
  return !1;
1708
1716
  const o = r.doc.nodeAt(i);
@@ -1710,14 +1718,14 @@ const Ie = () => {
1710
1718
  return !1;
1711
1719
  const c = { ...o.attrs, ...t.attrs };
1712
1720
  return n.setNodeMarkup(i, void 0, c), a && a(n), !0;
1713
- }), Yt = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1721
+ }), Zt = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1714
1722
  var c;
1715
- const i = typeof t.position == "number" ? t.position : (c = it(e, t.type || "")) == null ? void 0 : c.pos;
1723
+ const i = typeof t.position == "number" ? t.position : (c = st(e, t.type || "")) == null ? void 0 : c.pos;
1716
1724
  if (typeof i != "number")
1717
1725
  return !1;
1718
1726
  const o = r.doc.nodeAt(i);
1719
1727
  return !o || t.type && o.type.name !== t.type ? !1 : (n.delete(i, i + o.nodeSize), a && a(n), !0);
1720
- }), Zt = (e, t) => {
1728
+ }), Qt = (e, t) => {
1721
1729
  const n = Na(e, t.type);
1722
1730
  return n ? e.commands.command(({ tr: r, state: a, dispatch: i }) => {
1723
1731
  const { from: o, to: c } = a.selection, s = a.selection.$from.blockRange(a.selection.$to);
@@ -1731,17 +1739,17 @@ const Ie = () => {
1731
1739
  return !1;
1732
1740
  const n = e.getJSON();
1733
1741
  for (const r of t)
1734
- if (!(r.type === "insertNode" ? Xt(e, r.payload) : r.type === "updateNodeAttrs" ? ze(e, r.payload) : r.type === "removeNode" ? Yt(e, r.payload) : Zt(e, r.payload)))
1742
+ if (!(r.type === "insertNode" ? Yt(e, r.payload) : r.type === "updateNodeAttrs" ? ze(e, r.payload) : r.type === "removeNode" ? Zt(e, r.payload) : Qt(e, r.payload)))
1735
1743
  return e.commands.setContent(n), !1;
1736
1744
  return !0;
1737
1745
  }, de = "https://draw.goatpatent.com";
1738
1746
  let Ne = 0;
1739
1747
  const Qe = [];
1740
1748
  let Ae = !1;
1741
- const Pa = 2e4, yt = 6e4;
1749
+ const Pa = 2e4, bt = 6e4;
1742
1750
  let F = null, Me = !1, ne = null, pe = null;
1743
1751
  const et = /* @__PURE__ */ new Map();
1744
- function bt() {
1752
+ function vt() {
1745
1753
  ne && (window.removeEventListener("message", ne), ne = null), F && (F.src = "about:blank", F.remove(), F = null), Me = !1;
1746
1754
  }
1747
1755
  function Da(e, t) {
@@ -1757,13 +1765,13 @@ function tt() {
1757
1765
  Ae = !0, pe && (clearTimeout(pe), pe = null);
1758
1766
  const { xml: e, callback: t } = Qe.shift(), n = et.get(e);
1759
1767
  if (n) {
1760
- t(n), Ae = !1, pe = setTimeout(bt, yt), tt();
1768
+ t(n), Ae = !1, pe = setTimeout(vt, bt), tt();
1761
1769
  return;
1762
1770
  }
1763
1771
  ne && (window.removeEventListener("message", ne), ne = null);
1764
1772
  let r = null;
1765
1773
  const a = (o) => {
1766
- r && (clearTimeout(r), r = null), o && et.set(e, o), t(o), Ae = !1, pe = setTimeout(bt, yt), tt();
1774
+ r && (clearTimeout(r), r = null), o && et.set(e, o), t(o), Ae = !1, pe = setTimeout(vt, bt), tt();
1767
1775
  }, i = () => {
1768
1776
  var o;
1769
1777
  (o = F.contentWindow) == null || o.postMessage(
@@ -1835,12 +1843,12 @@ const Le = () => {
1835
1843
  g.type = "file", g.accept = "image/*", g.style.display = "none";
1836
1844
  const u = document.createElement("button");
1837
1845
  u.className = "figure-replace-btn", l.append(d, g);
1838
- const p = document.createElement("div");
1839
- p.className = "figure-mermaid-view", p.contentEditable = "false", p.setAttribute("spellcheck", "false");
1840
1846
  const f = document.createElement("div");
1841
- f.className = "figure-mermaid-preview", f.contentEditable = "false";
1847
+ f.className = "figure-mermaid-view", f.contentEditable = "false", f.setAttribute("spellcheck", "false");
1848
+ const p = document.createElement("div");
1849
+ p.className = "figure-mermaid-preview", p.contentEditable = "false";
1842
1850
  const b = document.createElement("div");
1843
- b.className = "figure-mermaid-view-hint", p.append(f, b);
1851
+ b.className = "figure-mermaid-view-hint", f.append(p, b);
1844
1852
  const h = document.createElement("div");
1845
1853
  h.className = "figure-mermaid-edit";
1846
1854
  const y = document.createElement("textarea");
@@ -1858,7 +1866,7 @@ const Le = () => {
1858
1866
  const _ = document.createElement("img");
1859
1867
  _.className = "figure-drawio-preview-img", _.style.display = "none";
1860
1868
  const C = document.createElement("div");
1861
- C.className = "figure-drawio-view-hint", v.append(_, C), c.append(s, l, u), c.append(p, h), c.append(v);
1869
+ C.className = "figure-drawio-view-hint", v.append(_, C), c.append(s, l, u), c.append(f, h), c.append(v);
1862
1870
  const N = document.createElement("figcaption");
1863
1871
  N.className = "figure-caption";
1864
1872
  const A = document.createElement("span");
@@ -1900,7 +1908,7 @@ const Le = () => {
1900
1908
  const P = await import("mermaid");
1901
1909
  P.default.initialize({ startOnLoad: !1, theme: "default" }), Ne += 1;
1902
1910
  const O = `fig-mermaid-${Ne}`, { svg: R } = await P.default.render(O, k);
1903
- f.innerHTML = R, Le();
1911
+ p.innerHTML = R, Le();
1904
1912
  } catch {
1905
1913
  Le();
1906
1914
  const P = I.getState().editorLanguage;
@@ -1909,14 +1917,14 @@ const Le = () => {
1909
1917
  }
1910
1918
  z({ mermaidCode: S }), a = !1, J();
1911
1919
  };
1912
- p.addEventListener("dblclick", (S) => {
1920
+ f.addEventListener("dblclick", (S) => {
1913
1921
  S.preventDefault(), S.stopPropagation(), gn();
1914
1922
  }), x.addEventListener("click", (S) => {
1915
1923
  S.stopPropagation(), pn();
1916
1924
  }), w.addEventListener("click", (S) => {
1917
1925
  S.stopPropagation(), fn();
1918
1926
  }), y.addEventListener("mousedown", (S) => S.stopPropagation()), y.addEventListener("keydown", (S) => S.stopPropagation()), y.addEventListener("keypress", (S) => S.stopPropagation());
1919
- let ee = null, G = null, U = null;
1927
+ let ee = null, G = null, q = null;
1920
1928
  const hn = () => {
1921
1929
  if (i) return;
1922
1930
  i = !0, J(), G = document.createElement("div"), G.className = "drawio-modal-overlay";
@@ -1927,44 +1935,44 @@ const Le = () => {
1927
1935
  const P = document.createElement("span"), O = I.getState().editorLanguage;
1928
1936
  P.textContent = O === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", P.className = "drawio-modal-title";
1929
1937
  const R = document.createElement("button");
1930
- R.className = "drawio-modal-close-btn", R.textContent = "✕", R.type = "button", R.addEventListener("click", () => We()), k.append(P, R), U = document.createElement("iframe"), U.className = "drawio-modal-iframe", U.setAttribute("frameborder", "0"), S.append(k, U), G.appendChild(S), document.body.appendChild(G);
1938
+ R.className = "drawio-modal-close-btn", R.textContent = "✕", R.type = "button", R.addEventListener("click", () => We()), k.append(P, R), q = document.createElement("iframe"), q.className = "drawio-modal-iframe", q.setAttribute("frameborder", "0"), S.append(k, q), G.appendChild(S), document.body.appendChild(G);
1931
1939
  const fe = O === "en" ? "en" : "zh";
1932
- U.src = `${de}/?embed=1&proto=json&spin=1&lang=${fe}`;
1933
- const K = U;
1940
+ q.src = `${de}/?embed=1&proto=json&spin=1&lang=${fe}`;
1941
+ const K = q;
1934
1942
  ee = (X) => {
1935
1943
  var oe, Te;
1936
1944
  if (!K || X.source !== K.contentWindow) return;
1937
- let W;
1945
+ let U;
1938
1946
  try {
1939
- W = typeof X.data == "string" ? JSON.parse(X.data) : X.data;
1947
+ U = typeof X.data == "string" ? JSON.parse(X.data) : X.data;
1940
1948
  } catch {
1941
1949
  return;
1942
1950
  }
1943
- if (W.event === "init") {
1951
+ if (U.event === "init") {
1944
1952
  const ce = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
1945
1953
  (oe = K.contentWindow) == null || oe.postMessage(
1946
1954
  JSON.stringify({ action: "load", autosave: 0, xml: ce || "" }),
1947
1955
  de
1948
1956
  );
1949
- } else if (W.event === "save") {
1950
- const ce = W.xml || "";
1957
+ } else if (U.event === "save") {
1958
+ const ce = U.xml || "";
1951
1959
  (Te = K.contentWindow) == null || Te.postMessage(
1952
1960
  JSON.stringify({ action: "export", format: "svg" }),
1953
1961
  de
1954
1962
  ), z({ drawioXml: ce });
1955
- } else if (W.event === "export") {
1956
- const ce = W.data || "";
1963
+ } else if (U.event === "export") {
1964
+ const ce = U.data || "";
1957
1965
  z({ drawioSvg: ce }), We();
1958
- } else W.event === "exit" && We();
1966
+ } else U.event === "exit" && We();
1959
1967
  }, window.addEventListener("message", ee);
1960
1968
  }, We = () => {
1961
- i = !1, ee && (window.removeEventListener("message", ee), ee = null), U && (U.src = "about:blank", U = null), G && (G.remove(), G = null), J();
1969
+ i = !1, ee && (window.removeEventListener("message", ee), ee = null), q && (q.src = "about:blank", q = null), G && (G.remove(), G = null), J();
1962
1970
  };
1963
1971
  v.addEventListener("dblclick", (S) => {
1964
1972
  S.preventDefault(), S.stopPropagation(), hn();
1965
1973
  }), o.addEventListener("mousedown", (S) => {
1966
1974
  const k = S.target;
1967
- if (!(k instanceof HTMLElement) || k === D || D.contains(k) || k === y || h.contains(k) || k === l || l.contains(k) || k === u || k === g || p.contains(k) || v.contains(k)) return;
1975
+ if (!(k instanceof HTMLElement) || k === D || D.contains(k) || k === y || h.contains(k) || k === l || l.contains(k) || k === u || k === g || f.contains(k) || v.contains(k)) return;
1968
1976
  const P = typeof n == "function" ? n() : null;
1969
1977
  if (typeof P != "number") return;
1970
1978
  const O = P + r.nodeSize - 1, R = Zn.create(e.state.doc, O);
@@ -1977,43 +1985,43 @@ const Le = () => {
1977
1985
  const k = S.trim();
1978
1986
  if (k !== ge) {
1979
1987
  if (!k) {
1980
- f.innerHTML = "", ge = "";
1988
+ p.innerHTML = "", ge = "";
1981
1989
  return;
1982
1990
  }
1983
1991
  try {
1984
1992
  const P = await import("mermaid");
1985
1993
  P.default.initialize({ startOnLoad: !1, theme: "default" }), Ne += 1;
1986
1994
  const O = `fig-mermaid-${Ne}`, { svg: R } = await P.default.render(O, k);
1987
- f.innerHTML = R, ge = k;
1995
+ p.innerHTML = R, ge = k;
1988
1996
  } catch {
1989
- f.innerHTML = "", ge = "";
1997
+ p.innerHTML = "", ge = "";
1990
1998
  } finally {
1991
1999
  Le();
1992
2000
  }
1993
2001
  }
1994
2002
  }, J = () => {
1995
- const S = I.getState().editorLanguage, k = q(S), P = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", O = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", R = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", fe = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
2003
+ const S = I.getState().editorLanguage, k = H(S), P = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", O = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", R = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", fe = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
1996
2004
  O ? (A.textContent = `[${O}] `, A.style.display = "inline") : (A.textContent = "", A.style.display = "none");
1997
- const K = P === "image", X = P === "mermaid", W = P === "drawio";
1998
- s.style.display = K && R ? "block" : "none", l.style.display = K && !R ? "flex" : "none", u.style.display = K && R ? "block" : "none", p.style.display = X && !a ? "block" : "none", h.style.display = X && a ? "block" : "none", v.style.display = W ? "flex" : "none", K && R && (s.src = R);
2005
+ const K = P === "image", X = P === "mermaid", U = P === "drawio";
2006
+ s.style.display = K && R ? "block" : "none", l.style.display = K && !R ? "flex" : "none", u.style.display = K && R ? "block" : "none", f.style.display = X && !a ? "block" : "none", h.style.display = X && a ? "block" : "none", v.style.display = U ? "flex" : "none", K && R && (s.src = R);
1999
2007
  const oe = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
2000
- W && (oe ? (_.src = oe, _.style.display = "block") : (_.src = "", _.style.display = "none")), d.textContent = k.figureUploadHint || "点击上传或拖拽图片", u.textContent = k.figureReplaceImage || "更换图片", x.textContent = k.mermaidSaveAndRender || "保存并渲染", w.textContent = k.mermaidCancel || "取消";
2001
- const Te = fe.trim().length > 0, ce = f.querySelector("svg") !== null;
2002
- X && !a && (Te && ce ? (b.textContent = k.mermaidDoubleClickToEdit || "双击编辑", b.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (b.textContent = k.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", b.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), W && !i && (oe ? (C.textContent = k.mermaidDoubleClickToEdit || "双击编辑", C.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (C.textContent = k.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", C.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), X && !a && fe.trim() !== ge && wn(fe);
2008
+ U && (oe ? (_.src = oe, _.style.display = "block") : (_.src = "", _.style.display = "none")), d.textContent = k.figureUploadHint || "点击上传或拖拽图片", u.textContent = k.figureReplaceImage || "更换图片", x.textContent = k.mermaidSaveAndRender || "保存并渲染", w.textContent = k.mermaidCancel || "取消";
2009
+ const Te = fe.trim().length > 0, ce = p.querySelector("svg") !== null;
2010
+ X && !a && (Te && ce ? (b.textContent = k.mermaidDoubleClickToEdit || "双击编辑", b.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (b.textContent = k.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", b.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), U && !i && (oe ? (C.textContent = k.mermaidDoubleClickToEdit || "双击编辑", C.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (C.textContent = k.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", C.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), X && !a && fe.trim() !== ge && wn(fe);
2003
2011
  const Cn = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
2004
- W && Cn && !oe && !xe && !i && (se && clearTimeout(se), se = setTimeout(() => {
2012
+ U && Cn && !oe && !xe && !i && (se && clearTimeout(se), se = setTimeout(() => {
2005
2013
  se = null;
2006
- const lt = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "", Tn = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
2007
- !lt || Tn || xe || (xe = !0, Da(lt, (dt) => {
2008
- xe = !1, dt ? (Ce = 0, z({ drawioSvg: dt })) : Ce < yn && (Ce++, me = setTimeout(() => {
2014
+ const dt = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "", Tn = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
2015
+ !dt || Tn || xe || (xe = !0, Da(dt, (ut) => {
2016
+ xe = !1, ut ? (Ce = 0, z({ drawioSvg: ut })) : Ce < yn && (Ce++, me = setTimeout(() => {
2009
2017
  me = null, J();
2010
2018
  }, vn * Ce));
2011
2019
  }));
2012
2020
  }, bn));
2013
2021
  };
2014
- let ct = I.getState().editorLanguage;
2022
+ let lt = I.getState().editorLanguage;
2015
2023
  const xn = I.subscribe((S) => {
2016
- S.editorLanguage !== ct && (ct = S.editorLanguage, J());
2024
+ S.editorLanguage !== lt && (lt = S.editorLanguage, J());
2017
2025
  });
2018
2026
  return J(), {
2019
2027
  dom: o,
@@ -2028,7 +2036,7 @@ const Le = () => {
2028
2036
  },
2029
2037
  update: (S) => S.type.name !== "figure" ? !1 : (r = S, J(), !0),
2030
2038
  destroy: () => {
2031
- se && (clearTimeout(se), se = null), me && (clearTimeout(me), me = null), xn(), Le(), ee && (window.removeEventListener("message", ee), ee = null), U && (U.src = "about:blank", U = null), G && (G.remove(), G = null);
2039
+ se && (clearTimeout(se), se = null), me && (clearTimeout(me), me = null), xn(), Le(), ee && (window.removeEventListener("message", ee), ee = null), q && (q.src = "about:blank", q = null), G && (G.remove(), G = null);
2032
2040
  }
2033
2041
  };
2034
2042
  };
@@ -2094,7 +2102,7 @@ const Le = () => {
2094
2102
  return ({ node: e, editor: t }) => {
2095
2103
  let n = e;
2096
2104
  const r = document.createElement("span"), a = () => {
2097
- const i = n.attrs.lang === "en" ? "en" : "zh", o = q(i), c = n.attrs.targetType === "figure" ? "figure" : "claim", s = Number(n.attrs.resolvedNumber), l = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, d = c === "figure" ? l || (i === "en" ? "Figure ?" : "附图?") : Number.isFinite(s) ? o.claimLabel(s) : i === "en" ? "Claim ?" : "权利要求?", g = n.attrs.displayText || d;
2105
+ const i = n.attrs.lang === "en" ? "en" : "zh", o = H(i), c = n.attrs.targetType === "figure" ? "figure" : "claim", s = Number(n.attrs.resolvedNumber), l = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, d = c === "figure" ? l || (i === "en" ? "Figure ?" : "附图?") : Number.isFinite(s) ? o.claimLabel(s) : i === "en" ? "Claim ?" : "权利要求?", g = n.attrs.displayText || d;
2098
2106
  r.textContent = g, r.className = `reference-link${n.attrs.invalid ? " reference-link-invalid" : ""}`, r.setAttribute("data-type", "reference"), r.setAttribute("data-highlight", n.attrs.highlight ? "true" : "false"), r.title = n.attrs.invalid ? o.referenceNavigateDisabledTitle : c === "figure" ? o.figureReferenceNavigateTitle : o.referenceNavigateTitle;
2099
2107
  };
2100
2108
  return a(), r.addEventListener("click", () => {
@@ -2119,7 +2127,7 @@ const Le = () => {
2119
2127
  };
2120
2128
  };
2121
2129
  }
2122
- }), vt = {
2130
+ }), wt = {
2123
2131
  technical_field: "sectionTitle_technical_field",
2124
2132
  background_art: "sectionTitle_background_art",
2125
2133
  summary: "sectionTitle_summary",
@@ -2151,14 +2159,14 @@ const Le = () => {
2151
2159
  "summary",
2152
2160
  "drawing_description",
2153
2161
  "detailed_description"
2154
- ]), st = (e) => {
2162
+ ]), ot = (e) => {
2155
2163
  if (e.isText)
2156
2164
  return (e.text ?? "").trim().length > 0;
2157
2165
  if (e.isAtom || e.isLeaf || !["patent_section", "patent_title", "paragraph"].includes(e.type.name))
2158
2166
  return !0;
2159
2167
  let t = !1;
2160
2168
  return e.forEach((n) => {
2161
- !t && st(n) && (t = !0);
2169
+ !t && ot(n) && (t = !0);
2162
2170
  }), t;
2163
2171
  }, za = Z.create({
2164
2172
  name: "patent_title",
@@ -2203,22 +2211,22 @@ const Le = () => {
2203
2211
  };
2204
2212
  o.addEventListener("click", d), c.addEventListener("focusin", l), c.addEventListener("click", l);
2205
2213
  const g = () => {
2206
- const b = I.getState(), h = q(b.editorLanguage), y = typeof h.bookTitle_description == "string" ? h.bookTitle_description : "说明书", E = typeof h.patentTitlePlaceholder == "string" ? h.patentTitlePlaceholder : "专利名称";
2214
+ const b = I.getState(), h = H(b.editorLanguage), y = typeof h.bookTitle_description == "string" ? h.bookTitle_description : "说明书", E = typeof h.patentTitlePlaceholder == "string" ? h.patentTitlePlaceholder : "专利名称";
2207
2215
  i.textContent = y;
2208
- const x = st(r), w = b.rightPanel.activeSectionPos === s();
2216
+ const x = ot(r), w = b.rightPanel.activeSectionPos === s();
2209
2217
  o.textContent = `[${E}]`, o.style.display = x ? "none" : "", o.classList.toggle("ps-placeholder--active", w && !x), c.classList.toggle("pt-title-content--has-content", x);
2210
2218
  };
2211
- let u = I.getState().editorLanguage, p = I.getState().rightPanel.activeSectionPos;
2212
- const f = I.subscribe((b) => {
2213
- const h = b.editorLanguage !== u, y = b.rightPanel.activeSectionPos !== p;
2214
- u = b.editorLanguage, p = b.rightPanel.activeSectionPos, (h || y) && g();
2219
+ let u = I.getState().editorLanguage, f = I.getState().rightPanel.activeSectionPos;
2220
+ const p = I.subscribe((b) => {
2221
+ const h = b.editorLanguage !== u, y = b.rightPanel.activeSectionPos !== f;
2222
+ u = b.editorLanguage, f = b.rightPanel.activeSectionPos, (h || y) && g();
2215
2223
  });
2216
2224
  return g(), {
2217
2225
  dom: a,
2218
2226
  contentDOM: c,
2219
2227
  update: (b) => b.type.name !== "patent_title" ? !1 : (r = b, g(), !0),
2220
2228
  destroy: () => {
2221
- f(), o.removeEventListener("click", d), c.removeEventListener("focusin", l), c.removeEventListener("click", l);
2229
+ p(), o.removeEventListener("click", d), c.removeEventListener("focusin", l), c.removeEventListener("click", l);
2222
2230
  }
2223
2231
  };
2224
2232
  };
@@ -2308,13 +2316,13 @@ const Le = () => {
2308
2316
  };
2309
2317
  c.addEventListener("click", g), s.addEventListener("focusin", d), s.addEventListener("click", d);
2310
2318
  const u = () => {
2311
- const h = I.getState(), y = q(h.editorLanguage), E = Object.keys(vt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", x = Fa.has(E), w = $a.has(E), T = vt[E], v = typeof y[T] == "string" ? y[T] : E, _ = st(r), C = h.rightPanel.activeSectionPos === l();
2319
+ const h = I.getState(), y = H(h.editorLanguage), E = Object.keys(wt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", x = Fa.has(E), w = $a.has(E), T = wt[E], v = typeof y[T] == "string" ? y[T] : E, _ = ot(r), C = h.rightPanel.activeSectionPos === l();
2312
2320
  a.className = `ps${_ ? "" : " ps--empty"}${w ? " ps--sub" : ""}`, a.setAttribute("data-section-type", E), i.className = x ? "pb-heading" : "ps-heading ps-heading--sub", i.textContent = v, c.textContent = `[${v}]`, c.style.display = _ ? "none" : "", c.classList.toggle("ps-placeholder--active", C && !_), s.classList.toggle("ps-content--has-content", _);
2313
2321
  };
2314
- let p = I.getState().editorLanguage, f = I.getState().rightPanel.activeSectionPos;
2322
+ let f = I.getState().editorLanguage, p = I.getState().rightPanel.activeSectionPos;
2315
2323
  const b = I.subscribe((h) => {
2316
- const y = h.editorLanguage !== p, E = h.rightPanel.activeSectionPos !== f;
2317
- p = h.editorLanguage, f = h.rightPanel.activeSectionPos, (y || E) && u();
2324
+ const y = h.editorLanguage !== f, E = h.rightPanel.activeSectionPos !== p;
2325
+ f = h.editorLanguage, p = h.rightPanel.activeSectionPos, (y || E) && u();
2318
2326
  });
2319
2327
  return u(), {
2320
2328
  dom: a,
@@ -2357,18 +2365,18 @@ const Le = () => {
2357
2365
  type: "paragraph"
2358
2366
  }
2359
2367
  ]
2360
- }), Qt = () => ({
2368
+ }), en = () => ({
2361
2369
  type: "patent_title",
2362
2370
  content: []
2363
2371
  }), Wa = () => [
2364
2372
  ...Ba.map(Fe),
2365
- Qt(),
2373
+ en(),
2366
2374
  ...Ha.map(Fe),
2367
2375
  ...qa.map(Fe)
2368
2376
  ], ja = () => [
2369
- Qt(),
2377
+ en(),
2370
2378
  ...Ua.map(Fe)
2371
- ], en = (e = "invention") => ({ type: "doc", content: e === "design" ? ja() : Wa() }), ve = (e) => Kt(e, (t) => t.type.name === "figure"), V = (e) => typeof e != "string" ? "" : e.trim(), wt = (e) => {
2379
+ ], tn = (e = "invention") => ({ type: "doc", content: e === "design" ? ja() : Wa() }), ve = (e) => Xt(e, (t) => t.type.name === "figure"), V = (e) => typeof e != "string" ? "" : e.trim(), xt = (e) => {
2372
2380
  const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
2373
2381
  ve(e).forEach((i) => {
2374
2382
  const o = V(i.node.attrs.id);
@@ -2396,7 +2404,7 @@ const Le = () => {
2396
2404
  !s || s.type.name !== "figure" || o.setNodeMarkup(c.pos, void 0, { ...s.attrs, id: c.expectedId });
2397
2405
  }
2398
2406
  o.steps.length > 0 && (o.setMeta("addToHistory", !1), e.view.dispatch(o));
2399
- }, tn = (e) => {
2407
+ }, nn = (e) => {
2400
2408
  const t = /* @__PURE__ */ new Map();
2401
2409
  return ve(e).forEach((n) => {
2402
2410
  const r = V(n.node.attrs.id);
@@ -2405,29 +2413,29 @@ const Le = () => {
2405
2413
  pos: n.pos
2406
2414
  });
2407
2415
  }), t;
2408
- }, nn = () => I.getState().editorLanguage === "en" ? "en" : "zh", rn = (e, t, n) => {
2409
- const r = q(e);
2416
+ }, rn = () => I.getState().editorLanguage === "en" ? "en" : "zh", an = (e, t, n) => {
2417
+ const r = H(e);
2410
2418
  return n ? r.invalidFigureReference : t || (e === "en" ? "Figure ?" : "附图?");
2411
2419
  }, Je = (e) => {
2412
- const t = tn(e), n = nn();
2420
+ const t = nn(e), n = rn();
2413
2421
  e.commands.command(({ tr: r, state: a, dispatch: i }) => {
2414
2422
  let o = !1;
2415
2423
  return a.doc.descendants((c, s) => {
2416
2424
  if (c.type.name !== "reference" || c.attrs.targetType !== "figure")
2417
2425
  return !0;
2418
- const l = typeof c.attrs.targetFigureId == "string" && c.attrs.targetFigureId ? V(c.attrs.targetFigureId) : null, d = l ? t.get(l) : void 0, g = d ? d.id : null, u = !d, p = rn(n, g, u), f = {
2426
+ const l = typeof c.attrs.targetFigureId == "string" && c.attrs.targetFigureId ? V(c.attrs.targetFigureId) : null, d = l ? t.get(l) : void 0, g = d ? d.id : null, u = !d, f = an(n, g, u), p = {
2419
2427
  ...c.attrs,
2420
2428
  targetType: "figure",
2421
2429
  targetFigureId: l,
2422
2430
  resolvedFigureId: g,
2423
2431
  invalid: u,
2424
2432
  lang: n,
2425
- displayText: p,
2433
+ displayText: f,
2426
2434
  target: g || c.attrs.target || l || null
2427
2435
  };
2428
- return Object.keys(f).some(
2429
- (h) => f[h] !== c.attrs[h]
2430
- ) && (r.setNodeMarkup(s, void 0, f), o = !0), !0;
2436
+ return Object.keys(p).some(
2437
+ (h) => p[h] !== c.attrs[h]
2438
+ ) && (r.setNodeMarkup(s, void 0, p), o = !0), !0;
2431
2439
  }), o && i && i(r), !0;
2432
2440
  });
2433
2441
  }, Ja = {
@@ -2472,7 +2480,7 @@ const Le = () => {
2472
2480
  shortcut: "Ctrl+Shift+F",
2473
2481
  isActive: ({ editor: e }) => e.isActive("figure"),
2474
2482
  execute: ({ editor: e }, t) => {
2475
- const n = typeof t == "object" && t ? t : {}, r = V(n.id) || wt(e), a = n.contentType && ["image", "mermaid", "drawio"].includes(n.contentType) ? n.contentType : "image";
2483
+ const n = typeof t == "object" && t ? t : {}, r = V(n.id) || xt(e), a = n.contentType && ["image", "mermaid", "drawio"].includes(n.contentType) ? n.contentType : "image";
2476
2484
  return e.chain().focus().insertContent({
2477
2485
  type: "figure",
2478
2486
  attrs: { id: r, contentType: a, imageSrc: "", mermaidCode: "", drawioXml: "" },
@@ -2490,7 +2498,7 @@ const Le = () => {
2490
2498
  const i = e.state.doc.nodeAt(a);
2491
2499
  if (!i || i.type.name !== "figure")
2492
2500
  return !1;
2493
- const c = (typeof n.id == "string" ? V(n.id) : V(i.attrs.id)) || wt(e);
2501
+ const c = (typeof n.id == "string" ? V(n.id) : V(i.attrs.id)) || xt(e);
2494
2502
  if (ve(e).some((d) => d.pos === a ? !1 : V(d.node.attrs.id) === c))
2495
2503
  return !1;
2496
2504
  const l = { id: c };
@@ -2531,13 +2539,13 @@ const Le = () => {
2531
2539
  return typeof n.targetFigureId == "string" && n.targetFigureId.trim().length > 0;
2532
2540
  },
2533
2541
  execute: ({ editor: e }, t) => {
2534
- const n = typeof t == "object" && t ? t : {}, r = tn(e), a = typeof n.targetFigureId == "string" ? V(n.targetFigureId) : "";
2542
+ const n = typeof t == "object" && t ? t : {}, r = nn(e), a = typeof n.targetFigureId == "string" ? V(n.targetFigureId) : "";
2535
2543
  if (!a)
2536
2544
  return !1;
2537
2545
  const i = r.get(a);
2538
2546
  if (!i)
2539
2547
  return !1;
2540
- const o = n.lang || nn(), c = n.displayText || rn(o, i.id, !1);
2548
+ const o = n.lang || rn(), c = n.displayText || an(o, i.id, !1);
2541
2549
  return e.chain().focus().insertContent({
2542
2550
  type: "reference",
2543
2551
  attrs: {
@@ -2559,7 +2567,7 @@ const Le = () => {
2559
2567
  description: "Insert patent document skeleton with all sections",
2560
2568
  category: "patent",
2561
2569
  execute: ({ editor: e }, t) => {
2562
- const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a = en(r);
2570
+ const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a = tn(r);
2563
2571
  return e.commands.setContent(a);
2564
2572
  }
2565
2573
  },
@@ -2600,20 +2608,20 @@ const Xa = (e = {}) => {
2600
2608
  selection: { from: t, to: n },
2601
2609
  store: I.getState()
2602
2610
  };
2603
- }, ot = (e) => ({
2611
+ }, ct = (e) => ({
2604
2612
  execCommand: (t, n, r) => B.executeCommand(t, Ke(e), n, r),
2605
2613
  canExecCommand: (t, n) => B.canExecuteCommand(t, Ke(e), n),
2606
2614
  isCommandActive: (t) => B.isCommandActive(t, Ke(e)),
2607
2615
  listCommands: () => B.getCommandNames(),
2608
- insertNode: (t) => Xt(e, t),
2616
+ insertNode: (t) => Yt(e, t),
2609
2617
  updateNodeAttrs: (t) => ze(e, t),
2610
- removeNode: (t) => Yt(e, t),
2611
- wrapSelection: (t) => Zt(e, t),
2618
+ removeNode: (t) => Zt(e, t),
2619
+ wrapSelection: (t) => Qt(e, t),
2612
2620
  applyTransactionBatch: (t) => La(e, t),
2613
- findNodeByType: (t, n) => it(e, t, n),
2621
+ findNodeByType: (t, n) => st(e, t, n),
2614
2622
  findAncestorNode: (t) => Re(e, t),
2615
2623
  findCurrentBlock: () => Ia(e),
2616
- findNodesByPredicate: (t, n) => Kt(e, t, n)
2624
+ findNodesByPredicate: (t, n) => Xt(e, t, n)
2617
2625
  }), Ya = ["history", "text", "structure", "format", "technical", "patent"], Za = {
2618
2626
  history: "groupHistory",
2619
2627
  text: "groupText",
@@ -2627,8 +2635,8 @@ const Xa = (e = {}) => {
2627
2635
  if (n && typeof t[n] == "string") return t[n];
2628
2636
  }
2629
2637
  return e.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ");
2630
- }, xt = ({ btn: e, items: t }) => {
2631
- const [n, r] = $(!1), a = j(null), i = j(null), [o, c] = $({ top: 0, left: 0 }), s = ae(() => {
2638
+ }, Ct = ({ btn: e, items: t }) => {
2639
+ const [n, r] = $(!1), a = W(null), i = W(null), [o, c] = $({ top: 0, left: 0 }), s = ae(() => {
2632
2640
  if (!a.current) return;
2633
2641
  const l = a.current.getBoundingClientRect();
2634
2642
  c({ top: l.bottom + 4, left: l.left });
@@ -2637,9 +2645,9 @@ const Xa = (e = {}) => {
2637
2645
  if (!n) return;
2638
2646
  s();
2639
2647
  const l = (g) => {
2640
- var p, f;
2648
+ var f, p;
2641
2649
  const u = g.target;
2642
- (p = a.current) != null && p.contains(u) || (f = i.current) != null && f.contains(u) || r(!1);
2650
+ (f = a.current) != null && f.contains(u) || (p = i.current) != null && p.contains(u) || r(!1);
2643
2651
  }, d = () => s();
2644
2652
  return document.addEventListener("mousedown", l), window.addEventListener("scroll", d, !0), () => {
2645
2653
  document.removeEventListener("mousedown", l), window.removeEventListener("scroll", d, !0);
@@ -2669,7 +2677,7 @@ const Xa = (e = {}) => {
2669
2677
  e.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200 text-gray-500"
2670
2678
  ),
2671
2679
  disabled: e.disabled,
2672
- children: /* @__PURE__ */ m(qt, { size: 12 })
2680
+ children: /* @__PURE__ */ m(Ut, { size: 12 })
2673
2681
  }
2674
2682
  ),
2675
2683
  n && yr(
@@ -2701,10 +2709,10 @@ const Xa = (e = {}) => {
2701
2709
  collapsibleGroups: n = !0,
2702
2710
  defaultCollapsedGroups: r = []
2703
2711
  }) => {
2704
- const [a, i] = $(() => new Set(r)), { editorLanguage: o, setEditorLanguage: c } = I(), s = q(o);
2712
+ const [a, i] = $(() => new Set(r)), { editorLanguage: o, setEditorLanguage: c } = I(), s = H(o);
2705
2713
  if (!e)
2706
2714
  return null;
2707
- const l = ot(e), d = o === "zh", g = [
2715
+ const l = ct(e), d = o === "zh", g = [
2708
2716
  {
2709
2717
  id: "core-undo",
2710
2718
  label: s.undo,
@@ -2733,7 +2741,7 @@ const Xa = (e = {}) => {
2733
2741
  id: "core-bold",
2734
2742
  label: s.bold,
2735
2743
  group: "text",
2736
- icon: Pt,
2744
+ icon: Dt,
2737
2745
  tooltip: s.bold,
2738
2746
  isActive: e.isActive("bold"),
2739
2747
  disabled: !1,
@@ -2745,7 +2753,7 @@ const Xa = (e = {}) => {
2745
2753
  id: "core-italic",
2746
2754
  label: s.italic,
2747
2755
  group: "text",
2748
- icon: Dt,
2756
+ icon: Rt,
2749
2757
  tooltip: s.italic,
2750
2758
  isActive: e.isActive("italic"),
2751
2759
  disabled: !1,
@@ -2757,7 +2765,7 @@ const Xa = (e = {}) => {
2757
2765
  id: "core-underline",
2758
2766
  label: s.underline,
2759
2767
  group: "text",
2760
- icon: Rt,
2768
+ icon: Mt,
2761
2769
  tooltip: s.underline,
2762
2770
  isActive: e.isActive("underline"),
2763
2771
  disabled: !1,
@@ -2769,7 +2777,7 @@ const Xa = (e = {}) => {
2769
2777
  id: "core-strike",
2770
2778
  label: s.strike,
2771
2779
  group: "text",
2772
- icon: Mt,
2780
+ icon: Ft,
2773
2781
  tooltip: s.strike,
2774
2782
  isActive: e.isActive("strike"),
2775
2783
  disabled: !1,
@@ -2781,7 +2789,7 @@ const Xa = (e = {}) => {
2781
2789
  id: "core-code",
2782
2790
  label: s.code,
2783
2791
  group: "text",
2784
- icon: Ft,
2792
+ icon: $t,
2785
2793
  tooltip: s.code,
2786
2794
  isActive: e.isActive("code"),
2787
2795
  disabled: !1,
@@ -2793,7 +2801,7 @@ const Xa = (e = {}) => {
2793
2801
  id: "core-superscript",
2794
2802
  label: s.superscript,
2795
2803
  group: "text",
2796
- icon: $t,
2804
+ icon: zt,
2797
2805
  tooltip: `${s.superscript} (Ctrl+.)`,
2798
2806
  isActive: e.isActive("superscript"),
2799
2807
  disabled: !1,
@@ -2805,7 +2813,7 @@ const Xa = (e = {}) => {
2805
2813
  id: "core-subscript",
2806
2814
  label: s.subscript,
2807
2815
  group: "text",
2808
- icon: zt,
2816
+ icon: Ot,
2809
2817
  tooltip: `${s.subscript} (Ctrl+,)`,
2810
2818
  isActive: e.isActive("subscript"),
2811
2819
  disabled: !1,
@@ -2999,16 +3007,16 @@ const Xa = (e = {}) => {
2999
3007
  FunctionSquare: $r,
3000
3008
  Workflow: Fr,
3001
3009
  Box: Mr,
3002
- FileText: Ht,
3003
- Link2: Bt,
3004
- Image: Ot
3005
- }, p = B.getToolbarItems().map((v) => {
3010
+ FileText: qt,
3011
+ Link2: Ht,
3012
+ Image: Bt
3013
+ }, f = B.getToolbarItems().map((v) => {
3006
3014
  const _ = B.getCommandMeta(v.command), C = d && v.tooltipZh ? v.tooltipZh : v.tooltip || (_ == null ? void 0 : _.description) || v.label, N = v.shortcut || (_ == null ? void 0 : _.shortcut), A = N ? `${C} (${N})` : C;
3007
3015
  return {
3008
3016
  id: v.id,
3009
3017
  label: v.label,
3010
3018
  group: v.group || "technical",
3011
- icon: v.icon ? u[v.icon] || ut : ut,
3019
+ icon: v.icon ? u[v.icon] || mt : mt,
3012
3020
  isActive: l.isCommandActive(v.command),
3013
3021
  disabled: !l.canExecCommand(v.command),
3014
3022
  tooltip: A,
@@ -3016,9 +3024,9 @@ const Xa = (e = {}) => {
3016
3024
  l.execCommand(v.command);
3017
3025
  }
3018
3026
  };
3019
- }), f = [...g, ...p], b = f.map((v) => v.group).filter((v, _, C) => C.indexOf(v) === _ && !t.includes(v)), y = [...t, ...b].map((v) => ({
3027
+ }), p = [...g, ...f], b = p.map((v) => v.group).filter((v, _, C) => C.indexOf(v) === _ && !t.includes(v)), y = [...t, ...b].map((v) => ({
3020
3028
  group: v,
3021
- items: f.filter((_) => _.group === v)
3029
+ items: p.filter((_) => _.group === v)
3022
3030
  })).filter((v) => v.items.length > 0), E = (v) => {
3023
3031
  i((_) => {
3024
3032
  const C = new Set(_);
@@ -3040,7 +3048,7 @@ const Xa = (e = {}) => {
3040
3048
  { label: s.insertImageFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "image" }) },
3041
3049
  { label: s.insertMermaidFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
3042
3050
  { label: s.insertDrawioFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "drawio" }) }
3043
- ], T = (v) => v.id === "core-table" ? /* @__PURE__ */ m(xt, { btn: v, items: x }, v.id) : v.id === "patent-figure-insert" ? /* @__PURE__ */ m(xt, { btn: v, items: w }, v.id) : /* @__PURE__ */ m(
3051
+ ], T = (v) => v.id === "core-table" ? /* @__PURE__ */ m(Ct, { btn: v, items: x }, v.id) : v.id === "patent-figure-insert" ? /* @__PURE__ */ m(Ct, { btn: v, items: w }, v.id) : /* @__PURE__ */ m(
3044
3052
  "button",
3045
3053
  {
3046
3054
  onClick: v.run,
@@ -3092,7 +3100,7 @@ const Xa = (e = {}) => {
3092
3100
  })
3093
3101
  ] }) });
3094
3102
  }, ei = ({ editor: e }) => {
3095
- const [t, n] = $(0), [r, a] = $(""), i = I((w) => w.editorLanguage), o = q(i);
3103
+ const [t, n] = $(0), [r, a] = $(""), i = I((w) => w.editorLanguage), o = H(i);
3096
3104
  if (M(() => {
3097
3105
  if (!e) return;
3098
3106
  const w = () => n((T) => T + 1);
@@ -3100,14 +3108,14 @@ const Xa = (e = {}) => {
3100
3108
  e.off("selectionUpdate", w), e.off("update", w);
3101
3109
  };
3102
3110
  }, [e]), !e) return null;
3103
- const c = ot(e), s = [];
3111
+ const c = ct(e), s = [];
3104
3112
  e.state.doc.descendants((w) => {
3105
3113
  if (w.type.name !== "figure") return !0;
3106
3114
  const T = typeof w.attrs.id == "string" ? w.attrs.id.trim() : "";
3107
3115
  return T && s.push({ id: T, label: T }), !0;
3108
3116
  });
3109
- const l = c.findAncestorNode("figure"), d = !!l, g = l && typeof l.node.attrs.id == "string" ? l.node.attrs.id.trim() : "", u = l && typeof l.node.attrs.contentType == "string" ? l.node.attrs.contentType : "image", [p, f] = $(""), b = j(null), h = j(null), y = (l == null ? void 0 : l.pos) ?? null;
3110
- y !== h.current && (h.current = y, d && g !== p && f(g));
3117
+ const l = c.findAncestorNode("figure"), d = !!l, g = l && typeof l.node.attrs.id == "string" ? l.node.attrs.id.trim() : "", u = l && typeof l.node.attrs.contentType == "string" ? l.node.attrs.contentType : "image", [f, p] = $(""), b = W(null), h = W(null), y = (l == null ? void 0 : l.pos) ?? null;
3118
+ y !== h.current && (h.current = y, d && g !== f && p(g));
3111
3119
  const E = (w) => {
3112
3120
  l && c.execCommand("patent.updateFigure", {
3113
3121
  position: l.pos,
@@ -3115,7 +3123,7 @@ const Xa = (e = {}) => {
3115
3123
  });
3116
3124
  }, x = () => {
3117
3125
  if (!l) return;
3118
- const w = p.trim();
3126
+ const w = f.trim();
3119
3127
  w !== g && c.execCommand("patent.updateFigure", {
3120
3128
  position: l.pos,
3121
3129
  id: w
@@ -3147,7 +3155,7 @@ const Xa = (e = {}) => {
3147
3155
  },
3148
3156
  className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
3149
3157
  title: o.insertFigureReference,
3150
- children: /* @__PURE__ */ m(Ot, { size: 16 })
3158
+ children: /* @__PURE__ */ m(Bt, { size: 16 })
3151
3159
  }
3152
3160
  )
3153
3161
  ] }),
@@ -3160,8 +3168,8 @@ const Xa = (e = {}) => {
3160
3168
  {
3161
3169
  ref: b,
3162
3170
  type: "text",
3163
- value: p,
3164
- onChange: (w) => f(w.target.value),
3171
+ value: f,
3172
+ onChange: (w) => p(w.target.value),
3165
3173
  onBlur: x,
3166
3174
  onKeyDown: (w) => {
3167
3175
  w.key === "Enter" && (x(), w.target.blur());
@@ -3216,7 +3224,7 @@ const Xa = (e = {}) => {
3216
3224
  }
3217
3225
  )
3218
3226
  ] }) });
3219
- }, an = {
3227
+ }, sn = {
3220
3228
  // Invention & Utility Model
3221
3229
  technical_field: [],
3222
3230
  background_art: ["technical_field"],
@@ -3235,7 +3243,7 @@ const Xa = (e = {}) => {
3235
3243
  design_brief: ["design_description", "design_views"]
3236
3244
  };
3237
3245
  function Us(e, t) {
3238
- return (an[e] || []).filter((r) => !t.has(r));
3246
+ return (sn[e] || []).filter((r) => !t.has(r));
3239
3247
  }
3240
3248
  function ti(e) {
3241
3249
  const t = [];
@@ -3249,7 +3257,7 @@ function ti(e) {
3249
3257
  content: n.textContent || ""
3250
3258
  }), !1) : !0), t;
3251
3259
  }
3252
- function sn(e) {
3260
+ function on(e) {
3253
3261
  const { from: t } = e.state.selection, n = e.state.doc.resolve(t);
3254
3262
  for (let r = n.depth; r >= 0; r--) {
3255
3263
  const a = n.node(r);
@@ -3269,7 +3277,7 @@ function sn(e) {
3269
3277
  return null;
3270
3278
  }
3271
3279
  function ni(e, t) {
3272
- const n = an[t];
3280
+ const n = sn[t];
3273
3281
  if (!n || n.length === 0) return [];
3274
3282
  const r = ti(e), a = new Map(r.map((i) => [i.sectionType, i]));
3275
3283
  return n.map((i) => {
@@ -3284,14 +3292,14 @@ function Ws(e, t = {}) {
3284
3292
  const n = I.getState().editorLanguage, { from: r, to: a } = e.state.selection, i = r !== a ? e.state.doc.textBetween(r, a, " ", "\0") : void 0;
3285
3293
  let o = t.sectionType, c = t.targetSectionPos;
3286
3294
  if (!o) {
3287
- const g = sn(e);
3295
+ const g = on(e);
3288
3296
  g && (o = g.sectionType, c = g.pos);
3289
3297
  }
3290
3298
  const s = t.scope || (o ? "section" : i ? "selection" : "document"), l = o ? ni(e, o) : void 0;
3291
3299
  let d;
3292
3300
  if (s === "selection" && r !== a) {
3293
- const u = Math.max(0, r - 200), p = Math.min(e.state.doc.content.size, a + 200), f = e.state.doc.textBetween(u, r, " ", "\0"), b = e.state.doc.textBetween(a, p, " ", "\0");
3294
- d = `...${f}[SELECTED]${b}...`;
3301
+ const u = Math.max(0, r - 200), f = Math.min(e.state.doc.content.size, a + 200), p = e.state.doc.textBetween(u, r, " ", "\0"), b = e.state.doc.textBetween(a, f, " ", "\0");
3302
+ d = `...${p}[SELECTED]${b}...`;
3295
3303
  }
3296
3304
  return {
3297
3305
  scope: s,
@@ -3311,7 +3319,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3311
3319
  ), c = () => {
3312
3320
  const { from: l, to: d } = e.state.selection;
3313
3321
  if (l === d) return;
3314
- const g = e.state.doc.textBetween(l, d, " "), u = sn(e);
3322
+ const g = e.state.doc.textBetween(l, d, " "), u = on(e);
3315
3323
  if (t) {
3316
3324
  t({ text: g, from: l, to: d, sectionType: u == null ? void 0 : u.sectionType });
3317
3325
  return;
@@ -3336,7 +3344,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3336
3344
  onClick: () => e.chain().focus().toggleBold().run(),
3337
3345
  className: o(e.isActive("bold")),
3338
3346
  title: "Bold",
3339
- children: /* @__PURE__ */ m(Pt, { size: 15 })
3347
+ children: /* @__PURE__ */ m(Dt, { size: 15 })
3340
3348
  }
3341
3349
  ),
3342
3350
  /* @__PURE__ */ m(
@@ -3345,7 +3353,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3345
3353
  onClick: () => e.chain().focus().toggleItalic().run(),
3346
3354
  className: o(e.isActive("italic")),
3347
3355
  title: "Italic",
3348
- children: /* @__PURE__ */ m(Dt, { size: 15 })
3356
+ children: /* @__PURE__ */ m(Rt, { size: 15 })
3349
3357
  }
3350
3358
  ),
3351
3359
  /* @__PURE__ */ m(
@@ -3354,7 +3362,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3354
3362
  onClick: () => e.chain().focus().toggleUnderline().run(),
3355
3363
  className: o(e.isActive("underline")),
3356
3364
  title: "Underline",
3357
- children: /* @__PURE__ */ m(Rt, { size: 15 })
3365
+ children: /* @__PURE__ */ m(Mt, { size: 15 })
3358
3366
  }
3359
3367
  ),
3360
3368
  /* @__PURE__ */ m(
@@ -3363,7 +3371,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3363
3371
  onClick: () => e.chain().focus().toggleStrike().run(),
3364
3372
  className: o(e.isActive("strike")),
3365
3373
  title: "Strikethrough",
3366
- children: /* @__PURE__ */ m(Mt, { size: 15 })
3374
+ children: /* @__PURE__ */ m(Ft, { size: 15 })
3367
3375
  }
3368
3376
  ),
3369
3377
  /* @__PURE__ */ m(
@@ -3372,7 +3380,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3372
3380
  onClick: () => e.chain().focus().toggleCode().run(),
3373
3381
  className: o(e.isActive("code")),
3374
3382
  title: "Code",
3375
- children: /* @__PURE__ */ m(Ft, { size: 15 })
3383
+ children: /* @__PURE__ */ m($t, { size: 15 })
3376
3384
  }
3377
3385
  ),
3378
3386
  /* @__PURE__ */ m(
@@ -3381,7 +3389,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3381
3389
  onClick: () => e.chain().focus().toggleSuperscript().run(),
3382
3390
  className: o(e.isActive("superscript")),
3383
3391
  title: "Superscript",
3384
- children: /* @__PURE__ */ m($t, { size: 15 })
3392
+ children: /* @__PURE__ */ m(zt, { size: 15 })
3385
3393
  }
3386
3394
  ),
3387
3395
  /* @__PURE__ */ m(
@@ -3390,7 +3398,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3390
3398
  onClick: () => e.chain().focus().toggleSubscript().run(),
3391
3399
  className: o(e.isActive("subscript")),
3392
3400
  title: "Subscript",
3393
- children: /* @__PURE__ */ m(zt, { size: 15 })
3401
+ children: /* @__PURE__ */ m(Ot, { size: 15 })
3394
3402
  }
3395
3403
  ),
3396
3404
  /* @__PURE__ */ m("div", { className: "bubble-menu-divider" }),
@@ -3409,7 +3417,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3409
3417
  onClick: s,
3410
3418
  className: o(e.isActive("link")),
3411
3419
  title: "Link",
3412
- children: /* @__PURE__ */ m(Bt, { size: 15 })
3420
+ children: /* @__PURE__ */ m(Ht, { size: 15 })
3413
3421
  }
3414
3422
  ),
3415
3423
  /* @__PURE__ */ m("div", { className: "bubble-menu-divider" }),
@@ -3427,7 +3435,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3427
3435
  );
3428
3436
  }, ai = ({ editor: e }) => {
3429
3437
  var E;
3430
- const [t, n] = $(!1), [r, a] = $(!1), [i, o] = $(""), [c, s] = $(""), [l, d] = $(!1), g = j(null), u = e.extensionStorage.searchReplace, p = ((E = u == null ? void 0 : u.results) == null ? void 0 : E.length) ?? 0, f = (u == null ? void 0 : u.currentIndex) ?? -1;
3438
+ const [t, n] = $(!1), [r, a] = $(!1), [i, o] = $(""), [c, s] = $(""), [l, d] = $(!1), g = W(null), u = e.extensionStorage.searchReplace, f = ((E = u == null ? void 0 : u.results) == null ? void 0 : E.length) ?? 0, p = (u == null ? void 0 : u.currentIndex) ?? -1;
3431
3439
  M(() => {
3432
3440
  const x = (w) => {
3433
3441
  n(!0);
@@ -3474,7 +3482,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3474
3482
  className: "find-replace-input"
3475
3483
  }
3476
3484
  ),
3477
- /* @__PURE__ */ m("span", { className: "find-replace-count", children: p > 0 ? `${f + 1}/${p}` : i ? "0" : "" })
3485
+ /* @__PURE__ */ m("span", { className: "find-replace-count", children: f > 0 ? `${p + 1}/${f}` : i ? "0" : "" })
3478
3486
  ] }),
3479
3487
  /* @__PURE__ */ m(
3480
3488
  "button",
@@ -3486,14 +3494,14 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3486
3494
  }
3487
3495
  ),
3488
3496
  /* @__PURE__ */ m("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ m(Wr, { size: 15 }) }),
3489
- /* @__PURE__ */ m("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ m(qt, { size: 15 }) }),
3497
+ /* @__PURE__ */ m("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ m(Ut, { size: 15 }) }),
3490
3498
  /* @__PURE__ */ m(
3491
3499
  "button",
3492
3500
  {
3493
3501
  onClick: () => a((x) => !x),
3494
3502
  className: Y("find-replace-btn", r && "find-replace-btn--active"),
3495
3503
  title: "Toggle Replace",
3496
- children: /* @__PURE__ */ m(mt, { size: 15 })
3504
+ children: /* @__PURE__ */ m(gt, { size: 15 })
3497
3505
  }
3498
3506
  ),
3499
3507
  /* @__PURE__ */ m("button", { onClick: h, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ m(jr, { size: 15 }) })
@@ -3514,12 +3522,12 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3514
3522
  className: "find-replace-input"
3515
3523
  }
3516
3524
  ),
3517
- /* @__PURE__ */ m("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ m(mt, { size: 15 }) }),
3525
+ /* @__PURE__ */ m("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ m(gt, { size: 15 }) }),
3518
3526
  /* @__PURE__ */ m("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ m(Gr, { size: 15 }) })
3519
3527
  ] })
3520
3528
  ] }) : null;
3521
3529
  }, ii = ({ editor: e }) => {
3522
- const { editorLanguage: t } = I(), n = t === "zh", r = Nt(() => {
3530
+ const { editorLanguage: t } = I(), n = t === "zh", r = At(() => {
3523
3531
  const a = e.state, o = a.doc.textBetween(0, a.doc.content.size, " ", "\0").replace(/\s/g, "").length, { from: c, to: s } = a.selection;
3524
3532
  let l = 0;
3525
3533
  return c !== s && (l = a.doc.textBetween(c, s, " ", "\0").replace(/\s/g, "").length), { charCount: o, selectionCount: l };
@@ -3549,14 +3557,14 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3549
3557
  "drawing_description",
3550
3558
  "detailed_description"
3551
3559
  ]), li = ({ editor: e }) => {
3552
- const { editorLanguage: t } = I(), n = q(t), [r, a] = $(!1), [i, o] = $(0);
3560
+ const { editorLanguage: t } = I(), n = H(t), [r, a] = $(!1), [i, o] = $(0);
3553
3561
  M(() => {
3554
3562
  const s = () => o((l) => l + 1);
3555
3563
  return e.on("update", s), () => {
3556
3564
  e.off("update", s);
3557
3565
  };
3558
3566
  }, [e]);
3559
- const c = Nt(() => {
3567
+ const c = At(() => {
3560
3568
  const s = [];
3561
3569
  let l = !1;
3562
3570
  return e.state.doc.descendants((d, g) => {
@@ -3570,35 +3578,35 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3570
3578
  charCount: 0
3571
3579
  }), l = !0;
3572
3580
  }
3573
- const u = d.textContent || "", p = u.trim().length > 0, f = typeof n.patentTitlePlaceholder == "string" ? n.patentTitlePlaceholder : "Patent Title";
3581
+ const u = d.textContent || "", f = u.trim().length > 0, p = typeof n.patentTitlePlaceholder == "string" ? n.patentTitlePlaceholder : "Patent Title";
3574
3582
  return s.push({
3575
3583
  type: "section",
3576
3584
  pos: g,
3577
- title: p ? u.trim() : f,
3578
- state: p ? "filled" : "empty",
3585
+ title: f ? u.trim() : p,
3586
+ state: f ? "filled" : "empty",
3579
3587
  charCount: u.replace(/\s/g, "").length,
3580
3588
  indent: !0
3581
3589
  }), !1;
3582
3590
  }
3583
3591
  if (d.type.name === "patent_section") {
3584
- const u = d.attrs.sectionType, p = ci.has(u), f = `sectionTitle_${u}`, b = typeof n[f] == "string" ? n[f] : u, h = d.textContent || "", y = h.trim().length > 0;
3592
+ const u = d.attrs.sectionType, f = ci.has(u), p = `sectionTitle_${u}`, b = typeof n[p] == "string" ? n[p] : u, h = d.textContent || "", y = h.trim().length > 0;
3585
3593
  return s.push({
3586
3594
  type: "section",
3587
3595
  pos: g,
3588
3596
  title: b,
3589
3597
  state: y ? "filled" : "empty",
3590
3598
  charCount: h.replace(/\s/g, "").length,
3591
- indent: p
3599
+ indent: f
3592
3600
  }), !1;
3593
3601
  }
3594
3602
  if (d.type.name === "heading") {
3595
- const u = d.attrs.level, p = d.textContent || "";
3596
- return p.trim() && s.push({
3603
+ const u = d.attrs.level, f = d.textContent || "";
3604
+ return f.trim() && s.push({
3597
3605
  type: "heading",
3598
3606
  pos: g,
3599
- title: p,
3607
+ title: f,
3600
3608
  level: u,
3601
- charCount: p.replace(/\s/g, "").length
3609
+ charCount: f.replace(/\s/g, "").length
3602
3610
  }), !1;
3603
3611
  }
3604
3612
  return !0;
@@ -3614,7 +3622,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3614
3622
  }
3615
3623
  ) }) : /* @__PURE__ */ L("div", { className: "outline-panel", children: [
3616
3624
  /* @__PURE__ */ L("div", { className: "outline-panel-header", children: [
3617
- /* @__PURE__ */ m(Ht, { size: 14 }),
3625
+ /* @__PURE__ */ m(qt, { size: 14 }),
3618
3626
  /* @__PURE__ */ m("span", { children: t === "zh" ? "文档大纲" : "Outline" }),
3619
3627
  /* @__PURE__ */ m(
3620
3628
  "button",
@@ -3669,9 +3677,9 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3669
3677
  ),
3670
3678
  children: /* @__PURE__ */ m(In, { editor: e, className: "h-full" })
3671
3679
  }
3672
- )), on = "patent-editor-draft", ui = 1500, mi = () => {
3680
+ )), cn = "patent-editor-draft", ui = 1500, mi = () => {
3673
3681
  try {
3674
- const e = localStorage.getItem(on);
3682
+ const e = localStorage.getItem(cn);
3675
3683
  return e ? JSON.parse(e) : null;
3676
3684
  } catch {
3677
3685
  return null;
@@ -3685,7 +3693,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3685
3693
  onEditorReady: i,
3686
3694
  onSelectionOptimize: o
3687
3695
  }) => {
3688
- const { setEditor: c, setDocument: s, editorLanguage: l, autoSaveStatus: d, ai: g } = I(), { setAutoSaveStatus: u, setLastSavedAt: p } = I(), f = j(null), b = e || (t ? null : mi()) || {
3696
+ const { setEditor: c, setDocument: s, editorLanguage: l, autoSaveStatus: d, ai: g } = I(), { setAutoSaveStatus: u, setLastSavedAt: f } = I(), p = W(null), b = e || (t ? null : mi()) || {
3689
3697
  type: "doc",
3690
3698
  content: [
3691
3699
  {
@@ -3695,16 +3703,16 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3695
3703
  ]
3696
3704
  }, h = ae((T) => {
3697
3705
  try {
3698
- u("saving"), localStorage.setItem(on, JSON.stringify(T)), u("saved"), p(/* @__PURE__ */ new Date());
3706
+ u("saving"), localStorage.setItem(cn, JSON.stringify(T)), u("saved"), f(/* @__PURE__ */ new Date());
3699
3707
  } catch {
3700
3708
  u("error");
3701
3709
  }
3702
- }, [u, p]), y = Nn(
3710
+ }, [u, f]), y = Nn(
3703
3711
  Xa({
3704
3712
  content: b,
3705
3713
  onUpdate: ({ editor: T }) => {
3706
3714
  const v = T.getJSON();
3707
- s(v), B.notifyStateChange(T), t && t(v), t || (f.current && clearTimeout(f.current), f.current = setTimeout(() => {
3715
+ s(v), B.notifyStateChange(T), t && t(v), t || (p.current && clearTimeout(p.current), p.current = setTimeout(() => {
3708
3716
  h(v);
3709
3717
  }, ui));
3710
3718
  },
@@ -3720,7 +3728,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3720
3728
  }
3721
3729
  }
3722
3730
  })
3723
- ), E = j(!1);
3731
+ ), E = W(!1);
3724
3732
  if (M(() => {
3725
3733
  if (!(!y || !e)) {
3726
3734
  if (!E.current) {
@@ -3730,12 +3738,12 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3730
3738
  y.commands.setContent(e);
3731
3739
  }
3732
3740
  }, [y, e]), M(() => () => {
3733
- f.current && clearTimeout(f.current), y && (B.destroyPlugins(y), y.destroy());
3741
+ p.current && clearTimeout(p.current), y && (B.destroyPlugins(y), y.destroy());
3734
3742
  }, [y]), M(() => {
3735
3743
  y && B.notifyStateChange(y);
3736
3744
  }, [y, l]), !y)
3737
3745
  return null;
3738
- const x = q(l), w = d === "saving" ? x.autoSaveSaving : d === "saved" ? x.autoSaveSaved : d === "error" ? x.autoSaveError : "";
3746
+ const x = H(l), w = d === "saving" ? x.autoSaveSaving : d === "saved" ? x.autoSaveSaved : d === "error" ? x.autoSaveError : "";
3739
3747
  return /* @__PURE__ */ L("div", { className: `editor-container flex flex-col h-full ${n}`, children: [
3740
3748
  !r && /* @__PURE__ */ L("div", { className: "flex items-center", children: [
3741
3749
  /* @__PURE__ */ m(Qa, { editor: y }),
@@ -3757,7 +3765,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
3757
3765
  !r && /* @__PURE__ */ m(ii, { editor: y })
3758
3766
  ] });
3759
3767
  };
3760
- function cn(e) {
3768
+ function ln(e) {
3761
3769
  const t = e.getReader(), n = new TextDecoder();
3762
3770
  let r = "";
3763
3771
  return new ReadableStream({
@@ -3786,18 +3794,18 @@ function cn(e) {
3786
3794
  return;
3787
3795
  }
3788
3796
  try {
3789
- const u = JSON.parse(g), p = l || u.type;
3790
- if (p === "delta" || !p && u.content != null)
3797
+ const u = JSON.parse(g), f = l || u.type;
3798
+ if (f === "delta" || !f && u.content != null)
3791
3799
  a.enqueue({
3792
3800
  type: "delta",
3793
3801
  content: u.content ?? u.text ?? ((i = u.delta) == null ? void 0 : i.content) ?? ""
3794
3802
  });
3795
- else if (p === "patch")
3803
+ else if (f === "patch")
3796
3804
  a.enqueue({ type: "patch", patch: u });
3797
- else if (p === "done") {
3805
+ else if (f === "done") {
3798
3806
  a.enqueue({ type: "done", usage: u.usage }), a.close();
3799
3807
  return;
3800
- } else p === "error" && a.enqueue({ type: "error", message: u.message || "Unknown error" });
3808
+ } else f === "error" && a.enqueue({ type: "error", message: u.message || "Unknown error" });
3801
3809
  } catch {
3802
3810
  }
3803
3811
  l = "";
@@ -3824,7 +3832,7 @@ function fi(e, t) {
3824
3832
  throw new Error(`AI service error: ${i.status} ${i.statusText}`);
3825
3833
  if (!i.body)
3826
3834
  throw new Error("AI service returned no body");
3827
- return cn(i.body);
3835
+ return ln(i.body);
3828
3836
  },
3829
3837
  abort() {
3830
3838
  n == null || n.abort(), n = null;
@@ -3878,28 +3886,28 @@ function pi(e, t) {
3878
3886
  });
3879
3887
  if (!s.ok) throw new Error(`Chat stream error: ${s.status} ${s.statusText}`);
3880
3888
  if (!s.body) throw new Error("Chat stream returned no body");
3881
- return cn(s.body);
3889
+ return ln(s.body);
3882
3890
  },
3883
3891
  abort() {
3884
3892
  n == null || n.abort(), n = null;
3885
3893
  }
3886
3894
  };
3887
3895
  }
3888
- const hi = _t(
3896
+ const hi = It(
3889
3897
  ({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, editable: i = !0, language: o, aiService: c, chatSessionAPI: s, aiBaseUrl: l, aiHeaders: d, onSelectionOptimize: g }, u) => {
3890
- const { setEditorLanguage: p, setAIService: f, setChatSessionAPI: b } = I(), h = j(null), y = ae((x) => {
3898
+ const { setEditorLanguage: f, setAIService: p, setChatSessionAPI: b } = I(), h = W(null), y = ae((x) => {
3891
3899
  h.current = x;
3892
3900
  }, []), E = Ee.useMemo(() => {
3893
3901
  if (e) return e;
3894
- if (t) return en(t);
3902
+ if (t) return tn(t);
3895
3903
  }, [e, t]);
3896
3904
  return Ee.useEffect(() => {
3897
- o && p(o);
3898
- }, [o, p]), Ee.useEffect(() => {
3899
- c ? f(c) : l && f(fi(l, d));
3900
- }, [c, l, d, f]), Ee.useEffect(() => {
3905
+ o && f(o);
3906
+ }, [o, f]), Ee.useEffect(() => {
3907
+ c ? p(c) : l && p(fi(l, d));
3908
+ }, [c, l, d, p]), Ee.useEffect(() => {
3901
3909
  s ? b(s) : l && b(pi(l, d));
3902
- }, [s, l, d, b]), It(u, () => ({
3910
+ }, [s, l, d, b]), Nt(u, () => ({
3903
3911
  getContent: () => {
3904
3912
  var x;
3905
3913
  return ((x = h.current) == null ? void 0 : x.getJSON()) ?? null;
@@ -3909,7 +3917,7 @@ const hi = _t(
3909
3917
  (w = h.current) == null || w.commands.setContent(x);
3910
3918
  },
3911
3919
  getEditor: () => h.current,
3912
- execCommand: async (x, w) => h.current ? ot(h.current).execCommand(x, w) : null,
3920
+ execCommand: async (x, w) => h.current ? ct(h.current).execCommand(x, w) : null,
3913
3921
  focus: () => {
3914
3922
  var x;
3915
3923
  (x = h.current) == null || x.commands.focus();
@@ -3932,9 +3940,9 @@ hi.displayName = "PatentEditor";
3932
3940
  async function js(e, t, n) {
3933
3941
  var a, i, o, c;
3934
3942
  let r = !1;
3935
- (a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && dn(e, n.targetSectionPos);
3943
+ (a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && un(e, n.targetSectionPos);
3936
3944
  try {
3937
- let s = ln(e, n);
3945
+ let s = dn(e, n);
3938
3946
  for (; ; ) {
3939
3947
  const { done: l, value: d } = await t.read();
3940
3948
  if (l) break;
@@ -3951,22 +3959,22 @@ async function js(e, t, n) {
3951
3959
  async function Gs(e, t, n, r) {
3952
3960
  var i, o, c, s, l, d, g, u;
3953
3961
  const a = new AbortController();
3954
- (i = r.onStart) == null || i.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && dn(e, r.targetSectionPos);
3962
+ (i = r.onStart) == null || i.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && un(e, r.targetSectionPos);
3955
3963
  try {
3956
- const p = await fetch(t, {
3964
+ const f = await fetch(t, {
3957
3965
  method: "POST",
3958
3966
  headers: { "Content-Type": "application/json" },
3959
3967
  body: JSON.stringify(n),
3960
3968
  signal: a.signal
3961
3969
  });
3962
- if (!p.ok)
3963
- throw new Error(`HTTP ${p.status}: ${p.statusText}`);
3964
- const f = (o = p.body) == null ? void 0 : o.getReader();
3965
- if (!f) throw new Error("No response body");
3970
+ if (!f.ok)
3971
+ throw new Error(`HTTP ${f.status}: ${f.statusText}`);
3972
+ const p = (o = f.body) == null ? void 0 : o.getReader();
3973
+ if (!p) throw new Error("No response body");
3966
3974
  const b = new TextDecoder();
3967
- let h = ln(e, r), y = "";
3975
+ let h = dn(e, r), y = "";
3968
3976
  for (; ; ) {
3969
- const { done: E, value: x } = await f.read();
3977
+ const { done: E, value: x } = await p.read();
3970
3978
  if (E) break;
3971
3979
  y += b.decode(x, { stream: !0 });
3972
3980
  const w = y.split(`
@@ -3988,12 +3996,12 @@ async function Gs(e, t, n, r) {
3988
3996
  }
3989
3997
  }
3990
3998
  r.mode === "section" && typeof r.targetSectionPos == "number" && nt(e, r.targetSectionPos), (d = r.onComplete) == null || d.call(r);
3991
- } catch (p) {
3992
- p.name === "AbortError" ? (g = r.onAbort) == null || g.call(r) : (u = r.onError) == null || u.call(r, p instanceof Error ? p : new Error(String(p)));
3999
+ } catch (f) {
4000
+ f.name === "AbortError" ? (g = r.onAbort) == null || g.call(r) : (u = r.onError) == null || u.call(r, f instanceof Error ? f : new Error(String(f)));
3993
4001
  }
3994
4002
  return { abort: () => a.abort() };
3995
4003
  }
3996
- function ln(e, t) {
4004
+ function dn(e, t) {
3997
4005
  if (t.mode === "section" && typeof t.targetSectionPos == "number") {
3998
4006
  const n = e.state.doc.nodeAt(t.targetSectionPos);
3999
4007
  if (n && n.type.name === "patent_section")
@@ -4001,7 +4009,7 @@ function ln(e, t) {
4001
4009
  }
4002
4010
  return e.state.selection.from;
4003
4011
  }
4004
- function dn(e, t) {
4012
+ function un(e, t) {
4005
4013
  const n = e.state.doc.nodeAt(t);
4006
4014
  if (!n || n.type.name !== "patent_section") return;
4007
4015
  const r = t + 1, a = t + n.nodeSize - 1;
@@ -4030,7 +4038,7 @@ function nt(e, t) {
4030
4038
  r.setMeta("addToHistory", !1), e.view.dispatch(r);
4031
4039
  }
4032
4040
  }
4033
- const Ct = {
4041
+ const Tt = {
4034
4042
  technical_field: {
4035
4043
  zh: "本发明涉及航天器自主导航与控制技术领域,具体涉及一种基于多传感器融合的航天器自主避障控制方法、系统、电子设备及计算机可读存储介质。该方法综合利用激光雷达、红外传感器和星敏感器的探测数据,通过实时环境感知与路径规划算法,实现航天器在复杂空间环境中的自主安全避障机动。",
4036
4044
  en: "The present invention relates to the field of autonomous navigation and control technology for spacecraft, and specifically to a method, system, electronic device, and computer-readable storage medium for autonomous obstacle avoidance control of spacecraft based on multi-sensor fusion."
@@ -4245,7 +4253,7 @@ function Vs() {
4245
4253
  var c;
4246
4254
  if (e = new AbortController(), await te(300), e.signal.aborted)
4247
4255
  throw new DOMException("Aborted", "AbortError");
4248
- const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((c = Ct[r]) == null ? void 0 : c[n]) || Ct.technical_field[n];
4256
+ const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((c = Tt[r]) == null ? void 0 : c[n]) || Tt.technical_field[n];
4249
4257
  let i = a;
4250
4258
  t.instruction && (i = (n === "zh" ? `[基于指令"${t.instruction}"生成]
4251
4259
 
@@ -4377,10 +4385,10 @@ function Ks(e) {
4377
4385
  content: n.text ? [{ type: "text", text: `${n.number}. ${n.text}` }] : [{ type: "text", text: `${n.number}. ` }]
4378
4386
  }));
4379
4387
  }
4380
- const xi = -1, Ci = 1, Ti = 0, un = new we("docDiff");
4388
+ const xi = -1, Ci = 1, Ti = 0, at = new we("docDiff");
4381
4389
  let Ye = null;
4382
4390
  function Si() {
4383
- return Ye || (Ye = new Lt()), Ye;
4391
+ return Ye || (Ye = new Pt()), Ye;
4384
4392
  }
4385
4393
  function Ei(e, t, n) {
4386
4394
  const r = [];
@@ -4393,35 +4401,35 @@ function Ei(e, t, n) {
4393
4401
  }), r;
4394
4402
  }
4395
4403
  function Xs(e, t) {
4396
- const n = e.state.doc, r = n.content.size, { text: a, segments: i } = jt(e, 0, r), o = Si(), c = o.diff_main(t, a);
4397
- o.diff_cleanupEfficiency(c);
4404
+ const n = e.state.doc, r = n.content.size, { text: a, segments: i } = Gt(e, 0, r), o = Si(), c = o.diff_main(t, a);
4405
+ o.diff_cleanupSemantic(c);
4398
4406
  const s = [];
4399
4407
  let l = 0;
4400
- for (const [u, p] of c)
4408
+ for (const [u, f] of c)
4401
4409
  if (u === Ti)
4402
- l += p.length;
4410
+ l += f.length;
4403
4411
  else if (u === Ci) {
4404
- let f = 0;
4405
- for (; f < p.length; ) {
4406
- for (; f < p.length && p[f] === "\0"; ) f++;
4407
- if (f >= p.length) break;
4408
- const b = f;
4409
- for (; f < p.length && p[f] !== "\0"; ) f++;
4410
- const h = ye(i, l + b), y = ye(i, l + f);
4412
+ let p = 0;
4413
+ for (; p < f.length; ) {
4414
+ for (; p < f.length && f[p] === "\0"; ) p++;
4415
+ if (p >= f.length) break;
4416
+ const b = p;
4417
+ for (; p < f.length && f[p] !== "\0"; ) p++;
4418
+ const h = ye(i, l + b), y = ye(i, l + p);
4411
4419
  if (h >= 0 && y >= 0 && y > h)
4412
4420
  for (const E of Ei(n, h, y))
4413
4421
  s.push(
4414
4422
  re.inline(E.from, E.to, { class: "patch-diff-insert-inline" })
4415
4423
  );
4416
4424
  }
4417
- l += p.length;
4425
+ l += f.length;
4418
4426
  } else if (u === xi) {
4419
- const f = ye(i, l);
4420
- if (f >= 0) {
4421
- const b = p.replace(/\0/g, " ");
4427
+ const p = ye(i, l);
4428
+ if (p >= 0) {
4429
+ const b = f.replace(/\0/g, " ");
4422
4430
  s.push(
4423
4431
  re.widget(
4424
- f,
4432
+ p,
4425
4433
  () => {
4426
4434
  const h = document.createElement("span");
4427
4435
  return h.className = "patch-diff-delete", h.textContent = b, h;
@@ -4432,17 +4440,21 @@ function Xs(e, t) {
4432
4440
  }
4433
4441
  }
4434
4442
  const d = be.create(n, s), g = new Be({
4435
- key: un,
4443
+ key: at,
4444
+ state: {
4445
+ init: () => d,
4446
+ apply: (u, f) => u.docChanged ? f.map(u.mapping, u.doc) : f
4447
+ },
4436
4448
  props: {
4437
- decorations() {
4438
- return d;
4449
+ decorations(u) {
4450
+ return at.getState(u);
4439
4451
  }
4440
4452
  }
4441
4453
  });
4442
4454
  e.registerPlugin(g);
4443
4455
  }
4444
4456
  function Ys(e) {
4445
- e.unregisterPlugin(un);
4457
+ e.unregisterPlugin(at);
4446
4458
  }
4447
4459
  const ki = /* @__PURE__ */ new Set([
4448
4460
  "abstract",
@@ -4457,7 +4469,7 @@ const ki = /* @__PURE__ */ new Set([
4457
4469
  "detailed_description"
4458
4470
  ]);
4459
4471
  function Ii(e, t) {
4460
- const n = q(t), r = [];
4472
+ const n = H(t), r = [];
4461
4473
  return e.state.doc.descendants((a) => {
4462
4474
  if (a.type.name === "patent_title") {
4463
4475
  const i = a.textContent.trim();
@@ -4478,24 +4490,24 @@ function Ii(e, t) {
4478
4490
  return !0;
4479
4491
  }), r;
4480
4492
  }
4481
- function Tt(e) {
4493
+ function St(e) {
4482
4494
  return new He({
4483
4495
  children: [new qe({ text: e, bold: !0, size: 32, font: "黑体" })],
4484
- alignment: at.CENTER,
4496
+ alignment: it.CENTER,
4485
4497
  spacing: { before: 400, after: 200 }
4486
4498
  });
4487
4499
  }
4488
- function St(e) {
4500
+ function Et(e) {
4489
4501
  return new He({
4490
4502
  children: [new qe({ text: e, bold: !0, size: 28, font: "黑体" })],
4491
- alignment: at.CENTER,
4503
+ alignment: it.CENTER,
4492
4504
  spacing: { before: 240, after: 120 }
4493
4505
  });
4494
4506
  }
4495
4507
  function Ni(e) {
4496
4508
  return new He({
4497
4509
  children: [new qe({ text: e, bold: !0, size: 36, font: "宋体" })],
4498
- alignment: at.CENTER,
4510
+ alignment: it.CENTER,
4499
4511
  spacing: { before: 200, after: 200 }
4500
4512
  });
4501
4513
  }
@@ -4507,11 +4519,11 @@ function Ze(e) {
4507
4519
  });
4508
4520
  }
4509
4521
  function Ai(e, t) {
4510
- const n = q(t), r = [];
4522
+ const n = H(t), r = [];
4511
4523
  let a = !1;
4512
4524
  for (const i of e) {
4513
4525
  if (ki.has(i.sectionType)) {
4514
- r.push(Tt(i.title));
4526
+ r.push(St(i.title));
4515
4527
  for (const o of i.paragraphs)
4516
4528
  r.push(Ze(o));
4517
4529
  continue;
@@ -4519,19 +4531,19 @@ function Ai(e, t) {
4519
4531
  if (i.type === "patent_title") {
4520
4532
  if (!a) {
4521
4533
  const o = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
4522
- r.push(Tt(o)), a = !0;
4534
+ r.push(St(o)), a = !0;
4523
4535
  }
4524
4536
  for (const o of i.paragraphs)
4525
4537
  r.push(Ni(o));
4526
4538
  continue;
4527
4539
  }
4528
4540
  if (_i.has(i.sectionType)) {
4529
- r.push(St(i.title));
4541
+ r.push(Et(i.title));
4530
4542
  for (const o of i.paragraphs)
4531
4543
  r.push(Ze(o));
4532
4544
  continue;
4533
4545
  }
4534
- r.push(St(i.title));
4546
+ r.push(Et(i.title));
4535
4547
  for (const o of i.paragraphs)
4536
4548
  r.push(Ze(o));
4537
4549
  }
@@ -4613,10 +4625,10 @@ function eo(e, t) {
4613
4625
  const d = /^(\d+)\s*[.、]/;
4614
4626
  o.forEach((g, u) => {
4615
4627
  if (g.type.name !== "paragraph") return;
4616
- const p = g.textContent.trim(), f = d.exec(p);
4617
- if (!f) return;
4618
- const b = f[1];
4619
- p.length > 0 && !p.endsWith("。") && !p.endsWith(".") && n.push({
4628
+ const f = g.textContent.trim(), p = d.exec(f);
4629
+ if (!p) return;
4630
+ const b = p[1];
4631
+ f.length > 0 && !f.endsWith("。") && !f.endsWith(".") && n.push({
4620
4632
  id: i(),
4621
4633
  severity: "warning",
4622
4634
  message: r ? `权利要求${b}末尾应以句号结束` : `Claim ${b} should end with a period`,
@@ -4629,16 +4641,16 @@ function eo(e, t) {
4629
4641
  return !0;
4630
4642
  }), n;
4631
4643
  }
4632
- const Li = /^(\d+)\s*[.、]\s*/, Et = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g, kt = /claims?\s+(\d+)(?:\s*[-~to]+\s*(\d+))?/gi;
4644
+ const Li = /^(\d+)\s*[.、]\s*/, kt = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g, _t = /claims?\s+(\d+)(?:\s*[-~to]+\s*(\d+))?/gi;
4633
4645
  function Pi(e, t) {
4634
4646
  const n = [];
4635
4647
  let r;
4636
- for (Et.lastIndex = 0; (r = Et.exec(e)) !== null; ) {
4648
+ for (kt.lastIndex = 0; (r = kt.exec(e)) !== null; ) {
4637
4649
  const a = parseInt(r[1], 10), i = r[2] ? parseInt(r[2], 10) : a;
4638
4650
  for (let o = a; o <= i; o++)
4639
4651
  o !== t && o > 0 && n.push(o);
4640
4652
  }
4641
- for (kt.lastIndex = 0; (r = kt.exec(e)) !== null; ) {
4653
+ for (_t.lastIndex = 0; (r = _t.exec(e)) !== null; ) {
4642
4654
  const a = parseInt(r[1], 10), i = r[2] ? parseInt(r[2], 10) : a;
4643
4655
  for (let o = a; o <= i; o++)
4644
4656
  o !== t && o > 0 && n.push(o);
@@ -4690,17 +4702,17 @@ const mn = (e) => {
4690
4702
  };
4691
4703
  export {
4692
4704
  gi as EditorView,
4693
- Wt as PatchDiffPluginKey,
4705
+ jt as PatchDiffPluginKey,
4694
4706
  hi as PatentEditor,
4695
4707
  Hs as acceptAllPatches,
4696
4708
  Os as acceptPatch,
4697
4709
  Xs as applyDocDiffDecorations,
4698
4710
  Ws as buildAIContext,
4699
4711
  Ks as buildClaimsJSONContent,
4700
- en as buildPatentDocument,
4712
+ tn as buildPatentDocument,
4701
4713
  zs as clearPatches,
4702
4714
  pi as createChatSessionAPI,
4703
- ot as createCommandExecutor,
4715
+ ct as createCommandExecutor,
4704
4716
  Xa as createEditorConfig,
4705
4717
  Vs as createMockAIService,
4706
4718
  Js as createMockChatSessionAPI,
@@ -4708,7 +4720,7 @@ export {
4708
4720
  Qs as exportToPdf,
4709
4721
  Zs as exportToWord,
4710
4722
  to as extractClaimsFromEditor,
4711
- sn as findSectionAtCursor,
4723
+ on as findSectionAtCursor,
4712
4724
  ti as getAllSections,
4713
4725
  Us as getMissingSectionDeps,
4714
4726
  Fs as getPatches,
@@ -4718,7 +4730,7 @@ export {
4718
4730
  Bs as rejectPatch,
4719
4731
  Ys as removeDocDiffDecorations,
4720
4732
  Rs as resolvePatchTarget,
4721
- an as sectionContextDeps,
4733
+ sn as sectionContextDeps,
4722
4734
  $s as setPatches,
4723
4735
  I as useEditorStore,
4724
4736
  eo as validatePatentDocument,