patent-editor 0.1.5 → 0.1.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
@@ -1,60 +1,60 @@
1
- var kn = Object.defineProperty;
2
- var _n = (e, t, n) => t in e ? kn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
1
+ var Nn = Object.defineProperty;
2
+ var _n = (e, t, n) => t in e ? Nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var De = (e, t, n) => _n(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as f, jsxs as A, Fragment as we } from "react/jsx-runtime";
5
- import Me, { forwardRef as Wt, useState as z, useEffect as B, useCallback as de, useImperativeHandle as qt, useRef as X, useMemo as Te } from "react";
6
- import { Extension as Je, ReactRenderer as An, Node as ee, mergeAttributes as ae, NodeViewWrapper as Ln, ReactNodeViewRenderer as Gt, useEditorState as Pn, EditorContent as Dn, useEditor as Mn } from "@tiptap/react";
7
- import Rn from "@tiptap/extension-document";
8
- import $n from "@tiptap/extension-paragraph";
9
- import On from "@tiptap/extension-text";
10
- import Fn from "@tiptap/extension-heading";
11
- import zn from "@tiptap/extension-bullet-list";
12
- import Bn from "@tiptap/extension-ordered-list";
13
- import Hn from "@tiptap/extension-list-item";
14
- import Un from "@tiptap/extension-blockquote";
15
- import jn from "@tiptap/extension-code-block";
16
- import Wn from "@tiptap/extension-horizontal-rule";
17
- import qn from "@tiptap/extension-task-list";
5
+ import Me, { forwardRef as jt, useState as z, useEffect as B, useCallback as de, useImperativeHandle as Wt, useRef as X, useMemo as Te } from "react";
6
+ import { Extension as Je, ReactRenderer as kn, Node as ee, mergeAttributes as ae, NodeViewWrapper as An, ReactNodeViewRenderer as Gt, useEditorState as Ln, EditorContent as Pn, useEditor as Dn } from "@tiptap/react";
7
+ import Mn from "@tiptap/extension-document";
8
+ import Rn from "@tiptap/extension-paragraph";
9
+ import $n from "@tiptap/extension-text";
10
+ import On from "@tiptap/extension-heading";
11
+ import Fn from "@tiptap/extension-bullet-list";
12
+ import zn from "@tiptap/extension-ordered-list";
13
+ import Bn from "@tiptap/extension-list-item";
14
+ import Hn from "@tiptap/extension-blockquote";
15
+ import Un from "@tiptap/extension-code-block";
16
+ import jn from "@tiptap/extension-horizontal-rule";
17
+ import Wn from "@tiptap/extension-task-list";
18
18
  import Gn from "@tiptap/extension-task-item";
19
- import Vn from "@tiptap/extension-image";
20
- import { Table as Kn } from "@tiptap/extension-table";
21
- import Jn from "@tiptap/extension-table-row";
22
- import Xn from "@tiptap/extension-table-cell";
23
- import Qn from "@tiptap/extension-table-header";
24
- import Yn from "@tiptap/extension-placeholder";
25
- import Zn from "@tiptap/extension-history";
26
- import { dropCursor as er } from "prosemirror-dropcursor";
27
- import { gapCursor as tr } from "prosemirror-gapcursor";
28
- import nr from "@tiptap/extension-text-align";
29
- import { PluginKey as _e, Plugin as Xe, TextSelection as Ie } from "@tiptap/pm/state";
30
- import rr from "@tiptap/suggestion";
31
- import ar from "tippy.js";
32
- import { create as sr } from "zustand";
19
+ import qn from "@tiptap/extension-image";
20
+ import { Table as Vn } from "@tiptap/extension-table";
21
+ import Kn from "@tiptap/extension-table-row";
22
+ import Jn from "@tiptap/extension-table-cell";
23
+ import Xn from "@tiptap/extension-table-header";
24
+ import Qn from "@tiptap/extension-placeholder";
25
+ import Yn from "@tiptap/extension-history";
26
+ import { dropCursor as Zn } from "prosemirror-dropcursor";
27
+ import { gapCursor as er } from "prosemirror-gapcursor";
28
+ import tr from "@tiptap/extension-text-align";
29
+ import { PluginKey as ke, Plugin as Xe, TextSelection as Ie } from "@tiptap/pm/state";
30
+ import nr from "@tiptap/suggestion";
31
+ import rr from "tippy.js";
32
+ import { create as ar } from "zustand";
33
33
  import { DecorationSet as Ne, Decoration as le } from "@tiptap/pm/view";
34
- import { diff_match_patch as Vt } from "diff-match-patch";
35
- import ir from "@tiptap/extension-bold";
36
- import or from "@tiptap/extension-italic";
37
- import cr from "@tiptap/extension-underline";
38
- import lr from "@tiptap/extension-strike";
39
- import dr from "@tiptap/extension-code";
40
- import ur from "@tiptap/extension-superscript";
41
- import mr from "@tiptap/extension-subscript";
42
- import fr from "@tiptap/extension-link";
43
- import { TextStyle as gr } from "@tiptap/extension-text-style";
44
- import pr from "@tiptap/extension-color";
45
- import hr from "@tiptap/extension-highlight";
46
- import yr from "katex";
34
+ import { diff_match_patch as qt } from "diff-match-patch";
35
+ import sr from "@tiptap/extension-bold";
36
+ import ir from "@tiptap/extension-italic";
37
+ import or from "@tiptap/extension-underline";
38
+ import cr from "@tiptap/extension-strike";
39
+ import lr from "@tiptap/extension-code";
40
+ import dr from "@tiptap/extension-superscript";
41
+ import ur from "@tiptap/extension-subscript";
42
+ import mr from "@tiptap/extension-link";
43
+ import { TextStyle as fr } from "@tiptap/extension-text-style";
44
+ import gr from "@tiptap/extension-color";
45
+ import pr from "@tiptap/extension-highlight";
46
+ import hr from "katex";
47
47
  import "katex/dist/katex.min.css";
48
48
  import "mathlive";
49
- import { findWrapping as br } from "@tiptap/pm/transform";
50
- import { Slice as vr, Fragment as Cr } from "@tiptap/pm/model";
51
- import { createPortal as wr } from "react-dom";
52
- import { Undo2 as xr, Redo2 as Sr, Bold as Kt, Italic as Jt, Underline as Xt, Strikethrough as Qt, Code as Yt, Superscript as Zt, Subscript as en, Pilcrow as Tr, Heading1 as Ir, Heading2 as Er, Heading3 as Nr, AlignLeft as kr, AlignCenter as _r, AlignRight as Ar, AlignJustify as Lr, List as Pr, ListOrdered as Dr, Quote as Mr, FileCode2 as Rr, Table as $r, Minus as Or, CheckSquare as Fr, Image as tn, Link2 as ht, FileText as nn, Box as zr, Workflow as Br, FunctionSquare as Hr, Sigma as Ur, GitGraph as jr, Square as It, Download as Wr, ChevronDown as rn, Trash2 as qr, Highlighter as Gr, Sparkles as Vr, CaseSensitive as Kr, ChevronUp as Jr, Replace as Et, X as Xr, ReplaceAll as Qr, PanelLeft as Yr, PanelLeftClose as Zr } from "lucide-react";
49
+ import { findWrapping as yr } from "@tiptap/pm/transform";
50
+ import { Slice as br, Fragment as vr } from "@tiptap/pm/model";
51
+ import { createPortal as Cr } from "react-dom";
52
+ import { Undo2 as wr, Redo2 as xr, Bold as Vt, Italic as Kt, Underline as Jt, Strikethrough as Xt, Code as Qt, Superscript as Yt, Subscript as Zt, Pilcrow as Sr, Heading1 as Tr, Heading2 as Ir, Heading3 as Er, AlignLeft as Nr, AlignCenter as _r, AlignRight as kr, AlignJustify as Ar, List as Lr, ListOrdered as Pr, Quote as Dr, FileCode2 as Mr, Table as Rr, Minus as $r, CheckSquare as Or, Image as en, Link2 as ht, FileText as tn, Box as Fr, Workflow as zr, FunctionSquare as Br, Sigma as Hr, GitGraph as Ur, Square as It, Download as jr, ChevronDown as nn, Trash2 as Wr, Highlighter as Gr, Sparkles as qr, CaseSensitive as Vr, ChevronUp as Kr, Replace as Et, X as Jr, ReplaceAll as Xr, PanelLeft as Qr, PanelLeftClose as Yr } from "lucide-react";
53
53
  import re from "clsx";
54
- import { convertMillimetersToTwip as Se, Document as ea, Packer as ta, Paragraph as Qe, AlignmentType as yt, TextRun as Ye } from "docx";
55
- import { saveAs as na } from "file-saver";
56
- import { BubbleMenu as ra } from "@tiptap/react/menus";
57
- const aa = new _e("slashCommand"), sa = Je.create({
54
+ import { convertMillimetersToTwip as Se, Document as Zr, Packer as ea, Paragraph as Qe, AlignmentType as yt, TextRun as Ye } from "docx";
55
+ import { saveAs as ta } from "file-saver";
56
+ import { BubbleMenu as na } from "@tiptap/react/menus";
57
+ const ra = new ke("slashCommand"), aa = Je.create({
58
58
  name: "slashCommand",
59
59
  addOptions() {
60
60
  return {
@@ -68,14 +68,14 @@ const aa = new _e("slashCommand"), sa = Je.create({
68
68
  },
69
69
  addProseMirrorPlugins() {
70
70
  return [
71
- rr({
71
+ nr({
72
72
  editor: this.editor,
73
73
  ...this.options.suggestion,
74
- pluginKey: aa
74
+ pluginKey: ra
75
75
  })
76
76
  ];
77
77
  }
78
- }), ia = {
78
+ }), sa = {
79
79
  visible: !0,
80
80
  activeTab: "chat",
81
81
  activeSectionType: null,
@@ -83,7 +83,7 @@ const aa = new _e("slashCommand"), sa = Je.create({
83
83
  regenerate: !1,
84
84
  chatReferences: [],
85
85
  pendingChatMessage: null
86
- }, _ = sr((e) => ({
86
+ }, k = ar((e) => ({
87
87
  editor: null,
88
88
  document: null,
89
89
  selection: null,
@@ -94,7 +94,7 @@ const aa = new _e("slashCommand"), sa = Je.create({
94
94
  aiService: null,
95
95
  chatSessionAPI: null,
96
96
  chatSessionId: null,
97
- rightPanel: { ...ia },
97
+ rightPanel: { ...sa },
98
98
  setEditor: (t) => e({ editor: t }),
99
99
  setDocument: (t) => e({ document: t }),
100
100
  setSelection: (t) => e({ selection: t }),
@@ -162,7 +162,7 @@ const aa = new _e("slashCommand"), sa = Je.create({
162
162
  setPendingChatMessage: (t) => e((n) => ({
163
163
  rightPanel: { ...n.rightPanel, pendingChatMessage: t }
164
164
  }))
165
- })), an = Wt(
165
+ })), rn = jt(
166
166
  ({ items: e, command: t }, n) => {
167
167
  const [r, a] = z(0);
168
168
  B(() => {
@@ -175,7 +175,7 @@ const aa = new _e("slashCommand"), sa = Je.create({
175
175
  },
176
176
  [e, t]
177
177
  );
178
- return qt(n, () => ({
178
+ return Wt(n, () => ({
179
179
  onKeyDown: ({ event: i }) => i.key === "ArrowUp" ? (a((l) => (l + e.length - 1) % e.length), !0) : i.key === "ArrowDown" ? (a((l) => (l + 1) % e.length), !0) : i.key === "Enter" ? (s(r), !0) : !1
180
180
  })), e.length ? /* @__PURE__ */ f("div", { className: "slash-menu", children: e.map((i, l) => /* @__PURE__ */ A(
181
181
  "button",
@@ -195,8 +195,8 @@ const aa = new _e("slashCommand"), sa = Je.create({
195
195
  )) }) : /* @__PURE__ */ f("div", { className: "slash-menu", children: /* @__PURE__ */ f("div", { className: "slash-menu-empty", children: "No results" }) });
196
196
  }
197
197
  );
198
- an.displayName = "SlashMenuList";
199
- function oa(e) {
198
+ rn.displayName = "SlashMenuList";
199
+ function ia(e) {
200
200
  const t = e === "zh";
201
201
  return [
202
202
  {
@@ -306,11 +306,11 @@ function oa(e) {
306
306
  }
307
307
  ];
308
308
  }
309
- function ca() {
309
+ function oa() {
310
310
  return {
311
311
  char: "/",
312
312
  items: ({ query: e }) => {
313
- const t = _.getState().editorLanguage, n = oa(t);
313
+ const t = k.getState().editorLanguage, n = ia(t);
314
314
  if (!e) return n;
315
315
  const r = e.toLowerCase();
316
316
  return n.filter(
@@ -321,10 +321,10 @@ function ca() {
321
321
  let e = null, t = null;
322
322
  return {
323
323
  onStart: (n) => {
324
- e = new An(an, {
324
+ e = new kn(rn, {
325
325
  props: n,
326
326
  editor: n.editor
327
- }), n.clientRect && (t = ar("body", {
327
+ }), n.clientRect && (t = rr("body", {
328
328
  getReferenceClientRect: n.clientRect,
329
329
  appendTo: () => document.body,
330
330
  content: e.element,
@@ -351,7 +351,7 @@ function ca() {
351
351
  }
352
352
  };
353
353
  }
354
- const la = new _e("searchReplace");
354
+ const ca = new ke("searchReplace");
355
355
  function Re(e, t, n) {
356
356
  if (!t) return [];
357
357
  const r = [], a = e.textBetween(0, e.content.size, `
@@ -377,7 +377,7 @@ function Re(e, t, n) {
377
377
  }
378
378
  return r;
379
379
  }
380
- const da = Je.create({
380
+ const la = Je.create({
381
381
  name: "searchReplace",
382
382
  addStorage() {
383
383
  return {
@@ -441,7 +441,7 @@ const da = Je.create({
441
441
  const e = this.storage;
442
442
  return [
443
443
  new Xe({
444
- key: la,
444
+ key: ca,
445
445
  props: {
446
446
  decorations: (t) => {
447
447
  if (!e.searchTerm || e.results.length === 0)
@@ -466,17 +466,17 @@ function Nt(e) {
466
466
  }
467
467
  });
468
468
  }
469
- const ua = -1, ma = 1, kt = 0;
469
+ const da = -1, ua = 1, _t = 0;
470
470
  let nt = null;
471
- function fa() {
472
- return nt || (nt = new Vt()), nt;
471
+ function ma() {
472
+ return nt || (nt = new qt()), nt;
473
473
  }
474
- const sn = new _e("patchDiff");
475
- function ga(e, t) {
474
+ const an = new ke("patchDiff");
475
+ function fa(e, t) {
476
476
  let n = null;
477
477
  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;
478
478
  }
479
- function on(e, t, n) {
479
+ function sn(e, t, n) {
480
480
  const r = [];
481
481
  let a = "", s = !0;
482
482
  return e.state.doc.nodesBetween(t, n, (i, l) => {
@@ -492,8 +492,8 @@ function Ee(e, t) {
492
492
  return n.docPos + (t - n.textIdx);
493
493
  return -1;
494
494
  }
495
- function _t(e, t, n, r, a) {
496
- const { text: s, segments: i } = on(e, n, r);
495
+ function kt(e, t, n, r, a) {
496
+ const { text: s, segments: i } = sn(e, n, r);
497
497
  let l = 0;
498
498
  for (; l <= s.length - t.length; ) {
499
499
  const c = s.indexOf(t, l);
@@ -505,7 +505,7 @@ function _t(e, t, n, r, a) {
505
505
  }
506
506
  return null;
507
507
  }
508
- function Yi(e, t, n, r, a) {
508
+ function Ki(e, t, n, r, a) {
509
509
  const s = t.target;
510
510
  let i = null;
511
511
  const l = /* @__PURE__ */ new Set();
@@ -515,15 +515,15 @@ function Yi(e, t, n, r, a) {
515
515
  if (!s)
516
516
  t.from != null && t.to != null && (i = { from: t.from, to: t.to });
517
517
  else if (s.type === "section" && s.sectionType)
518
- i = ga(e, s.sectionType);
518
+ i = fa(e, s.sectionType);
519
519
  else if (s.type === "ref" && s.refIndex != null) {
520
520
  const o = n[s.refIndex];
521
521
  (o == null ? void 0 : o.from) != null && (o == null ? void 0 : o.to) != null && (i = { from: o.from, to: o.to });
522
- } else s.type === "search" && s.searchText && (i = _t(e, s.searchText, 0, e.state.doc.content.size, l));
522
+ } else s.type === "search" && s.searchText && (i = kt(e, s.searchText, 0, e.state.doc.content.size, l));
523
523
  if (!i) return null;
524
524
  let c = i;
525
525
  if (t.search) {
526
- const o = _t(e, t.search, i.from, i.to, l);
526
+ const o = kt(e, t.search, i.from, i.to, l);
527
527
  o && (c = o);
528
528
  }
529
529
  const d = c.from < c.to ? e.state.doc.textBetween(c.from, c.to, " ", "\0") : "";
@@ -538,8 +538,8 @@ function Yi(e, t, n, r, a) {
538
538
  status: "pending"
539
539
  };
540
540
  }
541
- let q = [], Ue = [];
542
- function Zi(e) {
541
+ let G = [], Ue = [];
542
+ function Ji(e) {
543
543
  return Ue.push(e), () => {
544
544
  Ue = Ue.filter((t) => t !== e);
545
545
  };
@@ -547,17 +547,17 @@ function Zi(e) {
547
547
  function be() {
548
548
  Ue.forEach((e) => e());
549
549
  }
550
- function eo() {
551
- return [...q];
550
+ function Xi() {
551
+ return [...G];
552
552
  }
553
- function to(e) {
554
- q = e, be();
553
+ function Qi(e) {
554
+ G = e, be();
555
555
  }
556
- function no() {
557
- q = [], be();
556
+ function Yi() {
557
+ G = [], be();
558
558
  }
559
- function ro(e, t) {
560
- const n = q.find((s) => s.id === t);
559
+ function Zi(e, t) {
560
+ const n = G.find((s) => s.id === t);
561
561
  if (!n || n.status !== "pending") return !1;
562
562
  n.status = "accepted";
563
563
  const { tr: r } = e.state;
@@ -565,45 +565,45 @@ function ro(e, t) {
565
565
  r.delete(n.from, n.to);
566
566
  else if (n.type === "insert")
567
567
  r.insertText(n.content, n.from);
568
- else if (cn(e, n.from, n.to)) {
569
- const i = ln(e, n.content);
568
+ else if (on(e, n.from, n.to)) {
569
+ const i = cn(e, n.content);
570
570
  r.replaceWith(n.from, n.to, i);
571
571
  } else
572
572
  r.insertText(n.content, n.from, n.to);
573
573
  e.view.dispatch(r);
574
574
  const a = r.mapping;
575
- for (const s of q) {
575
+ for (const s of G) {
576
576
  if (s.id === t || s.status !== "pending") continue;
577
577
  const i = a.map(s.from, 1), l = a.map(s.to, -1);
578
578
  i >= l && s.type !== "insert" ? s.status = "rejected" : (s.from = i, s.to = s.type === "insert" ? i : l);
579
579
  }
580
- return q = q.filter((s) => s.id !== t && s.status === "pending"), Ze(e), be(), !0;
580
+ return G = G.filter((s) => s.id !== t && s.status === "pending"), Ze(e), be(), !0;
581
581
  }
582
- function ao(e, t) {
583
- const n = q.find((r) => r.id === t);
584
- return !n || n.status !== "pending" ? !1 : (n.status = "rejected", q = q.filter((r) => r.id !== t), Ze(e), be(), !0);
582
+ function eo(e, t) {
583
+ const n = G.find((r) => r.id === t);
584
+ return !n || n.status !== "pending" ? !1 : (n.status = "rejected", G = G.filter((r) => r.id !== t), Ze(e), be(), !0);
585
585
  }
586
- function so(e) {
587
- const n = [...q.filter((a) => a.status === "pending")].sort((a, s) => s.from - a.from), { tr: r } = e.state;
586
+ function to(e) {
587
+ const n = [...G.filter((a) => a.status === "pending")].sort((a, s) => s.from - a.from), { tr: r } = e.state;
588
588
  for (const a of n)
589
589
  if (a.type === "delete")
590
590
  r.delete(a.from, a.to);
591
591
  else if (a.type === "insert")
592
592
  r.insertText(a.content, a.from);
593
- else if (cn(e, a.from, a.to)) {
594
- const i = ln(e, a.content);
593
+ else if (on(e, a.from, a.to)) {
594
+ const i = cn(e, a.content);
595
595
  r.replaceWith(a.from, a.to, i);
596
596
  } else
597
597
  r.insertText(a.content, a.from, a.to);
598
- e.view.dispatch(r), q = [], Ze(e), be();
598
+ e.view.dispatch(r), G = [], Ze(e), be();
599
599
  }
600
- function io(e) {
601
- q = [], Ze(e), be();
600
+ function no(e) {
601
+ G = [], Ze(e), be();
602
602
  }
603
603
  function Ze(e) {
604
- e.view.dispatch(e.state.tr.setMeta(sn, !0));
604
+ e.view.dispatch(e.state.tr.setMeta(an, !0));
605
605
  }
606
- function pa(e, t, n) {
606
+ function ga(e, t, n) {
607
607
  const r = [];
608
608
  return e.nodesBetween(t, n, (a, s) => {
609
609
  if (a.isTextblock) {
@@ -613,7 +613,7 @@ function pa(e, t, n) {
613
613
  return !0;
614
614
  }), r;
615
615
  }
616
- function ha(e, t) {
616
+ function pa(e, t) {
617
617
  if (!t.originalText || !t.content) return null;
618
618
  try {
619
619
  const l = e.resolve(t.from), c = e.resolve(t.to);
@@ -621,16 +621,16 @@ function ha(e, t) {
621
621
  } catch {
622
622
  return null;
623
623
  }
624
- const n = fa(), r = n.diff_main(t.originalText, t.content);
624
+ const n = ma(), r = n.diff_main(t.originalText, t.content);
625
625
  n.diff_cleanupSemantic(r);
626
- const a = r.filter(([l]) => l === kt).reduce((l, [, c]) => l + c.length, 0);
626
+ const a = r.filter(([l]) => l === _t).reduce((l, [, c]) => l + c.length, 0);
627
627
  if (t.originalText.length > 0 && a / t.originalText.length < 0.3) return null;
628
628
  const s = [];
629
629
  let i = t.from;
630
630
  for (const [l, c] of r)
631
- if (l === kt)
631
+ if (l === _t)
632
632
  i += c.length;
633
- else if (l === ua) {
633
+ else if (l === da) {
634
634
  const d = i + c.length;
635
635
  s.push(
636
636
  le.inline(i, d, {
@@ -638,7 +638,7 @@ function ha(e, t) {
638
638
  "data-patch-id": t.id
639
639
  })
640
640
  ), i = d;
641
- } else l === ma && s.push(
641
+ } else l === ua && s.push(
642
642
  le.widget(i, () => {
643
643
  const d = document.createElement("span");
644
644
  return d.className = "patch-diff-insert-inline", d.textContent = c, d.setAttribute("data-patch-id", t.id), d;
@@ -646,24 +646,24 @@ function ha(e, t) {
646
646
  );
647
647
  return s;
648
648
  }
649
- function ya() {
649
+ function ha() {
650
650
  return new Xe({
651
- key: sn,
651
+ key: an,
652
652
  props: {
653
653
  decorations(e) {
654
- const t = q.filter((r) => r.status === "pending");
654
+ const t = G.filter((r) => r.status === "pending");
655
655
  if (t.length === 0) return Ne.empty;
656
656
  const n = [];
657
657
  for (const r of t) {
658
658
  if (r.type === "replace") {
659
- const a = ha(e.doc, r);
659
+ const a = pa(e.doc, r);
660
660
  if (a) {
661
661
  n.push(...a);
662
662
  continue;
663
663
  }
664
664
  }
665
665
  if (r.type === "delete" || r.type === "replace") {
666
- const a = pa(e.doc, r.from, r.to);
666
+ const a = ga(e.doc, r.from, r.to);
667
667
  for (const s of a)
668
668
  n.push(
669
669
  le.inline(s.from, s.to, {
@@ -694,12 +694,12 @@ function ya() {
694
694
  }
695
695
  });
696
696
  }
697
- function cn(e, t, n) {
697
+ function on(e, t, n) {
698
698
  var s;
699
699
  const r = e.state.doc.resolve(t);
700
700
  return !!((s = r.parent.type.spec.content) != null && s.includes("block") && t === r.start() && n === r.end());
701
701
  }
702
- function ln(e, t) {
702
+ function cn(e, t) {
703
703
  const n = e.state.schema;
704
704
  return t.split(/\n\n+/).filter((a) => a.trim().length > 0).map((a) => {
705
705
  const s = a.replace(/\n/g, " ").trim();
@@ -709,7 +709,7 @@ function ln(e, t) {
709
709
  );
710
710
  });
711
711
  }
712
- const ba = ee.create({
712
+ const ya = ee.create({
713
713
  name: "hardBreak",
714
714
  inline: !0,
715
715
  group: "inline",
@@ -730,40 +730,40 @@ const ba = ee.create({
730
730
  }
731
731
  };
732
732
  }
733
- }), va = Je.create({
733
+ }), ba = Je.create({
734
734
  name: "dragDropUX",
735
735
  addProseMirrorPlugins() {
736
736
  return [
737
- er({
737
+ Zn({
738
738
  width: 3,
739
739
  color: "#2563eb"
740
740
  }),
741
- tr()
741
+ er()
742
742
  ];
743
743
  }
744
- }), Ca = Je.create({
744
+ }), va = Je.create({
745
745
  name: "patchDiff",
746
746
  addProseMirrorPlugins() {
747
- return [ya()];
747
+ return [ha()];
748
748
  }
749
- }), wa = [
749
+ }), Ca = [
750
+ Mn,
750
751
  Rn,
751
752
  $n,
752
- On,
753
- va,
754
- Fn.configure({
753
+ ba,
754
+ On.configure({
755
755
  levels: [1, 2, 3, 4, 5, 6]
756
756
  }),
757
+ Fn,
757
758
  zn,
758
759
  Bn,
759
760
  Hn,
760
761
  Un,
762
+ ya,
761
763
  jn,
762
- ba,
763
764
  Wn,
764
- qn,
765
765
  Gn.configure({ nested: !0 }),
766
- Vn.extend({
766
+ qn.extend({
767
767
  addAttributes() {
768
768
  var e;
769
769
  return {
@@ -779,44 +779,44 @@ const ba = ee.create({
779
779
  inline: !0,
780
780
  allowBase64: !0
781
781
  }),
782
- Kn.configure({
782
+ Vn.configure({
783
783
  resizable: !0
784
784
  }),
785
+ Kn,
785
786
  Jn,
786
787
  Xn,
787
- Qn,
788
- Yn.configure({
788
+ Qn.configure({
789
789
  placeholder: ({ node: e }) => e.type.name === "heading" ? "Heading" : "Type / for commands..."
790
790
  }),
791
- Zn,
792
- sa.configure({
793
- suggestion: ca()
791
+ Yn,
792
+ aa.configure({
793
+ suggestion: oa()
794
794
  }),
795
- da,
796
- nr.configure({
795
+ la,
796
+ tr.configure({
797
797
  types: ["heading", "paragraph"],
798
798
  defaultAlignment: "left"
799
799
  }),
800
- Ca
801
- ], xa = [
800
+ va
801
+ ], wa = [
802
+ sr,
802
803
  ir,
803
804
  or,
804
805
  cr,
805
806
  lr,
806
807
  dr,
807
808
  ur,
808
- mr,
809
- fr.configure({
809
+ mr.configure({
810
810
  openOnClick: !1
811
811
  }),
812
+ fr,
812
813
  gr,
813
- pr,
814
- hr.configure({ multicolor: !0 })
815
- ], Sa = [
816
- ...wa,
817
- ...xa
814
+ pr.configure({ multicolor: !0 })
815
+ ], xa = [
816
+ ...Ca,
817
+ ...wa
818
818
  ];
819
- class Ta {
819
+ class Sa {
820
820
  constructor() {
821
821
  De(this, "commands", /* @__PURE__ */ new Map());
822
822
  }
@@ -882,8 +882,8 @@ class Ta {
882
882
  return Array.from(this.commands.keys()).sort();
883
883
  }
884
884
  }
885
- const ge = new Ta();
886
- class Ia {
885
+ const ge = new Sa();
886
+ class Ta {
887
887
  constructor() {
888
888
  De(this, "plugins", /* @__PURE__ */ new Map());
889
889
  De(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
@@ -968,7 +968,7 @@ class Ia {
968
968
  });
969
969
  }
970
970
  }
971
- const W = new Ia(), At = {
971
+ const W = new Ta(), At = {
972
972
  zh: {
973
973
  language: "语言",
974
974
  bold: "加粗",
@@ -1141,7 +1141,7 @@ const Oe = () => {
1141
1141
  document.querySelectorAll('body > svg[id^="standalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
1142
1142
  (e.id.startsWith("dmermaid") || e.id.startsWith("dstandalone")) && e.remove();
1143
1143
  }), document.querySelectorAll('body > div[id^="dstandalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > div[id^="dmermaid"]').forEach((e) => e.remove()), document.querySelectorAll('body > div[id^="standalone-mermaid-"]').forEach((e) => e.remove());
1144
- }, Ea = ee.create({
1144
+ }, Ia = ee.create({
1145
1145
  name: "mermaid",
1146
1146
  group: "block",
1147
1147
  atom: !0,
@@ -1203,9 +1203,9 @@ const Oe = () => {
1203
1203
  }
1204
1204
  }
1205
1205
  }, v = () => {
1206
- a || (a = !0, o.value = typeof r.attrs.code == "string" ? r.attrs.code : "", m.textContent = "", m.style.display = "none", k(), requestAnimationFrame(() => o.focus()));
1206
+ a || (a = !0, o.value = typeof r.attrs.code == "string" ? r.attrs.code : "", m.textContent = "", m.style.display = "none", _(), requestAnimationFrame(() => o.focus()));
1207
1207
  }, C = () => {
1208
- a = !1, k();
1208
+ a = !1, _();
1209
1209
  }, w = async () => {
1210
1210
  const y = o.value;
1211
1211
  m.textContent = "", m.style.display = "none";
@@ -1218,11 +1218,11 @@ const Oe = () => {
1218
1218
  l.innerHTML = R, b = T, Oe();
1219
1219
  } catch {
1220
1220
  Oe();
1221
- const E = _.getState().editorLanguage;
1221
+ const E = k.getState().editorLanguage;
1222
1222
  m.textContent = E === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", m.style.display = "inline";
1223
1223
  return;
1224
1224
  }
1225
- h({ code: y }), a = !1, k();
1225
+ h({ code: y }), a = !1, _();
1226
1226
  };
1227
1227
  i.addEventListener("dblclick", (y) => {
1228
1228
  y.preventDefault(), y.stopPropagation(), v();
@@ -1231,34 +1231,34 @@ const Oe = () => {
1231
1231
  }), g.addEventListener("click", (y) => {
1232
1232
  y.stopPropagation(), C();
1233
1233
  }), o.addEventListener("mousedown", (y) => y.stopPropagation()), o.addEventListener("keydown", (y) => y.stopPropagation()), o.addEventListener("keypress", (y) => y.stopPropagation());
1234
- const k = () => {
1235
- const y = _.getState().editorLanguage, T = U(y), E = typeof r.attrs.code == "string" ? r.attrs.code : "";
1234
+ const _ = () => {
1235
+ const y = k.getState().editorLanguage, T = U(y), E = typeof r.attrs.code == "string" ? r.attrs.code : "";
1236
1236
  i.style.display = a ? "none" : "block", d.style.display = a ? "block" : "none", p.textContent = T.mermaidSaveAndRender || "保存并渲染", g.textContent = T.mermaidCancel || "取消";
1237
1237
  const M = E.trim().length > 0, R = l.querySelector("svg") !== null;
1238
1238
  a || (M && R ? (c.textContent = T.mermaidDoubleClickToEdit || "双击编辑", c.className = "mermaid-view-hint mermaid-view-hint--subtle") : (c.textContent = T.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", c.className = "mermaid-view-hint mermaid-view-hint--empty")), !a && E.trim() !== b && x(E);
1239
1239
  };
1240
- let L = _.getState().editorLanguage;
1241
- const P = _.subscribe((y) => {
1242
- y.editorLanguage !== L && (L = y.editorLanguage, k());
1240
+ let L = k.getState().editorLanguage;
1241
+ const P = k.subscribe((y) => {
1242
+ y.editorLanguage !== L && (L = y.editorLanguage, _());
1243
1243
  });
1244
- return k(), {
1244
+ return _(), {
1245
1245
  dom: s,
1246
1246
  stopEvent: (y) => {
1247
1247
  const T = y.target;
1248
1248
  return !!(T === o || d.contains(T));
1249
1249
  },
1250
1250
  ignoreMutation: () => !0,
1251
- update: (y) => y.type.name !== "mermaid" ? !1 : (r = y, k(), !0),
1251
+ update: (y) => y.type.name !== "mermaid" ? !1 : (r = y, _(), !0),
1252
1252
  destroy: () => {
1253
1253
  P(), Oe();
1254
1254
  }
1255
1255
  };
1256
1256
  };
1257
1257
  }
1258
- }), Na = {
1258
+ }), Ea = {
1259
1259
  name: "mermaid",
1260
1260
  version: "1.0.0",
1261
- extensions: [Ea],
1261
+ extensions: [Ia],
1262
1262
  toolbarItems: [
1263
1263
  {
1264
1264
  id: "mermaid-insert",
@@ -1282,7 +1282,7 @@ const Oe = () => {
1282
1282
  }
1283
1283
  }
1284
1284
  }
1285
- }, ka = ee.create({
1285
+ }, Na = ee.create({
1286
1286
  name: "drawio",
1287
1287
  group: "block",
1288
1288
  atom: !0,
@@ -1311,7 +1311,7 @@ const Oe = () => {
1311
1311
  c.className = "drawio-view-hint", i.append(l, c), s.append(i);
1312
1312
  const d = (v) => {
1313
1313
  const C = typeof n == "function" ? n() : null;
1314
- typeof C == "number" && e.commands.command(({ tr: w, dispatch: k }) => (w.setNodeMarkup(C, void 0, { ...r.attrs, ...v }), k && k(w), !0));
1314
+ typeof C == "number" && e.commands.command(({ tr: w, dispatch: _ }) => (w.setNodeMarkup(C, void 0, { ...r.attrs, ...v }), _ && _(w), !0));
1315
1315
  };
1316
1316
  let o = null, u = null, m = null;
1317
1317
  const g = () => {
@@ -1321,10 +1321,10 @@ const Oe = () => {
1321
1321
  v.className = "drawio-modal-content";
1322
1322
  const C = document.createElement("div");
1323
1323
  C.className = "drawio-modal-header";
1324
- const w = _.getState().editorLanguage, k = document.createElement("span");
1325
- k.textContent = w === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", k.className = "drawio-modal-title";
1324
+ const w = k.getState().editorLanguage, _ = document.createElement("span");
1325
+ _.textContent = w === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", _.className = "drawio-modal-title";
1326
1326
  const L = document.createElement("button");
1327
- L.className = "drawio-modal-close-btn", L.textContent = "✕", L.type = "button", L.addEventListener("click", () => p()), C.append(k, L), m = document.createElement("iframe"), m.className = "drawio-modal-iframe", m.setAttribute("frameborder", "0"), v.append(C, m), u.appendChild(v), document.body.appendChild(u);
1327
+ L.className = "drawio-modal-close-btn", L.textContent = "✕", L.type = "button", L.addEventListener("click", () => p()), C.append(_, L), m = document.createElement("iframe"), m.className = "drawio-modal-iframe", m.setAttribute("frameborder", "0"), v.append(C, m), u.appendChild(v), document.body.appendChild(u);
1328
1328
  const P = w === "en" ? "en" : "zh";
1329
1329
  m.src = `https://embed.diagrams.net/?embed=1&proto=json&spin=1&lang=${P}`;
1330
1330
  const y = m;
@@ -1361,11 +1361,11 @@ const Oe = () => {
1361
1361
  v.preventDefault(), v.stopPropagation(), g();
1362
1362
  });
1363
1363
  const h = () => {
1364
- const v = _.getState().editorLanguage, C = U(v), w = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
1364
+ const v = k.getState().editorLanguage, C = U(v), w = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
1365
1365
  w ? (l.src = w, l.style.display = "block") : (l.src = "", l.style.display = "none"), w ? (c.textContent = C.mermaidDoubleClickToEdit || "双击编辑", c.className = "drawio-view-hint drawio-view-hint--subtle") : (c.textContent = C.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", c.className = "drawio-view-hint drawio-view-hint--empty");
1366
1366
  };
1367
- let b = _.getState().editorLanguage;
1368
- const x = _.subscribe((v) => {
1367
+ let b = k.getState().editorLanguage;
1368
+ const x = k.subscribe((v) => {
1369
1369
  v.editorLanguage !== b && (b = v.editorLanguage, h());
1370
1370
  });
1371
1371
  return h(), {
@@ -1381,7 +1381,7 @@ const Oe = () => {
1381
1381
  }), _a = {
1382
1382
  name: "drawio",
1383
1383
  version: "1.0.0",
1384
- extensions: [ka],
1384
+ extensions: [Na],
1385
1385
  toolbarItems: [
1386
1386
  {
1387
1387
  id: "drawio-insert",
@@ -1405,7 +1405,7 @@ const Oe = () => {
1405
1405
  }
1406
1406
  }
1407
1407
  }
1408
- }, dn = ({
1408
+ }, ln = ({
1409
1409
  node: e,
1410
1410
  updateAttributes: t,
1411
1411
  selected: n,
@@ -1458,7 +1458,7 @@ const Oe = () => {
1458
1458
  }, [e.attrs.latex, s]);
1459
1459
  let g = "";
1460
1460
  try {
1461
- g = yr.renderToString(e.attrs.latex || "", {
1461
+ g = hr.renderToString(e.attrs.latex || "", {
1462
1462
  throwOnError: !1,
1463
1463
  displayMode: l
1464
1464
  });
@@ -1466,7 +1466,7 @@ const Oe = () => {
1466
1466
  g = e.attrs.latex || "";
1467
1467
  }
1468
1468
  return /* @__PURE__ */ f(
1469
- Ln,
1469
+ An,
1470
1470
  {
1471
1471
  as: l ? "div" : "span",
1472
1472
  className: l ? "math-block" : "math-inline",
@@ -1483,7 +1483,7 @@ const Oe = () => {
1483
1483
  ] })
1484
1484
  }
1485
1485
  );
1486
- }, Aa = ee.create({
1486
+ }, ka = ee.create({
1487
1487
  name: "math_inline",
1488
1488
  group: "inline",
1489
1489
  inline: !0,
@@ -1509,14 +1509,14 @@ const Oe = () => {
1509
1509
  return ["span", ae(e, { "data-type": "math_inline" })];
1510
1510
  },
1511
1511
  addNodeView() {
1512
- return Gt(dn, {
1512
+ return Gt(ln, {
1513
1513
  stopEvent: ({ event: e }) => {
1514
1514
  const t = e.target;
1515
1515
  return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
1516
1516
  }
1517
1517
  });
1518
1518
  }
1519
- }), La = ee.create({
1519
+ }), Aa = ee.create({
1520
1520
  name: "math_block",
1521
1521
  group: "block",
1522
1522
  atom: !0,
@@ -1532,17 +1532,17 @@ const Oe = () => {
1532
1532
  return ["div", ae(e, { "data-type": "math_block" })];
1533
1533
  },
1534
1534
  addNodeView() {
1535
- return Gt(dn, {
1535
+ return Gt(ln, {
1536
1536
  stopEvent: ({ event: e }) => {
1537
1537
  const t = e.target;
1538
1538
  return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
1539
1539
  }
1540
1540
  });
1541
1541
  }
1542
- }), Pa = {
1542
+ }), La = {
1543
1543
  name: "math",
1544
1544
  version: "1.0.0",
1545
- extensions: [Aa, La],
1545
+ extensions: [ka, Aa],
1546
1546
  toolbarItems: [
1547
1547
  {
1548
1548
  id: "math-inline-insert",
@@ -1603,7 +1603,7 @@ const Oe = () => {
1603
1603
  };
1604
1604
  }
1605
1605
  return null;
1606
- }, Da = (e) => {
1606
+ }, Pa = (e) => {
1607
1607
  const { $from: t } = e.state.selection;
1608
1608
  for (let n = t.depth; n >= 0; n -= 1) {
1609
1609
  const r = t.node(n);
@@ -1614,7 +1614,7 @@ const Oe = () => {
1614
1614
  };
1615
1615
  }
1616
1616
  return null;
1617
- }, Ma = (e, t) => e.state.schema.nodes[t] || null, Ra = (e) => {
1617
+ }, Da = (e, t) => e.state.schema.nodes[t] || null, Ma = (e) => {
1618
1618
  const t = Array.isArray(e.content) ? e.content : e.content ? [e.content] : void 0;
1619
1619
  return {
1620
1620
  type: e.type,
@@ -1622,7 +1622,7 @@ const Oe = () => {
1622
1622
  content: t
1623
1623
  };
1624
1624
  }, Ve = (e, t) => {
1625
- const n = Ra(t);
1625
+ const n = Ma(t);
1626
1626
  return typeof t.position == "number" ? e.chain().focus().insertContentAt(t.position, n).run() : e.chain().focus().insertContent(n).run();
1627
1627
  }, pe = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1628
1628
  var c;
@@ -1641,24 +1641,24 @@ const Oe = () => {
1641
1641
  return !1;
1642
1642
  const i = r.doc.nodeAt(s);
1643
1643
  return !i || t.type && i.type.name !== t.type ? !1 : (n.delete(s, s + i.nodeSize), a && a(n), !0);
1644
- }), un = (e, t) => {
1645
- const n = Ma(e, t.type);
1644
+ }), dn = (e, t) => {
1645
+ const n = Da(e, t.type);
1646
1646
  return n ? e.commands.command(({ tr: r, state: a, dispatch: s }) => {
1647
1647
  const { from: i, to: l } = a.selection, c = a.selection.$from.blockRange(a.selection.$to);
1648
1648
  if (!c)
1649
1649
  return !1;
1650
- const d = br(c, n, t.attrs);
1650
+ const d = yr(c, n, t.attrs);
1651
1651
  return d ? (r.wrap(c, d), s && s(r.scrollIntoView()), i <= l) : !1;
1652
1652
  }) : !1;
1653
- }, $a = (e, t) => {
1653
+ }, Ra = (e, t) => {
1654
1654
  if (t.length === 0)
1655
1655
  return !1;
1656
1656
  const n = e.getJSON();
1657
1657
  for (const r of t)
1658
- if (!(r.type === "insertNode" ? Ve(e, r.payload) : r.type === "updateNodeAttrs" ? pe(e, r.payload) : r.type === "removeNode" ? Ct(e, r.payload) : un(e, r.payload)))
1658
+ if (!(r.type === "insertNode" ? Ve(e, r.payload) : r.type === "updateNodeAttrs" ? pe(e, r.payload) : r.type === "removeNode" ? Ct(e, r.payload) : dn(e, r.payload)))
1659
1659
  return e.commands.setContent(n), !1;
1660
1660
  return !0;
1661
- }, Oa = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Fa = ee.create({
1661
+ }, $a = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Oa = ee.create({
1662
1662
  name: "claim",
1663
1663
  group: "block",
1664
1664
  content: "inline*",
@@ -1694,7 +1694,7 @@ const Oe = () => {
1694
1694
  const o = e.schema.nodes.claim.create(
1695
1695
  {
1696
1696
  number: d + 1,
1697
- claimId: Oa(),
1697
+ claimId: $a(),
1698
1698
  dependsOn: [],
1699
1699
  dependsOnClaimIds: []
1700
1700
  }
@@ -1725,11 +1725,11 @@ const Oe = () => {
1725
1725
  const i = document.createElement("span");
1726
1726
  i.className = "claim-body";
1727
1727
  const l = () => {
1728
- const o = _.getState().editorLanguage, u = U(o), m = Number(r.attrs.number || 1);
1728
+ const o = k.getState().editorLanguage, u = U(o), m = Number(r.attrs.number || 1);
1729
1729
  s.textContent = `${u.claimLabel(m)}. `, r.content.size > 0 ? (i.removeAttribute("data-placeholder"), a.classList.remove("claim-line--empty")) : (i.setAttribute("data-placeholder", o === "en" ? "Type claim content... (Enter to add next)" : "输入权利要求内容… (Enter 添加下一条)"), a.classList.add("claim-line--empty"));
1730
1730
  };
1731
- let c = _.getState().editorLanguage;
1732
- const d = _.subscribe((o) => {
1731
+ let c = k.getState().editorLanguage;
1732
+ const d = k.subscribe((o) => {
1733
1733
  o.editorLanguage !== c && (c = o.editorLanguage, l());
1734
1734
  });
1735
1735
  return a.addEventListener("mousedown", (o) => {
@@ -1756,13 +1756,13 @@ function Lt(e) {
1756
1756
  let Fe = 0;
1757
1757
  const dt = [];
1758
1758
  let ze = !1;
1759
- const za = 2e4, Pt = 6e4;
1760
- let G = null, je = !1, ce = null, xe = null;
1759
+ const Fa = 2e4, Pt = 6e4;
1760
+ let q = null, je = !1, ce = null, xe = null;
1761
1761
  const ut = /* @__PURE__ */ new Map();
1762
1762
  function Dt() {
1763
- ce && (window.removeEventListener("message", ce), ce = null), G && (G.src = "about:blank", G.remove(), G = null), je = !1;
1763
+ ce && (window.removeEventListener("message", ce), ce = null), q && (q.src = "about:blank", q.remove(), q = null), je = !1;
1764
1764
  }
1765
- function Ba(e, t) {
1765
+ function za(e, t) {
1766
1766
  const n = ut.get(e);
1767
1767
  if (n) {
1768
1768
  t(n);
@@ -1784,31 +1784,31 @@ function mt() {
1784
1784
  r && (clearTimeout(r), r = null), i && ut.set(e, i), t(i), ze = !1, xe = setTimeout(Dt, Pt), mt();
1785
1785
  }, s = () => {
1786
1786
  var i;
1787
- (i = G.contentWindow) == null || i.postMessage(
1787
+ (i = q.contentWindow) == null || i.postMessage(
1788
1788
  JSON.stringify({ action: "load", autosave: 0, xml: e || "" }),
1789
1789
  "*"
1790
1790
  );
1791
1791
  };
1792
1792
  ce = (i) => {
1793
1793
  var c;
1794
- if (!G || i.source !== G.contentWindow) return;
1794
+ if (!q || i.source !== q.contentWindow) return;
1795
1795
  let l;
1796
1796
  try {
1797
1797
  l = typeof i.data == "string" ? JSON.parse(i.data) : i.data;
1798
1798
  } catch {
1799
1799
  return;
1800
1800
  }
1801
- l.event === "init" ? (je = !0, s()) : l.event === "load" ? (c = G.contentWindow) == null || c.postMessage(
1801
+ l.event === "init" ? (je = !0, s()) : l.event === "load" ? (c = q.contentWindow) == null || c.postMessage(
1802
1802
  JSON.stringify({ action: "export", format: "svg" }),
1803
1803
  "*"
1804
1804
  ) : l.event === "export" && a(l.data || "");
1805
- }, window.addEventListener("message", ce), r = setTimeout(() => a(""), za), G ? je && s() : (G = document.createElement("iframe"), G.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:1px;height:1px;opacity:0;pointer-events:none;", document.body.appendChild(G), je = !1, G.src = "https://embed.diagrams.net/?embed=1&proto=json&spin=0&chrome=0");
1805
+ }, window.addEventListener("message", ce), r = setTimeout(() => a(""), Fa), q ? je && s() : (q = document.createElement("iframe"), q.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:1px;height:1px;opacity:0;pointer-events:none;", document.body.appendChild(q), je = !1, q.src = "https://embed.diagrams.net/?embed=1&proto=json&spin=0&chrome=0");
1806
1806
  }
1807
1807
  const Be = () => {
1808
1808
  document.querySelectorAll('body > svg[id^="fig-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
1809
1809
  (e.id.startsWith("dmermaid") || e.id.startsWith("dfi")) && e.remove();
1810
1810
  }), document.querySelectorAll("body > #dmermaid-svg").forEach((e) => e.remove()), document.querySelectorAll("body > style[data-mermaid-style]").forEach((e) => e.remove());
1811
- }, Ha = ee.create({
1811
+ }, Ba = ee.create({
1812
1812
  name: "figure",
1813
1813
  group: "block",
1814
1814
  content: "inline*",
@@ -1867,8 +1867,8 @@ const Be = () => {
1867
1867
  C.className = "figure-mermaid-save-btn", C.type = "button";
1868
1868
  const w = document.createElement("button");
1869
1869
  w.className = "figure-mermaid-cancel-btn", w.type = "button";
1870
- const k = document.createElement("span");
1871
- k.className = "figure-mermaid-error-inline", v.append(k, w, C), b.append(x, v);
1870
+ const _ = document.createElement("span");
1871
+ _.className = "figure-mermaid-error-inline", v.append(_, w, C), b.append(x, v);
1872
1872
  const L = document.createElement("div");
1873
1873
  L.className = "figure-drawio-view", L.contentEditable = "false";
1874
1874
  const P = document.createElement("img");
@@ -1904,12 +1904,12 @@ const Be = () => {
1904
1904
  d.classList.remove("figure-upload-area--dragover"), r.attrs.contentType === "image" && (I.preventDefault(), I.stopPropagation(), Y(((N = I.dataTransfer) == null ? void 0 : N.files) ?? null));
1905
1905
  });
1906
1906
  const Le = () => {
1907
- a || (a = !0, x.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", k.textContent = "", k.style.display = "none", se(), requestAnimationFrame(() => x.focus()));
1907
+ a || (a = !0, x.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", _.textContent = "", _.style.display = "none", se(), requestAnimationFrame(() => x.focus()));
1908
1908
  }, S = () => {
1909
1909
  a = !1, se();
1910
1910
  }, H = async () => {
1911
1911
  const I = x.value;
1912
- k.textContent = "", k.style.display = "none";
1912
+ _.textContent = "", _.style.display = "none";
1913
1913
  const N = I.trim();
1914
1914
  if (N)
1915
1915
  try {
@@ -1919,8 +1919,8 @@ const Be = () => {
1919
1919
  p.innerHTML = F, Be();
1920
1920
  } catch {
1921
1921
  Be();
1922
- const D = _.getState().editorLanguage;
1923
- k.textContent = D === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", k.style.display = "inline";
1922
+ const D = k.getState().editorLanguage;
1923
+ _.textContent = D === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", _.style.display = "inline";
1924
1924
  return;
1925
1925
  }
1926
1926
  R({ mermaidCode: I }), a = !1, se();
@@ -1933,14 +1933,14 @@ const Be = () => {
1933
1933
  I.stopPropagation(), S();
1934
1934
  }), x.addEventListener("mousedown", (I) => I.stopPropagation()), x.addEventListener("keydown", (I) => I.stopPropagation()), x.addEventListener("keypress", (I) => I.stopPropagation());
1935
1935
  let $ = null, O = null, K = null;
1936
- const In = () => {
1936
+ const Tn = () => {
1937
1937
  if (s) return;
1938
1938
  s = !0, se(), O = document.createElement("div"), O.className = "drawio-modal-overlay";
1939
1939
  const I = document.createElement("div");
1940
1940
  I.className = "drawio-modal-content";
1941
1941
  const N = document.createElement("div");
1942
1942
  N.className = "drawio-modal-header";
1943
- const D = document.createElement("span"), j = _.getState().editorLanguage;
1943
+ const D = document.createElement("span"), j = k.getState().editorLanguage;
1944
1944
  D.textContent = j === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", D.className = "drawio-modal-title";
1945
1945
  const F = document.createElement("button");
1946
1946
  F.className = "drawio-modal-close-btn", F.textContent = "✕", F.type = "button", F.addEventListener("click", () => et()), N.append(D, F), K = document.createElement("iframe"), K.className = "drawio-modal-iframe", K.setAttribute("frameborder", "0"), I.append(N, K), O.appendChild(I), document.body.appendChild(O);
@@ -1977,7 +1977,7 @@ const Be = () => {
1977
1977
  s = !1, $ && (window.removeEventListener("message", $), $ = null), K && (K.src = "about:blank", K = null), O && (O.remove(), O = null), se();
1978
1978
  };
1979
1979
  L.addEventListener("dblclick", (I) => {
1980
- I.preventDefault(), I.stopPropagation(), In();
1980
+ I.preventDefault(), I.stopPropagation(), Tn();
1981
1981
  }), i.addEventListener("mousedown", (I) => {
1982
1982
  const N = I.target;
1983
1983
  if (!(N instanceof HTMLElement) || N === M || M.contains(N) || N === x || b.contains(N) || N === d || d.contains(N) || N === m || N === u || g.contains(N) || L.contains(N)) return;
@@ -1987,7 +1987,7 @@ const Be = () => {
1987
1987
  e.view.dispatch(e.state.tr.setSelection(F));
1988
1988
  });
1989
1989
  let tt = !1, ve = "";
1990
- const En = async (I) => {
1990
+ const In = async (I) => {
1991
1991
  const N = I.trim();
1992
1992
  if (N !== ve) {
1993
1993
  if (!N) {
@@ -2006,21 +2006,21 @@ const Be = () => {
2006
2006
  }
2007
2007
  }
2008
2008
  }, se = () => {
2009
- const I = _.getState().editorLanguage, N = U(I), D = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", j = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", F = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", Ce = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
2009
+ const I = k.getState().editorLanguage, N = U(I), D = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", j = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", F = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", Ce = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
2010
2010
  j ? (E.textContent = `[${j}] `, E.style.display = "inline") : (E.textContent = "", E.style.display = "none");
2011
2011
  const te = D === "image", ne = D === "mermaid", J = D === "drawio";
2012
2012
  c.style.display = te && F ? "block" : "none", d.style.display = te && !F ? "flex" : "none", m.style.display = te && F ? "block" : "none", g.style.display = ne && !a ? "block" : "none", b.style.display = ne && a ? "block" : "none", L.style.display = J ? "flex" : "none", te && F && (c.src = F);
2013
2013
  const ue = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
2014
2014
  J && (ue ? (P.src = ue, P.style.display = "block") : (P.src = "", P.style.display = "none")), o.textContent = N.figureUploadHint || "点击上传或拖拽图片", m.textContent = N.figureReplaceImage || "更换图片", C.textContent = N.mermaidSaveAndRender || "保存并渲染", w.textContent = N.mermaidCancel || "取消";
2015
2015
  const Pe = Ce.trim().length > 0, me = p.querySelector("svg") !== null;
2016
- ne && !a && (Pe && me ? (h.textContent = N.mermaidDoubleClickToEdit || "双击编辑", h.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (h.textContent = N.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", h.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), J && !s && (ue ? (y.textContent = N.mermaidDoubleClickToEdit || "双击编辑", y.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (y.textContent = N.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", y.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), ne && !a && Ce.trim() !== ve && En(Ce);
2016
+ ne && !a && (Pe && me ? (h.textContent = N.mermaidDoubleClickToEdit || "双击编辑", h.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (h.textContent = N.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", h.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), J && !s && (ue ? (y.textContent = N.mermaidDoubleClickToEdit || "双击编辑", y.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (y.textContent = N.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", y.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), ne && !a && Ce.trim() !== ve && In(Ce);
2017
2017
  const St = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
2018
- J && St && !ue && !tt && !s && (tt = !0, Ba(St, (Tt) => {
2018
+ J && St && !ue && !tt && !s && (tt = !0, za(St, (Tt) => {
2019
2019
  Tt && R({ drawioSvg: Tt }), tt = !1;
2020
2020
  }));
2021
2021
  };
2022
- let xt = _.getState().editorLanguage;
2023
- const Nn = _.subscribe((I) => {
2022
+ let xt = k.getState().editorLanguage;
2023
+ const En = k.subscribe((I) => {
2024
2024
  I.editorLanguage !== xt && (xt = I.editorLanguage, se());
2025
2025
  });
2026
2026
  return se(), {
@@ -2036,12 +2036,12 @@ const Be = () => {
2036
2036
  },
2037
2037
  update: (I) => I.type.name !== "figure" ? !1 : (r = I, se(), !0),
2038
2038
  destroy: () => {
2039
- Nn(), Be(), $ && (window.removeEventListener("message", $), $ = null), K && (K.src = "about:blank", K = null), O && (O.remove(), O = null);
2039
+ En(), Be(), $ && (window.removeEventListener("message", $), $ = null), K && (K.src = "about:blank", K = null), O && (O.remove(), O = null);
2040
2040
  }
2041
2041
  };
2042
2042
  };
2043
2043
  }
2044
- }), Ua = ee.create({
2044
+ }), Ha = ee.create({
2045
2045
  name: "reference",
2046
2046
  group: "inline",
2047
2047
  inline: !0,
@@ -2139,7 +2139,7 @@ const Be = () => {
2139
2139
  design_description: "sectionTitle_design_description",
2140
2140
  design_views: "sectionTitle_design_views",
2141
2141
  design_brief: "sectionTitle_design_brief"
2142
- }, ja = /* @__PURE__ */ new Set([
2142
+ }, Ua = /* @__PURE__ */ new Set([
2143
2143
  "abstract",
2144
2144
  "abstract_drawing",
2145
2145
  "claims",
@@ -2150,7 +2150,7 @@ const Be = () => {
2150
2150
  "design_description",
2151
2151
  "design_views",
2152
2152
  "design_brief"
2153
- ]), Wa = /* @__PURE__ */ new Set([
2153
+ ]), ja = /* @__PURE__ */ new Set([
2154
2154
  "technical_field",
2155
2155
  "background_art",
2156
2156
  "summary",
@@ -2165,7 +2165,7 @@ const Be = () => {
2165
2165
  return e.forEach((n) => {
2166
2166
  !t && wt(n) && (t = !0);
2167
2167
  }), t;
2168
- }, qa = ee.create({
2168
+ }, Wa = ee.create({
2169
2169
  name: "patent_title",
2170
2170
  group: "block",
2171
2171
  content: "inline*",
@@ -2201,20 +2201,20 @@ const Be = () => {
2201
2201
  return typeof h == "number" ? h : null;
2202
2202
  }, d = () => {
2203
2203
  const h = c();
2204
- h !== null && _.getState().setActiveSection("patent_title", h);
2204
+ h !== null && k.getState().setActiveSection("patent_title", h);
2205
2205
  }, o = () => {
2206
2206
  const h = c();
2207
- h !== null && (_.getState().openDraftingPanel("patent_title", h), e.commands.focus(h + 1));
2207
+ h !== null && (k.getState().openDraftingPanel("patent_title", h), e.commands.focus(h + 1));
2208
2208
  };
2209
2209
  i.addEventListener("click", o), l.addEventListener("focusin", d), l.addEventListener("click", d);
2210
2210
  const u = () => {
2211
- const h = _.getState(), b = U(h.editorLanguage), x = typeof b.bookTitle_description == "string" ? b.bookTitle_description : "说明书", v = typeof b.patentTitlePlaceholder == "string" ? b.patentTitlePlaceholder : "专利名称";
2211
+ const h = k.getState(), b = U(h.editorLanguage), x = typeof b.bookTitle_description == "string" ? b.bookTitle_description : "说明书", v = typeof b.patentTitlePlaceholder == "string" ? b.patentTitlePlaceholder : "专利名称";
2212
2212
  s.textContent = x;
2213
2213
  const C = wt(r), w = h.rightPanel.activeSectionPos === c();
2214
2214
  i.textContent = `[${v}]`, i.style.display = C ? "none" : "", i.classList.toggle("ps-placeholder--active", w && !C), l.classList.toggle("pt-title-content--has-content", C);
2215
2215
  };
2216
- let m = _.getState().editorLanguage, g = _.getState().rightPanel.activeSectionPos;
2217
- const p = _.subscribe((h) => {
2216
+ let m = k.getState().editorLanguage, g = k.getState().rightPanel.activeSectionPos;
2217
+ const p = k.subscribe((h) => {
2218
2218
  const b = h.editorLanguage !== m, x = h.rightPanel.activeSectionPos !== g;
2219
2219
  m = h.editorLanguage, g = h.rightPanel.activeSectionPos, (b || x) && u();
2220
2220
  });
@@ -2260,15 +2260,15 @@ const Be = () => {
2260
2260
  const n = [];
2261
2261
  return t.forEach((r) => {
2262
2262
  r.type.name === "patent_section" || r.type.name === "patent_title" ? e(r.content).forEach((s) => n.push(s)) : r.isBlock && r.content.size > 0 ? n.push(r.copy(e(r.content))) : n.push(r);
2263
- }), Cr.from(n);
2263
+ }), vr.from(n);
2264
2264
  };
2265
2265
  return [
2266
2266
  new Xe({
2267
- key: new _e("patentSectionLock"),
2267
+ key: new ke("patentSectionLock"),
2268
2268
  props: {
2269
2269
  transformPasted: (t) => {
2270
2270
  const n = e(t.content);
2271
- return new vr(n, t.openStart, t.openEnd);
2271
+ return new br(n, t.openStart, t.openEnd);
2272
2272
  }
2273
2273
  },
2274
2274
  filterTransaction: (t, n) => {
@@ -2307,19 +2307,19 @@ const Be = () => {
2307
2307
  }, u = () => {
2308
2308
  const v = o();
2309
2309
  if (v === null) return;
2310
- _.getState().setActiveSection(r.attrs.sectionType, v);
2310
+ k.getState().setActiveSection(r.attrs.sectionType, v);
2311
2311
  }, m = () => {
2312
2312
  const v = o();
2313
2313
  if (v === null) return;
2314
- _.getState().openDraftingPanel(r.attrs.sectionType, v), e.commands.focus(v + 1);
2314
+ k.getState().openDraftingPanel(r.attrs.sectionType, v), e.commands.focus(v + 1);
2315
2315
  }, g = (v) => {
2316
2316
  v.preventDefault(), v.stopPropagation();
2317
2317
  const C = `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
2318
2318
  let w = 0;
2319
2319
  e.state.doc.descendants((E) => (E.type.name === "claim" && w++, !0));
2320
- const k = o();
2321
- if (k === null) return;
2322
- const L = k + r.nodeSize - 1, P = e.state.schema.nodes.claim.create({
2320
+ const _ = o();
2321
+ if (_ === null) return;
2322
+ const L = _ + r.nodeSize - 1, P = e.state.schema.nodes.claim.create({
2323
2323
  number: w + 1,
2324
2324
  claimId: C,
2325
2325
  dependsOn: [],
@@ -2329,11 +2329,11 @@ const Be = () => {
2329
2329
  };
2330
2330
  l.addEventListener("click", m), c.addEventListener("focusin", u), c.addEventListener("click", u), d.addEventListener("mousedown", g);
2331
2331
  const p = () => {
2332
- const v = _.getState(), C = U(v.editorLanguage), w = Object.keys(Mt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", k = ja.has(w), L = Wa.has(w), P = w === "claims", y = Mt[w], T = typeof C[y] == "string" ? C[y] : w, E = wt(r), M = v.rightPanel.activeSectionPos === o();
2333
- a.className = `ps${E ? "" : " ps--empty"}${L ? " ps--sub" : ""}`, a.setAttribute("data-section-type", w), s.className = k ? "pb-heading" : "ps-heading ps-heading--sub", s.textContent = T, l.textContent = `[${T}]`, l.style.display = E ? "none" : "", l.classList.toggle("ps-placeholder--active", M && !E), c.classList.toggle("ps-content--has-content", E), P ? (d.style.display = "", d.textContent = v.editorLanguage === "en" ? "+ Add Claim" : "+ 添加权利要求") : d.style.display = "none";
2332
+ const v = k.getState(), C = U(v.editorLanguage), w = Object.keys(Mt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", _ = Ua.has(w), L = ja.has(w), P = w === "claims", y = Mt[w], T = typeof C[y] == "string" ? C[y] : w, E = wt(r), M = v.rightPanel.activeSectionPos === o();
2333
+ a.className = `ps${E ? "" : " ps--empty"}${L ? " ps--sub" : ""}`, a.setAttribute("data-section-type", w), s.className = _ ? "pb-heading" : "ps-heading ps-heading--sub", s.textContent = T, l.textContent = `[${T}]`, l.style.display = E ? "none" : "", l.classList.toggle("ps-placeholder--active", M && !E), c.classList.toggle("ps-content--has-content", E), P ? (d.style.display = "", d.textContent = v.editorLanguage === "en" ? "+ Add Claim" : "+ 添加权利要求") : d.style.display = "none";
2334
2334
  };
2335
- let h = _.getState().editorLanguage, b = _.getState().rightPanel.activeSectionPos;
2336
- const x = _.subscribe((v) => {
2335
+ let h = k.getState().editorLanguage, b = k.getState().rightPanel.activeSectionPos;
2336
+ const x = k.subscribe((v) => {
2337
2337
  const C = v.editorLanguage !== h, w = v.rightPanel.activeSectionPos !== b;
2338
2338
  h = v.editorLanguage, b = v.rightPanel.activeSectionPos, (C || w) && p();
2339
2339
  });
@@ -2347,21 +2347,21 @@ const Be = () => {
2347
2347
  };
2348
2348
  };
2349
2349
  }
2350
- }), Va = [
2350
+ }), qa = [
2351
2351
  "abstract",
2352
2352
  // 说明书摘要
2353
2353
  "abstract_drawing"
2354
2354
  // 摘要附图
2355
- ], Ka = [
2355
+ ], Va = [
2356
2356
  "technical_field",
2357
2357
  "background_art",
2358
2358
  "summary",
2359
2359
  "drawing_description",
2360
2360
  "detailed_description"
2361
- ], Ja = [
2361
+ ], Ka = [
2362
2362
  "drawing_figures"
2363
2363
  // 说明书附图
2364
- ], Xa = [
2364
+ ], Ja = [
2365
2365
  "design_product_name",
2366
2366
  "design_usage",
2367
2367
  "design_description",
@@ -2378,26 +2378,26 @@ const Be = () => {
2378
2378
  type: "paragraph"
2379
2379
  }
2380
2380
  ]
2381
- }), mn = () => ({
2381
+ }), un = () => ({
2382
2382
  type: "patent_title",
2383
2383
  content: []
2384
- }), Qa = () => [
2384
+ }), Xa = () => [
2385
+ ...qa.map(We),
2386
+ un(),
2385
2387
  ...Va.map(We),
2386
- mn(),
2387
- ...Ka.map(We),
2388
+ ...Ka.map(We)
2389
+ ], Qa = () => [
2390
+ un(),
2388
2391
  ...Ja.map(We)
2389
- ], Ya = () => [
2390
- mn(),
2391
- ...Xa.map(We)
2392
- ], fn = (e = "invention") => ({ type: "doc", content: e === "design" ? Ya() : Qa() }), Rt = 400, V = {
2392
+ ], mn = (e = "invention") => ({ type: "doc", content: e === "design" ? Qa() : Xa() }), Rt = 400, V = {
2393
2393
  lastClaimWarningSignature: "",
2394
2394
  lastInvalidReferenceSignature: "",
2395
2395
  lastClaimGraphSignature: "",
2396
2396
  invalidReferenceHandler: null,
2397
2397
  claimGraphHandler: null
2398
- }, fe = (e) => vt(e, (t) => t.type.name === "claim"), ke = (e) => vt(e, (t) => t.type.name === "figure"), gn = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Z = (e) => typeof e != "string" ? "" : e.trim(), $t = (e) => {
2399
- const n = _.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
2400
- ke(e).forEach((s) => {
2398
+ }, fe = (e) => vt(e, (t) => t.type.name === "claim"), _e = (e) => vt(e, (t) => t.type.name === "figure"), fn = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Z = (e) => typeof e != "string" ? "" : e.trim(), $t = (e) => {
2399
+ const n = k.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
2400
+ _e(e).forEach((s) => {
2401
2401
  const i = Z(s.node.attrs.id);
2402
2402
  i && r.add(i);
2403
2403
  });
@@ -2405,14 +2405,14 @@ const Be = () => {
2405
2405
  for (; r.has(`${n}${a}`); )
2406
2406
  a += 1;
2407
2407
  return `${n}${a}`;
2408
- }, Za = /^(Fig\.|图)(\d+)$/, es = (e) => {
2409
- const n = _.getState().editorLanguage === "en" ? "Fig." : "图", r = ke(e);
2408
+ }, Ya = /^(Fig\.|图)(\d+)$/, Za = (e) => {
2409
+ const n = k.getState().editorLanguage === "en" ? "Fig." : "图", r = _e(e);
2410
2410
  if (r.length === 0) return;
2411
2411
  const a = [];
2412
2412
  let s = 1;
2413
2413
  for (const l of r) {
2414
2414
  const c = Z(l.node.attrs.id);
2415
- if (!Za.exec(c)) continue;
2415
+ if (!Ya.exec(c)) continue;
2416
2416
  const o = `${n}${s}`;
2417
2417
  c !== o && a.push({ pos: l.pos, expectedId: o, currentId: c }), s++;
2418
2418
  }
@@ -2423,7 +2423,7 @@ const Be = () => {
2423
2423
  !c || c.type.name !== "figure" || i.setNodeMarkup(l.pos, void 0, { ...c.attrs, id: l.expectedId });
2424
2424
  }
2425
2425
  i.steps.length > 0 && (i.setMeta("addToHistory", !1), e.view.dispatch(i));
2426
- }, qe = (e) => {
2426
+ }, Ge = (e) => {
2427
2427
  if (!Array.isArray(e))
2428
2428
  return [];
2429
2429
  const t = e.map((n) => Number(n)).filter((n) => Number.isFinite(n) && n > 0);
@@ -2443,7 +2443,7 @@ const Be = () => {
2443
2443
  }, ft = (e, t, n, r, a) => {
2444
2444
  const s = U(e);
2445
2445
  return a ? t === "figure" ? s.invalidFigureReference : s.invalidClaimReference : t === "figure" ? r || (e === "en" ? "Figure ?" : "附图?") : typeof n != "number" ? s.invalidClaimReference : s.claimLabel(n);
2446
- }, Ke = () => _.getState().editorLanguage === "en" ? "en" : "zh", ts = (e) => {
2446
+ }, Ke = () => k.getState().editorLanguage === "en" ? "en" : "zh", es = (e) => {
2447
2447
  const t = [], n = Ke(), r = new Map(e.map((d) => [d.claimId, d.number]));
2448
2448
  e.forEach((d) => {
2449
2449
  d.dependsOnClaimIds.forEach((o) => {
@@ -2482,14 +2482,14 @@ const Be = () => {
2482
2482
  }), t;
2483
2483
  }, ie = (e) => {
2484
2484
  const t = fe(e), n = /* @__PURE__ */ new Set(), r = t.map((o, u) => {
2485
- const m = typeof o.node.attrs.claimId == "string" ? o.node.attrs.claimId : "", g = m && !n.has(m) ? m : gn();
2485
+ const m = typeof o.node.attrs.claimId == "string" ? o.node.attrs.claimId : "", g = m && !n.has(m) ? m : fn();
2486
2486
  return n.add(g), { pos: o.pos, node: o.node, claimId: g, number: u + 1 };
2487
2487
  }), a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
2488
2488
  r.forEach((o) => {
2489
2489
  a.set(o.number, o.claimId), s.set(o.claimId, o.number);
2490
2490
  });
2491
2491
  const i = r.map((o) => {
2492
- const u = rt(o.node.attrs.dependsOnClaimIds), g = qe(o.node.attrs.dependsOn).map((v) => a.get(v)).filter((v) => typeof v == "string"), h = (u.length > 0 ? u : g).filter((v, C, w) => w.indexOf(v) === C).filter((v) => v !== o.claimId && s.has(v)), b = h.map((v) => s.get(v)).filter((v) => typeof v == "number").sort((v, C) => v - C), x = {
2492
+ const u = rt(o.node.attrs.dependsOnClaimIds), g = Ge(o.node.attrs.dependsOn).map((v) => a.get(v)).filter((v) => typeof v == "string"), h = (u.length > 0 ? u : g).filter((v, C, w) => w.indexOf(v) === C).filter((v) => v !== o.claimId && s.has(v)), b = h.map((v) => s.get(v)).filter((v) => typeof v == "number").sort((v, C) => v - C), x = {
2493
2493
  ...o.node.attrs,
2494
2494
  claimId: o.claimId,
2495
2495
  number: o.number,
@@ -2497,21 +2497,21 @@ const Be = () => {
2497
2497
  dependsOnClaimIds: h
2498
2498
  };
2499
2499
  return { claimId: o.claimId, number: o.number, dependsOnClaimIds: h, pos: o.pos, attrs: x };
2500
- }), l = ts(i), c = e.commands.command(({ tr: o, dispatch: u }) => {
2500
+ }), l = es(i), c = e.commands.command(({ tr: o, dispatch: u }) => {
2501
2501
  let m = !1;
2502
2502
  return i.forEach((g) => {
2503
2503
  const p = e.state.doc.nodeAt(g.pos);
2504
2504
  if (!p || p.type.name !== "claim")
2505
2505
  return;
2506
2506
  const h = { ...g.attrs };
2507
- (p.attrs.number !== h.number || p.attrs.claimId !== h.claimId || !Ot(qe(p.attrs.dependsOn), qe(h.dependsOn)) || !Ot(
2507
+ (p.attrs.number !== h.number || p.attrs.claimId !== h.claimId || !Ot(Ge(p.attrs.dependsOn), Ge(h.dependsOn)) || !Ot(
2508
2508
  rt(p.attrs.dependsOnClaimIds),
2509
2509
  rt(h.dependsOnClaimIds)
2510
2510
  )) && (o.setNodeMarkup(g.pos, void 0, h), m = !0);
2511
2511
  }), m && u && u(o), !0;
2512
2512
  }), d = l.map((o) => `${o.claimId}:${o.code}`).join("|");
2513
2513
  return d !== V.lastClaimGraphSignature && (V.lastClaimGraphSignature = d, V.claimGraphHandler && V.claimGraphHandler({ issues: l }), l.length > 0 && console.warn(`Claim graph validation found ${l.length} issue(s).`)), c;
2514
- }, pn = (e) => {
2514
+ }, gn = (e) => {
2515
2515
  const t = /* @__PURE__ */ new Map();
2516
2516
  return fe(e).forEach((n) => {
2517
2517
  const r = typeof n.node.attrs.claimId == "string" ? n.node.attrs.claimId : "", a = Number(n.node.attrs.number);
@@ -2521,9 +2521,9 @@ const Be = () => {
2521
2521
  pos: n.pos
2522
2522
  });
2523
2523
  }), t;
2524
- }, hn = (e) => {
2524
+ }, pn = (e) => {
2525
2525
  const t = /* @__PURE__ */ new Map();
2526
- return ke(e).forEach((n) => {
2526
+ return _e(e).forEach((n) => {
2527
2527
  const r = Z(n.node.attrs.id);
2528
2528
  r && t.set(r, {
2529
2529
  id: r,
@@ -2531,13 +2531,13 @@ const Be = () => {
2531
2531
  });
2532
2532
  }), t;
2533
2533
  }, Q = (e) => {
2534
- const t = pn(e), n = hn(e), r = [], a = Ke();
2534
+ const t = gn(e), n = pn(e), r = [], a = Ke();
2535
2535
  if (!e.commands.command(({ tr: l, state: c, dispatch: d }) => {
2536
2536
  let o = !1;
2537
2537
  return c.doc.descendants((u, m) => {
2538
2538
  if (u.type.name !== "reference")
2539
2539
  return !0;
2540
- const g = u.attrs.targetType === "figure" ? "figure" : "claim", p = typeof u.attrs.targetClaimId == "string" && u.attrs.targetClaimId ? u.attrs.targetClaimId : null, h = typeof u.attrs.targetFigureId == "string" && u.attrs.targetFigureId ? Z(u.attrs.targetFigureId) : null, b = g === "claim" && p ? t.get(p) : void 0, x = g === "figure" && h ? n.get(h) : void 0, v = b ? b.number : null, C = x ? x.id : null, w = g === "figure" ? !x : !b, k = ft(a, g, v, C, w), L = g === "figure" ? C || u.attrs.target || h || null : b ? String(b.number) : u.attrs.target || p || null, P = {
2540
+ const g = u.attrs.targetType === "figure" ? "figure" : "claim", p = typeof u.attrs.targetClaimId == "string" && u.attrs.targetClaimId ? u.attrs.targetClaimId : null, h = typeof u.attrs.targetFigureId == "string" && u.attrs.targetFigureId ? Z(u.attrs.targetFigureId) : null, b = g === "claim" && p ? t.get(p) : void 0, x = g === "figure" && h ? n.get(h) : void 0, v = b ? b.number : null, C = x ? x.id : null, w = g === "figure" ? !x : !b, _ = ft(a, g, v, C, w), L = g === "figure" ? C || u.attrs.target || h || null : b ? String(b.number) : u.attrs.target || p || null, P = {
2541
2541
  ...u.attrs,
2542
2542
  targetType: g,
2543
2543
  targetClaimId: p,
@@ -2546,7 +2546,7 @@ const Be = () => {
2546
2546
  resolvedFigureId: C,
2547
2547
  invalid: w,
2548
2548
  lang: a,
2549
- displayText: k,
2549
+ displayText: _,
2550
2550
  target: L
2551
2551
  };
2552
2552
  return Object.keys(P).some(
@@ -2570,7 +2570,7 @@ const Be = () => {
2570
2570
  return l.attrs.highlight !== d && (r.setNodeMarkup(c, void 0, { ...l.attrs, highlight: d }), i = !0), !0;
2571
2571
  }), i && s && s(r), !0;
2572
2572
  });
2573
- }, ns = (e) => {
2573
+ }, ts = (e) => {
2574
2574
  const t = fe(e).map((r) => ({ pos: r.pos, length: r.node.textContent.length })).filter((r) => r.length > Rt), n = t.map((r) => `${r.pos}:${r.length}`).join("|");
2575
2575
  n !== V.lastClaimWarningSignature && (V.lastClaimWarningSignature = n, t.length !== 0 && console.warn(`Claim content is too long for ${t.length} block(s). Suggested max: ${Rt}.`));
2576
2576
  }, at = (e, t) => {
@@ -2581,16 +2581,16 @@ const Be = () => {
2581
2581
  return n.pos;
2582
2582
  const r = fe(e)[0];
2583
2583
  return r ? r.pos : null;
2584
- }, rs = (e, t, n) => e.commands.command(({ tr: r, state: a, dispatch: s }) => {
2584
+ }, ns = (e, t, n) => e.commands.command(({ tr: r, state: a, dispatch: s }) => {
2585
2585
  const i = a.doc.nodeAt(t);
2586
2586
  if (!i || i.type.name !== "claim")
2587
2587
  return !1;
2588
2588
  const l = t + 1, c = t + i.nodeSize - 1;
2589
2589
  return n.trim().length === 0 ? r.delete(l, c) : r.replaceWith(l, c, a.schema.text(n)), s && s(r), !0;
2590
- }), as = {
2590
+ }), rs = {
2591
2591
  name: "patent",
2592
2592
  version: "1.0.0",
2593
- extensions: [Fa, Ha, Ua, qa, Ga],
2593
+ extensions: [Oa, Ba, Ha, Wa, Ga],
2594
2594
  toolbarItems: [
2595
2595
  {
2596
2596
  id: "patent-claim-insert",
@@ -2620,7 +2620,7 @@ const Be = () => {
2620
2620
  execute: ({ editor: e }, t) => {
2621
2621
  const n = typeof t == "object" && t ? t : {}, r = n.placement || "current", a = typeof n.text == "string" ? n.text : "", s = fe(e).length, i = {
2622
2622
  number: n.number || s + 1,
2623
- claimId: gn(),
2623
+ claimId: fn(),
2624
2624
  dependsOn: [],
2625
2625
  dependsOnClaimIds: []
2626
2626
  }, l = a ? [{ type: "text", text: a }] : [];
@@ -2641,7 +2641,7 @@ const Be = () => {
2641
2641
  if (typeof r != "number")
2642
2642
  return !1;
2643
2643
  const a = {};
2644
- return typeof n.number == "number" && (a.number = n.number), !(Object.keys(a).length === 0 ? !0 : pe(e, { type: "claim", position: r, attrs: a })) || !(typeof n.text == "string" ? rs(e, r, n.text) : !0) || !ie(e) ? !1 : Q(e);
2644
+ return typeof n.number == "number" && (a.number = n.number), !(Object.keys(a).length === 0 ? !0 : pe(e, { type: "claim", position: r, attrs: a })) || !(typeof n.text == "string" ? ns(e, r, n.text) : !0) || !ie(e) ? !1 : Q(e);
2645
2645
  }
2646
2646
  },
2647
2647
  setClaimDependency: {
@@ -2659,7 +2659,7 @@ const Be = () => {
2659
2659
  const g = Number(m.node.attrs.number), p = typeof m.node.attrs.claimId == "string" ? m.node.attrs.claimId : "";
2660
2660
  Number.isFinite(g) && g > 0 && p && l.set(g, p);
2661
2661
  });
2662
- const c = qe(n.dependsOn).filter(
2662
+ const c = Ge(n.dependsOn).filter(
2663
2663
  (m) => Number.isFinite(s) && m > 0 && m < s
2664
2664
  ), d = c.map((m) => l.get(m)).filter((m) => typeof m == "string" && m.length > 0 && m !== i);
2665
2665
  return !pe(e, {
@@ -2677,7 +2677,7 @@ const Be = () => {
2677
2677
  if (!(n != null && n.lang))
2678
2678
  return !1;
2679
2679
  const r = n.lang === "en" ? "en" : "zh";
2680
- _.getState().setEditorLanguage(r);
2680
+ k.getState().setEditorLanguage(r);
2681
2681
  const s = (n.scope || "all") === "current" ? ye(e, "reference") : null;
2682
2682
  return e.commands.command(({ tr: l, state: c, dispatch: d }) => {
2683
2683
  let o = !1;
@@ -2736,7 +2736,7 @@ const Be = () => {
2736
2736
  if (!s || s.type.name !== "figure")
2737
2737
  return !1;
2738
2738
  const l = (typeof n.id == "string" ? Z(n.id) : Z(s.attrs.id)) || $t(e);
2739
- if (ke(e).some((o) => o.pos === a ? !1 : Z(o.node.attrs.id) === l))
2739
+ if (_e(e).some((o) => o.pos === a ? !1 : Z(o.node.attrs.id) === l))
2740
2740
  return !1;
2741
2741
  const d = { id: l };
2742
2742
  return typeof n.contentType == "string" && ["image", "mermaid", "drawio"].includes(n.contentType) && (d.contentType = n.contentType), typeof n.imageSrc == "string" && (d.imageSrc = n.imageSrc), typeof n.mermaidCode == "string" && (d.mermaidCode = n.mermaidCode), typeof n.drawioXml == "string" && (d.drawioXml = n.drawioXml), pe(e, {
@@ -2752,7 +2752,7 @@ const Be = () => {
2752
2752
  execute: ({ editor: e }) => {
2753
2753
  const t = /* @__PURE__ */ new Set();
2754
2754
  let n = !1;
2755
- return ke(e).forEach((r) => {
2755
+ return _e(e).forEach((r) => {
2756
2756
  const a = Z(r.node.attrs.id);
2757
2757
  if (a) {
2758
2758
  if (t.has(a)) {
@@ -2776,7 +2776,7 @@ const Be = () => {
2776
2776
  return typeof n.targetClaimId == "string" && n.targetClaimId.trim().length > 0;
2777
2777
  },
2778
2778
  execute: ({ editor: e }, t) => {
2779
- const n = typeof t == "object" && t ? t : {}, r = pn(e), a = typeof n.targetClaimId == "string" ? n.targetClaimId.trim() : "";
2779
+ const n = typeof t == "object" && t ? t : {}, r = gn(e), a = typeof n.targetClaimId == "string" ? n.targetClaimId.trim() : "";
2780
2780
  if (!a)
2781
2781
  return !1;
2782
2782
  const s = r.get(a);
@@ -2812,7 +2812,7 @@ const Be = () => {
2812
2812
  return typeof n.targetFigureId == "string" && n.targetFigureId.trim().length > 0;
2813
2813
  },
2814
2814
  execute: ({ editor: e }, t) => {
2815
- const n = typeof t == "object" && t ? t : {}, r = hn(e), a = typeof n.targetFigureId == "string" ? Z(n.targetFigureId) : "";
2815
+ const n = typeof t == "object" && t ? t : {}, r = pn(e), a = typeof n.targetFigureId == "string" ? Z(n.targetFigureId) : "";
2816
2816
  if (!a)
2817
2817
  return !1;
2818
2818
  const s = r.get(a);
@@ -2867,7 +2867,7 @@ const Be = () => {
2867
2867
  description: "Insert patent document skeleton with all sections",
2868
2868
  category: "patent",
2869
2869
  execute: ({ editor: e }, t) => {
2870
- const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a = fn(r);
2870
+ const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a = mn(r);
2871
2871
  return e.commands.setContent(a);
2872
2872
  }
2873
2873
  },
@@ -2887,16 +2887,16 @@ const Be = () => {
2887
2887
  }
2888
2888
  },
2889
2889
  onStateChange: (e) => {
2890
- ie(e) && (Q(e), Ft(e), ns(e), es(e));
2890
+ ie(e) && (Q(e), Ft(e), ts(e), Za(e));
2891
2891
  },
2892
2892
  onSelectionChange: (e) => {
2893
2893
  Ft(e);
2894
2894
  }
2895
- }, ss = [Na, _a, Pa, as];
2896
- ss.forEach((e) => W.register(e));
2897
- const is = (e = {}) => {
2895
+ }, as = [Ea, _a, La, rs];
2896
+ as.forEach((e) => W.register(e));
2897
+ const ss = (e = {}) => {
2898
2898
  const t = [
2899
- ...Sa,
2899
+ ...xa,
2900
2900
  ...W.getExtensions(),
2901
2901
  ...e.extensions || []
2902
2902
  ];
@@ -2909,7 +2909,7 @@ const is = (e = {}) => {
2909
2909
  return {
2910
2910
  editor: e,
2911
2911
  selection: { from: t, to: n },
2912
- store: _.getState()
2912
+ store: k.getState()
2913
2913
  };
2914
2914
  }, Ae = (e) => ({
2915
2915
  execCommand: (t, n, r) => W.executeCommand(t, st(e), n, r),
@@ -2919,25 +2919,25 @@ const is = (e = {}) => {
2919
2919
  insertNode: (t) => Ve(e, t),
2920
2920
  updateNodeAttrs: (t) => pe(e, t),
2921
2921
  removeNode: (t) => Ct(e, t),
2922
- wrapSelection: (t) => un(e, t),
2923
- applyTransactionBatch: (t) => $a(e, t),
2922
+ wrapSelection: (t) => dn(e, t),
2923
+ applyTransactionBatch: (t) => Ra(e, t),
2924
2924
  findNodeByType: (t, n) => bt(e, t, n),
2925
2925
  findAncestorNode: (t) => ye(e, t),
2926
- findCurrentBlock: () => Da(e),
2926
+ findCurrentBlock: () => Pa(e),
2927
2927
  findNodesByPredicate: (t, n) => vt(e, t, n)
2928
- }), os = /* @__PURE__ */ new Set([
2928
+ }), is = /* @__PURE__ */ new Set([
2929
2929
  "abstract",
2930
2930
  "abstract_drawing",
2931
2931
  "claims",
2932
2932
  "drawing_figures"
2933
- ]), cs = /* @__PURE__ */ new Set([
2933
+ ]), os = /* @__PURE__ */ new Set([
2934
2934
  "technical_field",
2935
2935
  "background_art",
2936
2936
  "summary",
2937
2937
  "drawing_description",
2938
2938
  "detailed_description"
2939
2939
  ]);
2940
- function ls(e, t) {
2940
+ function cs(e, t) {
2941
2941
  const n = U(t), r = [];
2942
2942
  return e.state.doc.descendants((a) => {
2943
2943
  if (a.type.name === "patent_title") {
@@ -2973,7 +2973,7 @@ function Bt(e) {
2973
2973
  spacing: { before: 240, after: 120 }
2974
2974
  });
2975
2975
  }
2976
- function ds(e) {
2976
+ function ls(e) {
2977
2977
  return new Qe({
2978
2978
  children: [new Ye({ text: e, bold: !0, size: 36, font: "宋体" })],
2979
2979
  alignment: yt.CENTER,
@@ -2987,11 +2987,11 @@ function it(e) {
2987
2987
  indent: { firstLine: Se(7) }
2988
2988
  });
2989
2989
  }
2990
- function us(e, t) {
2990
+ function ds(e, t) {
2991
2991
  const n = U(t), r = [];
2992
2992
  let a = !1;
2993
2993
  for (const s of e) {
2994
- if (os.has(s.sectionType)) {
2994
+ if (is.has(s.sectionType)) {
2995
2995
  r.push(zt(s.title));
2996
2996
  for (const i of s.paragraphs)
2997
2997
  r.push(it(i));
@@ -3003,10 +3003,10 @@ function us(e, t) {
3003
3003
  r.push(zt(i)), a = !0;
3004
3004
  }
3005
3005
  for (const i of s.paragraphs)
3006
- r.push(ds(i));
3006
+ r.push(ls(i));
3007
3007
  continue;
3008
3008
  }
3009
- if (cs.has(s.sectionType)) {
3009
+ if (os.has(s.sectionType)) {
3010
3010
  r.push(Bt(s.title));
3011
3011
  for (const i of s.paragraphs)
3012
3012
  r.push(it(i));
@@ -3019,7 +3019,7 @@ function us(e, t) {
3019
3019
  return r;
3020
3020
  }
3021
3021
  async function Ht(e, t) {
3022
- const n = ls(e, t), r = us(n, t), a = n.find((d) => d.type === "patent_title"), s = a != null && a.paragraphs[0] ? `${a.paragraphs[0]}.docx` : "patent-document.docx", i = {
3022
+ const n = cs(e, t), r = ds(n, t), a = n.find((d) => d.type === "patent_title"), s = a != null && a.paragraphs[0] ? `${a.paragraphs[0]}.docx` : "patent-document.docx", i = {
3023
3023
  properties: {
3024
3024
  page: {
3025
3025
  margin: {
@@ -3031,15 +3031,15 @@ async function Ht(e, t) {
3031
3031
  }
3032
3032
  },
3033
3033
  children: r
3034
- }, l = new ea({
3034
+ }, l = new Zr({
3035
3035
  sections: [i]
3036
- }), c = await ta.toBlob(l);
3037
- na(c, s);
3036
+ }), c = await ea.toBlob(l);
3037
+ ta(c, s);
3038
3038
  }
3039
- async function ms(e) {
3039
+ async function us(e) {
3040
3040
  window.print();
3041
3041
  }
3042
- const fs = ["history", "text", "structure", "format", "technical", "patent"], ot = (e) => e.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), ct = ({ btn: e, items: t }) => {
3042
+ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot = (e) => e.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), ct = ({ btn: e, items: t }) => {
3043
3043
  const [n, r] = z(!1), a = X(null), s = X(null), [i, l] = z({ top: 0, left: 0 }), c = de(() => {
3044
3044
  if (!a.current) return;
3045
3045
  const d = a.current.getBoundingClientRect();
@@ -3081,10 +3081,10 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3081
3081
  e.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200 text-gray-500"
3082
3082
  ),
3083
3083
  disabled: e.disabled,
3084
- children: /* @__PURE__ */ f(rn, { size: 12 })
3084
+ children: /* @__PURE__ */ f(nn, { size: 12 })
3085
3085
  }
3086
3086
  ),
3087
- n && wr(
3087
+ n && Cr(
3088
3088
  /* @__PURE__ */ f(
3089
3089
  "div",
3090
3090
  {
@@ -3107,13 +3107,13 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3107
3107
  document.body
3108
3108
  )
3109
3109
  ] });
3110
- }, gs = ({
3110
+ }, fs = ({
3111
3111
  editor: e,
3112
- groupOrder: t = fs,
3112
+ groupOrder: t = ms,
3113
3113
  collapsibleGroups: n = !0,
3114
3114
  defaultCollapsedGroups: r = []
3115
3115
  }) => {
3116
- const [a, s] = z(() => new Set(r)), { editorLanguage: i, setEditorLanguage: l } = _(), c = U(i);
3116
+ const [a, s] = z(() => new Set(r)), { editorLanguage: i, setEditorLanguage: l } = k(), c = U(i);
3117
3117
  if (!e)
3118
3118
  return null;
3119
3119
  const d = Ae(e), o = i === "zh", u = [
@@ -3121,7 +3121,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3121
3121
  id: "core-undo",
3122
3122
  label: "Undo",
3123
3123
  group: "history",
3124
- icon: xr,
3124
+ icon: wr,
3125
3125
  tooltip: "Undo (Ctrl+Z)",
3126
3126
  isActive: !1,
3127
3127
  disabled: !e.can().chain().focus().undo().run(),
@@ -3133,7 +3133,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3133
3133
  id: "core-redo",
3134
3134
  label: "Redo",
3135
3135
  group: "history",
3136
- icon: Sr,
3136
+ icon: xr,
3137
3137
  tooltip: "Redo (Ctrl+Y)",
3138
3138
  isActive: !1,
3139
3139
  disabled: !e.can().chain().focus().redo().run(),
@@ -3145,7 +3145,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3145
3145
  id: "core-bold",
3146
3146
  label: "Bold",
3147
3147
  group: "text",
3148
- icon: Kt,
3148
+ icon: Vt,
3149
3149
  tooltip: "Bold",
3150
3150
  isActive: e.isActive("bold"),
3151
3151
  disabled: !1,
@@ -3157,7 +3157,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3157
3157
  id: "core-italic",
3158
3158
  label: "Italic",
3159
3159
  group: "text",
3160
- icon: Jt,
3160
+ icon: Kt,
3161
3161
  tooltip: "Italic",
3162
3162
  isActive: e.isActive("italic"),
3163
3163
  disabled: !1,
@@ -3169,7 +3169,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3169
3169
  id: "core-underline",
3170
3170
  label: "Underline",
3171
3171
  group: "text",
3172
- icon: Xt,
3172
+ icon: Jt,
3173
3173
  tooltip: "Underline",
3174
3174
  isActive: e.isActive("underline"),
3175
3175
  disabled: !1,
@@ -3181,7 +3181,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3181
3181
  id: "core-strike",
3182
3182
  label: "Strike",
3183
3183
  group: "text",
3184
- icon: Qt,
3184
+ icon: Xt,
3185
3185
  tooltip: "Strike",
3186
3186
  isActive: e.isActive("strike"),
3187
3187
  disabled: !1,
@@ -3193,7 +3193,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3193
3193
  id: "core-code",
3194
3194
  label: "Code",
3195
3195
  group: "text",
3196
- icon: Yt,
3196
+ icon: Qt,
3197
3197
  tooltip: "Code",
3198
3198
  isActive: e.isActive("code"),
3199
3199
  disabled: !1,
@@ -3205,7 +3205,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3205
3205
  id: "core-superscript",
3206
3206
  label: "Superscript",
3207
3207
  group: "text",
3208
- icon: Zt,
3208
+ icon: Yt,
3209
3209
  tooltip: "Superscript (Ctrl+.)",
3210
3210
  isActive: e.isActive("superscript"),
3211
3211
  disabled: !1,
@@ -3217,7 +3217,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3217
3217
  id: "core-subscript",
3218
3218
  label: "Subscript",
3219
3219
  group: "text",
3220
- icon: en,
3220
+ icon: Zt,
3221
3221
  tooltip: "Subscript (Ctrl+,)",
3222
3222
  isActive: e.isActive("subscript"),
3223
3223
  disabled: !1,
@@ -3229,7 +3229,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3229
3229
  id: "core-paragraph",
3230
3230
  label: "Paragraph",
3231
3231
  group: "structure",
3232
- icon: Tr,
3232
+ icon: Sr,
3233
3233
  tooltip: "Paragraph",
3234
3234
  isActive: e.isActive("paragraph"),
3235
3235
  disabled: !1,
@@ -3241,7 +3241,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3241
3241
  id: "core-heading1",
3242
3242
  label: "H1",
3243
3243
  group: "structure",
3244
- icon: Ir,
3244
+ icon: Tr,
3245
3245
  tooltip: "Heading 1",
3246
3246
  isActive: e.isActive("heading", { level: 1 }),
3247
3247
  disabled: !1,
@@ -3253,7 +3253,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3253
3253
  id: "core-heading2",
3254
3254
  label: "H2",
3255
3255
  group: "structure",
3256
- icon: Er,
3256
+ icon: Ir,
3257
3257
  tooltip: "Heading 2",
3258
3258
  isActive: e.isActive("heading", { level: 2 }),
3259
3259
  disabled: !1,
@@ -3265,7 +3265,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3265
3265
  id: "core-heading3",
3266
3266
  label: "H3",
3267
3267
  group: "structure",
3268
- icon: Nr,
3268
+ icon: Er,
3269
3269
  tooltip: "Heading 3",
3270
3270
  isActive: e.isActive("heading", { level: 3 }),
3271
3271
  disabled: !1,
@@ -3277,7 +3277,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3277
3277
  id: "core-align-left",
3278
3278
  label: o ? "左对齐" : "Align Left",
3279
3279
  group: "format",
3280
- icon: kr,
3280
+ icon: Nr,
3281
3281
  tooltip: o ? "左对齐" : "Align Left",
3282
3282
  isActive: e.isActive({ textAlign: "left" }),
3283
3283
  disabled: !1,
@@ -3301,7 +3301,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3301
3301
  id: "core-align-right",
3302
3302
  label: o ? "右对齐" : "Align Right",
3303
3303
  group: "format",
3304
- icon: Ar,
3304
+ icon: kr,
3305
3305
  tooltip: o ? "右对齐" : "Align Right",
3306
3306
  isActive: e.isActive({ textAlign: "right" }),
3307
3307
  disabled: !1,
@@ -3313,7 +3313,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3313
3313
  id: "core-align-justify",
3314
3314
  label: o ? "两端对齐" : "Justify",
3315
3315
  group: "format",
3316
- icon: Lr,
3316
+ icon: Ar,
3317
3317
  tooltip: o ? "两端对齐" : "Justify",
3318
3318
  isActive: e.isActive({ textAlign: "justify" }),
3319
3319
  disabled: !1,
@@ -3325,7 +3325,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3325
3325
  id: "core-bullet-list",
3326
3326
  label: "Bullet List",
3327
3327
  group: "structure",
3328
- icon: Pr,
3328
+ icon: Lr,
3329
3329
  tooltip: "Bullet List",
3330
3330
  isActive: e.isActive("bulletList"),
3331
3331
  disabled: !1,
@@ -3337,7 +3337,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3337
3337
  id: "core-ordered-list",
3338
3338
  label: "Ordered List",
3339
3339
  group: "structure",
3340
- icon: Dr,
3340
+ icon: Pr,
3341
3341
  tooltip: "Ordered List",
3342
3342
  isActive: e.isActive("orderedList"),
3343
3343
  disabled: !1,
@@ -3349,7 +3349,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3349
3349
  id: "core-blockquote",
3350
3350
  label: "Blockquote",
3351
3351
  group: "structure",
3352
- icon: Mr,
3352
+ icon: Dr,
3353
3353
  tooltip: "Blockquote",
3354
3354
  isActive: e.isActive("blockquote"),
3355
3355
  disabled: !1,
@@ -3361,7 +3361,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3361
3361
  id: "core-code-block",
3362
3362
  label: "Code Block",
3363
3363
  group: "structure",
3364
- icon: Rr,
3364
+ icon: Mr,
3365
3365
  tooltip: "Code Block",
3366
3366
  isActive: e.isActive("codeBlock"),
3367
3367
  disabled: !1,
@@ -3373,7 +3373,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3373
3373
  id: "core-table",
3374
3374
  label: "Insert Table",
3375
3375
  group: "structure",
3376
- icon: $r,
3376
+ icon: Rr,
3377
3377
  tooltip: "Insert Table",
3378
3378
  isActive: !1,
3379
3379
  disabled: !1,
@@ -3385,7 +3385,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3385
3385
  id: "core-horizontal-rule",
3386
3386
  label: "Horizontal Rule",
3387
3387
  group: "structure",
3388
- icon: Or,
3388
+ icon: $r,
3389
3389
  tooltip: "Horizontal Rule",
3390
3390
  isActive: !1,
3391
3391
  disabled: !1,
@@ -3397,7 +3397,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3397
3397
  id: "core-task-list",
3398
3398
  label: "Task List",
3399
3399
  group: "structure",
3400
- icon: Fr,
3400
+ icon: Or,
3401
3401
  tooltip: "Task List",
3402
3402
  isActive: e.isActive("taskList"),
3403
3403
  disabled: !1,
@@ -3406,14 +3406,14 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3406
3406
  }
3407
3407
  }
3408
3408
  ], m = {
3409
- GitGraph: jr,
3410
- Sigma: Ur,
3411
- FunctionSquare: Hr,
3412
- Workflow: Br,
3413
- Box: zr,
3414
- FileText: nn,
3409
+ GitGraph: Ur,
3410
+ Sigma: Hr,
3411
+ FunctionSquare: Br,
3412
+ Workflow: zr,
3413
+ Box: Fr,
3414
+ FileText: tn,
3415
3415
  Link2: ht,
3416
- Image: tn
3416
+ Image: en
3417
3417
  }, g = W.getToolbarItems().map((y) => {
3418
3418
  const T = W.getCommandMeta(y.command), E = y.tooltip || (T == null ? void 0 : T.description) || y.label, M = y.shortcut || (T == null ? void 0 : T.shortcut), R = M ? `${E} (${M})` : E;
3419
3419
  return {
@@ -3432,14 +3432,14 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3432
3432
  id: "core-export",
3433
3433
  label: o ? "导出" : "Export",
3434
3434
  group: "patent",
3435
- icon: Wr,
3435
+ icon: jr,
3436
3436
  tooltip: o ? "导出文档" : "Export Document",
3437
3437
  isActive: !1,
3438
3438
  disabled: !1,
3439
3439
  run: () => void Ht(e, i)
3440
3440
  }, h = [
3441
3441
  { label: o ? "导出 Word (.docx)" : "Export Word (.docx)", onClick: () => void Ht(e, i) },
3442
- { label: o ? "导出 PDF (打印)" : "Export PDF (Print)", onClick: () => void ms() }
3442
+ { label: o ? "导出 PDF (打印)" : "Export PDF (Print)", onClick: () => void us() }
3443
3443
  ], b = [...u, ...g, p], x = b.map((y) => y.group).filter((y, T, E) => E.indexOf(y) === T && !t.includes(y)), C = [...t, ...x].map((y) => ({
3444
3444
  group: y,
3445
3445
  items: b.filter((T) => T.group === y)
@@ -3448,7 +3448,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3448
3448
  const E = new Set(T);
3449
3449
  return E.has(y) ? E.delete(y) : E.add(y), E;
3450
3450
  });
3451
- }, k = [
3451
+ }, _ = [
3452
3452
  { label: o ? "插入表格 3×3" : "Insert Table 3×3", onClick: () => e.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run() },
3453
3453
  { label: o ? "上方插入行" : "Add Row Before", onClick: () => e.chain().focus().addRowBefore().run() },
3454
3454
  { label: o ? "下方插入行" : "Add Row After", onClick: () => e.chain().focus().addRowAfter().run() },
@@ -3464,7 +3464,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3464
3464
  { label: c.insertImageFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "image" }) },
3465
3465
  { label: c.insertMermaidFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
3466
3466
  { label: c.insertDrawioFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "drawio" }) }
3467
- ], P = (y) => y.id === "core-table" ? /* @__PURE__ */ f(ct, { btn: y, items: k }, y.id) : y.id === "core-export" ? /* @__PURE__ */ f(ct, { btn: y, items: h }, y.id) : y.id === "patent-figure-insert" ? /* @__PURE__ */ f(ct, { btn: y, items: L }, y.id) : /* @__PURE__ */ f(
3467
+ ], P = (y) => y.id === "core-table" ? /* @__PURE__ */ f(ct, { btn: y, items: _ }, y.id) : y.id === "core-export" ? /* @__PURE__ */ f(ct, { btn: y, items: h }, y.id) : y.id === "patent-figure-insert" ? /* @__PURE__ */ f(ct, { btn: y, items: L }, y.id) : /* @__PURE__ */ f(
3468
3468
  "button",
3469
3469
  {
3470
3470
  onClick: y.run,
@@ -3515,8 +3515,8 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3515
3515
  ] }, y.group);
3516
3516
  })
3517
3517
  ] }) });
3518
- }, ps = ({ editor: e }) => {
3519
- const [t, n] = z(0), [r, a] = z(""), [s, i] = z(""), l = _((S) => S.editorLanguage), c = U(l);
3518
+ }, gs = ({ editor: e }) => {
3519
+ const [t, n] = z(0), [r, a] = z(""), [s, i] = z(""), l = k((S) => S.editorLanguage), c = U(l);
3520
3520
  if (B(() => {
3521
3521
  if (!e) return;
3522
3522
  const S = () => n((H) => H + 1);
@@ -3546,8 +3546,8 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3546
3546
  if (!v) return;
3547
3547
  const H = x.has(S) ? h.filter(($) => $ !== S) : [...h, S].sort(($, O) => $ - O);
3548
3548
  d.execCommand("patent.setClaimDependency", { dependsOn: H });
3549
- }, w = d.findAncestorNode("figure"), k = !!w, L = w && typeof w.node.attrs.id == "string" ? w.node.attrs.id.trim() : "", P = w && typeof w.node.attrs.contentType == "string" ? w.node.attrs.contentType : "image", [y, T] = z(""), E = X(null), M = X(null), R = (w == null ? void 0 : w.pos) ?? null;
3550
- R !== M.current && (M.current = R, k && L !== y && T(L));
3549
+ }, w = d.findAncestorNode("figure"), _ = !!w, L = w && typeof w.node.attrs.id == "string" ? w.node.attrs.id.trim() : "", P = w && typeof w.node.attrs.contentType == "string" ? w.node.attrs.contentType : "image", [y, T] = z(""), E = X(null), M = X(null), R = (w == null ? void 0 : w.pos) ?? null;
3550
+ R !== M.current && (M.current = R, _ && L !== y && T(L));
3551
3551
  const Y = (S) => {
3552
3552
  w && d.execCommand("patent.updateFigure", {
3553
3553
  position: w.pos,
@@ -3616,12 +3616,12 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3616
3616
  },
3617
3617
  className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
3618
3618
  title: c.insertFigureReference,
3619
- children: /* @__PURE__ */ f(tn, { size: 16 })
3619
+ children: /* @__PURE__ */ f(en, { size: 16 })
3620
3620
  }
3621
3621
  )
3622
3622
  ] }),
3623
3623
  /* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
3624
- k && /* @__PURE__ */ A(we, { children: [
3624
+ _ && /* @__PURE__ */ A(we, { children: [
3625
3625
  /* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: c.currentFigure }),
3626
3626
  /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.figureId }),
3627
3627
  /* @__PURE__ */ f(
@@ -3685,7 +3685,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3685
3685
  S.id
3686
3686
  ))
3687
3687
  ] })
3688
- ] }) : k ? null : /* @__PURE__ */ f("span", { className: "text-xs text-gray-400", children: c.placeCursorToEditDependencies }),
3688
+ ] }) : _ ? null : /* @__PURE__ */ f("span", { className: "text-xs text-gray-400", children: c.placeCursorToEditDependencies }),
3689
3689
  /* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
3690
3690
  /* @__PURE__ */ f(
3691
3691
  "button",
@@ -3697,21 +3697,21 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3697
3697
  },
3698
3698
  className: "p-2 hover:bg-red-50 text-red-600 rounded",
3699
3699
  title: c.deleteSelection,
3700
- children: /* @__PURE__ */ f(qr, { size: 16 })
3700
+ children: /* @__PURE__ */ f(Wr, { size: 16 })
3701
3701
  }
3702
3702
  )
3703
3703
  ] }) });
3704
- }, hs = (e) => {
3704
+ }, ps = (e) => {
3705
3705
  if (!Array.isArray(e))
3706
3706
  return [];
3707
3707
  const t = e.map((n) => Number(n)).filter((n) => Number.isFinite(n) && n > 0);
3708
3708
  return Array.from(new Set(t)).sort((n, r) => n - r);
3709
- }, ys = (e) => {
3709
+ }, hs = (e) => {
3710
3710
  if (!Array.isArray(e))
3711
3711
  return [];
3712
3712
  const t = e.map((n) => typeof n == "string" ? n.trim() : "").filter(Boolean);
3713
3713
  return Array.from(new Set(t));
3714
- }, bs = (e) => {
3714
+ }, ys = (e) => {
3715
3715
  const t = e.attrs.lang === "en" ? "en" : "zh", n = e.attrs.targetType === "figure" ? "figure" : "claim", r = typeof e.attrs.displayText == "string" ? e.attrs.displayText.trim() : "";
3716
3716
  if (r)
3717
3717
  return r;
@@ -3721,9 +3721,9 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3721
3721
  }
3722
3722
  const a = Number(e.attrs.resolvedNumber);
3723
3723
  return Number.isFinite(a) ? t === "en" ? `Claim ${a}` : `权利要求${a}` : t === "en" ? "Claim ?" : "权利要求?";
3724
- }, yn = (e) => {
3724
+ }, hn = (e) => {
3725
3725
  if (e.type.name === "reference")
3726
- return bs(e);
3726
+ return ys(e);
3727
3727
  if (e.type.name === "hardBreak")
3728
3728
  return `
3729
3729
  `;
@@ -3731,9 +3731,9 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3731
3731
  return e.text || "";
3732
3732
  let t = "";
3733
3733
  return e.forEach((n) => {
3734
- t += yn(n);
3734
+ t += hn(n);
3735
3735
  }), t;
3736
- }, vs = (e) => {
3736
+ }, bs = (e) => {
3737
3737
  const t = [];
3738
3738
  e.state.doc.descendants((r, a) => {
3739
3739
  if (r.type.name !== "claim")
@@ -3742,9 +3742,9 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3742
3742
  return !Number.isFinite(i) || i <= 0 || t.push({
3743
3743
  claimId: s,
3744
3744
  number: i,
3745
- dependsOn: hs(r.attrs.dependsOn),
3746
- dependsOnClaimIds: ys(r.attrs.dependsOnClaimIds),
3747
- body: yn(r).trim(),
3745
+ dependsOn: ps(r.attrs.dependsOn),
3746
+ dependsOnClaimIds: hs(r.attrs.dependsOnClaimIds),
3747
+ body: hn(r).trim(),
3748
3748
  pos: a
3749
3749
  }), !0;
3750
3750
  });
@@ -3756,7 +3756,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3756
3756
  dependsOnClaimIds: Array.from(new Set(s))
3757
3757
  };
3758
3758
  });
3759
- }, Cs = (e, t = "zh") => {
3759
+ }, vs = (e, t = "zh") => {
3760
3760
  const n = [], r = new Map(e.map((o) => [o.claimId, o.number]));
3761
3761
  e.forEach((o) => {
3762
3762
  o.dependsOnClaimIds.forEach((u) => {
@@ -3808,7 +3808,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3808
3808
  });
3809
3809
  }
3810
3810
  }), n;
3811
- }, ws = (e) => {
3811
+ }, Cs = (e) => {
3812
3812
  const t = new Map(e.map((o) => [o.claimId, o.dependsOnClaimIds])), n = /* @__PURE__ */ new Map();
3813
3813
  e.forEach((o) => {
3814
3814
  o.dependsOnClaimIds.forEach((u) => {
@@ -3830,18 +3830,14 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3830
3830
  }), (n.get(o) || []).map((p) => i.get(p)).filter((p) => !!p).sort((p, h) => p.number - h.number).map((p) => p.claimId).forEach((p) => d(p, u + 1));
3831
3831
  };
3832
3832
  return s.forEach((o) => d(o, 0)), l;
3833
- }, xs = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), Ss = (e) => `<claims>${e.sort((n, r) => n.number - r.number).map((n) => `<claim id="${n.number}"><claim-text>${xs(n.body)}</claim-text></claim>`).join("")}</claims>`, Ts = (e) => ["Claims", "", ...e.sort((n, r) => n.number - r.number).map((n) => `${n.number}. ${n.body}`)].join(`
3834
- `), Ut = (e, t, n) => {
3835
- const r = new Blob([t], { type: n }), a = URL.createObjectURL(r), s = document.createElement("a");
3836
- s.href = a, s.download = e, s.click(), URL.revokeObjectURL(a);
3837
- }, Is = ({ editor: e }) => {
3838
- const [t, n] = z(!1), r = _((o) => o.editorLanguage), a = U(r), s = Pn({
3833
+ }, ws = ({ editor: e }) => {
3834
+ const [t, n] = z(!1), r = k((o) => o.editorLanguage), a = U(r), s = Ln({
3839
3835
  editor: e,
3840
- selector: (o) => vs(o.editor)
3836
+ selector: (o) => bs(o.editor)
3841
3837
  }), i = Te(
3842
- () => Cs(s, r),
3838
+ () => vs(s, r),
3843
3839
  [s, r]
3844
- ), l = Te(() => ws(s), [s]), c = Te(
3840
+ ), l = Te(() => Cs(s), [s]), c = Te(
3845
3841
  () => new Map(s.map((o) => [o.claimId, o.pos])),
3846
3842
  [s]
3847
3843
  ), d = (o) => {
@@ -3853,27 +3849,6 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3853
3849
  /* @__PURE__ */ f("span", { className: "font-medium text-gray-700", children: a.claimWorkspacePanel }),
3854
3850
  /* @__PURE__ */ f("span", { className: "text-gray-400", children: a.totalCount(s.length) }),
3855
3851
  /* @__PURE__ */ f("span", { className: i.length === 0 ? "text-emerald-600" : "text-amber-600", children: a.graphIssuesCount(i.length) }),
3856
- /* @__PURE__ */ A("div", { className: "relative group", children: [
3857
- /* @__PURE__ */ f("button", { className: "px-2 py-1 rounded border border-gray-200 hover:bg-gray-50 text-gray-700", children: "更多 ▾" }),
3858
- /* @__PURE__ */ A("div", { className: "absolute left-0 top-full mt-1 hidden group-hover:flex flex-col bg-white border border-gray-200 rounded shadow-md z-10 min-w-max", children: [
3859
- /* @__PURE__ */ f(
3860
- "button",
3861
- {
3862
- onClick: () => Ut("claims-cnipa.xml", Ss(s), "application/xml;charset=utf-8"),
3863
- className: "px-3 py-2 text-left text-xs hover:bg-gray-50 text-gray-700",
3864
- children: a.exportCnipaXml
3865
- }
3866
- ),
3867
- /* @__PURE__ */ f(
3868
- "button",
3869
- {
3870
- onClick: () => Ut("claims-word-mapping.txt", Ts(s), "text/plain;charset=utf-8"),
3871
- className: "px-3 py-2 text-left text-xs hover:bg-gray-50 text-gray-700",
3872
- children: a.exportWordMapping
3873
- }
3874
- )
3875
- ] })
3876
- ] }),
3877
3852
  l.length > 0 && /* @__PURE__ */ f(
3878
3853
  "button",
3879
3854
  {
@@ -3906,7 +3881,7 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3906
3881
  )) })
3907
3882
  ] })
3908
3883
  ] });
3909
- }, bn = {
3884
+ }, yn = {
3910
3885
  // Invention & Utility Model
3911
3886
  technical_field: [],
3912
3887
  background_art: ["technical_field"],
@@ -3924,10 +3899,10 @@ const fs = ["history", "text", "structure", "format", "technical", "patent"], ot
3924
3899
  design_views: ["design_description"],
3925
3900
  design_brief: ["design_description", "design_views"]
3926
3901
  };
3927
- function oo(e, t) {
3928
- return (bn[e] || []).filter((r) => !t.has(r));
3902
+ function ro(e, t) {
3903
+ return (yn[e] || []).filter((r) => !t.has(r));
3929
3904
  }
3930
- function Es(e) {
3905
+ function xs(e) {
3931
3906
  const t = [];
3932
3907
  return e.state.doc.descendants((n, r) => n.type.name === "patent_title" ? (t.push({
3933
3908
  sectionType: "patent_title",
@@ -3939,7 +3914,7 @@ function Es(e) {
3939
3914
  content: n.textContent || ""
3940
3915
  }), !1) : !0), t;
3941
3916
  }
3942
- function vn(e) {
3917
+ function bn(e) {
3943
3918
  const { from: t } = e.state.selection, n = e.state.doc.resolve(t);
3944
3919
  for (let r = n.depth; r >= 0; r--) {
3945
3920
  const a = n.node(r);
@@ -3958,10 +3933,10 @@ function vn(e) {
3958
3933
  }
3959
3934
  return null;
3960
3935
  }
3961
- function Ns(e, t) {
3962
- const n = bn[t];
3936
+ function Ss(e, t) {
3937
+ const n = yn[t];
3963
3938
  if (!n || n.length === 0) return [];
3964
- const r = Es(e), a = new Map(r.map((s) => [s.sectionType, s]));
3939
+ const r = xs(e), a = new Map(r.map((s) => [s.sectionType, s]));
3965
3940
  return n.map((s) => {
3966
3941
  const i = a.get(s);
3967
3942
  return !i || i.content.trim().length === 0 ? null : {
@@ -3970,14 +3945,14 @@ function Ns(e, t) {
3970
3945
  };
3971
3946
  }).filter((s) => s !== null && s.content.length > 0);
3972
3947
  }
3973
- function co(e, t = {}) {
3974
- const n = _.getState().editorLanguage, { from: r, to: a } = e.state.selection, s = r !== a ? e.state.doc.textBetween(r, a, " ", "\0") : void 0;
3948
+ function ao(e, t = {}) {
3949
+ const n = k.getState().editorLanguage, { from: r, to: a } = e.state.selection, s = r !== a ? e.state.doc.textBetween(r, a, " ", "\0") : void 0;
3975
3950
  let i = t.sectionType, l = t.targetSectionPos;
3976
3951
  if (!i) {
3977
- const u = vn(e);
3952
+ const u = bn(e);
3978
3953
  u && (i = u.sectionType, l = u.pos);
3979
3954
  }
3980
- const c = t.scope || (i ? "section" : s ? "selection" : "document"), d = i ? Ns(e, i) : void 0;
3955
+ const c = t.scope || (i ? "section" : s ? "selection" : "document"), d = i ? Ss(e, i) : void 0;
3981
3956
  let o;
3982
3957
  if (c === "selection" && r !== a) {
3983
3958
  const m = Math.max(0, r - 200), g = Math.min(e.state.doc.content.size, a + 200), p = e.state.doc.textBetween(m, r, " ", "\0"), h = e.state.doc.textBetween(a, g, " ", "\0");
@@ -3994,14 +3969,14 @@ function co(e, t = {}) {
3994
3969
  language: n
3995
3970
  };
3996
3971
  }
3997
- const ks = ({ editor: e, onSelectionOptimize: t }) => {
3998
- const { addChatReference: n, openChatPanel: r, editorLanguage: a } = _(), s = a === "zh", i = (d) => re(
3972
+ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
3973
+ const { addChatReference: n, openChatPanel: r, editorLanguage: a } = k(), s = a === "zh", i = (d) => re(
3999
3974
  "p-1.5 rounded transition-colors",
4000
3975
  d ? "bg-blue-100 text-blue-600" : "text-gray-600 hover:bg-gray-100"
4001
3976
  ), l = () => {
4002
3977
  const { from: d, to: o } = e.state.selection;
4003
3978
  if (d === o) return;
4004
- const u = e.state.doc.textBetween(d, o, " "), m = vn(e);
3979
+ const u = e.state.doc.textBetween(d, o, " "), m = bn(e);
4005
3980
  if (t) {
4006
3981
  t({ text: u, from: d, to: o, sectionType: m == null ? void 0 : m.sectionType });
4007
3982
  return;
@@ -4012,7 +3987,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4012
3987
  o !== null && (o === "" ? e.chain().focus().extendMarkRange("link").unsetLink().run() : e.chain().focus().extendMarkRange("link").setLink({ href: o }).run());
4013
3988
  };
4014
3989
  return /* @__PURE__ */ f(
4015
- ra,
3990
+ na,
4016
3991
  {
4017
3992
  editor: e,
4018
3993
  shouldShow: ({ editor: d, state: o }) => {
@@ -4026,7 +4001,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4026
4001
  onClick: () => e.chain().focus().toggleBold().run(),
4027
4002
  className: i(e.isActive("bold")),
4028
4003
  title: "Bold",
4029
- children: /* @__PURE__ */ f(Kt, { size: 15 })
4004
+ children: /* @__PURE__ */ f(Vt, { size: 15 })
4030
4005
  }
4031
4006
  ),
4032
4007
  /* @__PURE__ */ f(
@@ -4035,7 +4010,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4035
4010
  onClick: () => e.chain().focus().toggleItalic().run(),
4036
4011
  className: i(e.isActive("italic")),
4037
4012
  title: "Italic",
4038
- children: /* @__PURE__ */ f(Jt, { size: 15 })
4013
+ children: /* @__PURE__ */ f(Kt, { size: 15 })
4039
4014
  }
4040
4015
  ),
4041
4016
  /* @__PURE__ */ f(
@@ -4044,7 +4019,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4044
4019
  onClick: () => e.chain().focus().toggleUnderline().run(),
4045
4020
  className: i(e.isActive("underline")),
4046
4021
  title: "Underline",
4047
- children: /* @__PURE__ */ f(Xt, { size: 15 })
4022
+ children: /* @__PURE__ */ f(Jt, { size: 15 })
4048
4023
  }
4049
4024
  ),
4050
4025
  /* @__PURE__ */ f(
@@ -4053,7 +4028,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4053
4028
  onClick: () => e.chain().focus().toggleStrike().run(),
4054
4029
  className: i(e.isActive("strike")),
4055
4030
  title: "Strikethrough",
4056
- children: /* @__PURE__ */ f(Qt, { size: 15 })
4031
+ children: /* @__PURE__ */ f(Xt, { size: 15 })
4057
4032
  }
4058
4033
  ),
4059
4034
  /* @__PURE__ */ f(
@@ -4062,7 +4037,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4062
4037
  onClick: () => e.chain().focus().toggleCode().run(),
4063
4038
  className: i(e.isActive("code")),
4064
4039
  title: "Code",
4065
- children: /* @__PURE__ */ f(Yt, { size: 15 })
4040
+ children: /* @__PURE__ */ f(Qt, { size: 15 })
4066
4041
  }
4067
4042
  ),
4068
4043
  /* @__PURE__ */ f(
@@ -4071,7 +4046,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4071
4046
  onClick: () => e.chain().focus().toggleSuperscript().run(),
4072
4047
  className: i(e.isActive("superscript")),
4073
4048
  title: "Superscript",
4074
- children: /* @__PURE__ */ f(Zt, { size: 15 })
4049
+ children: /* @__PURE__ */ f(Yt, { size: 15 })
4075
4050
  }
4076
4051
  ),
4077
4052
  /* @__PURE__ */ f(
@@ -4080,7 +4055,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4080
4055
  onClick: () => e.chain().focus().toggleSubscript().run(),
4081
4056
  className: i(e.isActive("subscript")),
4082
4057
  title: "Subscript",
4083
- children: /* @__PURE__ */ f(en, { size: 15 })
4058
+ children: /* @__PURE__ */ f(Zt, { size: 15 })
4084
4059
  }
4085
4060
  ),
4086
4061
  /* @__PURE__ */ f("div", { className: "bubble-menu-divider" }),
@@ -4109,20 +4084,20 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4109
4084
  onClick: l,
4110
4085
  className: "p-1.5 rounded transition-colors text-purple-500 hover:bg-purple-50",
4111
4086
  title: s ? "AI 优化" : "AI Optimize",
4112
- children: /* @__PURE__ */ f(Vr, { size: 15 })
4087
+ children: /* @__PURE__ */ f(qr, { size: 15 })
4113
4088
  }
4114
4089
  )
4115
4090
  ] })
4116
4091
  }
4117
4092
  );
4118
- }, _s = ({ editor: e }) => {
4093
+ }, Is = ({ editor: e }) => {
4119
4094
  var v;
4120
4095
  const [t, n] = z(!1), [r, a] = z(!1), [s, i] = z(""), [l, c] = z(""), [d, o] = z(!1), u = X(null), m = e.extensionStorage.searchReplace, g = ((v = m == null ? void 0 : m.results) == null ? void 0 : v.length) ?? 0, p = (m == null ? void 0 : m.currentIndex) ?? -1;
4121
4096
  B(() => {
4122
4097
  const C = (w) => {
4123
4098
  n(!0);
4124
- const k = w.detail;
4125
- k != null && k.replace && a(!0), requestAnimationFrame(() => {
4099
+ const _ = w.detail;
4100
+ _ != null && _.replace && a(!0), requestAnimationFrame(() => {
4126
4101
  var L;
4127
4102
  return (L = u.current) == null ? void 0 : L.focus();
4128
4103
  });
@@ -4172,11 +4147,11 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4172
4147
  onClick: x,
4173
4148
  className: re("find-replace-btn", d && "find-replace-btn--active"),
4174
4149
  title: "Case Sensitive",
4175
- children: /* @__PURE__ */ f(Kr, { size: 15 })
4150
+ children: /* @__PURE__ */ f(Vr, { size: 15 })
4176
4151
  }
4177
4152
  ),
4178
- /* @__PURE__ */ f("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ f(Jr, { size: 15 }) }),
4179
- /* @__PURE__ */ f("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ f(rn, { size: 15 }) }),
4153
+ /* @__PURE__ */ f("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ f(Kr, { size: 15 }) }),
4154
+ /* @__PURE__ */ f("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ f(nn, { size: 15 }) }),
4180
4155
  /* @__PURE__ */ f(
4181
4156
  "button",
4182
4157
  {
@@ -4186,7 +4161,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4186
4161
  children: /* @__PURE__ */ f(Et, { size: 15 })
4187
4162
  }
4188
4163
  ),
4189
- /* @__PURE__ */ f("button", { onClick: b, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ f(Xr, { size: 15 }) })
4164
+ /* @__PURE__ */ f("button", { onClick: b, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ f(Jr, { size: 15 }) })
4190
4165
  ] }),
4191
4166
  r && /* @__PURE__ */ A("div", { className: "find-replace-row", children: [
4192
4167
  /* @__PURE__ */ f(
@@ -4205,11 +4180,11 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4205
4180
  }
4206
4181
  ),
4207
4182
  /* @__PURE__ */ f("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ f(Et, { size: 15 }) }),
4208
- /* @__PURE__ */ f("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ f(Qr, { size: 15 }) })
4183
+ /* @__PURE__ */ f("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ f(Xr, { size: 15 }) })
4209
4184
  ] })
4210
4185
  ] }) : null;
4211
- }, As = ({ editor: e }) => {
4212
- const { editorLanguage: t } = _(), n = t === "zh", r = Te(() => {
4186
+ }, Es = ({ editor: e }) => {
4187
+ const { editorLanguage: t } = k(), n = t === "zh", r = Te(() => {
4213
4188
  const a = e.state, i = a.doc.textBetween(0, a.doc.content.size, " ", "\0").replace(/\s/g, "").length, { from: l, to: c } = a.selection;
4214
4189
  let d = 0;
4215
4190
  return l !== c && (d = a.doc.textBetween(l, c, " ", "\0").replace(/\s/g, "").length), { charCount: i, selectionCount: d };
@@ -4226,20 +4201,20 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4226
4201
  r.selectionCount
4227
4202
  ] })
4228
4203
  ] });
4229
- }, Ls = {
4204
+ }, Ns = {
4230
4205
  empty: "○",
4231
4206
  filled: "●"
4232
- }, Ps = {
4207
+ }, _s = {
4233
4208
  empty: "text-gray-400",
4234
4209
  filled: "text-green-500"
4235
- }, Ds = /* @__PURE__ */ new Set([
4210
+ }, ks = /* @__PURE__ */ new Set([
4236
4211
  "technical_field",
4237
4212
  "background_art",
4238
4213
  "summary",
4239
4214
  "drawing_description",
4240
4215
  "detailed_description"
4241
- ]), Ms = ({ editor: e }) => {
4242
- const { editorLanguage: t } = _(), n = U(t), [r, a] = z(!1), [s, i] = z(0);
4216
+ ]), As = ({ editor: e }) => {
4217
+ const { editorLanguage: t } = k(), n = U(t), [r, a] = z(!1), [s, i] = z(0);
4243
4218
  B(() => {
4244
4219
  const c = () => i((d) => d + 1);
4245
4220
  return e.on("update", c), () => {
@@ -4271,7 +4246,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4271
4246
  }), !1;
4272
4247
  }
4273
4248
  if (o.type.name === "patent_section") {
4274
- const m = o.attrs.sectionType, g = Ds.has(m), p = `sectionTitle_${m}`, h = typeof n[p] == "string" ? n[p] : m, b = o.textContent || "", x = b.trim().length > 0;
4249
+ const m = o.attrs.sectionType, g = ks.has(m), p = `sectionTitle_${m}`, h = typeof n[p] == "string" ? n[p] : m, b = o.textContent || "", x = b.trim().length > 0;
4275
4250
  return c.push({
4276
4251
  type: "section",
4277
4252
  pos: u,
@@ -4300,11 +4275,11 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4300
4275
  onClick: () => a(!1),
4301
4276
  className: "outline-panel-toggle",
4302
4277
  title: t === "zh" ? "展开大纲" : "Expand Outline",
4303
- children: /* @__PURE__ */ f(Yr, { size: 16 })
4278
+ children: /* @__PURE__ */ f(Qr, { size: 16 })
4304
4279
  }
4305
4280
  ) }) : /* @__PURE__ */ A("div", { className: "outline-panel", children: [
4306
4281
  /* @__PURE__ */ A("div", { className: "outline-panel-header", children: [
4307
- /* @__PURE__ */ f(nn, { size: 14 }),
4282
+ /* @__PURE__ */ f(tn, { size: 14 }),
4308
4283
  /* @__PURE__ */ f("span", { children: t === "zh" ? "文档大纲" : "Outline" }),
4309
4284
  /* @__PURE__ */ f(
4310
4285
  "button",
@@ -4312,7 +4287,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4312
4287
  onClick: () => a(!0),
4313
4288
  className: "outline-panel-toggle ml-auto",
4314
4289
  title: t === "zh" ? "收起大纲" : "Collapse Outline",
4315
- children: /* @__PURE__ */ f(Zr, { size: 14 })
4290
+ children: /* @__PURE__ */ f(Yr, { size: 14 })
4316
4291
  }
4317
4292
  )
4318
4293
  ] }),
@@ -4334,7 +4309,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4334
4309
  }));
4335
4310
  },
4336
4311
  children: [
4337
- c.type === "section" && c.state && /* @__PURE__ */ f("span", { className: re("outline-item-state", Ps[c.state]), children: Ls[c.state] || "○" }),
4312
+ c.type === "section" && c.state && /* @__PURE__ */ f("span", { className: re("outline-item-state", _s[c.state]), children: Ns[c.state] || "○" }),
4338
4313
  /* @__PURE__ */ f("span", { className: "outline-item-title", children: c.title }),
4339
4314
  c.type !== "book-group" && /* @__PURE__ */ f("span", { className: "outline-item-count", children: c.charCount })
4340
4315
  ]
@@ -4343,7 +4318,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4343
4318
  ))
4344
4319
  ] })
4345
4320
  ] });
4346
- }, Rs = ({
4321
+ }, Ls = ({
4347
4322
  editor: e,
4348
4323
  mode: t = "edit",
4349
4324
  className: n
@@ -4357,16 +4332,16 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4357
4332
  t === "readonly" ? "cursor-default" : "cursor-text",
4358
4333
  n
4359
4334
  ),
4360
- children: /* @__PURE__ */ f(Dn, { editor: e, className: "h-full" })
4335
+ children: /* @__PURE__ */ f(Pn, { editor: e, className: "h-full" })
4361
4336
  }
4362
- )), Cn = "patent-editor-draft", $s = 1500, Os = () => {
4337
+ )), vn = "patent-editor-draft", Ps = 1500, Ds = () => {
4363
4338
  try {
4364
- const e = localStorage.getItem(Cn);
4339
+ const e = localStorage.getItem(vn);
4365
4340
  return e ? JSON.parse(e) : null;
4366
4341
  } catch {
4367
4342
  return null;
4368
4343
  }
4369
- }, Fs = ({
4344
+ }, Ms = ({
4370
4345
  initialContent: e,
4371
4346
  onChange: t,
4372
4347
  className: n,
@@ -4374,7 +4349,7 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4374
4349
  onEditorReady: a,
4375
4350
  onSelectionOptimize: s
4376
4351
  }) => {
4377
- const { setEditor: i, setDocument: l, editorLanguage: c, autoSaveStatus: d, ai: o } = _(), { setAutoSaveStatus: u, setLastSavedAt: m } = _(), g = X(null), p = e || (t ? null : Os()) || {
4352
+ const { setEditor: i, setDocument: l, editorLanguage: c, autoSaveStatus: d, ai: o } = k(), { setAutoSaveStatus: u, setLastSavedAt: m } = k(), g = X(null), p = e || (t ? null : Ds()) || {
4378
4353
  type: "doc",
4379
4354
  content: [
4380
4355
  {
@@ -4384,18 +4359,18 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4384
4359
  ]
4385
4360
  }, h = de((w) => {
4386
4361
  try {
4387
- u("saving"), localStorage.setItem(Cn, JSON.stringify(w)), u("saved"), m(/* @__PURE__ */ new Date());
4362
+ u("saving"), localStorage.setItem(vn, JSON.stringify(w)), u("saved"), m(/* @__PURE__ */ new Date());
4388
4363
  } catch {
4389
4364
  u("error");
4390
4365
  }
4391
- }, [u, m]), b = Mn(
4392
- is({
4366
+ }, [u, m]), b = Dn(
4367
+ ss({
4393
4368
  content: p,
4394
4369
  onUpdate: ({ editor: w }) => {
4395
- const k = w.getJSON();
4396
- l(k), W.notifyStateChange(w), t && t(k), t || (g.current && clearTimeout(g.current), g.current = setTimeout(() => {
4397
- h(k);
4398
- }, $s));
4370
+ const _ = w.getJSON();
4371
+ l(_), W.notifyStateChange(w), t && t(_), t || (g.current && clearTimeout(g.current), g.current = setTimeout(() => {
4372
+ h(_);
4373
+ }, Ps));
4399
4374
  },
4400
4375
  onCreate: ({ editor: w }) => {
4401
4376
  i(w), a == null || a(w), W.initializePlugins(w), Ae(w).execCommand("patent.normalizeClaims"), W.notifyStateChange(w);
@@ -4427,27 +4402,27 @@ const ks = ({ editor: e, onSelectionOptimize: t }) => {
4427
4402
  const v = U(c), C = d === "saving" ? v.autoSaveSaving : d === "saved" ? v.autoSaveSaved : d === "error" ? v.autoSaveError : "";
4428
4403
  return /* @__PURE__ */ A("div", { className: `editor-container flex flex-col h-full ${n}`, children: [
4429
4404
  !r && /* @__PURE__ */ A("div", { className: "flex items-center", children: [
4430
- /* @__PURE__ */ f(gs, { editor: b }),
4405
+ /* @__PURE__ */ f(fs, { editor: b }),
4431
4406
  C && /* @__PURE__ */ f("span", { className: `auto-save-indicator auto-save-indicator--${d} ml-2`, children: C })
4432
4407
  ] }),
4433
- !r && b && /* @__PURE__ */ f(ps, { editor: b }),
4408
+ !r && b && /* @__PURE__ */ f(gs, { editor: b }),
4409
+ !r && b && /* @__PURE__ */ f(ws, { editor: b }),
4410
+ !r && b && /* @__PURE__ */ f(Ts, { editor: b, onSelectionOptimize: s }),
4434
4411
  !r && b && /* @__PURE__ */ f(Is, { editor: b }),
4435
- !r && b && /* @__PURE__ */ f(ks, { editor: b, onSelectionOptimize: s }),
4436
- !r && b && /* @__PURE__ */ f(_s, { editor: b }),
4437
4412
  /* @__PURE__ */ A("div", { className: "flex flex-1 overflow-hidden", children: [
4438
- !r && b && /* @__PURE__ */ f(Ms, { editor: b }),
4413
+ !r && b && /* @__PURE__ */ f(As, { editor: b }),
4439
4414
  /* @__PURE__ */ f("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ f(
4440
- Rs,
4415
+ Ls,
4441
4416
  {
4442
4417
  editor: b,
4443
4418
  mode: r || o.status === "streaming" && o.activeSectionType === "claims" ? "readonly" : "edit"
4444
4419
  }
4445
4420
  ) })
4446
4421
  ] }),
4447
- !r && /* @__PURE__ */ f(As, { editor: b })
4422
+ !r && /* @__PURE__ */ f(Es, { editor: b })
4448
4423
  ] });
4449
4424
  };
4450
- function wn(e) {
4425
+ function Cn(e) {
4451
4426
  const t = e.getReader(), n = new TextDecoder();
4452
4427
  let r = "";
4453
4428
  return new ReadableStream({
@@ -4499,7 +4474,7 @@ function wn(e) {
4499
4474
  }
4500
4475
  });
4501
4476
  }
4502
- function zs(e, t) {
4477
+ function Rs(e, t) {
4503
4478
  let n = null;
4504
4479
  return {
4505
4480
  async request(r) {
@@ -4514,14 +4489,14 @@ function zs(e, t) {
4514
4489
  throw new Error(`AI service error: ${s.status} ${s.statusText}`);
4515
4490
  if (!s.body)
4516
4491
  throw new Error("AI service returned no body");
4517
- return wn(s.body);
4492
+ return Cn(s.body);
4518
4493
  },
4519
4494
  abort() {
4520
4495
  n == null || n.abort(), n = null;
4521
4496
  }
4522
4497
  };
4523
4498
  }
4524
- function Bs(e, t) {
4499
+ function $s(e, t) {
4525
4500
  let n = null;
4526
4501
  const r = e.replace(/\/+$/, "");
4527
4502
  async function a(s, i) {
@@ -4568,28 +4543,28 @@ function Bs(e, t) {
4568
4543
  });
4569
4544
  if (!c.ok) throw new Error(`Chat stream error: ${c.status} ${c.statusText}`);
4570
4545
  if (!c.body) throw new Error("Chat stream returned no body");
4571
- return wn(c.body);
4546
+ return Cn(c.body);
4572
4547
  },
4573
4548
  abort() {
4574
4549
  n == null || n.abort(), n = null;
4575
4550
  }
4576
4551
  };
4577
4552
  }
4578
- const Hs = Wt(
4553
+ const Os = jt(
4579
4554
  ({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, language: s, aiService: i, chatSessionAPI: l, aiBaseUrl: c, aiHeaders: d, onSelectionOptimize: o }, u) => {
4580
- const { setEditorLanguage: m, setAIService: g, setChatSessionAPI: p } = _(), h = X(null), b = de((v) => {
4555
+ const { setEditorLanguage: m, setAIService: g, setChatSessionAPI: p } = k(), h = X(null), b = de((v) => {
4581
4556
  h.current = v;
4582
4557
  }, []), x = Me.useMemo(() => {
4583
4558
  if (e) return e;
4584
- if (t) return fn(t);
4559
+ if (t) return mn(t);
4585
4560
  }, [e, t]);
4586
4561
  return Me.useEffect(() => {
4587
4562
  s && m(s);
4588
4563
  }, [s, m]), Me.useEffect(() => {
4589
- i ? g(i) : c && g(zs(c, d));
4564
+ i ? g(i) : c && g(Rs(c, d));
4590
4565
  }, [i, c, d, g]), Me.useEffect(() => {
4591
- l ? p(l) : c && p(Bs(c, d));
4592
- }, [l, c, d, p]), qt(u, () => ({
4566
+ l ? p(l) : c && p($s(c, d));
4567
+ }, [l, c, d, p]), Wt(u, () => ({
4593
4568
  getContent: () => {
4594
4569
  var v;
4595
4570
  return ((v = h.current) == null ? void 0 : v.getJSON()) ?? null;
@@ -4605,7 +4580,7 @@ const Hs = Wt(
4605
4580
  (v = h.current) == null || v.commands.focus();
4606
4581
  }
4607
4582
  })), /* @__PURE__ */ f(
4608
- Fs,
4583
+ Ms,
4609
4584
  {
4610
4585
  initialContent: x,
4611
4586
  onChange: n,
@@ -4617,13 +4592,13 @@ const Hs = Wt(
4617
4592
  );
4618
4593
  }
4619
4594
  );
4620
- Hs.displayName = "PatentEditor";
4621
- async function lo(e, t, n) {
4595
+ Os.displayName = "PatentEditor";
4596
+ async function so(e, t, n) {
4622
4597
  var a, s, i, l;
4623
4598
  let r = !1;
4624
- (a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && Sn(e, n.targetSectionPos);
4599
+ (a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && xn(e, n.targetSectionPos);
4625
4600
  try {
4626
- let c = xn(e, n);
4601
+ let c = wn(e, n);
4627
4602
  for (; ; ) {
4628
4603
  const { done: d, value: o } = await t.read();
4629
4604
  if (d) break;
@@ -4637,10 +4612,10 @@ async function lo(e, t, n) {
4637
4612
  (l = n.onError) == null || l.call(n, c instanceof Error ? c : new Error(String(c)));
4638
4613
  }
4639
4614
  }
4640
- async function uo(e, t, n, r) {
4615
+ async function io(e, t, n, r) {
4641
4616
  var s, i, l, c, d, o, u, m;
4642
4617
  const a = new AbortController();
4643
- (s = r.onStart) == null || s.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && Sn(e, r.targetSectionPos);
4618
+ (s = r.onStart) == null || s.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && xn(e, r.targetSectionPos);
4644
4619
  try {
4645
4620
  const g = await fetch(t, {
4646
4621
  method: "POST",
@@ -4653,7 +4628,7 @@ async function uo(e, t, n, r) {
4653
4628
  const p = (i = g.body) == null ? void 0 : i.getReader();
4654
4629
  if (!p) throw new Error("No response body");
4655
4630
  const h = new TextDecoder();
4656
- let b = xn(e, r), x = "";
4631
+ let b = wn(e, r), x = "";
4657
4632
  for (; ; ) {
4658
4633
  const { done: v, value: C } = await p.read();
4659
4634
  if (v) break;
@@ -4661,9 +4636,9 @@ async function uo(e, t, n, r) {
4661
4636
  const w = x.split(`
4662
4637
  `);
4663
4638
  x = w.pop() || "";
4664
- for (const k of w) {
4665
- if (!k.startsWith("data: ")) continue;
4666
- const L = k.slice(6).trim();
4639
+ for (const _ of w) {
4640
+ if (!_.startsWith("data: ")) continue;
4641
+ const L = _.slice(6).trim();
4667
4642
  if (L === "[DONE]")
4668
4643
  return r.mode === "section" && typeof r.targetSectionPos == "number" && gt(e, r.targetSectionPos), (l = r.onComplete) == null || l.call(r), { abort: () => a.abort() };
4669
4644
  try {
@@ -4682,7 +4657,7 @@ async function uo(e, t, n, r) {
4682
4657
  }
4683
4658
  return { abort: () => a.abort() };
4684
4659
  }
4685
- function xn(e, t) {
4660
+ function wn(e, t) {
4686
4661
  if (t.mode === "section" && typeof t.targetSectionPos == "number") {
4687
4662
  const n = e.state.doc.nodeAt(t.targetSectionPos);
4688
4663
  if (n && n.type.name === "patent_section")
@@ -4690,7 +4665,7 @@ function xn(e, t) {
4690
4665
  }
4691
4666
  return e.state.selection.from;
4692
4667
  }
4693
- function Sn(e, t) {
4668
+ function xn(e, t) {
4694
4669
  const n = e.state.doc.nodeAt(t);
4695
4670
  if (!n || n.type.name !== "patent_section") return;
4696
4671
  const r = t + 1, a = t + n.nodeSize - 1;
@@ -4719,7 +4694,7 @@ function gt(e, t) {
4719
4694
  r.setMeta("addToHistory", !1), e.view.dispatch(r);
4720
4695
  }
4721
4696
  }
4722
- const jt = {
4697
+ const Ut = {
4723
4698
  technical_field: {
4724
4699
  zh: "本发明涉及航天器自主导航与控制技术领域,具体涉及一种基于多传感器融合的航天器自主避障控制方法、系统、电子设备及计算机可读存储介质。该方法综合利用激光雷达、红外传感器和星敏感器的探测数据,通过实时环境感知与路径规划算法,实现航天器在复杂空间环境中的自主安全避障机动。",
4725
4700
  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."
@@ -4867,19 +4842,19 @@ function pt(e, t = 30) {
4867
4842
  }
4868
4843
  });
4869
4844
  }
4870
- function Us(e) {
4871
- const t = [], n = Ge(e, 3);
4845
+ function Fs(e) {
4846
+ const t = [], n = qe(e, 3);
4872
4847
  for (const r of n)
4873
4848
  t.push({ type: "delta", content: r });
4874
4849
  return t.push({ type: "done", usage: { tokens: e.length * 2 } }), t;
4875
4850
  }
4876
- function Ge(e, t) {
4851
+ function qe(e, t) {
4877
4852
  const n = [];
4878
4853
  for (let r = 0; r < e.length; r += t)
4879
4854
  n.push(e.slice(r, r + t));
4880
4855
  return n;
4881
4856
  }
4882
- function js(e, t, n) {
4857
+ function zs(e, t, n) {
4883
4858
  const r = n === "zh", a = [];
4884
4859
  let s;
4885
4860
  if (e.includes("技术方案") || e.includes("draft") ? s = He["help-draft"][r ? "zh" : "en"] : e.includes("审查") || e.includes("review") || e.includes("Review") ? s = He.review[r ? "zh" : "en"] : e.includes("权利要求") || e.includes("claims") || e.includes("Optimize") ? s = He.claims[r ? "zh" : "en"] : s = He.default[r ? "zh" : "en"], t.length > 0) {
@@ -4888,9 +4863,9 @@ function js(e, t, n) {
4888
4863
  ` : `Analyzing ${t.length} referenced text(s) and generating suggestions...
4889
4864
 
4890
4865
  `;
4891
- for (const l of Ge(i, 4))
4866
+ for (const l of qe(i, 4))
4892
4867
  a.push({ type: "delta", content: l });
4893
- for (const l of Ge(s, 4))
4868
+ for (const l of qe(s, 4))
4894
4869
  a.push({ type: "delta", content: l });
4895
4870
  for (let l = 0; l < t.length; l++) {
4896
4871
  const c = t[l], d = c.text;
@@ -4923,25 +4898,25 @@ function js(e, t, n) {
4923
4898
  });
4924
4899
  }
4925
4900
  } else
4926
- for (const i of Ge(s, 4))
4901
+ for (const i of qe(s, 4))
4927
4902
  a.push({ type: "delta", content: i });
4928
4903
  return a.push({ type: "done", usage: { tokens: s.length * 2 } }), a;
4929
4904
  }
4930
- function mo() {
4905
+ function oo() {
4931
4906
  let e = null;
4932
4907
  return {
4933
4908
  async request(t) {
4934
4909
  var l;
4935
4910
  if (e = new AbortController(), await oe(300), e.signal.aborted)
4936
4911
  throw new DOMException("Aborted", "AbortError");
4937
- const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((l = jt[r]) == null ? void 0 : l[n]) || jt.technical_field[n];
4912
+ const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((l = Ut[r]) == null ? void 0 : l[n]) || Ut.technical_field[n];
4938
4913
  let s = a;
4939
4914
  t.instruction && (s = (n === "zh" ? `[基于指令"${t.instruction}"生成]
4940
4915
 
4941
4916
  ` : `[Generated based on instruction "${t.instruction}"]
4942
4917
 
4943
4918
  `) + a);
4944
- const i = Us(s);
4919
+ const i = Fs(s);
4945
4920
  return pt(i, 25);
4946
4921
  },
4947
4922
  abort() {
@@ -4949,7 +4924,7 @@ function mo() {
4949
4924
  }
4950
4925
  };
4951
4926
  }
4952
- function fo() {
4927
+ function co() {
4953
4928
  const e = /* @__PURE__ */ new Map();
4954
4929
  let t = null, n = null;
4955
4930
  return {
@@ -4992,7 +4967,7 @@ function fo() {
4992
4967
  status: "done",
4993
4968
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4994
4969
  }), s.session.messageCount = s.messages.length, s.session.lastMessage = a.content, s.session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
4995
- const l = js(
4970
+ const l = zs(
4996
4971
  a.content,
4997
4972
  a.references || [],
4998
4973
  a.language
@@ -5024,7 +4999,7 @@ function fo() {
5024
4999
  }
5025
5000
  };
5026
5001
  }
5027
- function Ws(e) {
5002
+ function Bs(e) {
5028
5003
  const t = [], n = e.replace(/\r\n/g, `
5029
5004
  `).trim();
5030
5005
  if (!n) return t;
@@ -5039,12 +5014,12 @@ function Ws(e) {
5039
5014
  if (a.length === 0)
5040
5015
  return t.push({ number: 1, text: n, dependsOn: [] }), t;
5041
5016
  for (let i = 0; i < a.length; i++) {
5042
- const l = a[i].index + a[i].matchLength, c = i + 1 < a.length ? a[i + 1].index : n.length, d = n.slice(l, c).trim(), o = a[i].number, u = qs(d, o);
5017
+ const l = a[i].index + a[i].matchLength, c = i + 1 < a.length ? a[i + 1].index : n.length, d = n.slice(l, c).trim(), o = a[i].number, u = Hs(d, o);
5043
5018
  t.push({ number: o, text: d, dependsOn: u });
5044
5019
  }
5045
5020
  return t;
5046
5021
  }
5047
- function qs(e, t) {
5022
+ function Hs(e, t) {
5048
5023
  const n = [], r = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g;
5049
5024
  let a;
5050
5025
  for (; (a = r.exec(e)) !== null; ) {
@@ -5060,27 +5035,27 @@ function qs(e, t) {
5060
5035
  }
5061
5036
  return [...new Set(n)].sort((i, l) => i - l);
5062
5037
  }
5063
- function Gs() {
5038
+ function Us() {
5064
5039
  return `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
5065
5040
  }
5066
- function go(e) {
5067
- return Ws(e).map((n) => ({
5041
+ function lo(e) {
5042
+ return Bs(e).map((n) => ({
5068
5043
  type: "claim",
5069
5044
  attrs: {
5070
5045
  number: n.number,
5071
- claimId: Gs(),
5046
+ claimId: Us(),
5072
5047
  dependsOn: n.dependsOn,
5073
5048
  dependsOnClaimIds: []
5074
5049
  },
5075
5050
  content: n.text ? [{ type: "text", text: n.text }] : void 0
5076
5051
  }));
5077
5052
  }
5078
- const Vs = -1, Ks = 1, Js = 0, Tn = new _e("docDiff");
5053
+ const js = -1, Ws = 1, Gs = 0, Sn = new ke("docDiff");
5079
5054
  let lt = null;
5080
- function Xs() {
5081
- return lt || (lt = new Vt()), lt;
5055
+ function qs() {
5056
+ return lt || (lt = new qt()), lt;
5082
5057
  }
5083
- function Qs(e, t, n) {
5058
+ function Vs(e, t, n) {
5084
5059
  const r = [];
5085
5060
  return e.nodesBetween(t, n, (a, s) => {
5086
5061
  if (a.isTextblock) {
@@ -5090,15 +5065,15 @@ function Qs(e, t, n) {
5090
5065
  return !0;
5091
5066
  }), r;
5092
5067
  }
5093
- function po(e, t) {
5094
- const n = e.state.doc, r = n.content.size, { text: a, segments: s } = on(e, 0, r), i = Xs(), l = i.diff_main(t, a);
5068
+ function uo(e, t) {
5069
+ const n = e.state.doc, r = n.content.size, { text: a, segments: s } = sn(e, 0, r), i = qs(), l = i.diff_main(t, a);
5095
5070
  i.diff_cleanupSemantic(l);
5096
5071
  const c = [];
5097
5072
  let d = 0;
5098
5073
  for (const [m, g] of l)
5099
- if (m === Js)
5074
+ if (m === Gs)
5100
5075
  d += g.length;
5101
- else if (m === Ks) {
5076
+ else if (m === Ws) {
5102
5077
  let p = 0;
5103
5078
  for (; p < g.length; ) {
5104
5079
  for (; p < g.length && g[p] === "\0"; ) p++;
@@ -5107,13 +5082,13 @@ function po(e, t) {
5107
5082
  for (; p < g.length && g[p] !== "\0"; ) p++;
5108
5083
  const b = Ee(s, d + h), x = Ee(s, d + p);
5109
5084
  if (b >= 0 && x >= 0 && x > b)
5110
- for (const v of Qs(n, b, x))
5085
+ for (const v of Vs(n, b, x))
5111
5086
  c.push(
5112
5087
  le.inline(v.from, v.to, { class: "patch-diff-insert-inline" })
5113
5088
  );
5114
5089
  }
5115
5090
  d += g.length;
5116
- } else if (m === Vs) {
5091
+ } else if (m === js) {
5117
5092
  const p = Ee(s, d);
5118
5093
  if (p >= 0) {
5119
5094
  const h = g.replace(/\0/g, " ");
@@ -5130,7 +5105,7 @@ function po(e, t) {
5130
5105
  }
5131
5106
  }
5132
5107
  const o = Ne.create(n, c), u = new Xe({
5133
- key: Tn,
5108
+ key: Sn,
5134
5109
  props: {
5135
5110
  decorations() {
5136
5111
  return o;
@@ -5139,10 +5114,10 @@ function po(e, t) {
5139
5114
  });
5140
5115
  e.registerPlugin(u);
5141
5116
  }
5142
- function ho(e) {
5143
- e.unregisterPlugin(Tn);
5117
+ function mo(e) {
5118
+ e.unregisterPlugin(Sn);
5144
5119
  }
5145
- function yo(e, t) {
5120
+ function fo(e, t) {
5146
5121
  const n = [], r = t === "zh";
5147
5122
  let a = 0;
5148
5123
  const s = () => `v_${++a}`;
@@ -5208,40 +5183,40 @@ function yo(e, t) {
5208
5183
  }), n;
5209
5184
  }
5210
5185
  export {
5211
- Fs as EditorView,
5212
- sn as PatchDiffPluginKey,
5213
- Hs as PatentEditor,
5214
- so as acceptAllPatches,
5215
- ro as acceptPatch,
5216
- po as applyDocDiffDecorations,
5217
- co as buildAIContext,
5218
- go as buildClaimsJSONContent,
5219
- fn as buildPatentDocument,
5220
- no as clearPatches,
5221
- Bs as createChatSessionAPI,
5186
+ Ms as EditorView,
5187
+ an as PatchDiffPluginKey,
5188
+ Os as PatentEditor,
5189
+ to as acceptAllPatches,
5190
+ Zi as acceptPatch,
5191
+ uo as applyDocDiffDecorations,
5192
+ ao as buildAIContext,
5193
+ lo as buildClaimsJSONContent,
5194
+ mn as buildPatentDocument,
5195
+ Yi as clearPatches,
5196
+ $s as createChatSessionAPI,
5222
5197
  Ae as createCommandExecutor,
5223
- is as createEditorConfig,
5224
- mo as createMockAIService,
5225
- fo as createMockChatSessionAPI,
5226
- zs as createSSEAdapter,
5227
- ms as exportToPdf,
5198
+ ss as createEditorConfig,
5199
+ oo as createMockAIService,
5200
+ co as createMockChatSessionAPI,
5201
+ Rs as createSSEAdapter,
5202
+ us as exportToPdf,
5228
5203
  Ht as exportToWord,
5229
- vs as extractClaimsFromEditor,
5230
- vn as findSectionAtCursor,
5231
- Es as getAllSections,
5232
- oo as getMissingSectionDeps,
5233
- eo as getPatches,
5234
- Zi as onPatchChange,
5204
+ bs as extractClaimsFromEditor,
5205
+ bn as findSectionAtCursor,
5206
+ xs as getAllSections,
5207
+ ro as getMissingSectionDeps,
5208
+ Xi as getPatches,
5209
+ Ji as onPatchChange,
5235
5210
  W as pluginManager,
5236
- io as rejectAllPatches,
5237
- ao as rejectPatch,
5238
- ho as removeDocDiffDecorations,
5239
- Yi as resolvePatchTarget,
5240
- bn as sectionContextDeps,
5241
- to as setPatches,
5242
- _ as useEditorStore,
5243
- yo as validatePatentDocument,
5244
- lo as writeStream,
5245
- uo as writeStreamFromSSE
5211
+ no as rejectAllPatches,
5212
+ eo as rejectPatch,
5213
+ mo as removeDocDiffDecorations,
5214
+ Ki as resolvePatchTarget,
5215
+ yn as sectionContextDeps,
5216
+ Qi as setPatches,
5217
+ k as useEditorStore,
5218
+ fo as validatePatentDocument,
5219
+ so as writeStream,
5220
+ io as writeStreamFromSSE
5246
5221
  };
5247
5222
  //# sourceMappingURL=lib.js.map