patent-editor 0.1.4 → 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.
Files changed (3) hide show
  1. package/dist/lib.js +1091 -1090
  2. package/dist/lib.js.map +1 -1
  3. package/package.json +1 -1
package/dist/lib.js CHANGED
@@ -1,11 +1,11 @@
1
1
  var Nn = Object.defineProperty;
2
- var kn = (e, t, n) => t in e ? Nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var Re = (e, t, n) => kn(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsx as g, jsxs as A, Fragment as we } from "react/jsx-runtime";
5
- import De, { 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 _n, Node as ee, mergeAttributes as ae, NodeViewWrapper as An, ReactNodeViewRenderer as qt, useEditorState as Ln, EditorContent as Pn, useEditor as Rn } from "@tiptap/react";
7
- import Dn from "@tiptap/extension-document";
8
- import Mn from "@tiptap/extension-paragraph";
2
+ var _n = (e, t, n) => t in e ? Nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var De = (e, t, n) => _n(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsx as f, jsxs as A, Fragment as we } from "react/jsx-runtime";
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
9
  import $n from "@tiptap/extension-text";
10
10
  import On from "@tiptap/extension-heading";
11
11
  import Fn from "@tiptap/extension-bullet-list";
@@ -15,8 +15,8 @@ import Hn from "@tiptap/extension-blockquote";
15
15
  import Un from "@tiptap/extension-code-block";
16
16
  import jn from "@tiptap/extension-horizontal-rule";
17
17
  import Wn from "@tiptap/extension-task-list";
18
- import qn from "@tiptap/extension-task-item";
19
- import Gn from "@tiptap/extension-image";
18
+ import Gn from "@tiptap/extension-task-item";
19
+ import qn from "@tiptap/extension-image";
20
20
  import { Table as Vn } from "@tiptap/extension-table";
21
21
  import Kn from "@tiptap/extension-table-row";
22
22
  import Jn from "@tiptap/extension-table-cell";
@@ -26,12 +26,12 @@ import Yn from "@tiptap/extension-history";
26
26
  import { dropCursor as Zn } from "prosemirror-dropcursor";
27
27
  import { gapCursor as er } from "prosemirror-gapcursor";
28
28
  import tr from "@tiptap/extension-text-align";
29
- import { PluginKey as _e, Plugin as Xe, TextSelection as Ie } from "@tiptap/pm/state";
29
+ import { PluginKey as ke, Plugin as Xe, TextSelection as Ie } from "@tiptap/pm/state";
30
30
  import nr from "@tiptap/suggestion";
31
31
  import rr from "tippy.js";
32
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 Gt } from "diff-match-patch";
34
+ import { diff_match_patch as qt } from "diff-match-patch";
35
35
  import sr from "@tiptap/extension-bold";
36
36
  import ir from "@tiptap/extension-italic";
37
37
  import or from "@tiptap/extension-underline";
@@ -46,15 +46,15 @@ import pr from "@tiptap/extension-highlight";
46
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 yr, Fragment as vr } from "@tiptap/pm/model";
49
+ import { findWrapping as yr } from "@tiptap/pm/transform";
50
+ import { Slice as br, Fragment as vr } from "@tiptap/pm/model";
51
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 kr, AlignRight as _r, AlignJustify as Ar, List as Lr, ListOrdered as Pr, Quote as Rr, FileCode2 as Dr, Table as Mr, Minus as $r, CheckSquare as Or, Image as en, Link2 as pt, FileText as tn, Box as Fr, Workflow as zr, FunctionSquare as Br, Sigma as Hr, GitGraph as Ur, Square as Tt, Download as jr, ChevronDown as nn, Trash2 as Wr, Highlighter as qr, Sparkles as Gr, CaseSensitive as Vr, ChevronUp as Kr, Replace as It, X as Jr, ReplaceAll as Xr, PanelLeft as Qr, PanelLeftClose as Yr } from "lucide-react";
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 Zr, Packer as ea, Paragraph as Qe, AlignmentType as ht, TextRun as Ye } from "docx";
54
+ import { convertMillimetersToTwip as Se, Document as Zr, Packer as ea, Paragraph as Qe, AlignmentType as yt, TextRun as Ye } from "docx";
55
55
  import { saveAs as ta } from "file-saver";
56
56
  import { BubbleMenu as na } from "@tiptap/react/menus";
57
- const ra = new _e("slashCommand"), aa = Je.create({
57
+ const ra = new ke("slashCommand"), aa = Je.create({
58
58
  name: "slashCommand",
59
59
  addOptions() {
60
60
  return {
@@ -170,29 +170,29 @@ const ra = new _e("slashCommand"), aa = Je.create({
170
170
  }, [e]);
171
171
  const s = de(
172
172
  (i) => {
173
- const c = e[i];
174
- c && t(c);
173
+ const l = e[i];
174
+ l && t(l);
175
175
  },
176
176
  [e, t]
177
177
  );
178
178
  return Wt(n, () => ({
179
- onKeyDown: ({ event: i }) => i.key === "ArrowUp" ? (a((c) => (c + e.length - 1) % e.length), !0) : i.key === "ArrowDown" ? (a((c) => (c + 1) % e.length), !0) : i.key === "Enter" ? (s(r), !0) : !1
180
- })), e.length ? /* @__PURE__ */ g("div", { className: "slash-menu", children: e.map((i, c) => /* @__PURE__ */ A(
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
+ })), e.length ? /* @__PURE__ */ f("div", { className: "slash-menu", children: e.map((i, l) => /* @__PURE__ */ A(
181
181
  "button",
182
182
  {
183
- className: `slash-menu-item ${c === r ? "slash-menu-item--active" : ""}`,
184
- onClick: () => s(c),
185
- onMouseEnter: () => a(c),
183
+ className: `slash-menu-item ${l === r ? "slash-menu-item--active" : ""}`,
184
+ onClick: () => s(l),
185
+ onMouseEnter: () => a(l),
186
186
  children: [
187
- /* @__PURE__ */ g("span", { className: "slash-menu-icon", children: i.icon }),
187
+ /* @__PURE__ */ f("span", { className: "slash-menu-icon", children: i.icon }),
188
188
  /* @__PURE__ */ A("div", { className: "slash-menu-text", children: [
189
- /* @__PURE__ */ g("span", { className: "slash-menu-title", children: i.title }),
190
- /* @__PURE__ */ g("span", { className: "slash-menu-desc", children: i.description })
189
+ /* @__PURE__ */ f("span", { className: "slash-menu-title", children: i.title }),
190
+ /* @__PURE__ */ f("span", { className: "slash-menu-desc", children: i.description })
191
191
  ] })
192
192
  ]
193
193
  },
194
194
  i.title
195
- )) }) : /* @__PURE__ */ g("div", { className: "slash-menu", children: /* @__PURE__ */ g("div", { className: "slash-menu-empty", children: "No results" }) });
195
+ )) }) : /* @__PURE__ */ f("div", { className: "slash-menu", children: /* @__PURE__ */ f("div", { className: "slash-menu-empty", children: "No results" }) });
196
196
  }
197
197
  );
198
198
  rn.displayName = "SlashMenuList";
@@ -321,7 +321,7 @@ function oa() {
321
321
  let e = null, t = null;
322
322
  return {
323
323
  onStart: (n) => {
324
- e = new _n(rn, {
324
+ e = new kn(rn, {
325
325
  props: n,
326
326
  editor: n.editor
327
327
  }), n.clientRect && (t = rr("body", {
@@ -351,29 +351,29 @@ function oa() {
351
351
  }
352
352
  };
353
353
  }
354
- const ca = new _e("searchReplace");
355
- function Me(e, t, n) {
354
+ const ca = new ke("searchReplace");
355
+ function Re(e, t, n) {
356
356
  if (!t) return [];
357
357
  const r = [], a = e.textBetween(0, e.content.size, `
358
358
  `, "\0"), s = n ? t : t.toLowerCase(), i = n ? a : a.toLowerCase();
359
- let c = 0;
360
- for (; c < i.length; ) {
361
- const l = i.indexOf(s, c);
362
- if (l === -1) break;
359
+ let l = 0;
360
+ for (; l < i.length; ) {
361
+ const c = i.indexOf(s, l);
362
+ if (c === -1) break;
363
363
  let d = 0, o = -1, u = -1;
364
- e.descendants((m, h) => {
364
+ e.descendants((m, g) => {
365
365
  if (o !== -1 && u !== -1) return !1;
366
366
  if (m.isText) {
367
367
  const p = m.text || "";
368
- for (let f = 0; f < p.length; f++) {
369
- if (d === l && (o = h + f), d === l + s.length)
370
- return u = h + f, !1;
368
+ for (let h = 0; h < p.length; h++) {
369
+ if (d === c && (o = g + h), d === c + s.length)
370
+ return u = g + h, !1;
371
371
  d++;
372
372
  }
373
- d === l + s.length && u === -1 && (u = h + p.length);
374
- } else m.isBlock && d > 0 && (d === l && (o = h), d++);
373
+ d === c + s.length && u === -1 && (u = g + p.length);
374
+ } else m.isBlock && d > 0 && (d === c && (o = g), d++);
375
375
  return !0;
376
- }), o !== -1 && u !== -1 && r.push({ from: o, to: u }), c = l + 1;
376
+ }), o !== -1 && u !== -1 && r.push({ from: o, to: u }), l = c + 1;
377
377
  }
378
378
  return r;
379
379
  }
@@ -390,35 +390,35 @@ const la = Je.create({
390
390
  },
391
391
  addCommands() {
392
392
  return {
393
- setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results = Me(t.state.doc, e, this.storage.caseSensitive), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
393
+ setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results = Re(t.state.doc, e, this.storage.caseSensitive), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
394
394
  setReplaceTerm: (e) => () => (this.storage.replaceTerm = e, !0),
395
- setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results = Me(t.state.doc, this.storage.searchTerm, e), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
395
+ setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results = Re(t.state.doc, this.storage.searchTerm, e), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
396
396
  nextSearchResult: () => ({ editor: e }) => {
397
397
  if (this.storage.results.length === 0) return !1;
398
398
  this.storage.currentIndex = (this.storage.currentIndex + 1) % this.storage.results.length;
399
399
  const t = this.storage.results[this.storage.currentIndex];
400
- return t && (e.commands.setTextSelection(t), Et(e)), e.view.dispatch(e.state.tr), !0;
400
+ return t && (e.commands.setTextSelection(t), Nt(e)), e.view.dispatch(e.state.tr), !0;
401
401
  },
402
402
  previousSearchResult: () => ({ editor: e }) => {
403
403
  if (this.storage.results.length === 0) return !1;
404
404
  this.storage.currentIndex = (this.storage.currentIndex - 1 + this.storage.results.length) % this.storage.results.length;
405
405
  const t = this.storage.results[this.storage.currentIndex];
406
- return t && (e.commands.setTextSelection(t), Et(e)), e.view.dispatch(e.state.tr), !0;
406
+ return t && (e.commands.setTextSelection(t), Nt(e)), e.view.dispatch(e.state.tr), !0;
407
407
  },
408
408
  replaceCurrent: () => ({ editor: e }) => {
409
409
  if (this.storage.results.length === 0 || this.storage.currentIndex < 0) return !1;
410
410
  const t = this.storage.results[this.storage.currentIndex];
411
- return t ? (e.chain().focus().insertContentAt(t, this.storage.replaceTerm).run(), this.storage.results = Me(e.state.doc, this.storage.searchTerm, this.storage.caseSensitive), this.storage.currentIndex >= this.storage.results.length && (this.storage.currentIndex = 0), e.view.dispatch(e.state.tr), !0) : !1;
411
+ return t ? (e.chain().focus().insertContentAt(t, this.storage.replaceTerm).run(), this.storage.results = Re(e.state.doc, this.storage.searchTerm, this.storage.caseSensitive), this.storage.currentIndex >= this.storage.results.length && (this.storage.currentIndex = 0), e.view.dispatch(e.state.tr), !0) : !1;
412
412
  },
413
413
  replaceAll: () => ({ editor: e }) => {
414
414
  if (this.storage.results.length === 0) return !1;
415
415
  const { searchTerm: t, replaceTerm: n, caseSensitive: r } = this.storage;
416
- let a = Me(e.state.doc, t, r);
416
+ let a = Re(e.state.doc, t, r);
417
417
  const s = e.state.tr;
418
418
  let i = 0;
419
- for (const c of a) {
420
- const l = c.from + i, d = c.to + i;
421
- s.insertText(n, l, d), i += n.length - (c.to - c.from);
419
+ for (const l of a) {
420
+ const c = l.from + i, d = l.to + i;
421
+ s.insertText(n, c, d), i += n.length - (l.to - l.from);
422
422
  }
423
423
  return e.view.dispatch(s), this.storage.results = [], this.storage.currentIndex = -1, !0;
424
424
  },
@@ -457,7 +457,7 @@ const la = Je.create({
457
457
  ];
458
458
  }
459
459
  });
460
- function Et(e) {
460
+ function Nt(e) {
461
461
  requestAnimationFrame(() => {
462
462
  const t = e.view.domAtPos(e.state.selection.from);
463
463
  if (t != null && t.node) {
@@ -466,12 +466,12 @@ function Et(e) {
466
466
  }
467
467
  });
468
468
  }
469
- const da = -1, ua = 1, Nt = 0;
469
+ const da = -1, ua = 1, _t = 0;
470
470
  let nt = null;
471
471
  function ma() {
472
- return nt || (nt = new Gt()), nt;
472
+ return nt || (nt = new qt()), nt;
473
473
  }
474
- const an = new _e("patchDiff");
474
+ const an = new ke("patchDiff");
475
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;
@@ -479,10 +479,10 @@ function fa(e, t) {
479
479
  function sn(e, t, n) {
480
480
  const r = [];
481
481
  let a = "", s = !0;
482
- return e.state.doc.nodesBetween(t, n, (i, c) => {
482
+ return e.state.doc.nodesBetween(t, n, (i, l) => {
483
483
  if (i.isText) {
484
- const l = c, d = Math.max(t, l) - l, o = Math.min(n, l + i.nodeSize) - l, u = i.text.slice(d, o);
485
- r.push({ textIdx: a.length, docPos: l + d, len: u.length }), a += u, s = !1;
484
+ const c = l, d = Math.max(t, c) - c, o = Math.min(n, c + i.nodeSize) - c, u = i.text.slice(d, o);
485
+ r.push({ textIdx: a.length, docPos: c + d, len: u.length }), a += u, s = !1;
486
486
  } else i.isLeaf ? (a += "\0", s = !1) : !s && i.isBlock && (a += "\0", s = !0);
487
487
  }), { text: a, segments: r };
488
488
  }
@@ -494,24 +494,24 @@ function Ee(e, t) {
494
494
  }
495
495
  function kt(e, t, n, r, a) {
496
496
  const { text: s, segments: i } = sn(e, n, r);
497
- let c = 0;
498
- for (; c <= s.length - t.length; ) {
499
- const l = s.indexOf(t, c);
500
- if (l === -1) return null;
501
- const d = Ee(i, l), o = Ee(i, l + t.length);
497
+ let l = 0;
498
+ for (; l <= s.length - t.length; ) {
499
+ const c = s.indexOf(t, l);
500
+ if (c === -1) return null;
501
+ const d = Ee(i, c), o = Ee(i, c + t.length);
502
502
  if (d >= 0 && o >= 0 && !(a && a.has(d)))
503
503
  return { from: d, to: o };
504
- c = l + 1;
504
+ l = c + 1;
505
505
  }
506
506
  return null;
507
507
  }
508
- function Qi(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
- const c = /* @__PURE__ */ new Set();
511
+ const l = /* @__PURE__ */ new Set();
512
512
  if (a)
513
513
  for (const o of a)
514
- c.add(o.from);
514
+ l.add(o.from);
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)
@@ -519,45 +519,45 @@ function Qi(e, t, n, r, a) {
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 = kt(e, s.searchText, 0, e.state.doc.content.size, c));
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
- let l = i;
524
+ let c = i;
525
525
  if (t.search) {
526
- const o = kt(e, t.search, i.from, i.to, c);
527
- o && (l = o);
526
+ const o = kt(e, t.search, i.from, i.to, l);
527
+ o && (c = o);
528
528
  }
529
- const d = l.from < l.to ? e.state.doc.textBetween(l.from, l.to, " ", "\0") : "";
529
+ const d = c.from < c.to ? e.state.doc.textBetween(c.from, c.to, " ", "\0") : "";
530
530
  return {
531
531
  id: `patch_${Date.now()}_${r}`,
532
532
  type: t.op === "delete" ? "delete" : t.op === "insert" ? "insert" : "replace",
533
- from: l.from,
534
- to: t.op === "insert" ? l.from : l.to,
533
+ from: c.from,
534
+ to: t.op === "insert" ? c.from : c.to,
535
535
  content: t.content || "",
536
536
  originalText: d,
537
537
  reason: t.reason,
538
538
  status: "pending"
539
539
  };
540
540
  }
541
- let q = [], Ue = [];
542
- function Yi(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
  };
546
546
  }
547
- function ye() {
547
+ function be() {
548
548
  Ue.forEach((e) => e());
549
549
  }
550
- function Zi() {
551
- return [...q];
550
+ function Xi() {
551
+ return [...G];
552
552
  }
553
- function eo(e) {
554
- q = e, ye();
553
+ function Qi(e) {
554
+ G = e, be();
555
555
  }
556
- function to() {
557
- q = [], ye();
556
+ function Yi() {
557
+ G = [], be();
558
558
  }
559
- function no(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;
@@ -572,19 +572,19 @@ function no(e, t) {
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
- const i = a.map(s.from, 1), c = a.map(s.to, -1);
578
- i >= c && s.type !== "insert" ? s.status = "rejected" : (s.from = i, s.to = s.type === "insert" ? i : c);
577
+ const i = a.map(s.from, 1), l = a.map(s.to, -1);
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), ye(), !0;
580
+ return G = G.filter((s) => s.id !== t && s.status === "pending"), Ze(e), be(), !0;
581
581
  }
582
- function ro(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), ye(), !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 ao(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);
@@ -595,10 +595,10 @@ function ao(e) {
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), ye();
598
+ e.view.dispatch(r), G = [], Ze(e), be();
599
599
  }
600
- function so(e) {
601
- q = [], Ze(e), ye();
600
+ function no(e) {
601
+ G = [], Ze(e), be();
602
602
  }
603
603
  function Ze(e) {
604
604
  e.view.dispatch(e.state.tr.setMeta(an, !0));
@@ -607,8 +607,8 @@ function ga(e, t, n) {
607
607
  const r = [];
608
608
  return e.nodesBetween(t, n, (a, s) => {
609
609
  if (a.isTextblock) {
610
- const i = s + 1, c = s + a.nodeSize - 1, l = Math.max(i, t), d = Math.min(c, n);
611
- return d > l && r.push({ from: l, to: d }), !1;
610
+ const i = s + 1, l = s + a.nodeSize - 1, c = Math.max(i, t), d = Math.min(l, n);
611
+ return d > c && r.push({ from: c, to: d }), !1;
612
612
  }
613
613
  return !0;
614
614
  }), r;
@@ -616,32 +616,32 @@ function ga(e, t, n) {
616
616
  function pa(e, t) {
617
617
  if (!t.originalText || !t.content) return null;
618
618
  try {
619
- const c = e.resolve(t.from), l = e.resolve(t.to);
620
- if (c.parent !== l.parent || !c.parent.isTextblock) return null;
619
+ const l = e.resolve(t.from), c = e.resolve(t.to);
620
+ if (l.parent !== c.parent || !l.parent.isTextblock) return null;
621
621
  } catch {
622
622
  return null;
623
623
  }
624
624
  const n = ma(), r = n.diff_main(t.originalText, t.content);
625
625
  n.diff_cleanupSemantic(r);
626
- const a = r.filter(([c]) => c === Nt).reduce((c, [, l]) => c + l.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
- for (const [c, l] of r)
631
- if (c === Nt)
632
- i += l.length;
633
- else if (c === da) {
634
- const d = i + l.length;
630
+ for (const [l, c] of r)
631
+ if (l === _t)
632
+ i += c.length;
633
+ else if (l === da) {
634
+ const d = i + c.length;
635
635
  s.push(
636
636
  le.inline(i, d, {
637
637
  class: "patch-diff-delete",
638
638
  "data-patch-id": t.id
639
639
  })
640
640
  ), i = d;
641
- } else c === ua && s.push(
641
+ } else l === ua && s.push(
642
642
  le.widget(i, () => {
643
643
  const d = document.createElement("span");
644
- return d.className = "patch-diff-insert-inline", d.textContent = l, d.setAttribute("data-patch-id", t.id), d;
644
+ return d.className = "patch-diff-insert-inline", d.textContent = c, d.setAttribute("data-patch-id", t.id), d;
645
645
  }, { side: 1 })
646
646
  );
647
647
  return s;
@@ -651,7 +651,7 @@ function ha() {
651
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) {
@@ -676,8 +676,8 @@ function ha() {
676
676
  `);
677
677
  n.push(
678
678
  le.widget(s, () => {
679
- const c = document.createElement(i ? "div" : "span");
680
- return c.className = i ? "patch-diff-insert-inline patch-diff-insert-block" : "patch-diff-insert-inline", c.textContent = r.content, c.setAttribute("data-patch-id", r.id), c;
679
+ const l = document.createElement(i ? "div" : "span");
680
+ return l.className = i ? "patch-diff-insert-inline patch-diff-insert-block" : "patch-diff-insert-inline", l.textContent = r.content, l.setAttribute("data-patch-id", r.id), l;
681
681
  }, { side: 1 })
682
682
  );
683
683
  }
@@ -709,7 +709,7 @@ function cn(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,7 +730,7 @@ const ba = ee.create({
730
730
  }
731
731
  };
732
732
  }
733
- }), ya = Je.create({
733
+ }), ba = Je.create({
734
734
  name: "dragDropUX",
735
735
  addProseMirrorPlugins() {
736
736
  return [
@@ -747,10 +747,10 @@ const ba = ee.create({
747
747
  return [ha()];
748
748
  }
749
749
  }), Ca = [
750
- Dn,
751
750
  Mn,
751
+ Rn,
752
752
  $n,
753
- ya,
753
+ ba,
754
754
  On.configure({
755
755
  levels: [1, 2, 3, 4, 5, 6]
756
756
  }),
@@ -759,11 +759,11 @@ const ba = ee.create({
759
759
  Bn,
760
760
  Hn,
761
761
  Un,
762
- ba,
762
+ ya,
763
763
  jn,
764
764
  Wn,
765
- qn.configure({ nested: !0 }),
766
- Gn.extend({
765
+ Gn.configure({ nested: !0 }),
766
+ qn.extend({
767
767
  addAttributes() {
768
768
  var e;
769
769
  return {
@@ -818,7 +818,7 @@ const ba = ee.create({
818
818
  ];
819
819
  class Sa {
820
820
  constructor() {
821
- Re(this, "commands", /* @__PURE__ */ new Map());
821
+ De(this, "commands", /* @__PURE__ */ new Map());
822
822
  }
823
823
  normalizeCommand(t) {
824
824
  return typeof t == "function" ? {
@@ -841,8 +841,8 @@ class Sa {
841
841
  return !r || !r.isActive ? !1 : r.isActive(n);
842
842
  }
843
843
  async execute(t, n, r, a = {}) {
844
- var o, u, m, h;
845
- const s = Date.now(), i = a.transaction ?? !0, c = a.rollbackOnFail ?? !0, l = i ? n.editor.getJSON() : null, d = this.commands.get(t);
844
+ var o, u, m, g;
845
+ const s = Date.now(), i = a.transaction ?? !0, l = a.rollbackOnFail ?? !0, c = i ? n.editor.getJSON() : null, d = this.commands.get(t);
846
846
  if (!d)
847
847
  return console.warn(`Command "${t}" not found.`), (o = a.onComplete) == null || o.call(a, {
848
848
  name: t,
@@ -856,23 +856,23 @@ class Sa {
856
856
  durationMs: Date.now() - s
857
857
  }), !1;
858
858
  try {
859
- const f = !!await d.execute(n, r);
860
- !f && l && c && n.editor.commands.setContent(l);
861
- const C = {
859
+ const h = !!await d.execute(n, r);
860
+ !h && c && l && n.editor.commands.setContent(c);
861
+ const b = {
862
862
  name: t,
863
- success: f,
863
+ success: h,
864
864
  durationMs: Date.now() - s
865
865
  };
866
- return (m = a.onComplete) == null || m.call(a, C), f;
866
+ return (m = a.onComplete) == null || m.call(a, b), h;
867
867
  } catch (p) {
868
- l && c && n.editor.commands.setContent(l);
869
- const f = {
868
+ c && l && n.editor.commands.setContent(c);
869
+ const h = {
870
870
  name: t,
871
871
  success: !1,
872
872
  durationMs: Date.now() - s,
873
873
  error: p
874
874
  };
875
- return (h = a.onComplete) == null || h.call(a, f), !1;
875
+ return (g = a.onComplete) == null || g.call(a, h), !1;
876
876
  }
877
877
  }
878
878
  getCommand(t) {
@@ -885,8 +885,8 @@ class Sa {
885
885
  const ge = new Sa();
886
886
  class Ta {
887
887
  constructor() {
888
- Re(this, "plugins", /* @__PURE__ */ new Map());
889
- Re(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
888
+ De(this, "plugins", /* @__PURE__ */ new Map());
889
+ De(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
890
890
  }
891
891
  logLifecycle(t, n) {
892
892
  t !== "stateSync" && console.info(`[PluginManager:${t}] ${n}`);
@@ -968,7 +968,7 @@ class Ta {
968
968
  });
969
969
  }
970
970
  }
971
- const W = new Ta(), _t = {
971
+ const W = new Ta(), At = {
972
972
  zh: {
973
973
  language: "语言",
974
974
  bold: "加粗",
@@ -1135,7 +1135,7 @@ const W = new Ta(), _t = {
1135
1135
  autoSaveSaved: "Saved",
1136
1136
  autoSaveError: "Save failed"
1137
1137
  }
1138
- }, U = (e) => e === "en" ? _t.en : _t.zh, he = (e, t, n, r) => e === "en" ? t === "forward_reference" ? `Claim ${n} references later claim ${r}.` : t === "self_reference" ? `Claim ${n} references itself.` : `Claim ${n} has circular dependency.` : t === "forward_reference" ? `权利要求${n}引用了后置项权利要求${r}。` : t === "self_reference" ? `权利要求${n}引用了自身。` : `权利要求${n}存在循环依赖。`;
1138
+ }, U = (e) => e === "en" ? At.en : At.zh, he = (e, t, n, r) => e === "en" ? t === "forward_reference" ? `Claim ${n} references later claim ${r}.` : t === "self_reference" ? `Claim ${n} references itself.` : `Claim ${n} has circular dependency.` : t === "forward_reference" ? `权利要求${n}引用了后置项权利要求${r}。` : t === "self_reference" ? `权利要求${n}引用了自身。` : `权利要求${n}存在循环依赖。`;
1139
1139
  let $e = 0;
1140
1140
  const Oe = () => {
1141
1141
  document.querySelectorAll('body > svg[id^="standalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
@@ -1163,10 +1163,10 @@ const Oe = () => {
1163
1163
  s.classList.add("mermaid-node");
1164
1164
  const i = document.createElement("div");
1165
1165
  i.className = "mermaid-view", i.contentEditable = "false";
1166
- const c = document.createElement("div");
1167
- c.className = "mermaid-preview", c.contentEditable = "false";
1168
1166
  const l = document.createElement("div");
1169
- l.className = "mermaid-view-hint", i.append(c, l);
1167
+ l.className = "mermaid-preview", l.contentEditable = "false";
1168
+ const c = document.createElement("div");
1169
+ c.className = "mermaid-view-hint", i.append(l, c);
1170
1170
  const d = document.createElement("div");
1171
1171
  d.className = "mermaid-edit";
1172
1172
  const o = document.createElement("textarea");
@@ -1175,80 +1175,80 @@ const Oe = () => {
1175
1175
  u.className = "mermaid-edit-toolbar";
1176
1176
  const m = document.createElement("span");
1177
1177
  m.className = "mermaid-error-msg";
1178
- const h = document.createElement("button");
1179
- h.className = "mermaid-cancel-btn", h.type = "button";
1178
+ const g = document.createElement("button");
1179
+ g.className = "mermaid-cancel-btn", g.type = "button";
1180
1180
  const p = document.createElement("button");
1181
- p.className = "mermaid-save-btn", p.type = "button", u.append(m, h, p), d.append(o, u), s.append(i, d);
1182
- const f = (b) => {
1181
+ p.className = "mermaid-save-btn", p.type = "button", u.append(m, g, p), d.append(o, u), s.append(i, d);
1182
+ const h = (y) => {
1183
1183
  const T = typeof n == "function" ? n() : null;
1184
- typeof T == "number" && e.commands.command(({ tr: E, dispatch: D }) => (E.setNodeMarkup(T, void 0, { ...r.attrs, ...b }), D && D(E), !0));
1184
+ typeof T == "number" && e.commands.command(({ tr: E, dispatch: M }) => (E.setNodeMarkup(T, void 0, { ...r.attrs, ...y }), M && M(E), !0));
1185
1185
  };
1186
- let C = "";
1187
- const w = async (b) => {
1188
- const T = b.trim();
1189
- if (T !== C) {
1186
+ let b = "";
1187
+ const x = async (y) => {
1188
+ const T = y.trim();
1189
+ if (T !== b) {
1190
1190
  if (!T) {
1191
- c.innerHTML = "", C = "";
1191
+ l.innerHTML = "", b = "";
1192
1192
  return;
1193
1193
  }
1194
1194
  try {
1195
1195
  const E = await import("mermaid");
1196
1196
  E.default.initialize({ startOnLoad: !1, theme: "default" }), $e += 1;
1197
- const D = `standalone-mermaid-${$e}`, { svg: M } = await E.default.render(D, T);
1198
- c.innerHTML = M, C = T;
1197
+ const M = `standalone-mermaid-${$e}`, { svg: R } = await E.default.render(M, T);
1198
+ l.innerHTML = R, b = T;
1199
1199
  } catch {
1200
- c.innerHTML = "", C = "";
1200
+ l.innerHTML = "", b = "";
1201
1201
  } finally {
1202
1202
  Oe();
1203
1203
  }
1204
1204
  }
1205
- }, y = () => {
1206
- a || (a = !0, o.value = typeof r.attrs.code == "string" ? r.attrs.code : "", m.textContent = "", m.style.display = "none", _(), requestAnimationFrame(() => o.focus()));
1207
1205
  }, v = () => {
1206
+ a || (a = !0, o.value = typeof r.attrs.code == "string" ? r.attrs.code : "", m.textContent = "", m.style.display = "none", _(), requestAnimationFrame(() => o.focus()));
1207
+ }, C = () => {
1208
1208
  a = !1, _();
1209
- }, x = async () => {
1210
- const b = o.value;
1209
+ }, w = async () => {
1210
+ const y = o.value;
1211
1211
  m.textContent = "", m.style.display = "none";
1212
- const T = b.trim();
1212
+ const T = y.trim();
1213
1213
  if (T)
1214
1214
  try {
1215
1215
  const E = await import("mermaid");
1216
1216
  E.default.initialize({ startOnLoad: !1, theme: "default" }), $e += 1;
1217
- const D = `standalone-mermaid-${$e}`, { svg: M } = await E.default.render(D, T);
1218
- c.innerHTML = M, C = T, Oe();
1217
+ const M = `standalone-mermaid-${$e}`, { svg: R } = await E.default.render(M, T);
1218
+ l.innerHTML = R, b = T, Oe();
1219
1219
  } catch {
1220
1220
  Oe();
1221
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
- f({ code: b }), a = !1, _();
1225
+ h({ code: y }), a = !1, _();
1226
1226
  };
1227
- i.addEventListener("dblclick", (b) => {
1228
- b.preventDefault(), b.stopPropagation(), y();
1229
- }), p.addEventListener("click", (b) => {
1230
- b.stopPropagation(), x();
1231
- }), h.addEventListener("click", (b) => {
1232
- b.stopPropagation(), v();
1233
- }), o.addEventListener("mousedown", (b) => b.stopPropagation()), o.addEventListener("keydown", (b) => b.stopPropagation()), o.addEventListener("keypress", (b) => b.stopPropagation());
1227
+ i.addEventListener("dblclick", (y) => {
1228
+ y.preventDefault(), y.stopPropagation(), v();
1229
+ }), p.addEventListener("click", (y) => {
1230
+ y.stopPropagation(), w();
1231
+ }), g.addEventListener("click", (y) => {
1232
+ y.stopPropagation(), C();
1233
+ }), o.addEventListener("mousedown", (y) => y.stopPropagation()), o.addEventListener("keydown", (y) => y.stopPropagation()), o.addEventListener("keypress", (y) => y.stopPropagation());
1234
1234
  const _ = () => {
1235
- const b = k.getState().editorLanguage, T = U(b), E = typeof r.attrs.code == "string" ? r.attrs.code : "";
1236
- i.style.display = a ? "none" : "block", d.style.display = a ? "block" : "none", p.textContent = T.mermaidSaveAndRender || "保存并渲染", h.textContent = T.mermaidCancel || "取消";
1237
- const D = E.trim().length > 0, M = c.querySelector("svg") !== null;
1238
- a || (D && M ? (l.textContent = T.mermaidDoubleClickToEdit || "双击编辑", l.className = "mermaid-view-hint mermaid-view-hint--subtle") : (l.textContent = T.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", l.className = "mermaid-view-hint mermaid-view-hint--empty")), !a && E.trim() !== C && w(E);
1235
+ const y = k.getState().editorLanguage, T = U(y), E = typeof r.attrs.code == "string" ? r.attrs.code : "";
1236
+ i.style.display = a ? "none" : "block", d.style.display = a ? "block" : "none", p.textContent = T.mermaidSaveAndRender || "保存并渲染", g.textContent = T.mermaidCancel || "取消";
1237
+ const M = E.trim().length > 0, R = l.querySelector("svg") !== null;
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
1240
  let L = k.getState().editorLanguage;
1241
- const P = k.subscribe((b) => {
1242
- b.editorLanguage !== L && (L = b.editorLanguage, _());
1241
+ const P = k.subscribe((y) => {
1242
+ y.editorLanguage !== L && (L = y.editorLanguage, _());
1243
1243
  });
1244
1244
  return _(), {
1245
1245
  dom: s,
1246
- stopEvent: (b) => {
1247
- const T = b.target;
1246
+ stopEvent: (y) => {
1247
+ const T = y.target;
1248
1248
  return !!(T === o || d.contains(T));
1249
1249
  },
1250
1250
  ignoreMutation: () => !0,
1251
- update: (b) => b.type.name !== "mermaid" ? !1 : (r = b, _(), !0),
1251
+ update: (y) => y.type.name !== "mermaid" ? !1 : (r = y, _(), !0),
1252
1252
  destroy: () => {
1253
1253
  P(), Oe();
1254
1254
  }
@@ -1305,32 +1305,32 @@ const Oe = () => {
1305
1305
  s.classList.add("drawio-node");
1306
1306
  const i = document.createElement("div");
1307
1307
  i.className = "drawio-view", i.contentEditable = "false";
1308
- const c = document.createElement("img");
1309
- c.className = "drawio-preview-img", c.style.display = "none";
1310
- const l = document.createElement("div");
1311
- l.className = "drawio-view-hint", i.append(c, l), s.append(i);
1312
- const d = (y) => {
1313
- const v = typeof n == "function" ? n() : null;
1314
- typeof v == "number" && e.commands.command(({ tr: x, dispatch: _ }) => (x.setNodeMarkup(v, void 0, { ...r.attrs, ...y }), _ && _(x), !0));
1308
+ const l = document.createElement("img");
1309
+ l.className = "drawio-preview-img", l.style.display = "none";
1310
+ const c = document.createElement("div");
1311
+ c.className = "drawio-view-hint", i.append(l, c), s.append(i);
1312
+ const d = (v) => {
1313
+ const C = typeof n == "function" ? n() : null;
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
- const h = () => {
1317
+ const g = () => {
1318
1318
  if (a) return;
1319
1319
  a = !0, u = document.createElement("div"), u.className = "drawio-modal-overlay";
1320
- const y = document.createElement("div");
1321
- y.className = "drawio-modal-content";
1322
1320
  const v = document.createElement("div");
1323
- v.className = "drawio-modal-header";
1324
- const x = k.getState().editorLanguage, _ = document.createElement("span");
1325
- _.textContent = x === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", _.className = "drawio-modal-title";
1321
+ v.className = "drawio-modal-content";
1322
+ const C = document.createElement("div");
1323
+ C.className = "drawio-modal-header";
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()), v.append(_, L), m = document.createElement("iframe"), m.className = "drawio-modal-iframe", m.setAttribute("frameborder", "0"), y.append(v, m), u.appendChild(y), document.body.appendChild(u);
1328
- const P = x === "en" ? "en" : "zh";
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
+ const P = w === "en" ? "en" : "zh";
1329
1329
  m.src = `https://embed.diagrams.net/?embed=1&proto=json&spin=1&lang=${P}`;
1330
- const b = m;
1330
+ const y = m;
1331
1331
  o = (T) => {
1332
- var D, M;
1333
- if (!b || T.source !== b.contentWindow) return;
1332
+ var M, R;
1333
+ if (!y || T.source !== y.contentWindow) return;
1334
1334
  let E;
1335
1335
  try {
1336
1336
  E = typeof T.data == "string" ? JSON.parse(T.data) : T.data;
@@ -1339,13 +1339,13 @@ const Oe = () => {
1339
1339
  }
1340
1340
  if (E.event === "init") {
1341
1341
  const Y = typeof r.attrs.xml == "string" ? r.attrs.xml : "";
1342
- (D = b.contentWindow) == null || D.postMessage(
1342
+ (M = y.contentWindow) == null || M.postMessage(
1343
1343
  JSON.stringify({ action: "load", autosave: 0, xml: Y || "" }),
1344
1344
  "*"
1345
1345
  );
1346
1346
  } else if (E.event === "save") {
1347
1347
  const Y = E.xml || "";
1348
- (M = b.contentWindow) == null || M.postMessage(
1348
+ (R = y.contentWindow) == null || R.postMessage(
1349
1349
  JSON.stringify({ action: "export", format: "svg" }),
1350
1350
  "*"
1351
1351
  ), d({ xml: Y });
@@ -1355,30 +1355,30 @@ const Oe = () => {
1355
1355
  } else E.event === "exit" && p();
1356
1356
  }, window.addEventListener("message", o);
1357
1357
  }, p = () => {
1358
- a = !1, o && (window.removeEventListener("message", o), o = null), m && (m.src = "about:blank", m = null), u && (u.remove(), u = null), f();
1358
+ a = !1, o && (window.removeEventListener("message", o), o = null), m && (m.src = "about:blank", m = null), u && (u.remove(), u = null), h();
1359
1359
  };
1360
- i.addEventListener("dblclick", (y) => {
1361
- y.preventDefault(), y.stopPropagation(), h();
1360
+ i.addEventListener("dblclick", (v) => {
1361
+ v.preventDefault(), v.stopPropagation(), g();
1362
1362
  });
1363
- const f = () => {
1364
- const y = k.getState().editorLanguage, v = U(y), x = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
1365
- x ? (c.src = x, c.style.display = "block") : (c.src = "", c.style.display = "none"), x ? (l.textContent = v.mermaidDoubleClickToEdit || "双击编辑", l.className = "drawio-view-hint drawio-view-hint--subtle") : (l.textContent = v.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", l.className = "drawio-view-hint drawio-view-hint--empty");
1363
+ const h = () => {
1364
+ const v = k.getState().editorLanguage, C = U(v), w = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
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 C = k.getState().editorLanguage;
1368
- const w = k.subscribe((y) => {
1369
- y.editorLanguage !== C && (C = y.editorLanguage, f());
1367
+ let b = k.getState().editorLanguage;
1368
+ const x = k.subscribe((v) => {
1369
+ v.editorLanguage !== b && (b = v.editorLanguage, h());
1370
1370
  });
1371
- return f(), {
1371
+ return h(), {
1372
1372
  dom: s,
1373
1373
  ignoreMutation: () => !0,
1374
- update: (y) => y.type.name !== "drawio" ? !1 : (r = y, f(), !0),
1374
+ update: (v) => v.type.name !== "drawio" ? !1 : (r = v, h(), !0),
1375
1375
  destroy: () => {
1376
- w(), o && (window.removeEventListener("message", o), o = null), m && (m.src = "about:blank", m = null), u && (u.remove(), u = null);
1376
+ x(), o && (window.removeEventListener("message", o), o = null), m && (m.src = "about:blank", m = null), u && (u.remove(), u = null);
1377
1377
  }
1378
1378
  };
1379
1379
  };
1380
1380
  }
1381
- }), ka = {
1381
+ }), _a = {
1382
1382
  name: "drawio",
1383
1383
  version: "1.0.0",
1384
1384
  extensions: [Na],
@@ -1411,79 +1411,79 @@ const Oe = () => {
1411
1411
  selected: n,
1412
1412
  editor: r
1413
1413
  }) => {
1414
- const a = X(null), [s, i] = z(!1), c = e.type.name === "math_block", l = X(!1), d = X(t), o = X(e.attrs.latex ?? "");
1414
+ const a = X(null), [s, i] = z(!1), l = e.type.name === "math_block", c = X(!1), d = X(t), o = X(e.attrs.latex ?? "");
1415
1415
  B(() => {
1416
1416
  d.current = t;
1417
1417
  }, [t]), B(() => {
1418
1418
  o.current = e.attrs.latex ?? "";
1419
1419
  }, [e.attrs.latex]);
1420
1420
  const u = de(() => {
1421
- l.current || (l.current = !0, i(!0));
1421
+ c.current || (c.current = !0, i(!0));
1422
1422
  }, []), m = de(() => {
1423
- var f, C;
1424
- if (!l.current) return;
1425
- l.current = !1;
1426
- const p = ((f = a.current) == null ? void 0 : f.value) ?? o.current;
1427
- d.current({ latex: p }), i(!1), (C = globalThis.mathVirtualKeyboard) == null || C.hide({ animate: !0 });
1423
+ var h, b;
1424
+ if (!c.current) return;
1425
+ c.current = !1;
1426
+ const p = ((h = a.current) == null ? void 0 : h.value) ?? o.current;
1427
+ d.current({ latex: p }), i(!1), (b = globalThis.mathVirtualKeyboard) == null || b.hide({ animate: !0 });
1428
1428
  }, []);
1429
1429
  B(() => {
1430
- var f, C, w;
1431
- const p = !!((w = (C = (f = r == null ? void 0 : r.view) == null ? void 0 : f.state) == null ? void 0 : C.selection) != null && w.empty);
1430
+ var h, b, x;
1431
+ const p = !!((x = (b = (h = r == null ? void 0 : r.view) == null ? void 0 : h.state) == null ? void 0 : b.selection) != null && x.empty);
1432
1432
  n && p && u();
1433
1433
  }, [n, u]), B(() => {
1434
1434
  s && requestAnimationFrame(() => {
1435
- var f;
1435
+ var h;
1436
1436
  const p = a.current;
1437
- p && (p.virtualKeyboardMode = "onfocus", (f = p.focus) == null || f.call(p));
1437
+ p && (p.virtualKeyboardMode = "onfocus", (h = p.focus) == null || h.call(p));
1438
1438
  });
1439
1439
  }, [s]), B(() => {
1440
1440
  if (!s) return;
1441
1441
  const p = a.current;
1442
1442
  if (!p) return;
1443
- const f = () => {
1443
+ const h = () => {
1444
1444
  setTimeout(() => {
1445
- var y, v, x;
1446
- if (!l.current) return;
1447
- const w = document.activeElement;
1448
- (w == null ? void 0 : w.tagName) === "MATH-FIELD" || (y = w == null ? void 0 : w.closest) != null && y.call(w, "math-field") || (v = w == null ? void 0 : w.closest) != null && v.call(w, ".ML__keyboard") || (x = document.querySelector(".ML__keyboard")) != null && x.contains(w) || m();
1445
+ var v, C, w;
1446
+ if (!c.current) return;
1447
+ const x = document.activeElement;
1448
+ (x == null ? void 0 : x.tagName) === "MATH-FIELD" || (v = x == null ? void 0 : x.closest) != null && v.call(x, "math-field") || (C = x == null ? void 0 : x.closest) != null && C.call(x, ".ML__keyboard") || (w = document.querySelector(".ML__keyboard")) != null && w.contains(x) || m();
1449
1449
  }, 300);
1450
- }, C = (w) => {
1451
- w.key === "Escape" && m();
1450
+ }, b = (x) => {
1451
+ x.key === "Escape" && m();
1452
1452
  };
1453
- return p.addEventListener("focusout", f), p.addEventListener("keydown", C), () => {
1454
- p.removeEventListener("focusout", f), p.removeEventListener("keydown", C);
1453
+ return p.addEventListener("focusout", h), p.addEventListener("keydown", b), () => {
1454
+ p.removeEventListener("focusout", h), p.removeEventListener("keydown", b);
1455
1455
  };
1456
1456
  }, [s, m]), B(() => {
1457
1457
  !s && a.current && a.current.value !== e.attrs.latex && (a.current.value = e.attrs.latex ?? "");
1458
1458
  }, [e.attrs.latex, s]);
1459
- let h = "";
1459
+ let g = "";
1460
1460
  try {
1461
- h = hr.renderToString(e.attrs.latex || "", {
1461
+ g = hr.renderToString(e.attrs.latex || "", {
1462
1462
  throwOnError: !1,
1463
- displayMode: c
1463
+ displayMode: l
1464
1464
  });
1465
1465
  } catch {
1466
- h = e.attrs.latex || "";
1466
+ g = e.attrs.latex || "";
1467
1467
  }
1468
- return /* @__PURE__ */ g(
1468
+ return /* @__PURE__ */ f(
1469
1469
  An,
1470
1470
  {
1471
- as: c ? "div" : "span",
1472
- className: c ? "math-block" : "math-inline",
1473
- children: s ? /* @__PURE__ */ g(
1471
+ as: l ? "div" : "span",
1472
+ className: l ? "math-block" : "math-inline",
1473
+ children: s ? /* @__PURE__ */ f(
1474
1474
  "math-field",
1475
1475
  {
1476
1476
  ref: a,
1477
- className: c ? "math-live-field math-live-field--block" : "math-live-field",
1477
+ className: l ? "math-live-field math-live-field--block" : "math-live-field",
1478
1478
  children: e.attrs.latex
1479
1479
  }
1480
1480
  ) : /* @__PURE__ */ A("span", { className: "math-preview", onClick: u, children: [
1481
- /* @__PURE__ */ g("span", { dangerouslySetInnerHTML: { __html: h } }),
1482
- /* @__PURE__ */ g("span", { className: "math-tooltip", children: "点击编辑" })
1481
+ /* @__PURE__ */ f("span", { dangerouslySetInnerHTML: { __html: g } }),
1482
+ /* @__PURE__ */ f("span", { className: "math-tooltip", children: "点击编辑" })
1483
1483
  ] })
1484
1484
  }
1485
1485
  );
1486
- }, _a = ee.create({
1486
+ }, ka = ee.create({
1487
1487
  name: "math_inline",
1488
1488
  group: "inline",
1489
1489
  inline: !0,
@@ -1509,7 +1509,7 @@ const Oe = () => {
1509
1509
  return ["span", ae(e, { "data-type": "math_inline" })];
1510
1510
  },
1511
1511
  addNodeView() {
1512
- return qt(ln, {
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;
@@ -1532,7 +1532,7 @@ const Oe = () => {
1532
1532
  return ["div", ae(e, { "data-type": "math_block" })];
1533
1533
  },
1534
1534
  addNodeView() {
1535
- return qt(ln, {
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;
@@ -1542,7 +1542,7 @@ const Oe = () => {
1542
1542
  }), La = {
1543
1543
  name: "math",
1544
1544
  version: "1.0.0",
1545
- extensions: [_a, Aa],
1545
+ extensions: [ka, Aa],
1546
1546
  toolbarItems: [
1547
1547
  {
1548
1548
  id: "math-inline-insert",
@@ -1588,11 +1588,11 @@ const Oe = () => {
1588
1588
  }, bt = (e, t, n = {}) => {
1589
1589
  const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size;
1590
1590
  let s = null;
1591
- return e.state.doc.nodesBetween(r, a, (i, c) => s ? !1 : i.type.name === t ? (s = { node: i, pos: c }, !1) : !0), s;
1592
- }, yt = (e, t, n = {}) => {
1591
+ return e.state.doc.nodesBetween(r, a, (i, l) => s ? !1 : i.type.name === t ? (s = { node: i, pos: l }, !1) : !0), s;
1592
+ }, vt = (e, t, n = {}) => {
1593
1593
  const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size, s = [];
1594
- return e.state.doc.nodesBetween(r, a, (i, c) => (t(i, c) && s.push({ node: i, pos: c }), !0)), s;
1595
- }, be = (e, t) => {
1594
+ return e.state.doc.nodesBetween(r, a, (i, l) => (t(i, l) && s.push({ node: i, pos: l }), !0)), s;
1595
+ }, ye = (e, t) => {
1596
1596
  const { $from: n } = e.state.selection;
1597
1597
  for (let r = n.depth; r >= 0; r -= 1) {
1598
1598
  const a = n.node(r);
@@ -1614,7 +1614,7 @@ const Oe = () => {
1614
1614
  };
1615
1615
  }
1616
1616
  return null;
1617
- }, Ra = (e, t) => e.state.schema.nodes[t] || null, Da = (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,40 +1622,40 @@ const Oe = () => {
1622
1622
  content: t
1623
1623
  };
1624
1624
  }, Ve = (e, t) => {
1625
- const n = Da(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
- var l;
1629
- const s = typeof t.position == "number" ? t.position : (l = bt(e, t.type || "")) == null ? void 0 : l.pos;
1628
+ var c;
1629
+ const s = typeof t.position == "number" ? t.position : (c = bt(e, t.type || "")) == null ? void 0 : c.pos;
1630
1630
  if (typeof s != "number")
1631
1631
  return !1;
1632
1632
  const i = r.doc.nodeAt(s);
1633
1633
  if (!i || t.type && i.type.name !== t.type)
1634
1634
  return !1;
1635
- const c = { ...i.attrs, ...t.attrs };
1636
- return n.setNodeMarkup(s, void 0, c), a && a(n), !0;
1637
- }), vt = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1638
- var c;
1639
- const s = typeof t.position == "number" ? t.position : (c = bt(e, t.type || "")) == null ? void 0 : c.pos;
1635
+ const l = { ...i.attrs, ...t.attrs };
1636
+ return n.setNodeMarkup(s, void 0, l), a && a(n), !0;
1637
+ }), Ct = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1638
+ var l;
1639
+ const s = typeof t.position == "number" ? t.position : (l = bt(e, t.type || "")) == null ? void 0 : l.pos;
1640
1640
  if (typeof s != "number")
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
1644
  }), dn = (e, t) => {
1645
- const n = Ra(e, t.type);
1645
+ const n = Da(e, t.type);
1646
1646
  return n ? e.commands.command(({ tr: r, state: a, dispatch: s }) => {
1647
- const { from: i, to: c } = a.selection, l = a.selection.$from.blockRange(a.selection.$to);
1648
- if (!l)
1647
+ const { from: i, to: l } = a.selection, c = a.selection.$from.blockRange(a.selection.$to);
1648
+ if (!c)
1649
1649
  return !1;
1650
- const d = br(l, n, t.attrs);
1651
- return d ? (r.wrap(l, d), s && s(r.scrollIntoView()), i <= c) : !1;
1650
+ const d = yr(c, n, t.attrs);
1651
+ return d ? (r.wrap(c, d), s && s(r.scrollIntoView()), i <= l) : !1;
1652
1652
  }) : !1;
1653
- }, Ma = (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" ? vt(e, r.payload) : dn(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
1661
  }, $a = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Oa = ee.create({
@@ -1684,13 +1684,13 @@ const Oe = () => {
1684
1684
  addKeyboardShortcuts() {
1685
1685
  return {
1686
1686
  Enter: () => {
1687
- const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection, a = At(n);
1687
+ const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection, a = Lt(n);
1688
1688
  if (a === null) return !1;
1689
- const s = n.node(a), c = n.before(a) + s.nodeSize;
1690
- if (!r || n.pos !== c - 1) return !1;
1691
- const l = c;
1689
+ const s = n.node(a), l = n.before(a) + s.nodeSize;
1690
+ if (!r || n.pos !== l - 1) return !1;
1691
+ const c = l;
1692
1692
  let d = 0;
1693
- e.doc.descendants((h) => (h.type.name === "claim" && d++, !0));
1693
+ e.doc.descendants((g) => (g.type.name === "claim" && d++, !0));
1694
1694
  const o = e.schema.nodes.claim.create(
1695
1695
  {
1696
1696
  number: d + 1,
@@ -1698,19 +1698,19 @@ const Oe = () => {
1698
1698
  dependsOn: [],
1699
1699
  dependsOnClaimIds: []
1700
1700
  }
1701
- ), u = e.tr.insert(l, o), m = l + 1;
1701
+ ), u = e.tr.insert(c, o), m = c + 1;
1702
1702
  return u.setSelection(Ie.create(u.doc, m)), t(u), !0;
1703
1703
  },
1704
1704
  Backspace: () => {
1705
1705
  const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection;
1706
1706
  if (!r) return !1;
1707
- const a = At(n);
1707
+ const a = Lt(n);
1708
1708
  if (a === null) return !1;
1709
1709
  const s = n.node(a);
1710
1710
  if (s.content.size > 0) return !1;
1711
1711
  let i = 0;
1712
1712
  if (e.doc.descendants((m) => (m.type.name === "claim" && i++, !0)), i <= 1) return !1;
1713
- const c = n.before(a), l = c + s.nodeSize, d = e.tr.delete(c, l), o = Math.min(c, d.doc.content.size), u = d.doc.resolve(o);
1713
+ const l = n.before(a), c = l + s.nodeSize, d = e.tr.delete(l, c), o = Math.min(l, d.doc.content.size), u = d.doc.resolve(o);
1714
1714
  return d.setSelection(Ie.near(u)), t(d), !0;
1715
1715
  }
1716
1716
  };
@@ -1724,31 +1724,31 @@ const Oe = () => {
1724
1724
  s.className = "claim-label", s.contentEditable = "false";
1725
1725
  const i = document.createElement("span");
1726
1726
  i.className = "claim-body";
1727
- const c = () => {
1727
+ const l = () => {
1728
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 l = k.getState().editorLanguage;
1731
+ let c = k.getState().editorLanguage;
1732
1732
  const d = k.subscribe((o) => {
1733
- o.editorLanguage !== l && (l = o.editorLanguage, c());
1733
+ o.editorLanguage !== c && (c = o.editorLanguage, l());
1734
1734
  });
1735
1735
  return a.addEventListener("mousedown", (o) => {
1736
1736
  const u = o.target;
1737
1737
  if (!(u instanceof HTMLElement) || u === i || i.contains(u)) return;
1738
1738
  const m = typeof n == "function" ? n() : null;
1739
1739
  if (typeof m != "number") return;
1740
- const h = m + r.nodeSize - 1, p = Ie.create(e.state.doc, h);
1740
+ const g = m + r.nodeSize - 1, p = Ie.create(e.state.doc, g);
1741
1741
  e.view.dispatch(e.state.tr.setSelection(p));
1742
- }), a.append(s, i), c(), {
1742
+ }), a.append(s, i), l(), {
1743
1743
  dom: a,
1744
1744
  contentDOM: i,
1745
- update: (o) => o.type.name !== "claim" ? !1 : (r = o, c(), !0),
1745
+ update: (o) => o.type.name !== "claim" ? !1 : (r = o, l(), !0),
1746
1746
  destroy: () => d()
1747
1747
  };
1748
1748
  };
1749
1749
  }
1750
1750
  });
1751
- function At(e) {
1751
+ function Lt(e) {
1752
1752
  for (let t = e.depth; t >= 0; t--)
1753
1753
  if (e.node(t).type.name === "claim") return t;
1754
1754
  return null;
@@ -1756,11 +1756,11 @@ function At(e) {
1756
1756
  let Fe = 0;
1757
1757
  const dt = [];
1758
1758
  let ze = !1;
1759
- const Fa = 2e4, Lt = 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
- function Pt() {
1763
- ce && (window.removeEventListener("message", ce), ce = null), G && (G.src = "about:blank", G.remove(), G = null), je = !1;
1762
+ function Dt() {
1763
+ ce && (window.removeEventListener("message", ce), ce = null), q && (q.src = "about:blank", q.remove(), q = null), je = !1;
1764
1764
  }
1765
1765
  function za(e, t) {
1766
1766
  const n = ut.get(e);
@@ -1775,34 +1775,34 @@ function mt() {
1775
1775
  ze = !0, xe && (clearTimeout(xe), xe = null);
1776
1776
  const { xml: e, callback: t } = dt.shift(), n = ut.get(e);
1777
1777
  if (n) {
1778
- t(n), ze = !1, xe = setTimeout(Pt, Lt), mt();
1778
+ t(n), ze = !1, xe = setTimeout(Dt, Pt), mt();
1779
1779
  return;
1780
1780
  }
1781
1781
  ce && (window.removeEventListener("message", ce), ce = null);
1782
1782
  let r = null;
1783
1783
  const a = (i) => {
1784
- r && (clearTimeout(r), r = null), i && ut.set(e, i), t(i), ze = !1, xe = setTimeout(Pt, Lt), mt();
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
- var l;
1794
- if (!G || i.source !== G.contentWindow) return;
1795
- let c;
1793
+ var c;
1794
+ if (!q || i.source !== q.contentWindow) return;
1795
+ let l;
1796
1796
  try {
1797
- c = typeof i.data == "string" ? JSON.parse(i.data) : i.data;
1797
+ l = typeof i.data == "string" ? JSON.parse(i.data) : i.data;
1798
1798
  } catch {
1799
1799
  return;
1800
1800
  }
1801
- c.event === "init" ? (je = !0, s()) : c.event === "load" ? (l = G.contentWindow) == null || l.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
- ) : c.event === "export" && a(c.data || "");
1805
- }, window.addEventListener("message", ce), r = setTimeout(() => a(""), Fa), 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");
1804
+ ) : l.event === "export" && a(l.data || "");
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) => {
@@ -1839,10 +1839,10 @@ const Be = () => {
1839
1839
  let r = t, a = !1, s = !1;
1840
1840
  const i = document.createElement("figure");
1841
1841
  i.setAttribute("data-type", "figure"), i.className = "figure-block";
1842
- const c = document.createElement("div");
1843
- c.className = "figure-visual", c.contentEditable = "false", c.setAttribute("spellcheck", "false");
1844
- const l = document.createElement("img");
1845
- l.className = "figure-img-preview";
1842
+ const l = document.createElement("div");
1843
+ l.className = "figure-visual", l.contentEditable = "false", l.setAttribute("spellcheck", "false");
1844
+ const c = document.createElement("img");
1845
+ c.className = "figure-img-preview";
1846
1846
  const d = document.createElement("div");
1847
1847
  d.className = "figure-upload-area";
1848
1848
  const o = document.createElement("span");
@@ -1851,87 +1851,87 @@ const Be = () => {
1851
1851
  u.type = "file", u.accept = "image/*", u.style.display = "none";
1852
1852
  const m = document.createElement("button");
1853
1853
  m.className = "figure-replace-btn", d.append(o, u);
1854
- const h = document.createElement("div");
1855
- h.className = "figure-mermaid-view", h.contentEditable = "false", h.setAttribute("spellcheck", "false");
1854
+ const g = document.createElement("div");
1855
+ g.className = "figure-mermaid-view", g.contentEditable = "false", g.setAttribute("spellcheck", "false");
1856
1856
  const p = document.createElement("div");
1857
1857
  p.className = "figure-mermaid-preview", p.contentEditable = "false";
1858
- const f = document.createElement("div");
1859
- f.className = "figure-mermaid-view-hint", h.append(p, f);
1860
- const C = document.createElement("div");
1861
- C.className = "figure-mermaid-edit";
1862
- const w = document.createElement("textarea");
1863
- w.className = "figure-mermaid-editor", w.spellcheck = !1;
1864
- const y = document.createElement("div");
1865
- y.className = "figure-mermaid-toolbar";
1866
- const v = document.createElement("button");
1867
- v.className = "figure-mermaid-save-btn", v.type = "button";
1868
- const x = document.createElement("button");
1869
- x.className = "figure-mermaid-cancel-btn", x.type = "button";
1858
+ const h = document.createElement("div");
1859
+ h.className = "figure-mermaid-view-hint", g.append(p, h);
1860
+ const b = document.createElement("div");
1861
+ b.className = "figure-mermaid-edit";
1862
+ const x = document.createElement("textarea");
1863
+ x.className = "figure-mermaid-editor", x.spellcheck = !1;
1864
+ const v = document.createElement("div");
1865
+ v.className = "figure-mermaid-toolbar";
1866
+ const C = document.createElement("button");
1867
+ C.className = "figure-mermaid-save-btn", C.type = "button";
1868
+ const w = document.createElement("button");
1869
+ w.className = "figure-mermaid-cancel-btn", w.type = "button";
1870
1870
  const _ = document.createElement("span");
1871
- _.className = "figure-mermaid-error-inline", y.append(_, x, v), C.append(w, y);
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");
1875
1875
  P.className = "figure-drawio-preview-img", P.style.display = "none";
1876
- const b = document.createElement("div");
1877
- b.className = "figure-drawio-view-hint", L.append(P, b), c.append(l, d, m), c.append(h, C), c.append(L);
1876
+ const y = document.createElement("div");
1877
+ y.className = "figure-drawio-view-hint", L.append(P, y), l.append(c, d, m), l.append(g, b), l.append(L);
1878
1878
  const T = document.createElement("figcaption");
1879
1879
  T.className = "figure-caption";
1880
1880
  const E = document.createElement("span");
1881
1881
  E.className = "figure-id-label", E.contentEditable = "false";
1882
- const D = document.createElement("span");
1883
- D.className = "figure-caption-content", T.append(E, D), i.append(c, T);
1884
- const M = (I) => {
1882
+ const M = document.createElement("span");
1883
+ M.className = "figure-caption-content", T.append(E, M), i.append(l, T);
1884
+ const R = (I) => {
1885
1885
  const N = typeof n == "function" ? n() : null;
1886
- typeof N == "number" && e.commands.command(({ tr: R, dispatch: j }) => (R.setNodeMarkup(N, void 0, { ...r.attrs, ...I }), j && j(R), !0));
1886
+ typeof N == "number" && e.commands.command(({ tr: D, dispatch: j }) => (D.setNodeMarkup(N, void 0, { ...r.attrs, ...I }), j && j(D), !0));
1887
1887
  }, Y = (I) => {
1888
1888
  if (!I || I.length === 0) return;
1889
1889
  const N = I[0];
1890
1890
  if (!N.type.startsWith("image/")) return;
1891
- const R = new FileReader();
1892
- R.onload = () => {
1893
- typeof R.result == "string" && M({ imageSrc: R.result });
1894
- }, R.readAsDataURL(N);
1891
+ const D = new FileReader();
1892
+ D.onload = () => {
1893
+ typeof D.result == "string" && R({ imageSrc: D.result });
1894
+ }, D.readAsDataURL(N);
1895
1895
  };
1896
1896
  u.addEventListener("change", () => Y(u.files)), d.addEventListener("click", () => u.click()), m.addEventListener("click", (I) => {
1897
1897
  I.stopPropagation(), u.click();
1898
- }), c.addEventListener("dragover", (I) => {
1898
+ }), l.addEventListener("dragover", (I) => {
1899
1899
  r.attrs.contentType === "image" && (I.preventDefault(), I.stopPropagation(), d.classList.add("figure-upload-area--dragover"));
1900
- }), c.addEventListener("dragleave", () => {
1900
+ }), l.addEventListener("dragleave", () => {
1901
1901
  d.classList.remove("figure-upload-area--dragover");
1902
- }), c.addEventListener("drop", (I) => {
1902
+ }), l.addEventListener("drop", (I) => {
1903
1903
  var N;
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, w.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", _.textContent = "", _.style.display = "none", se(), requestAnimationFrame(() => w.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
- const I = w.value;
1911
+ const I = x.value;
1912
1912
  _.textContent = "", _.style.display = "none";
1913
1913
  const N = I.trim();
1914
1914
  if (N)
1915
1915
  try {
1916
- const R = await import("mermaid");
1917
- R.default.initialize({ startOnLoad: !1, theme: "default" }), Fe += 1;
1918
- const j = `fig-mermaid-${Fe}`, { svg: F } = await R.default.render(j, N);
1916
+ const D = await import("mermaid");
1917
+ D.default.initialize({ startOnLoad: !1, theme: "default" }), Fe += 1;
1918
+ const j = `fig-mermaid-${Fe}`, { svg: F } = await D.default.render(j, N);
1919
1919
  p.innerHTML = F, Be();
1920
1920
  } catch {
1921
1921
  Be();
1922
- const R = k.getState().editorLanguage;
1923
- _.textContent = R === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", _.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
- M({ mermaidCode: I }), a = !1, se();
1926
+ R({ mermaidCode: I }), a = !1, se();
1927
1927
  };
1928
- h.addEventListener("dblclick", (I) => {
1928
+ g.addEventListener("dblclick", (I) => {
1929
1929
  I.preventDefault(), I.stopPropagation(), Le();
1930
- }), v.addEventListener("click", (I) => {
1930
+ }), C.addEventListener("click", (I) => {
1931
1931
  I.stopPropagation(), H();
1932
- }), x.addEventListener("click", (I) => {
1932
+ }), w.addEventListener("click", (I) => {
1933
1933
  I.stopPropagation(), S();
1934
- }), w.addEventListener("mousedown", (I) => I.stopPropagation()), w.addEventListener("keydown", (I) => I.stopPropagation()), w.addEventListener("keypress", (I) => I.stopPropagation());
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
1936
  const Tn = () => {
1937
1937
  if (s) return;
@@ -1940,10 +1940,10 @@ const Be = () => {
1940
1940
  I.className = "drawio-modal-content";
1941
1941
  const N = document.createElement("div");
1942
1942
  N.className = "drawio-modal-header";
1943
- const R = document.createElement("span"), j = k.getState().editorLanguage;
1944
- R.textContent = j === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", R.className = "drawio-modal-title";
1943
+ const D = document.createElement("span"), j = k.getState().editorLanguage;
1944
+ D.textContent = j === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", D.className = "drawio-modal-title";
1945
1945
  const F = document.createElement("button");
1946
- F.className = "drawio-modal-close-btn", F.textContent = "✕", F.type = "button", F.addEventListener("click", () => et()), N.append(R, 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);
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);
1947
1947
  const Ce = j === "en" ? "en" : "zh";
1948
1948
  K.src = `https://embed.diagrams.net/?embed=1&proto=json&spin=1&lang=${Ce}`;
1949
1949
  const te = K;
@@ -1967,10 +1967,10 @@ const Be = () => {
1967
1967
  (Pe = te.contentWindow) == null || Pe.postMessage(
1968
1968
  JSON.stringify({ action: "export", format: "svg" }),
1969
1969
  "*"
1970
- ), M({ drawioXml: me });
1970
+ ), R({ drawioXml: me });
1971
1971
  } else if (J.event === "export") {
1972
1972
  const me = J.data || "";
1973
- M({ drawioSvg: me }), et();
1973
+ R({ drawioSvg: me }), et();
1974
1974
  } else J.event === "exit" && et();
1975
1975
  }, window.addEventListener("message", $);
1976
1976
  }, et = () => {
@@ -1980,10 +1980,10 @@ const Be = () => {
1980
1980
  I.preventDefault(), I.stopPropagation(), Tn();
1981
1981
  }), i.addEventListener("mousedown", (I) => {
1982
1982
  const N = I.target;
1983
- if (!(N instanceof HTMLElement) || N === D || D.contains(N) || N === w || C.contains(N) || N === d || d.contains(N) || N === m || N === u || h.contains(N) || L.contains(N)) return;
1984
- const R = typeof n == "function" ? n() : null;
1985
- if (typeof R != "number") return;
1986
- const j = R + r.nodeSize - 1, F = Ie.create(e.state.doc, j);
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;
1984
+ const D = typeof n == "function" ? n() : null;
1985
+ if (typeof D != "number") return;
1986
+ const j = D + r.nodeSize - 1, F = Ie.create(e.state.doc, j);
1987
1987
  e.view.dispatch(e.state.tr.setSelection(F));
1988
1988
  });
1989
1989
  let tt = !1, ve = "";
@@ -1995,9 +1995,9 @@ const Be = () => {
1995
1995
  return;
1996
1996
  }
1997
1997
  try {
1998
- const R = await import("mermaid");
1999
- R.default.initialize({ startOnLoad: !1, theme: "default" }), Fe += 1;
2000
- const j = `fig-mermaid-${Fe}`, { svg: F } = await R.default.render(j, N);
1998
+ const D = await import("mermaid");
1999
+ D.default.initialize({ startOnLoad: !1, theme: "default" }), Fe += 1;
2000
+ const j = `fig-mermaid-${Fe}`, { svg: F } = await D.default.render(j, N);
2001
2001
  p.innerHTML = F, ve = N;
2002
2002
  } catch {
2003
2003
  p.innerHTML = "", ve = "";
@@ -2006,33 +2006,33 @@ const Be = () => {
2006
2006
  }
2007
2007
  }
2008
2008
  }, se = () => {
2009
- const I = k.getState().editorLanguage, N = U(I), R = ["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
- const te = R === "image", ne = R === "mermaid", J = R === "drawio";
2012
- l.style.display = te && F ? "block" : "none", d.style.display = te && !F ? "flex" : "none", m.style.display = te && F ? "block" : "none", h.style.display = ne && !a ? "block" : "none", C.style.display = ne && a ? "block" : "none", L.style.display = J ? "flex" : "none", te && F && (l.src = F);
2011
+ const te = D === "image", ne = D === "mermaid", J = D === "drawio";
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
- J && (ue ? (P.src = ue, P.style.display = "block") : (P.src = "", P.style.display = "none")), o.textContent = N.figureUploadHint || "点击上传或拖拽图片", m.textContent = N.figureReplaceImage || "更换图片", v.textContent = N.mermaidSaveAndRender || "保存并渲染", x.textContent = N.mermaidCancel || "取消";
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 ? (f.textContent = N.mermaidDoubleClickToEdit || "双击编辑", f.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (f.textContent = N.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", f.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), J && !s && (ue ? (b.textContent = N.mermaidDoubleClickToEdit || "双击编辑", b.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (b.textContent = N.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", b.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), ne && !a && Ce.trim() !== ve && In(Ce);
2017
- const xt = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
2018
- J && xt && !ue && !tt && !s && (tt = !0, za(xt, (St) => {
2019
- St && M({ drawioSvg: St }), tt = !1;
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
+ const St = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
2018
+ J && St && !ue && !tt && !s && (tt = !0, za(St, (Tt) => {
2019
+ Tt && R({ drawioSvg: Tt }), tt = !1;
2020
2020
  }));
2021
2021
  };
2022
- let wt = k.getState().editorLanguage;
2022
+ let xt = k.getState().editorLanguage;
2023
2023
  const En = k.subscribe((I) => {
2024
- I.editorLanguage !== wt && (wt = I.editorLanguage, se());
2024
+ I.editorLanguage !== xt && (xt = I.editorLanguage, se());
2025
2025
  });
2026
2026
  return se(), {
2027
2027
  dom: i,
2028
- contentDOM: D,
2028
+ contentDOM: M,
2029
2029
  stopEvent: (I) => {
2030
2030
  const N = I.target;
2031
- return !!(N === w || C.contains(N) || N === u);
2031
+ return !!(N === x || b.contains(N) || N === u);
2032
2032
  },
2033
2033
  ignoreMutation: (I) => {
2034
2034
  const N = I.target;
2035
- return !!(c.contains(N) || E.contains(N));
2035
+ return !!(l.contains(N) || E.contains(N));
2036
2036
  },
2037
2037
  update: (I) => I.type.name !== "figure" ? !1 : (r = I, se(), !0),
2038
2038
  destroy: () => {
@@ -2102,7 +2102,7 @@ const Be = () => {
2102
2102
  return ({ node: e, editor: t }) => {
2103
2103
  let n = e;
2104
2104
  const r = document.createElement("span"), a = () => {
2105
- const s = n.attrs.lang === "en" ? "en" : "zh", i = U(s), c = n.attrs.targetType === "figure" ? "figure" : "claim", l = Number(n.attrs.resolvedNumber), d = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, o = c === "figure" ? d || (s === "en" ? "Figure ?" : "附图?") : Number.isFinite(l) ? i.claimLabel(l) : s === "en" ? "Claim ?" : "权利要求?", u = n.attrs.displayText || o;
2105
+ const s = n.attrs.lang === "en" ? "en" : "zh", i = U(s), l = n.attrs.targetType === "figure" ? "figure" : "claim", c = Number(n.attrs.resolvedNumber), d = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, o = l === "figure" ? d || (s === "en" ? "Figure ?" : "附图?") : Number.isFinite(c) ? i.claimLabel(c) : s === "en" ? "Claim ?" : "权利要求?", u = n.attrs.displayText || o;
2106
2106
  r.textContent = u, r.className = `reference-link${n.attrs.invalid ? " reference-link-invalid" : ""}`, r.setAttribute("data-type", "reference"), r.setAttribute("data-highlight", n.attrs.highlight ? "true" : "false"), r.title = n.attrs.invalid ? i.referenceNavigateDisabledTitle : i.referenceNavigateTitle;
2107
2107
  };
2108
2108
  return a(), r.addEventListener("click", () => {
@@ -2111,20 +2111,20 @@ const Be = () => {
2111
2111
  return;
2112
2112
  let i = null;
2113
2113
  if (s === "figure") {
2114
- const c = typeof n.attrs.targetFigureId == "string" ? n.attrs.targetFigureId : "";
2115
- if (!c)
2114
+ const l = typeof n.attrs.targetFigureId == "string" ? n.attrs.targetFigureId : "";
2115
+ if (!l)
2116
2116
  return;
2117
- t.state.doc.descendants((l, d) => l.type.name !== "figure" ? !0 : l.attrs.id === c ? (i = d, !1) : !0), typeof i == "number" && t.chain().focus().setTextSelection(i + 1).run();
2117
+ t.state.doc.descendants((c, d) => c.type.name !== "figure" ? !0 : c.attrs.id === l ? (i = d, !1) : !0), typeof i == "number" && t.chain().focus().setTextSelection(i + 1).run();
2118
2118
  return;
2119
2119
  }
2120
- n.attrs.targetClaimId && (t.state.doc.descendants((c, l) => c.type.name !== "claim" ? !0 : c.attrs.claimId === n.attrs.targetClaimId ? (i = l, !1) : !0), typeof i == "number" && t.chain().focus().setTextSelection(i + 1).run());
2120
+ n.attrs.targetClaimId && (t.state.doc.descendants((l, c) => l.type.name !== "claim" ? !0 : l.attrs.claimId === n.attrs.targetClaimId ? (i = c, !1) : !0), typeof i == "number" && t.chain().focus().setTextSelection(i + 1).run());
2121
2121
  }), {
2122
2122
  dom: r,
2123
2123
  update: (s) => s.type.name !== this.name ? !1 : (n = s, a(), !0)
2124
2124
  };
2125
2125
  };
2126
2126
  }
2127
- }), Rt = {
2127
+ }), Mt = {
2128
2128
  technical_field: "sectionTitle_technical_field",
2129
2129
  background_art: "sectionTitle_background_art",
2130
2130
  summary: "sectionTitle_summary",
@@ -2156,14 +2156,14 @@ const Be = () => {
2156
2156
  "summary",
2157
2157
  "drawing_description",
2158
2158
  "detailed_description"
2159
- ]), Ct = (e) => {
2159
+ ]), wt = (e) => {
2160
2160
  if (e.isText)
2161
2161
  return (e.text ?? "").trim().length > 0;
2162
2162
  if (e.isAtom || e.isLeaf || !["patent_section", "patent_title", "paragraph"].includes(e.type.name))
2163
2163
  return !0;
2164
2164
  let t = !1;
2165
2165
  return e.forEach((n) => {
2166
- !t && Ct(n) && (t = !0);
2166
+ !t && wt(n) && (t = !0);
2167
2167
  }), t;
2168
2168
  }, Wa = ee.create({
2169
2169
  name: "patent_title",
@@ -2194,41 +2194,41 @@ const Be = () => {
2194
2194
  s.className = "pb-heading", s.contentEditable = "false";
2195
2195
  const i = document.createElement("div");
2196
2196
  i.className = "ps-placeholder", i.contentEditable = "false";
2197
- const c = document.createElement("h1");
2198
- c.className = "pt-title-content", a.append(s, i, c);
2199
- const l = () => {
2200
- const f = typeof n == "function" ? n() : null;
2201
- return typeof f == "number" ? f : null;
2197
+ const l = document.createElement("h1");
2198
+ l.className = "pt-title-content", a.append(s, i, l);
2199
+ const c = () => {
2200
+ const h = typeof n == "function" ? n() : null;
2201
+ return typeof h == "number" ? h : null;
2202
2202
  }, d = () => {
2203
- const f = l();
2204
- f !== null && k.getState().setActiveSection("patent_title", f);
2203
+ const h = c();
2204
+ h !== null && k.getState().setActiveSection("patent_title", h);
2205
2205
  }, o = () => {
2206
- const f = l();
2207
- f !== null && (k.getState().openDraftingPanel("patent_title", f), e.commands.focus(f + 1));
2206
+ const h = c();
2207
+ h !== null && (k.getState().openDraftingPanel("patent_title", h), e.commands.focus(h + 1));
2208
2208
  };
2209
- i.addEventListener("click", o), c.addEventListener("focusin", d), c.addEventListener("click", d);
2209
+ i.addEventListener("click", o), l.addEventListener("focusin", d), l.addEventListener("click", d);
2210
2210
  const u = () => {
2211
- const f = k.getState(), C = U(f.editorLanguage), w = typeof C.bookTitle_description == "string" ? C.bookTitle_description : "说明书", y = typeof C.patentTitlePlaceholder == "string" ? C.patentTitlePlaceholder : "专利名称";
2212
- s.textContent = w;
2213
- const v = Ct(r), x = f.rightPanel.activeSectionPos === l();
2214
- i.textContent = `[${y}]`, i.style.display = v ? "none" : "", i.classList.toggle("ps-placeholder--active", x && !v), c.classList.toggle("pt-title-content--has-content", v);
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
+ s.textContent = x;
2213
+ const C = wt(r), w = h.rightPanel.activeSectionPos === c();
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 = k.getState().editorLanguage, h = k.getState().rightPanel.activeSectionPos;
2217
- const p = k.subscribe((f) => {
2218
- const C = f.editorLanguage !== m, w = f.rightPanel.activeSectionPos !== h;
2219
- m = f.editorLanguage, h = f.rightPanel.activeSectionPos, (C || w) && u();
2216
+ let m = k.getState().editorLanguage, g = k.getState().rightPanel.activeSectionPos;
2217
+ const p = k.subscribe((h) => {
2218
+ const b = h.editorLanguage !== m, x = h.rightPanel.activeSectionPos !== g;
2219
+ m = h.editorLanguage, g = h.rightPanel.activeSectionPos, (b || x) && u();
2220
2220
  });
2221
2221
  return u(), {
2222
2222
  dom: a,
2223
- contentDOM: c,
2224
- update: (f) => f.type.name !== "patent_title" ? !1 : (r = f, u(), !0),
2223
+ contentDOM: l,
2224
+ update: (h) => h.type.name !== "patent_title" ? !1 : (r = h, u(), !0),
2225
2225
  destroy: () => {
2226
- p(), i.removeEventListener("click", o), c.removeEventListener("focusin", d), c.removeEventListener("click", d);
2226
+ p(), i.removeEventListener("click", o), l.removeEventListener("focusin", d), l.removeEventListener("click", d);
2227
2227
  }
2228
2228
  };
2229
2229
  };
2230
2230
  }
2231
- }), qa = ee.create({
2231
+ }), Ga = ee.create({
2232
2232
  name: "patent_section",
2233
2233
  group: "block",
2234
2234
  content: "block+",
@@ -2264,11 +2264,11 @@ const Be = () => {
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 yr(n, t.openStart, t.openEnd);
2271
+ return new br(n, t.openStart, t.openEnd);
2272
2272
  }
2273
2273
  },
2274
2274
  filterTransaction: (t, n) => {
@@ -2295,59 +2295,59 @@ const Be = () => {
2295
2295
  s.contentEditable = "false";
2296
2296
  const i = document.createElement("div");
2297
2297
  i.className = "ps-body";
2298
- const c = document.createElement("div");
2299
- c.className = "ps-placeholder", c.contentEditable = "false";
2300
2298
  const l = document.createElement("div");
2301
- l.className = "ps-content";
2299
+ l.className = "ps-placeholder", l.contentEditable = "false";
2300
+ const c = document.createElement("div");
2301
+ c.className = "ps-content";
2302
2302
  const d = document.createElement("button");
2303
- d.type = "button", d.className = "claim-add-btn", d.contentEditable = "false", i.append(c, l, d), a.append(s, i);
2303
+ d.type = "button", d.className = "claim-add-btn", d.contentEditable = "false", i.append(l, c, d), a.append(s, i);
2304
2304
  const o = () => {
2305
- const y = typeof n == "function" ? n() : null;
2306
- return typeof y == "number" ? y : null;
2305
+ const v = typeof n == "function" ? n() : null;
2306
+ return typeof v == "number" ? v : null;
2307
2307
  }, u = () => {
2308
- const y = o();
2309
- if (y === null) return;
2310
- k.getState().setActiveSection(r.attrs.sectionType, y);
2308
+ const v = o();
2309
+ if (v === null) return;
2310
+ k.getState().setActiveSection(r.attrs.sectionType, v);
2311
2311
  }, m = () => {
2312
- const y = o();
2313
- if (y === null) return;
2314
- k.getState().openDraftingPanel(r.attrs.sectionType, y), e.commands.focus(y + 1);
2315
- }, h = (y) => {
2316
- y.preventDefault(), y.stopPropagation();
2317
- const v = `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
2318
- let x = 0;
2319
- e.state.doc.descendants((E) => (E.type.name === "claim" && x++, !0));
2312
+ const v = o();
2313
+ if (v === null) return;
2314
+ k.getState().openDraftingPanel(r.attrs.sectionType, v), e.commands.focus(v + 1);
2315
+ }, g = (v) => {
2316
+ v.preventDefault(), v.stopPropagation();
2317
+ const C = `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
2318
+ let w = 0;
2319
+ e.state.doc.descendants((E) => (E.type.name === "claim" && w++, !0));
2320
2320
  const _ = o();
2321
2321
  if (_ === null) return;
2322
2322
  const L = _ + r.nodeSize - 1, P = e.state.schema.nodes.claim.create({
2323
- number: x + 1,
2324
- claimId: v,
2323
+ number: w + 1,
2324
+ claimId: C,
2325
2325
  dependsOn: [],
2326
2326
  dependsOnClaimIds: []
2327
- }), b = e.state.tr.insert(L, P), T = L + 1;
2328
- b.setSelection(Ie.create(b.doc, T)), e.view.dispatch(b), e.view.focus();
2327
+ }), y = e.state.tr.insert(L, P), T = L + 1;
2328
+ y.setSelection(Ie.create(y.doc, T)), e.view.dispatch(y), e.view.focus();
2329
2329
  };
2330
- c.addEventListener("click", m), l.addEventListener("focusin", u), l.addEventListener("click", u), d.addEventListener("mousedown", h);
2330
+ l.addEventListener("click", m), c.addEventListener("focusin", u), c.addEventListener("click", u), d.addEventListener("mousedown", g);
2331
2331
  const p = () => {
2332
- const y = k.getState(), v = U(y.editorLanguage), x = Object.keys(Rt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", _ = Ua.has(x), L = ja.has(x), P = x === "claims", b = Rt[x], T = typeof v[b] == "string" ? v[b] : x, E = Ct(r), D = y.rightPanel.activeSectionPos === o();
2333
- a.className = `ps${E ? "" : " ps--empty"}${L ? " ps--sub" : ""}`, a.setAttribute("data-section-type", x), s.className = _ ? "pb-heading" : "ps-heading ps-heading--sub", s.textContent = T, c.textContent = `[${T}]`, c.style.display = E ? "none" : "", c.classList.toggle("ps-placeholder--active", D && !E), l.classList.toggle("ps-content--has-content", E), P ? (d.style.display = "", d.textContent = y.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 f = k.getState().editorLanguage, C = k.getState().rightPanel.activeSectionPos;
2336
- const w = k.subscribe((y) => {
2337
- const v = y.editorLanguage !== f, x = y.rightPanel.activeSectionPos !== C;
2338
- f = y.editorLanguage, C = y.rightPanel.activeSectionPos, (v || x) && p();
2335
+ let h = k.getState().editorLanguage, b = k.getState().rightPanel.activeSectionPos;
2336
+ const x = k.subscribe((v) => {
2337
+ const C = v.editorLanguage !== h, w = v.rightPanel.activeSectionPos !== b;
2338
+ h = v.editorLanguage, b = v.rightPanel.activeSectionPos, (C || w) && p();
2339
2339
  });
2340
2340
  return p(), {
2341
2341
  dom: a,
2342
- contentDOM: l,
2343
- update: (y) => y.type.name !== "patent_section" ? !1 : (r = y, p(), !0),
2342
+ contentDOM: c,
2343
+ update: (v) => v.type.name !== "patent_section" ? !1 : (r = v, p(), !0),
2344
2344
  destroy: () => {
2345
- w(), c.removeEventListener("click", m), l.removeEventListener("focusin", u), l.removeEventListener("click", u), d.removeEventListener("mousedown", h);
2345
+ x(), l.removeEventListener("click", m), c.removeEventListener("focusin", u), c.removeEventListener("click", u), d.removeEventListener("mousedown", g);
2346
2346
  }
2347
2347
  };
2348
2348
  };
2349
2349
  }
2350
- }), Ga = [
2350
+ }), qa = [
2351
2351
  "abstract",
2352
2352
  // 说明书摘要
2353
2353
  "abstract_drawing"
@@ -2382,22 +2382,22 @@ const Be = () => {
2382
2382
  type: "patent_title",
2383
2383
  content: []
2384
2384
  }), Xa = () => [
2385
- ...Ga.map(We),
2385
+ ...qa.map(We),
2386
2386
  un(),
2387
2387
  ...Va.map(We),
2388
2388
  ...Ka.map(We)
2389
2389
  ], Qa = () => [
2390
2390
  un(),
2391
2391
  ...Ja.map(We)
2392
- ], mn = (e = "invention") => ({ type: "doc", content: e === "design" ? Qa() : Xa() }), Dt = 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) => yt(e, (t) => t.type.name === "claim"), ke = (e) => yt(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(), Mt = (e) => {
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
2399
  const n = k.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
2400
- ke(e).forEach((s) => {
2400
+ _e(e).forEach((s) => {
2401
2401
  const i = Z(s.node.attrs.id);
2402
2402
  i && r.add(i);
2403
2403
  });
@@ -2406,24 +2406,24 @@ const Be = () => {
2406
2406
  a += 1;
2407
2407
  return `${n}${a}`;
2408
2408
  }, Ya = /^(Fig\.|图)(\d+)$/, Za = (e) => {
2409
- const n = k.getState().editorLanguage === "en" ? "Fig." : "图", r = ke(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
- for (const c of r) {
2414
- const l = Z(c.node.attrs.id);
2415
- if (!Ya.exec(l)) continue;
2413
+ for (const l of r) {
2414
+ const c = Z(l.node.attrs.id);
2415
+ if (!Ya.exec(c)) continue;
2416
2416
  const o = `${n}${s}`;
2417
- l !== o && a.push({ pos: c.pos, expectedId: o, currentId: l }), s++;
2417
+ c !== o && a.push({ pos: l.pos, expectedId: o, currentId: c }), s++;
2418
2418
  }
2419
2419
  if (a.length === 0) return;
2420
2420
  const { tr: i } = e.state;
2421
- for (const c of a) {
2422
- const l = i.doc.nodeAt(c.pos);
2423
- !l || l.type.name !== "figure" || i.setNodeMarkup(c.pos, void 0, { ...l.attrs, id: c.expectedId });
2421
+ for (const l of a) {
2422
+ const c = i.doc.nodeAt(l.pos);
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);
@@ -2433,7 +2433,7 @@ const Be = () => {
2433
2433
  return [];
2434
2434
  const t = e.map((n) => typeof n == "string" ? n.trim() : "").filter(Boolean);
2435
2435
  return Array.from(new Set(t));
2436
- }, $t = (e, t) => {
2436
+ }, Ot = (e, t) => {
2437
2437
  if (e.length !== t.length)
2438
2438
  return !1;
2439
2439
  for (let n = 0; n < e.length; n += 1)
@@ -2462,16 +2462,16 @@ const Be = () => {
2462
2462
  });
2463
2463
  });
2464
2464
  });
2465
- const a = new Map(e.map((d) => [d.claimId, d.dependsOnClaimIds])), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = (d) => {
2465
+ const a = new Map(e.map((d) => [d.claimId, d.dependsOnClaimIds])), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), c = (d) => {
2466
2466
  if (i.has(d)) {
2467
- c.add(d);
2467
+ l.add(d);
2468
2468
  return;
2469
2469
  }
2470
2470
  if (s.has(d))
2471
2471
  return;
2472
- s.add(d), i.add(d), (a.get(d) || []).forEach((u) => l(u)), i.delete(d);
2472
+ s.add(d), i.add(d), (a.get(d) || []).forEach((u) => c(u)), i.delete(d);
2473
2473
  };
2474
- return e.forEach((d) => l(d.claimId)), c.forEach((d) => {
2474
+ return e.forEach((d) => c(d.claimId)), l.forEach((d) => {
2475
2475
  const o = e.find((u) => u.claimId === d);
2476
2476
  o && t.push({
2477
2477
  claimId: d,
@@ -2482,35 +2482,35 @@ 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 : "", h = m && !n.has(m) ? m : fn();
2486
- return n.add(h), { pos: o.pos, node: o.node, claimId: h, number: u + 1 };
2485
+ const m = typeof o.node.attrs.claimId == "string" ? o.node.attrs.claimId : "", g = m && !n.has(m) ? m : fn();
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), h = qe(o.node.attrs.dependsOn).map((y) => a.get(y)).filter((y) => typeof y == "string"), f = (u.length > 0 ? u : h).filter((y, v, x) => x.indexOf(y) === v).filter((y) => y !== o.claimId && s.has(y)), C = f.map((y) => s.get(y)).filter((y) => typeof y == "number").sort((y, v) => y - v), w = {
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,
2496
- dependsOn: C,
2497
- dependsOnClaimIds: f
2496
+ dependsOn: b,
2497
+ dependsOnClaimIds: h
2498
2498
  };
2499
- return { claimId: o.claimId, number: o.number, dependsOnClaimIds: f, pos: o.pos, attrs: w };
2500
- }), c = es(i), l = e.commands.command(({ tr: o, dispatch: u }) => {
2499
+ return { claimId: o.claimId, number: o.number, dependsOnClaimIds: h, pos: o.pos, attrs: x };
2500
+ }), l = es(i), c = e.commands.command(({ tr: o, dispatch: u }) => {
2501
2501
  let m = !1;
2502
- return i.forEach((h) => {
2503
- const p = e.state.doc.nodeAt(h.pos);
2502
+ return i.forEach((g) => {
2503
+ const p = e.state.doc.nodeAt(g.pos);
2504
2504
  if (!p || p.type.name !== "claim")
2505
2505
  return;
2506
- const f = { ...h.attrs };
2507
- (p.attrs.number !== f.number || p.attrs.claimId !== f.claimId || !$t(qe(p.attrs.dependsOn), qe(f.dependsOn)) || !$t(
2506
+ const h = { ...g.attrs };
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
- rt(f.dependsOnClaimIds)
2510
- )) && (o.setNodeMarkup(h.pos, void 0, f), m = !0);
2509
+ rt(h.dependsOnClaimIds)
2510
+ )) && (o.setNodeMarkup(g.pos, void 0, h), m = !0);
2511
2511
  }), m && u && u(o), !0;
2512
- }), d = c.map((o) => `${o.claimId}:${o.code}`).join("|");
2513
- return d !== V.lastClaimGraphSignature && (V.lastClaimGraphSignature = d, V.claimGraphHandler && V.claimGraphHandler({ issues: c }), c.length > 0 && console.warn(`Claim graph validation found ${c.length} issue(s).`)), l;
2512
+ }), d = l.map((o) => `${o.claimId}:${o.code}`).join("|");
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
2514
  }, gn = (e) => {
2515
2515
  const t = /* @__PURE__ */ new Map();
2516
2516
  return fe(e).forEach((n) => {
@@ -2523,7 +2523,7 @@ const Be = () => {
2523
2523
  }), t;
2524
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,
@@ -2532,51 +2532,51 @@ const Be = () => {
2532
2532
  }), t;
2533
2533
  }, Q = (e) => {
2534
2534
  const t = gn(e), n = pn(e), r = [], a = Ke();
2535
- if (!e.commands.command(({ tr: c, state: l, dispatch: d }) => {
2535
+ if (!e.commands.command(({ tr: l, state: c, dispatch: d }) => {
2536
2536
  let o = !1;
2537
- return l.doc.descendants((u, m) => {
2537
+ return c.doc.descendants((u, m) => {
2538
2538
  if (u.type.name !== "reference")
2539
2539
  return !0;
2540
- const h = u.attrs.targetType === "figure" ? "figure" : "claim", p = typeof u.attrs.targetClaimId == "string" && u.attrs.targetClaimId ? u.attrs.targetClaimId : null, f = typeof u.attrs.targetFigureId == "string" && u.attrs.targetFigureId ? Z(u.attrs.targetFigureId) : null, C = h === "claim" && p ? t.get(p) : void 0, w = h === "figure" && f ? n.get(f) : void 0, y = C ? C.number : null, v = w ? w.id : null, x = h === "figure" ? !w : !C, _ = ft(a, h, y, v, x), L = h === "figure" ? v || u.attrs.target || f || null : C ? String(C.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
- targetType: h,
2542
+ targetType: g,
2543
2543
  targetClaimId: p,
2544
- targetFigureId: f,
2545
- resolvedNumber: y,
2546
- resolvedFigureId: v,
2547
- invalid: x,
2544
+ targetFigureId: h,
2545
+ resolvedNumber: v,
2546
+ resolvedFigureId: C,
2547
+ invalid: w,
2548
2548
  lang: a,
2549
2549
  displayText: _,
2550
2550
  target: L
2551
2551
  };
2552
2552
  return Object.keys(P).some(
2553
2553
  (T) => P[T] !== u.attrs[T]
2554
- ) && (c.setNodeMarkup(m, void 0, P), o = !0), x && r.push({ targetType: h, targetClaimId: p, targetFigureId: f, position: m }), !0;
2555
- }), o && d && d(c), !0;
2554
+ ) && (l.setNodeMarkup(m, void 0, P), o = !0), w && r.push({ targetType: g, targetClaimId: p, targetFigureId: h, position: m }), !0;
2555
+ }), o && d && d(l), !0;
2556
2556
  }))
2557
2557
  return !1;
2558
- const i = r.map((c) => `${c.position}:${c.targetType}:${c.targetClaimId || c.targetFigureId || "null"}`).join("|");
2559
- return i !== V.lastInvalidReferenceSignature && (V.lastInvalidReferenceSignature = i, r.forEach((c) => {
2560
- V.invalidReferenceHandler && V.invalidReferenceHandler(c);
2558
+ const i = r.map((l) => `${l.position}:${l.targetType}:${l.targetClaimId || l.targetFigureId || "null"}`).join("|");
2559
+ return i !== V.lastInvalidReferenceSignature && (V.lastInvalidReferenceSignature = i, r.forEach((l) => {
2560
+ V.invalidReferenceHandler && V.invalidReferenceHandler(l);
2561
2561
  })), !0;
2562
- }, Ot = (e) => {
2563
- const t = be(e, "claim"), n = t && typeof t.node.attrs.claimId == "string" ? t.node.attrs.claimId : null;
2562
+ }, Ft = (e) => {
2563
+ const t = ye(e, "claim"), n = t && typeof t.node.attrs.claimId == "string" ? t.node.attrs.claimId : null;
2564
2564
  return e.commands.command(({ tr: r, state: a, dispatch: s }) => {
2565
2565
  let i = !1;
2566
- return a.doc.descendants((c, l) => {
2567
- if (c.type.name !== "reference")
2566
+ return a.doc.descendants((l, c) => {
2567
+ if (l.type.name !== "reference")
2568
2568
  return !0;
2569
- const d = c.attrs.targetType !== "figure" && !!n && c.attrs.targetClaimId === n && !c.attrs.invalid;
2570
- return c.attrs.highlight !== d && (r.setNodeMarkup(l, void 0, { ...c.attrs, highlight: d }), i = !0), !0;
2569
+ const d = l.attrs.targetType !== "figure" && !!n && l.attrs.targetClaimId === n && !l.attrs.invalid;
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
2573
  }, ts = (e) => {
2574
- const t = fe(e).map((r) => ({ pos: r.pos, length: r.node.textContent.length })).filter((r) => r.length > Dt), n = t.map((r) => `${r.pos}:${r.length}`).join("|");
2575
- n !== V.lastClaimWarningSignature && (V.lastClaimWarningSignature = n, t.length !== 0 && console.warn(`Claim content is too long for ${t.length} block(s). Suggested max: ${Dt}.`));
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
+ 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) => {
2577
2577
  if (typeof t == "number")
2578
2578
  return t;
2579
- const n = be(e, "claim");
2579
+ const n = ye(e, "claim");
2580
2580
  if (n)
2581
2581
  return n.pos;
2582
2582
  const r = fe(e)[0];
@@ -2585,12 +2585,12 @@ const Be = () => {
2585
2585
  const i = a.doc.nodeAt(t);
2586
2586
  if (!i || i.type.name !== "claim")
2587
2587
  return !1;
2588
- const c = t + 1, l = t + i.nodeSize - 1;
2589
- return n.trim().length === 0 ? r.delete(c, l) : r.replaceWith(c, l, a.schema.text(n)), s && s(r), !0;
2588
+ const l = t + 1, c = t + i.nodeSize - 1;
2589
+ return n.trim().length === 0 ? r.delete(l, c) : r.replaceWith(l, c, a.schema.text(n)), s && s(r), !0;
2590
2590
  }), rs = {
2591
2591
  name: "patent",
2592
2592
  version: "1.0.0",
2593
- extensions: [Oa, Ba, Ha, Wa, qa],
2593
+ extensions: [Oa, Ba, Ha, Wa, Ga],
2594
2594
  toolbarItems: [
2595
2595
  {
2596
2596
  id: "patent-claim-insert",
@@ -2623,14 +2623,14 @@ const Be = () => {
2623
2623
  claimId: fn(),
2624
2624
  dependsOn: [],
2625
2625
  dependsOnClaimIds: []
2626
- }, c = a ? [{ type: "text", text: a }] : [];
2627
- let l;
2626
+ }, l = a ? [{ type: "text", text: a }] : [];
2627
+ let c;
2628
2628
  if (r === "end") {
2629
2629
  const o = fe(e).at(-1), u = o ? o.pos + o.node.nodeSize : e.state.doc.content.size;
2630
- l = Ve(e, { type: "claim", position: u, attrs: i, content: c });
2630
+ c = Ve(e, { type: "claim", position: u, attrs: i, content: l });
2631
2631
  } else
2632
- l = Ve(e, { type: "claim", attrs: i, content: c });
2633
- return !l || !ie(e) ? !1 : Q(e);
2632
+ c = Ve(e, { type: "claim", attrs: i, content: l });
2633
+ return !c || !ie(e) ? !1 : Q(e);
2634
2634
  }
2635
2635
  },
2636
2636
  updateClaim: {
@@ -2654,18 +2654,18 @@ const Be = () => {
2654
2654
  const a = e.state.doc.nodeAt(r);
2655
2655
  if (!a || a.type.name !== "claim")
2656
2656
  return !1;
2657
- const s = Number(a.attrs.number), i = typeof a.attrs.claimId == "string" ? a.attrs.claimId : "", c = /* @__PURE__ */ new Map();
2657
+ const s = Number(a.attrs.number), i = typeof a.attrs.claimId == "string" ? a.attrs.claimId : "", l = /* @__PURE__ */ new Map();
2658
2658
  fe(e).forEach((m) => {
2659
- const h = Number(m.node.attrs.number), p = typeof m.node.attrs.claimId == "string" ? m.node.attrs.claimId : "";
2660
- Number.isFinite(h) && h > 0 && p && c.set(h, p);
2659
+ const g = Number(m.node.attrs.number), p = typeof m.node.attrs.claimId == "string" ? m.node.attrs.claimId : "";
2660
+ Number.isFinite(g) && g > 0 && p && l.set(g, p);
2661
2661
  });
2662
- const l = qe(n.dependsOn).filter(
2662
+ const c = Ge(n.dependsOn).filter(
2663
2663
  (m) => Number.isFinite(s) && m > 0 && m < s
2664
- ), d = l.map((m) => c.get(m)).filter((m) => typeof m == "string" && m.length > 0 && m !== i);
2664
+ ), d = c.map((m) => l.get(m)).filter((m) => typeof m == "string" && m.length > 0 && m !== i);
2665
2665
  return !pe(e, {
2666
2666
  type: "claim",
2667
2667
  position: r,
2668
- attrs: { dependsOn: l, dependsOnClaimIds: d }
2668
+ attrs: { dependsOn: c, dependsOnClaimIds: d }
2669
2669
  }) || !ie(e) ? !1 : Q(e);
2670
2670
  }
2671
2671
  },
@@ -2678,13 +2678,13 @@ const Be = () => {
2678
2678
  return !1;
2679
2679
  const r = n.lang === "en" ? "en" : "zh";
2680
2680
  k.getState().setEditorLanguage(r);
2681
- const s = (n.scope || "all") === "current" ? be(e, "reference") : null;
2682
- return e.commands.command(({ tr: c, state: l, dispatch: d }) => {
2681
+ const s = (n.scope || "all") === "current" ? ye(e, "reference") : null;
2682
+ return e.commands.command(({ tr: l, state: c, dispatch: d }) => {
2683
2683
  let o = !1;
2684
- return l.doc.descendants((u, m) => (u.type.name !== "reference" || s && m !== s.pos || u.attrs.lang !== r && (c.setNodeMarkup(m, void 0, {
2684
+ return c.doc.descendants((u, m) => (u.type.name !== "reference" || s && m !== s.pos || u.attrs.lang !== r && (l.setNodeMarkup(m, void 0, {
2685
2685
  ...u.attrs,
2686
2686
  lang: r
2687
- }), o = !0), !0)), o && d && d(c), !0;
2687
+ }), o = !0), !0)), o && d && d(l), !0;
2688
2688
  }) ? Q(e) : !1;
2689
2689
  }
2690
2690
  },
@@ -2698,7 +2698,7 @@ const Be = () => {
2698
2698
  category: "patent",
2699
2699
  execute: ({ editor: e }, t) => {
2700
2700
  const r = at(e, (typeof t == "object" && t ? t : {}).position);
2701
- return typeof r != "number" || !vt(e, { type: "claim", position: r }) || !ie(e) ? !1 : Q(e);
2701
+ return typeof r != "number" || !Ct(e, { type: "claim", position: r }) || !ie(e) ? !1 : Q(e);
2702
2702
  }
2703
2703
  },
2704
2704
  reorderClaims: {
@@ -2717,7 +2717,7 @@ const Be = () => {
2717
2717
  shortcut: "Ctrl+Shift+F",
2718
2718
  isActive: ({ editor: e }) => e.isActive("figure"),
2719
2719
  execute: ({ editor: e }, t) => {
2720
- const n = typeof t == "object" && t ? t : {}, r = Z(n.id) || Mt(e), a = n.contentType && ["image", "mermaid", "drawio"].includes(n.contentType) ? n.contentType : "image";
2720
+ const n = typeof t == "object" && t ? t : {}, r = Z(n.id) || $t(e), a = n.contentType && ["image", "mermaid", "drawio"].includes(n.contentType) ? n.contentType : "image";
2721
2721
  return e.chain().focus().insertContent({
2722
2722
  type: "figure",
2723
2723
  attrs: { id: r, contentType: a, imageSrc: "", mermaidCode: "", drawioXml: "" },
@@ -2729,16 +2729,16 @@ const Be = () => {
2729
2729
  description: "Update figure attributes",
2730
2730
  category: "patent",
2731
2731
  execute: ({ editor: e }, t) => {
2732
- const n = typeof t == "object" && t ? t : {}, r = be(e, "figure"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
2732
+ const n = typeof t == "object" && t ? t : {}, r = ye(e, "figure"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
2733
2733
  if (typeof a != "number")
2734
2734
  return !1;
2735
2735
  const s = e.state.doc.nodeAt(a);
2736
2736
  if (!s || s.type.name !== "figure")
2737
2737
  return !1;
2738
- const c = (typeof n.id == "string" ? Z(n.id) : Z(s.attrs.id)) || Mt(e);
2739
- if (ke(e).some((o) => o.pos === a ? !1 : Z(o.node.attrs.id) === c))
2738
+ const l = (typeof n.id == "string" ? Z(n.id) : Z(s.attrs.id)) || $t(e);
2739
+ if (_e(e).some((o) => o.pos === a ? !1 : Z(o.node.attrs.id) === l))
2740
2740
  return !1;
2741
- const d = { id: c };
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, {
2743
2743
  type: "figure",
2744
2744
  position: a,
@@ -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)) {
@@ -2782,7 +2782,7 @@ const Be = () => {
2782
2782
  const s = r.get(a);
2783
2783
  if (!s)
2784
2784
  return !1;
2785
- const i = s.number, c = n.lang || Ke(), l = n.displayText || ft(c, "claim", i, null, !1);
2785
+ const i = s.number, l = n.lang || Ke(), c = n.displayText || ft(l, "claim", i, null, !1);
2786
2786
  return e.chain().focus().insertContent({
2787
2787
  type: "reference",
2788
2788
  attrs: {
@@ -2791,9 +2791,9 @@ const Be = () => {
2791
2791
  targetFigureId: null,
2792
2792
  resolvedNumber: i,
2793
2793
  resolvedFigureId: null,
2794
- lang: c,
2794
+ lang: l,
2795
2795
  invalid: !1,
2796
- displayText: l,
2796
+ displayText: c,
2797
2797
  target: n.target || String(i),
2798
2798
  highlight: !1
2799
2799
  }
@@ -2818,7 +2818,7 @@ const Be = () => {
2818
2818
  const s = r.get(a);
2819
2819
  if (!s)
2820
2820
  return !1;
2821
- const i = n.lang || Ke(), c = n.displayText || ft(i, "figure", null, s.id, !1);
2821
+ const i = n.lang || Ke(), l = n.displayText || ft(i, "figure", null, s.id, !1);
2822
2822
  return e.chain().focus().insertContent({
2823
2823
  type: "reference",
2824
2824
  attrs: {
@@ -2829,7 +2829,7 @@ const Be = () => {
2829
2829
  resolvedFigureId: s.id,
2830
2830
  lang: i,
2831
2831
  invalid: !1,
2832
- displayText: c,
2832
+ displayText: l,
2833
2833
  target: n.target || s.id,
2834
2834
  highlight: !1
2835
2835
  }
@@ -2842,14 +2842,14 @@ const Be = () => {
2842
2842
  execute: ({ editor: e }, t) => {
2843
2843
  const n = typeof t == "object" && t ? t : null;
2844
2844
  return !(n != null && n.targetClaimId) || !e.commands.command(({ tr: a, state: s, dispatch: i }) => {
2845
- let c = !1;
2846
- return s.doc.descendants((l, d) => (l.type.name !== "reference" || !l.attrs.invalid || (a.setNodeMarkup(d, void 0, {
2847
- ...l.attrs,
2845
+ let l = !1;
2846
+ return s.doc.descendants((c, d) => (c.type.name !== "reference" || !c.attrs.invalid || (a.setNodeMarkup(d, void 0, {
2847
+ ...c.attrs,
2848
2848
  targetType: "claim",
2849
2849
  targetClaimId: n.targetClaimId,
2850
2850
  targetFigureId: null,
2851
2851
  invalid: !1
2852
- }), c = !0), !0)), c && i && i(a), c;
2852
+ }), l = !0), !0)), l && i && i(a), l;
2853
2853
  }) ? !1 : Q(e);
2854
2854
  }
2855
2855
  },
@@ -2875,7 +2875,7 @@ const Be = () => {
2875
2875
  description: "Toggle patent section collapse state",
2876
2876
  category: "patent",
2877
2877
  execute: ({ editor: e }, t) => {
2878
- const n = typeof t == "object" && t ? t : {}, r = be(e, "patent_section"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
2878
+ const n = typeof t == "object" && t ? t : {}, r = ye(e, "patent_section"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
2879
2879
  if (typeof a != "number") return !1;
2880
2880
  const s = e.state.doc.nodeAt(a);
2881
2881
  return !s || s.type.name !== "patent_section" ? !1 : pe(e, {
@@ -2887,12 +2887,12 @@ const Be = () => {
2887
2887
  }
2888
2888
  },
2889
2889
  onStateChange: (e) => {
2890
- ie(e) && (Q(e), Ot(e), ts(e), Za(e));
2890
+ ie(e) && (Q(e), Ft(e), ts(e), Za(e));
2891
2891
  },
2892
2892
  onSelectionChange: (e) => {
2893
- Ot(e);
2893
+ Ft(e);
2894
2894
  }
2895
- }, as = [Ea, ka, La, rs];
2895
+ }, as = [Ea, _a, La, rs];
2896
2896
  as.forEach((e) => W.register(e));
2897
2897
  const ss = (e = {}) => {
2898
2898
  const t = [
@@ -2918,13 +2918,13 @@ const ss = (e = {}) => {
2918
2918
  listCommands: () => W.getCommandNames(),
2919
2919
  insertNode: (t) => Ve(e, t),
2920
2920
  updateNodeAttrs: (t) => pe(e, t),
2921
- removeNode: (t) => vt(e, t),
2921
+ removeNode: (t) => Ct(e, t),
2922
2922
  wrapSelection: (t) => dn(e, t),
2923
- applyTransactionBatch: (t) => Ma(e, t),
2923
+ applyTransactionBatch: (t) => Ra(e, t),
2924
2924
  findNodeByType: (t, n) => bt(e, t, n),
2925
- findAncestorNode: (t) => be(e, t),
2925
+ findAncestorNode: (t) => ye(e, t),
2926
2926
  findCurrentBlock: () => Pa(e),
2927
- findNodesByPredicate: (t, n) => yt(e, t, n)
2927
+ findNodesByPredicate: (t, n) => vt(e, t, n)
2928
2928
  }), is = /* @__PURE__ */ new Set([
2929
2929
  "abstract",
2930
2930
  "abstract_drawing",
@@ -2950,33 +2950,33 @@ function cs(e, t) {
2950
2950
  }), !1;
2951
2951
  }
2952
2952
  if (a.type.name === "patent_section") {
2953
- const s = a.attrs.sectionType, i = `sectionTitle_${s}`, c = typeof n[i] == "string" ? n[i] : s, l = [];
2953
+ const s = a.attrs.sectionType, i = `sectionTitle_${s}`, l = typeof n[i] == "string" ? n[i] : s, c = [];
2954
2954
  return a.forEach((d) => {
2955
2955
  const o = d.textContent.trim();
2956
- o && l.push(o);
2957
- }), r.push({ type: "patent_section", sectionType: s, title: c, paragraphs: l }), !1;
2956
+ o && c.push(o);
2957
+ }), r.push({ type: "patent_section", sectionType: s, title: l, paragraphs: c }), !1;
2958
2958
  }
2959
2959
  return !0;
2960
2960
  }), r;
2961
2961
  }
2962
- function Ft(e) {
2962
+ function zt(e) {
2963
2963
  return new Qe({
2964
2964
  children: [new Ye({ text: e, bold: !0, size: 32, font: "黑体" })],
2965
- alignment: ht.CENTER,
2965
+ alignment: yt.CENTER,
2966
2966
  spacing: { before: 400, after: 200 }
2967
2967
  });
2968
2968
  }
2969
- function zt(e) {
2969
+ function Bt(e) {
2970
2970
  return new Qe({
2971
2971
  children: [new Ye({ text: e, bold: !0, size: 28, font: "黑体" })],
2972
- alignment: ht.CENTER,
2972
+ alignment: yt.CENTER,
2973
2973
  spacing: { before: 240, after: 120 }
2974
2974
  });
2975
2975
  }
2976
2976
  function ls(e) {
2977
2977
  return new Qe({
2978
2978
  children: [new Ye({ text: e, bold: !0, size: 36, font: "宋体" })],
2979
- alignment: ht.CENTER,
2979
+ alignment: yt.CENTER,
2980
2980
  spacing: { before: 200, after: 200 }
2981
2981
  });
2982
2982
  }
@@ -2992,7 +2992,7 @@ function ds(e, t) {
2992
2992
  let a = !1;
2993
2993
  for (const s of e) {
2994
2994
  if (is.has(s.sectionType)) {
2995
- r.push(Ft(s.title));
2995
+ r.push(zt(s.title));
2996
2996
  for (const i of s.paragraphs)
2997
2997
  r.push(it(i));
2998
2998
  continue;
@@ -3000,25 +3000,25 @@ function ds(e, t) {
3000
3000
  if (s.type === "patent_title") {
3001
3001
  if (!a) {
3002
3002
  const i = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
3003
- r.push(Ft(i)), a = !0;
3003
+ r.push(zt(i)), a = !0;
3004
3004
  }
3005
3005
  for (const i of s.paragraphs)
3006
3006
  r.push(ls(i));
3007
3007
  continue;
3008
3008
  }
3009
3009
  if (os.has(s.sectionType)) {
3010
- r.push(zt(s.title));
3010
+ r.push(Bt(s.title));
3011
3011
  for (const i of s.paragraphs)
3012
3012
  r.push(it(i));
3013
3013
  continue;
3014
3014
  }
3015
- r.push(zt(s.title));
3015
+ r.push(Bt(s.title));
3016
3016
  for (const i of s.paragraphs)
3017
3017
  r.push(it(i));
3018
3018
  }
3019
3019
  return r;
3020
3020
  }
3021
- async function Bt(e, t) {
3021
+ async function Ht(e, t) {
3022
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: {
@@ -3031,33 +3031,33 @@ async function Bt(e, t) {
3031
3031
  }
3032
3032
  },
3033
3033
  children: r
3034
- }, c = new Zr({
3034
+ }, l = new Zr({
3035
3035
  sections: [i]
3036
- }), l = await ea.toBlob(c);
3037
- ta(l, s);
3036
+ }), c = await ea.toBlob(l);
3037
+ ta(c, s);
3038
3038
  }
3039
3039
  async function us(e) {
3040
3040
  window.print();
3041
3041
  }
3042
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
- const [n, r] = z(!1), a = X(null), s = X(null), [i, c] = z({ top: 0, left: 0 }), l = de(() => {
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();
3046
- c({ top: d.bottom + 4, left: d.left });
3046
+ l({ top: d.bottom + 4, left: d.left });
3047
3047
  }, []);
3048
3048
  return B(() => {
3049
3049
  if (!n) return;
3050
- l();
3050
+ c();
3051
3051
  const d = (u) => {
3052
- var h, p;
3052
+ var g, p;
3053
3053
  const m = u.target;
3054
- (h = a.current) != null && h.contains(m) || (p = s.current) != null && p.contains(m) || r(!1);
3055
- }, o = () => l();
3054
+ (g = a.current) != null && g.contains(m) || (p = s.current) != null && p.contains(m) || r(!1);
3055
+ }, o = () => c();
3056
3056
  return document.addEventListener("mousedown", d), window.addEventListener("scroll", o, !0), () => {
3057
3057
  document.removeEventListener("mousedown", d), window.removeEventListener("scroll", o, !0);
3058
3058
  };
3059
- }, [n, l]), /* @__PURE__ */ A("div", { className: "flex items-center", children: [
3060
- /* @__PURE__ */ g(
3059
+ }, [n, c]), /* @__PURE__ */ A("div", { className: "flex items-center", children: [
3060
+ /* @__PURE__ */ f(
3061
3061
  "button",
3062
3062
  {
3063
3063
  onClick: e.run,
@@ -3068,10 +3068,10 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3068
3068
  e.isActive ? "bg-gray-300 text-blue-600" : "text-gray-700"
3069
3069
  ),
3070
3070
  title: e.tooltip,
3071
- children: /* @__PURE__ */ g(e.icon, { size: 18 })
3071
+ children: /* @__PURE__ */ f(e.icon, { size: 18 })
3072
3072
  }
3073
3073
  ),
3074
- /* @__PURE__ */ g(
3074
+ /* @__PURE__ */ f(
3075
3075
  "button",
3076
3076
  {
3077
3077
  ref: a,
@@ -3081,17 +3081,17 @@ const ms = ["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__ */ g(nn, { size: 12 })
3084
+ children: /* @__PURE__ */ f(nn, { size: 12 })
3085
3085
  }
3086
3086
  ),
3087
3087
  n && Cr(
3088
- /* @__PURE__ */ g(
3088
+ /* @__PURE__ */ f(
3089
3089
  "div",
3090
3090
  {
3091
3091
  ref: s,
3092
3092
  className: "bg-white border border-gray-200 rounded shadow-lg min-w-[160px] py-1",
3093
3093
  style: { position: "fixed", top: i.top, left: i.left, zIndex: 9999 },
3094
- children: t.map((d, o) => /* @__PURE__ */ g(
3094
+ children: t.map((d, o) => /* @__PURE__ */ f(
3095
3095
  "button",
3096
3096
  {
3097
3097
  onClick: () => {
@@ -3113,7 +3113,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3113
3113
  collapsibleGroups: n = !0,
3114
3114
  defaultCollapsedGroups: r = []
3115
3115
  }) => {
3116
- const [a, s] = z(() => new Set(r)), { editorLanguage: i, setEditorLanguage: c } = k(), l = 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 = [
@@ -3289,7 +3289,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3289
3289
  id: "core-align-center",
3290
3290
  label: o ? "居中" : "Center",
3291
3291
  group: "format",
3292
- icon: kr,
3292
+ icon: _r,
3293
3293
  tooltip: o ? "居中对齐" : "Align Center",
3294
3294
  isActive: e.isActive({ textAlign: "center" }),
3295
3295
  disabled: !1,
@@ -3301,7 +3301,7 @@ const ms = ["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: _r,
3304
+ icon: kr,
3305
3305
  tooltip: o ? "右对齐" : "Align Right",
3306
3306
  isActive: e.isActive({ textAlign: "right" }),
3307
3307
  disabled: !1,
@@ -3349,7 +3349,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3349
3349
  id: "core-blockquote",
3350
3350
  label: "Blockquote",
3351
3351
  group: "structure",
3352
- icon: Rr,
3352
+ icon: Dr,
3353
3353
  tooltip: "Blockquote",
3354
3354
  isActive: e.isActive("blockquote"),
3355
3355
  disabled: !1,
@@ -3361,7 +3361,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3361
3361
  id: "core-code-block",
3362
3362
  label: "Code Block",
3363
3363
  group: "structure",
3364
- icon: Dr,
3364
+ icon: Mr,
3365
3365
  tooltip: "Code Block",
3366
3366
  isActive: e.isActive("codeBlock"),
3367
3367
  disabled: !1,
@@ -3373,7 +3373,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3373
3373
  id: "core-table",
3374
3374
  label: "Insert Table",
3375
3375
  group: "structure",
3376
- icon: Mr,
3376
+ icon: Rr,
3377
3377
  tooltip: "Insert Table",
3378
3378
  isActive: !1,
3379
3379
  disabled: !1,
@@ -3412,20 +3412,20 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3412
3412
  Workflow: zr,
3413
3413
  Box: Fr,
3414
3414
  FileText: tn,
3415
- Link2: pt,
3415
+ Link2: ht,
3416
3416
  Image: en
3417
- }, h = W.getToolbarItems().map((b) => {
3418
- const T = W.getCommandMeta(b.command), E = b.tooltip || (T == null ? void 0 : T.description) || b.label, D = b.shortcut || (T == null ? void 0 : T.shortcut), M = D ? `${E} (${D})` : E;
3417
+ }, g = W.getToolbarItems().map((y) => {
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 {
3420
- id: b.id,
3421
- label: b.label,
3422
- group: b.group || "technical",
3423
- icon: b.icon ? m[b.icon] || Tt : Tt,
3424
- isActive: d.isCommandActive(b.command),
3425
- disabled: !d.canExecCommand(b.command),
3426
- tooltip: M,
3420
+ id: y.id,
3421
+ label: y.label,
3422
+ group: y.group || "technical",
3423
+ icon: y.icon ? m[y.icon] || It : It,
3424
+ isActive: d.isCommandActive(y.command),
3425
+ disabled: !d.canExecCommand(y.command),
3426
+ tooltip: R,
3427
3427
  run: () => {
3428
- d.execCommand(b.command);
3428
+ d.execCommand(y.command);
3429
3429
  }
3430
3430
  };
3431
3431
  }), p = {
@@ -3436,17 +3436,17 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3436
3436
  tooltip: o ? "导出文档" : "Export Document",
3437
3437
  isActive: !1,
3438
3438
  disabled: !1,
3439
- run: () => void Bt(e, i)
3440
- }, f = [
3441
- { label: o ? "导出 Word (.docx)" : "Export Word (.docx)", onClick: () => void Bt(e, i) },
3439
+ run: () => void Ht(e, i)
3440
+ }, h = [
3441
+ { label: o ? "导出 Word (.docx)" : "Export Word (.docx)", onClick: () => void Ht(e, i) },
3442
3442
  { label: o ? "导出 PDF (打印)" : "Export PDF (Print)", onClick: () => void us() }
3443
- ], C = [...u, ...h, p], w = C.map((b) => b.group).filter((b, T, E) => E.indexOf(b) === T && !t.includes(b)), v = [...t, ...w].map((b) => ({
3444
- group: b,
3445
- items: C.filter((T) => T.group === b)
3446
- })).filter((b) => b.items.length > 0), x = (b) => {
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
+ group: y,
3445
+ items: b.filter((T) => T.group === y)
3446
+ })).filter((y) => y.items.length > 0), w = (y) => {
3447
3447
  s((T) => {
3448
3448
  const E = new Set(T);
3449
- return E.has(b) ? E.delete(b) : E.add(b), E;
3449
+ return E.has(y) ? E.delete(y) : E.add(y), E;
3450
3450
  });
3451
3451
  }, _ = [
3452
3452
  { label: o ? "插入表格 3×3" : "Insert Table 3×3", onClick: () => e.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run() },
@@ -3461,62 +3461,62 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3461
3461
  { label: o ? "切换表头" : "Toggle Header Row", onClick: () => e.chain().focus().toggleHeaderRow().run() },
3462
3462
  { label: o ? "删除表格" : "Delete Table", onClick: () => e.chain().focus().deleteTable().run() }
3463
3463
  ], L = [
3464
- { label: l.insertImageFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "image" }) },
3465
- { label: l.insertMermaidFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
3466
- { label: l.insertDrawioFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "drawio" }) }
3467
- ], P = (b) => b.id === "core-table" ? /* @__PURE__ */ g(ct, { btn: b, items: _ }, b.id) : b.id === "core-export" ? /* @__PURE__ */ g(ct, { btn: b, items: f }, b.id) : b.id === "patent-figure-insert" ? /* @__PURE__ */ g(ct, { btn: b, items: L }, b.id) : /* @__PURE__ */ g(
3464
+ { label: c.insertImageFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "image" }) },
3465
+ { label: c.insertMermaidFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
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: _ }, 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
- onClick: b.run,
3471
- disabled: b.disabled,
3470
+ onClick: y.run,
3471
+ disabled: y.disabled,
3472
3472
  className: re(
3473
3473
  "p-2 rounded transition-colors",
3474
- b.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200",
3475
- b.isActive ? "bg-gray-300 text-blue-600" : "text-gray-700"
3474
+ y.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200",
3475
+ y.isActive ? "bg-gray-300 text-blue-600" : "text-gray-700"
3476
3476
  ),
3477
- title: b.tooltip,
3478
- children: /* @__PURE__ */ g(b.icon, { size: 18 })
3477
+ title: y.tooltip,
3478
+ children: /* @__PURE__ */ f(y.icon, { size: 18 })
3479
3479
  },
3480
- b.id
3480
+ y.id
3481
3481
  );
3482
- return /* @__PURE__ */ g("div", { className: "border-b border-gray-200 bg-gray-50 sticky top-0 z-10 overflow-x-auto", children: /* @__PURE__ */ A("div", { className: "flex flex-nowrap md:flex-wrap gap-2 p-2 min-w-max md:min-w-0", children: [
3482
+ return /* @__PURE__ */ f("div", { className: "border-b border-gray-200 bg-gray-50 sticky top-0 z-10 overflow-x-auto", children: /* @__PURE__ */ A("div", { className: "flex flex-nowrap md:flex-wrap gap-2 p-2 min-w-max md:min-w-0", children: [
3483
3483
  /* @__PURE__ */ A("div", { className: "flex items-center gap-1 pr-2 mr-2 border-r border-gray-200", children: [
3484
- /* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: l.language }),
3484
+ /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.language }),
3485
3485
  /* @__PURE__ */ A(
3486
3486
  "select",
3487
3487
  {
3488
3488
  value: i,
3489
- onChange: (b) => {
3490
- c(b.target.value === "en" ? "en" : "zh");
3489
+ onChange: (y) => {
3490
+ l(y.target.value === "en" ? "en" : "zh");
3491
3491
  },
3492
3492
  className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white text-gray-700",
3493
3493
  children: [
3494
- /* @__PURE__ */ g("option", { value: "zh", children: "中文" }),
3495
- /* @__PURE__ */ g("option", { value: "en", children: "English" })
3494
+ /* @__PURE__ */ f("option", { value: "zh", children: "中文" }),
3495
+ /* @__PURE__ */ f("option", { value: "en", children: "English" })
3496
3496
  ]
3497
3497
  }
3498
3498
  )
3499
3499
  ] }),
3500
- v.map((b) => {
3501
- const T = a.has(b.group);
3500
+ C.map((y) => {
3501
+ const T = a.has(y.group);
3502
3502
  return /* @__PURE__ */ A("div", { className: "flex items-center gap-1 pr-2 mr-2 border-r border-gray-200 last:border-r-0 last:mr-0 last:pr-0", children: [
3503
- n && /* @__PURE__ */ g(
3503
+ n && /* @__PURE__ */ f(
3504
3504
  "button",
3505
3505
  {
3506
3506
  onClick: () => {
3507
- x(b.group);
3507
+ w(y.group);
3508
3508
  },
3509
3509
  className: "px-2 py-1 text-xs rounded bg-gray-200 text-gray-700 hover:bg-gray-300",
3510
- title: T ? `Expand ${ot(b.group)}` : `Collapse ${ot(b.group)}`,
3511
- children: ot(b.group)
3510
+ title: T ? `Expand ${ot(y.group)}` : `Collapse ${ot(y.group)}`,
3511
+ children: ot(y.group)
3512
3512
  }
3513
3513
  ),
3514
- (!n || !T) && b.items.map(P)
3515
- ] }, b.group);
3514
+ (!n || !T) && y.items.map(P)
3515
+ ] }, y.group);
3516
3516
  })
3517
3517
  ] }) });
3518
3518
  }, gs = ({ editor: e }) => {
3519
- const [t, n] = z(0), [r, a] = z(""), [s, i] = z(""), c = k((S) => S.editorLanguage), l = U(c);
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);
@@ -3531,7 +3531,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3531
3531
  return !H || !Number.isFinite($) || o.push({
3532
3532
  id: H,
3533
3533
  number: $,
3534
- label: c === "en" ? `Claim ${$}` : `权利要求${$}`
3534
+ label: l === "en" ? `Claim ${$}` : `权利要求${$}`
3535
3535
  }), !0;
3536
3536
  });
3537
3537
  const u = [];
@@ -3540,30 +3540,30 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3540
3540
  const H = typeof S.attrs.id == "string" ? S.attrs.id.trim() : "";
3541
3541
  return H && u.push({ id: H, label: H }), !0;
3542
3542
  });
3543
- const m = d.findAncestorNode("claim"), h = m && typeof m.node.attrs.claimId == "string" ? m.node.attrs.claimId : "", p = Number(m == null ? void 0 : m.node.attrs.number), f = Array.isArray(m == null ? void 0 : m.node.attrs.dependsOn) ? m.node.attrs.dependsOn.map((S) => Number(S)).filter((S) => Number.isFinite(S)) : [], C = o.filter(
3543
+ const m = d.findAncestorNode("claim"), g = m && typeof m.node.attrs.claimId == "string" ? m.node.attrs.claimId : "", p = Number(m == null ? void 0 : m.node.attrs.number), h = Array.isArray(m == null ? void 0 : m.node.attrs.dependsOn) ? m.node.attrs.dependsOn.map((S) => Number(S)).filter((S) => Number.isFinite(S)) : [], b = o.filter(
3544
3544
  (S) => Number.isFinite(p) && S.number < p
3545
- ), w = new Set(f), y = !!h, v = (S) => {
3546
- if (!y) return;
3547
- const H = w.has(S) ? f.filter(($) => $ !== S) : [...f, S].sort(($, O) => $ - O);
3545
+ ), x = new Set(h), v = !!g, C = (S) => {
3546
+ if (!v) return;
3547
+ const H = x.has(S) ? h.filter(($) => $ !== S) : [...h, S].sort(($, O) => $ - O);
3548
3548
  d.execCommand("patent.setClaimDependency", { dependsOn: H });
3549
- }, x = d.findAncestorNode("figure"), _ = !!x, L = x && typeof x.node.attrs.id == "string" ? x.node.attrs.id.trim() : "", P = x && typeof x.node.attrs.contentType == "string" ? x.node.attrs.contentType : "image", [b, T] = z(""), E = X(null), D = X(null), M = (x == null ? void 0 : x.pos) ?? null;
3550
- M !== D.current && (D.current = M, _ && L !== b && 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
- x && d.execCommand("patent.updateFigure", {
3553
- position: x.pos,
3552
+ w && d.execCommand("patent.updateFigure", {
3553
+ position: w.pos,
3554
3554
  contentType: S
3555
3555
  });
3556
3556
  }, Le = () => {
3557
- if (!x) return;
3558
- const S = b.trim();
3557
+ if (!w) return;
3558
+ const S = y.trim();
3559
3559
  S !== L && d.execCommand("patent.updateFigure", {
3560
- position: x.pos,
3560
+ position: w.pos,
3561
3561
  id: S
3562
3562
  });
3563
3563
  };
3564
- return /* @__PURE__ */ g("div", { className: "border-b border-gray-200 bg-gray-50 p-2", children: /* @__PURE__ */ A("div", { className: "bg-white border border-gray-200 rounded-md px-2 py-2 flex flex-wrap items-center gap-2", children: [
3564
+ return /* @__PURE__ */ f("div", { className: "border-b border-gray-200 bg-gray-50 p-2", children: /* @__PURE__ */ A("div", { className: "bg-white border border-gray-200 rounded-md px-2 py-2 flex flex-wrap items-center gap-2", children: [
3565
3565
  o.length > 0 && /* @__PURE__ */ A(we, { children: [
3566
- /* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: l.referenceTarget }),
3566
+ /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.referenceTarget }),
3567
3567
  /* @__PURE__ */ A(
3568
3568
  "select",
3569
3569
  {
@@ -3571,12 +3571,12 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3571
3571
  onChange: (S) => a(S.target.value === "__none__" ? "" : S.target.value),
3572
3572
  className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
3573
3573
  children: [
3574
- /* @__PURE__ */ g("option", { value: "__none__", children: l.referenceTargetPlaceholder }),
3575
- o.map((S) => /* @__PURE__ */ g("option", { value: S.id, children: S.label }, S.id))
3574
+ /* @__PURE__ */ f("option", { value: "__none__", children: c.referenceTargetPlaceholder }),
3575
+ o.map((S) => /* @__PURE__ */ f("option", { value: S.id, children: S.label }, S.id))
3576
3576
  ]
3577
3577
  }
3578
3578
  ),
3579
- /* @__PURE__ */ g(
3579
+ /* @__PURE__ */ f(
3580
3580
  "button",
3581
3581
  {
3582
3582
  onClick: () => {
@@ -3586,13 +3586,13 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3586
3586
  });
3587
3587
  },
3588
3588
  className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
3589
- title: l.insertReference,
3590
- children: /* @__PURE__ */ g(pt, { size: 16 })
3589
+ title: c.insertReference,
3590
+ children: /* @__PURE__ */ f(ht, { size: 16 })
3591
3591
  }
3592
3592
  )
3593
3593
  ] }),
3594
3594
  u.length > 0 && /* @__PURE__ */ A(we, { children: [
3595
- /* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: l.figureReferenceTarget }),
3595
+ /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.figureReferenceTarget }),
3596
3596
  /* @__PURE__ */ A(
3597
3597
  "select",
3598
3598
  {
@@ -3600,12 +3600,12 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3600
3600
  onChange: (S) => i(S.target.value === "__none__" ? "" : S.target.value),
3601
3601
  className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
3602
3602
  children: [
3603
- /* @__PURE__ */ g("option", { value: "__none__", children: l.figureReferenceTargetPlaceholder }),
3604
- u.map((S) => /* @__PURE__ */ g("option", { value: S.id, children: S.label }, S.id))
3603
+ /* @__PURE__ */ f("option", { value: "__none__", children: c.figureReferenceTargetPlaceholder }),
3604
+ u.map((S) => /* @__PURE__ */ f("option", { value: S.id, children: S.label }, S.id))
3605
3605
  ]
3606
3606
  }
3607
3607
  ),
3608
- /* @__PURE__ */ g(
3608
+ /* @__PURE__ */ f(
3609
3609
  "button",
3610
3610
  {
3611
3611
  onClick: () => {
@@ -3615,31 +3615,31 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3615
3615
  });
3616
3616
  },
3617
3617
  className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
3618
- title: l.insertFigureReference,
3619
- children: /* @__PURE__ */ g(en, { size: 16 })
3618
+ title: c.insertFigureReference,
3619
+ children: /* @__PURE__ */ f(en, { size: 16 })
3620
3620
  }
3621
3621
  )
3622
3622
  ] }),
3623
- /* @__PURE__ */ g("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
3623
+ /* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
3624
3624
  _ && /* @__PURE__ */ A(we, { children: [
3625
- /* @__PURE__ */ g("span", { className: "text-xs font-medium text-gray-700", children: l.currentFigure }),
3626
- /* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: l.figureId }),
3627
- /* @__PURE__ */ g(
3625
+ /* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: c.currentFigure }),
3626
+ /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.figureId }),
3627
+ /* @__PURE__ */ f(
3628
3628
  "input",
3629
3629
  {
3630
3630
  ref: E,
3631
3631
  type: "text",
3632
- value: b,
3632
+ value: y,
3633
3633
  onChange: (S) => T(S.target.value),
3634
3634
  onBlur: Le,
3635
3635
  onKeyDown: (S) => {
3636
3636
  S.key === "Enter" && (Le(), S.target.blur());
3637
3637
  },
3638
3638
  className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white w-20",
3639
- placeholder: c === "en" ? "Fig.1" : "图1"
3639
+ placeholder: l === "en" ? "Fig.1" : "图1"
3640
3640
  }
3641
3641
  ),
3642
- /* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: l.switchFigureType }),
3642
+ /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.switchFigureType }),
3643
3643
  /* @__PURE__ */ A(
3644
3644
  "select",
3645
3645
  {
@@ -3647,19 +3647,19 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3647
3647
  onChange: (S) => Y(S.target.value),
3648
3648
  className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
3649
3649
  children: [
3650
- /* @__PURE__ */ g("option", { value: "image", children: l.figureContentTypeImage }),
3651
- /* @__PURE__ */ g("option", { value: "mermaid", children: l.figureContentTypeMermaid }),
3652
- /* @__PURE__ */ g("option", { value: "drawio", children: l.figureContentTypeDrawio })
3650
+ /* @__PURE__ */ f("option", { value: "image", children: c.figureContentTypeImage }),
3651
+ /* @__PURE__ */ f("option", { value: "mermaid", children: c.figureContentTypeMermaid }),
3652
+ /* @__PURE__ */ f("option", { value: "drawio", children: c.figureContentTypeDrawio })
3653
3653
  ]
3654
3654
  }
3655
3655
  ),
3656
- /* @__PURE__ */ g("div", { className: "h-6 w-px bg-gray-200 mx-1" })
3656
+ /* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" })
3657
3657
  ] }),
3658
3658
  e.isActive("image") && (() => {
3659
3659
  const H = e.getAttributes("image").width || "";
3660
3660
  return /* @__PURE__ */ A(we, { children: [
3661
- /* @__PURE__ */ g("span", { className: "text-xs font-medium text-gray-700", children: c === "zh" ? "图片" : "Image" }),
3662
- ["25%", "50%", "75%", "100%"].map((O) => /* @__PURE__ */ g(
3661
+ /* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: l === "zh" ? "图片" : "Image" }),
3662
+ ["25%", "50%", "75%", "100%"].map((O) => /* @__PURE__ */ f(
3663
3663
  "button",
3664
3664
  {
3665
3665
  onClick: () => e.chain().focus().updateAttributes("image", { width: O }).run(),
@@ -3668,36 +3668,36 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3668
3668
  },
3669
3669
  O
3670
3670
  )),
3671
- /* @__PURE__ */ g("div", { className: "h-6 w-px bg-gray-200 mx-1" })
3671
+ /* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" })
3672
3672
  ] });
3673
3673
  })(),
3674
- y ? /* @__PURE__ */ A(we, { children: [
3675
- /* @__PURE__ */ g("span", { className: "text-xs font-medium text-gray-700", children: l.currentClaim(p) }),
3676
- C.length > 0 && /* @__PURE__ */ A("div", { className: "flex flex-wrap gap-1 items-center", children: [
3677
- /* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: l.dependsOn }),
3678
- C.map((S) => /* @__PURE__ */ g(
3674
+ v ? /* @__PURE__ */ A(we, { children: [
3675
+ /* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: c.currentClaim(p) }),
3676
+ b.length > 0 && /* @__PURE__ */ A("div", { className: "flex flex-wrap gap-1 items-center", children: [
3677
+ /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.dependsOn }),
3678
+ b.map((S) => /* @__PURE__ */ f(
3679
3679
  "button",
3680
3680
  {
3681
- onClick: () => v(S.number),
3682
- className: `text-xs px-2 py-0.5 rounded border ${w.has(S.number) ? "bg-blue-50 text-blue-700 border-blue-200" : "bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,
3681
+ onClick: () => C(S.number),
3682
+ className: `text-xs px-2 py-0.5 rounded border ${x.has(S.number) ? "bg-blue-50 text-blue-700 border-blue-200" : "bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,
3683
3683
  children: S.number
3684
3684
  },
3685
3685
  S.id
3686
3686
  ))
3687
3687
  ] })
3688
- ] }) : _ ? null : /* @__PURE__ */ g("span", { className: "text-xs text-gray-400", children: l.placeCursorToEditDependencies }),
3689
- /* @__PURE__ */ g("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
3690
- /* @__PURE__ */ g(
3688
+ ] }) : _ ? null : /* @__PURE__ */ f("span", { className: "text-xs text-gray-400", children: c.placeCursorToEditDependencies }),
3689
+ /* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
3690
+ /* @__PURE__ */ f(
3691
3691
  "button",
3692
3692
  {
3693
3693
  onClick: async () => {
3694
- if (y && await d.execCommand("patent.deleteClaim") || e.chain().focus().deleteSelection().run()) return;
3694
+ if (v && await d.execCommand("patent.deleteClaim") || e.chain().focus().deleteSelection().run()) return;
3695
3695
  const { from: S } = e.state.selection;
3696
3696
  S > 1 && e.chain().focus().deleteRange({ from: S - 1, to: S }).run();
3697
3697
  },
3698
3698
  className: "p-2 hover:bg-red-50 text-red-600 rounded",
3699
- title: l.deleteSelection,
3700
- children: /* @__PURE__ */ g(Wr, { size: 16 })
3699
+ title: c.deleteSelection,
3700
+ children: /* @__PURE__ */ f(Wr, { size: 16 })
3701
3701
  }
3702
3702
  )
3703
3703
  ] }) });
@@ -3711,7 +3711,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
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;
@@ -3723,7 +3723,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3723
3723
  return Number.isFinite(a) ? t === "en" ? `Claim ${a}` : `权利要求${a}` : t === "en" ? "Claim ?" : "权利要求?";
3724
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
  `;
@@ -3733,7 +3733,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3733
3733
  return e.forEach((n) => {
3734
3734
  t += hn(n);
3735
3735
  }), t;
3736
- }, ys = (e) => {
3736
+ }, bs = (e) => {
3737
3737
  const t = [];
3738
3738
  e.state.doc.descendants((r, a) => {
3739
3739
  if (r.type.name !== "claim")
@@ -3772,14 +3772,14 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3772
3772
  });
3773
3773
  });
3774
3774
  });
3775
- const a = new Map(e.map((o) => [o.claimId, o.dependsOnClaimIds])), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = (o) => {
3775
+ const a = new Map(e.map((o) => [o.claimId, o.dependsOnClaimIds])), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), c = (o) => {
3776
3776
  if (i.has(o)) {
3777
- c.add(o);
3777
+ l.add(o);
3778
3778
  return;
3779
3779
  }
3780
- s.has(o) || (s.add(o), i.add(o), (a.get(o) || []).forEach((u) => l(u)), i.delete(o));
3780
+ s.has(o) || (s.add(o), i.add(o), (a.get(o) || []).forEach((u) => c(u)), i.delete(o));
3781
3781
  };
3782
- e.forEach((o) => l(o.claimId)), c.forEach((o) => {
3782
+ e.forEach((o) => c(o.claimId)), l.forEach((o) => {
3783
3783
  const u = e.find((m) => m.claimId === o);
3784
3784
  u && n.push({
3785
3785
  claimId: o,
@@ -3795,13 +3795,13 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3795
3795
  }), e.forEach((o) => {
3796
3796
  if (o.dependsOn.length > 1) {
3797
3797
  const u = o.dependsOn, m = u.some((p) => {
3798
- const f = e.find((C) => C.number === p);
3799
- return f && f.dependsOn.length === 0;
3800
- }), h = u.some((p) => {
3801
- const f = e.find((C) => C.number === p);
3802
- return f && f.dependsOn.length > 0;
3798
+ const h = e.find((b) => b.number === p);
3799
+ return h && h.dependsOn.length === 0;
3800
+ }), g = u.some((p) => {
3801
+ const h = e.find((b) => b.number === p);
3802
+ return h && h.dependsOn.length > 0;
3803
3803
  });
3804
- m && h && n.push({
3804
+ m && g && n.push({
3805
3805
  claimId: o.claimId,
3806
3806
  code: "multi_dependency_conflict",
3807
3807
  message: t === "en" ? `Claim ${o.number} depends on both independent and dependent claims (multi-dependency conflict)` : `权利要求${o.number}同时引用独立项和从属项(多项从属冲突)`
@@ -3816,65 +3816,40 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3816
3816
  m.includes(o.claimId) || m.push(o.claimId), n.set(u, m);
3817
3817
  });
3818
3818
  });
3819
- const r = e.filter((o) => (t.get(o.claimId) || []).length === 0).sort((o, u) => o.number - u.number).map((o) => o.claimId), a = e.map((o) => o.claimId), s = [...r, ...a.filter((o) => !r.includes(o))], i = new Map(e.map((o) => [o.claimId, o])), c = [], l = /* @__PURE__ */ new Set(), d = (o, u) => {
3820
- if (l.has(o))
3819
+ const r = e.filter((o) => (t.get(o.claimId) || []).length === 0).sort((o, u) => o.number - u.number).map((o) => o.claimId), a = e.map((o) => o.claimId), s = [...r, ...a.filter((o) => !r.includes(o))], i = new Map(e.map((o) => [o.claimId, o])), l = [], c = /* @__PURE__ */ new Set(), d = (o, u) => {
3820
+ if (c.has(o))
3821
3821
  return;
3822
- l.add(o);
3822
+ c.add(o);
3823
3823
  const m = i.get(o);
3824
3824
  if (!m)
3825
3825
  return;
3826
- c.push({
3826
+ l.push({
3827
3827
  claimId: o,
3828
3828
  number: m.number,
3829
3829
  depth: u
3830
- }), (n.get(o) || []).map((p) => i.get(p)).filter((p) => !!p).sort((p, f) => p.number - f.number).map((p) => p.claimId).forEach((p) => d(p, u + 1));
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
- return s.forEach((o) => d(o, 0)), c;
3833
- }, ws = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), xs = (e) => `<claims>${e.sort((n, r) => n.number - r.number).map((n) => `<claim id="${n.number}"><claim-text>${ws(n.body)}</claim-text></claim>`).join("")}</claims>`, Ss = (e) => ["Claims", "", ...e.sort((n, r) => n.number - r.number).map((n) => `${n.number}. ${n.body}`)].join(`
3834
- `), Ht = (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
- }, Ts = ({ editor: e }) => {
3832
+ return s.forEach((o) => d(o, 0)), l;
3833
+ }, ws = ({ editor: e }) => {
3838
3834
  const [t, n] = z(!1), r = k((o) => o.editorLanguage), a = U(r), s = Ln({
3839
3835
  editor: e,
3840
- selector: (o) => ys(o.editor)
3836
+ selector: (o) => bs(o.editor)
3841
3837
  }), i = Te(
3842
3838
  () => vs(s, r),
3843
3839
  [s, r]
3844
- ), c = Te(() => Cs(s), [s]), l = 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) => {
3848
- const u = l.get(o);
3844
+ const u = c.get(o);
3849
3845
  typeof u == "number" && e.chain().focus().setTextSelection(u + 1).run();
3850
3846
  };
3851
3847
  return /* @__PURE__ */ A("div", { className: "border-b border-gray-200 bg-white px-3 py-2", children: [
3852
3848
  /* @__PURE__ */ A("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: [
3853
- /* @__PURE__ */ g("span", { className: "font-medium text-gray-700", children: a.claimWorkspacePanel }),
3854
- /* @__PURE__ */ g("span", { className: "text-gray-400", children: a.totalCount(s.length) }),
3855
- /* @__PURE__ */ g("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__ */ g("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__ */ g(
3860
- "button",
3861
- {
3862
- onClick: () => Ht("claims-cnipa.xml", xs(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__ */ g(
3868
- "button",
3869
- {
3870
- onClick: () => Ht("claims-word-mapping.txt", Ss(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
- c.length > 0 && /* @__PURE__ */ g(
3849
+ /* @__PURE__ */ f("span", { className: "font-medium text-gray-700", children: a.claimWorkspacePanel }),
3850
+ /* @__PURE__ */ f("span", { className: "text-gray-400", children: a.totalCount(s.length) }),
3851
+ /* @__PURE__ */ f("span", { className: i.length === 0 ? "text-emerald-600" : "text-amber-600", children: a.graphIssuesCount(i.length) }),
3852
+ l.length > 0 && /* @__PURE__ */ f(
3878
3853
  "button",
3879
3854
  {
3880
3855
  onClick: () => n((o) => !o),
@@ -3883,7 +3858,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3883
3858
  }
3884
3859
  )
3885
3860
  ] }),
3886
- i.length > 0 && /* @__PURE__ */ g("div", { className: "mt-2 flex flex-wrap gap-1", children: i.map((o, u) => /* @__PURE__ */ g(
3861
+ i.length > 0 && /* @__PURE__ */ f("div", { className: "mt-2 flex flex-wrap gap-1", children: i.map((o, u) => /* @__PURE__ */ f(
3887
3862
  "button",
3888
3863
  {
3889
3864
  onClick: () => d(o.claimId),
@@ -3892,9 +3867,9 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3892
3867
  },
3893
3868
  `${o.claimId}-${o.code}-${u}`
3894
3869
  )) }),
3895
- t && c.length > 0 && /* @__PURE__ */ A("div", { className: "mt-2 border border-gray-200 rounded p-2 bg-gray-50", children: [
3896
- /* @__PURE__ */ g("div", { className: "text-xs font-medium text-gray-600 mb-1", children: a.claimDependencyTree }),
3897
- /* @__PURE__ */ g("div", { className: "space-y-0.5", children: c.map((o) => /* @__PURE__ */ g(
3870
+ t && l.length > 0 && /* @__PURE__ */ A("div", { className: "mt-2 border border-gray-200 rounded p-2 bg-gray-50", children: [
3871
+ /* @__PURE__ */ f("div", { className: "text-xs font-medium text-gray-600 mb-1", children: a.claimDependencyTree }),
3872
+ /* @__PURE__ */ f("div", { className: "space-y-0.5", children: l.map((o) => /* @__PURE__ */ f(
3898
3873
  "button",
3899
3874
  {
3900
3875
  onClick: () => d(o.claimId),
@@ -3906,7 +3881,7 @@ const ms = ["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 ms = ["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 io(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 Is(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 Is(e) {
3939
3914
  content: n.textContent || ""
3940
3915
  }), !1) : !0), t;
3941
3916
  }
3942
- function yn(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 yn(e) {
3958
3933
  }
3959
3934
  return null;
3960
3935
  }
3961
- function Es(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 = Is(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,23 +3945,23 @@ function Es(e, t) {
3970
3945
  };
3971
3946
  }).filter((s) => s !== null && s.content.length > 0);
3972
3947
  }
3973
- function oo(e, t = {}) {
3948
+ function ao(e, t = {}) {
3974
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
- let i = t.sectionType, c = t.targetSectionPos;
3950
+ let i = t.sectionType, l = t.targetSectionPos;
3976
3951
  if (!i) {
3977
- const u = yn(e);
3978
- u && (i = u.sectionType, c = u.pos);
3952
+ const u = bn(e);
3953
+ u && (i = u.sectionType, l = u.pos);
3979
3954
  }
3980
- const l = t.scope || (i ? "section" : s ? "selection" : "document"), d = i ? Es(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
- if (l === "selection" && r !== a) {
3983
- const m = Math.max(0, r - 200), h = Math.min(e.state.doc.content.size, a + 200), p = e.state.doc.textBetween(m, r, " ", "\0"), f = e.state.doc.textBetween(a, h, " ", "\0");
3984
- o = `...${p}[SELECTED]${f}...`;
3957
+ if (c === "selection" && r !== a) {
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");
3959
+ o = `...${p}[SELECTED]${h}...`;
3985
3960
  }
3986
3961
  return {
3987
- scope: l,
3962
+ scope: c,
3988
3963
  sectionType: i,
3989
- targetSectionPos: c,
3964
+ targetSectionPos: l,
3990
3965
  userInput: t.userInput,
3991
3966
  selectedText: s,
3992
3967
  dependencyContext: d,
@@ -3994,24 +3969,24 @@ function oo(e, t = {}) {
3994
3969
  language: n
3995
3970
  };
3996
3971
  }
3997
- const Ns = ({ editor: e, onSelectionOptimize: t }) => {
3972
+ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
3998
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
- ), c = () => {
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 = yn(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;
4008
3983
  }
4009
3984
  n({ text: u, from: d, to: o, sectionType: m == null ? void 0 : m.sectionType }), r();
4010
- }, l = () => {
3985
+ }, c = () => {
4011
3986
  const d = e.getAttributes("link").href, o = window.prompt("URL", d || "https://");
4012
3987
  o !== null && (o === "" ? e.chain().focus().extendMarkRange("link").unsetLink().run() : e.chain().focus().extendMarkRange("link").setLink({ href: o }).run());
4013
3988
  };
4014
- return /* @__PURE__ */ g(
3989
+ return /* @__PURE__ */ f(
4015
3990
  na,
4016
3991
  {
4017
3992
  editor: e,
@@ -4020,199 +3995,199 @@ const Ns = ({ editor: e, onSelectionOptimize: t }) => {
4020
3995
  return !(u === m || d.isActive("codeBlock"));
4021
3996
  },
4022
3997
  children: /* @__PURE__ */ A("div", { className: "bubble-menu", children: [
4023
- /* @__PURE__ */ g(
3998
+ /* @__PURE__ */ f(
4024
3999
  "button",
4025
4000
  {
4026
4001
  onClick: () => e.chain().focus().toggleBold().run(),
4027
4002
  className: i(e.isActive("bold")),
4028
4003
  title: "Bold",
4029
- children: /* @__PURE__ */ g(Vt, { size: 15 })
4004
+ children: /* @__PURE__ */ f(Vt, { size: 15 })
4030
4005
  }
4031
4006
  ),
4032
- /* @__PURE__ */ g(
4007
+ /* @__PURE__ */ f(
4033
4008
  "button",
4034
4009
  {
4035
4010
  onClick: () => e.chain().focus().toggleItalic().run(),
4036
4011
  className: i(e.isActive("italic")),
4037
4012
  title: "Italic",
4038
- children: /* @__PURE__ */ g(Kt, { size: 15 })
4013
+ children: /* @__PURE__ */ f(Kt, { size: 15 })
4039
4014
  }
4040
4015
  ),
4041
- /* @__PURE__ */ g(
4016
+ /* @__PURE__ */ f(
4042
4017
  "button",
4043
4018
  {
4044
4019
  onClick: () => e.chain().focus().toggleUnderline().run(),
4045
4020
  className: i(e.isActive("underline")),
4046
4021
  title: "Underline",
4047
- children: /* @__PURE__ */ g(Jt, { size: 15 })
4022
+ children: /* @__PURE__ */ f(Jt, { size: 15 })
4048
4023
  }
4049
4024
  ),
4050
- /* @__PURE__ */ g(
4025
+ /* @__PURE__ */ f(
4051
4026
  "button",
4052
4027
  {
4053
4028
  onClick: () => e.chain().focus().toggleStrike().run(),
4054
4029
  className: i(e.isActive("strike")),
4055
4030
  title: "Strikethrough",
4056
- children: /* @__PURE__ */ g(Xt, { size: 15 })
4031
+ children: /* @__PURE__ */ f(Xt, { size: 15 })
4057
4032
  }
4058
4033
  ),
4059
- /* @__PURE__ */ g(
4034
+ /* @__PURE__ */ f(
4060
4035
  "button",
4061
4036
  {
4062
4037
  onClick: () => e.chain().focus().toggleCode().run(),
4063
4038
  className: i(e.isActive("code")),
4064
4039
  title: "Code",
4065
- children: /* @__PURE__ */ g(Qt, { size: 15 })
4040
+ children: /* @__PURE__ */ f(Qt, { size: 15 })
4066
4041
  }
4067
4042
  ),
4068
- /* @__PURE__ */ g(
4043
+ /* @__PURE__ */ f(
4069
4044
  "button",
4070
4045
  {
4071
4046
  onClick: () => e.chain().focus().toggleSuperscript().run(),
4072
4047
  className: i(e.isActive("superscript")),
4073
4048
  title: "Superscript",
4074
- children: /* @__PURE__ */ g(Yt, { size: 15 })
4049
+ children: /* @__PURE__ */ f(Yt, { size: 15 })
4075
4050
  }
4076
4051
  ),
4077
- /* @__PURE__ */ g(
4052
+ /* @__PURE__ */ f(
4078
4053
  "button",
4079
4054
  {
4080
4055
  onClick: () => e.chain().focus().toggleSubscript().run(),
4081
4056
  className: i(e.isActive("subscript")),
4082
4057
  title: "Subscript",
4083
- children: /* @__PURE__ */ g(Zt, { size: 15 })
4058
+ children: /* @__PURE__ */ f(Zt, { size: 15 })
4084
4059
  }
4085
4060
  ),
4086
- /* @__PURE__ */ g("div", { className: "bubble-menu-divider" }),
4087
- /* @__PURE__ */ g(
4061
+ /* @__PURE__ */ f("div", { className: "bubble-menu-divider" }),
4062
+ /* @__PURE__ */ f(
4088
4063
  "button",
4089
4064
  {
4090
4065
  onClick: () => e.chain().focus().toggleHighlight().run(),
4091
4066
  className: i(e.isActive("highlight")),
4092
4067
  title: "Highlight",
4093
- children: /* @__PURE__ */ g(qr, { size: 15 })
4068
+ children: /* @__PURE__ */ f(Gr, { size: 15 })
4094
4069
  }
4095
4070
  ),
4096
- /* @__PURE__ */ g(
4071
+ /* @__PURE__ */ f(
4097
4072
  "button",
4098
4073
  {
4099
- onClick: l,
4074
+ onClick: c,
4100
4075
  className: i(e.isActive("link")),
4101
4076
  title: "Link",
4102
- children: /* @__PURE__ */ g(pt, { size: 15 })
4077
+ children: /* @__PURE__ */ f(ht, { size: 15 })
4103
4078
  }
4104
4079
  ),
4105
- /* @__PURE__ */ g("div", { className: "bubble-menu-divider" }),
4106
- /* @__PURE__ */ g(
4080
+ /* @__PURE__ */ f("div", { className: "bubble-menu-divider" }),
4081
+ /* @__PURE__ */ f(
4107
4082
  "button",
4108
4083
  {
4109
- onClick: c,
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__ */ g(Gr, { size: 15 })
4087
+ children: /* @__PURE__ */ f(qr, { size: 15 })
4113
4088
  }
4114
4089
  )
4115
4090
  ] })
4116
4091
  }
4117
4092
  );
4118
- }, ks = ({ editor: e }) => {
4119
- var y;
4120
- const [t, n] = z(!1), [r, a] = z(!1), [s, i] = z(""), [c, l] = z(""), [d, o] = z(!1), u = X(null), m = e.extensionStorage.searchReplace, h = ((y = m == null ? void 0 : m.results) == null ? void 0 : y.length) ?? 0, p = (m == null ? void 0 : m.currentIndex) ?? -1;
4093
+ }, Is = ({ editor: e }) => {
4094
+ var v;
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
- const v = (x) => {
4097
+ const C = (w) => {
4123
4098
  n(!0);
4124
- const _ = x.detail;
4099
+ const _ = w.detail;
4125
4100
  _ != null && _.replace && a(!0), requestAnimationFrame(() => {
4126
4101
  var L;
4127
4102
  return (L = u.current) == null ? void 0 : L.focus();
4128
4103
  });
4129
4104
  };
4130
- return window.addEventListener("editor:toggleSearch", v), () => window.removeEventListener("editor:toggleSearch", v);
4105
+ return window.addEventListener("editor:toggleSearch", C), () => window.removeEventListener("editor:toggleSearch", C);
4131
4106
  }, []);
4132
- const f = de(
4133
- (v) => {
4134
- i(v), e.commands.setSearchTerm(v);
4107
+ const h = de(
4108
+ (C) => {
4109
+ i(C), e.commands.setSearchTerm(C);
4135
4110
  },
4136
4111
  [e]
4137
- ), C = de(() => {
4112
+ ), b = de(() => {
4138
4113
  n(!1), e.commands.clearSearch(), e.commands.focus();
4139
4114
  }, [e]);
4140
4115
  B(() => {
4141
- const v = (x) => {
4142
- x.key === "Escape" && t && C();
4116
+ const C = (w) => {
4117
+ w.key === "Escape" && t && b();
4143
4118
  };
4144
- return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
4145
- }, [t, C]);
4146
- const w = () => {
4147
- const v = !d;
4148
- o(v), e.commands.setCaseSensitive(v);
4119
+ return window.addEventListener("keydown", C), () => window.removeEventListener("keydown", C);
4120
+ }, [t, b]);
4121
+ const x = () => {
4122
+ const C = !d;
4123
+ o(C), e.commands.setCaseSensitive(C);
4149
4124
  };
4150
4125
  return t ? /* @__PURE__ */ A("div", { className: "find-replace-bar", children: [
4151
4126
  /* @__PURE__ */ A("div", { className: "find-replace-row", children: [
4152
4127
  /* @__PURE__ */ A("div", { className: "find-replace-input-group", children: [
4153
- /* @__PURE__ */ g(
4128
+ /* @__PURE__ */ f(
4154
4129
  "input",
4155
4130
  {
4156
4131
  ref: u,
4157
4132
  type: "text",
4158
4133
  value: s,
4159
- onChange: (v) => f(v.target.value),
4160
- onKeyDown: (v) => {
4161
- v.key === "Enter" && (v.shiftKey ? e.commands.previousSearchResult() : e.commands.nextSearchResult());
4134
+ onChange: (C) => h(C.target.value),
4135
+ onKeyDown: (C) => {
4136
+ C.key === "Enter" && (C.shiftKey ? e.commands.previousSearchResult() : e.commands.nextSearchResult());
4162
4137
  },
4163
4138
  placeholder: "Find...",
4164
4139
  className: "find-replace-input"
4165
4140
  }
4166
4141
  ),
4167
- /* @__PURE__ */ g("span", { className: "find-replace-count", children: h > 0 ? `${p + 1}/${h}` : s ? "0" : "" })
4142
+ /* @__PURE__ */ f("span", { className: "find-replace-count", children: g > 0 ? `${p + 1}/${g}` : s ? "0" : "" })
4168
4143
  ] }),
4169
- /* @__PURE__ */ g(
4144
+ /* @__PURE__ */ f(
4170
4145
  "button",
4171
4146
  {
4172
- onClick: w,
4147
+ onClick: x,
4173
4148
  className: re("find-replace-btn", d && "find-replace-btn--active"),
4174
4149
  title: "Case Sensitive",
4175
- children: /* @__PURE__ */ g(Vr, { size: 15 })
4150
+ children: /* @__PURE__ */ f(Vr, { size: 15 })
4176
4151
  }
4177
4152
  ),
4178
- /* @__PURE__ */ g("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ g(Kr, { size: 15 }) }),
4179
- /* @__PURE__ */ g("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ g(nn, { size: 15 }) }),
4180
- /* @__PURE__ */ g(
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 }) }),
4155
+ /* @__PURE__ */ f(
4181
4156
  "button",
4182
4157
  {
4183
- onClick: () => a((v) => !v),
4158
+ onClick: () => a((C) => !C),
4184
4159
  className: re("find-replace-btn", r && "find-replace-btn--active"),
4185
4160
  title: "Toggle Replace",
4186
- children: /* @__PURE__ */ g(It, { size: 15 })
4161
+ children: /* @__PURE__ */ f(Et, { size: 15 })
4187
4162
  }
4188
4163
  ),
4189
- /* @__PURE__ */ g("button", { onClick: C, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ g(Jr, { 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
- /* @__PURE__ */ g(
4167
+ /* @__PURE__ */ f(
4193
4168
  "input",
4194
4169
  {
4195
4170
  type: "text",
4196
- value: c,
4197
- onChange: (v) => {
4198
- l(v.target.value), e.commands.setReplaceTerm(v.target.value);
4171
+ value: l,
4172
+ onChange: (C) => {
4173
+ c(C.target.value), e.commands.setReplaceTerm(C.target.value);
4199
4174
  },
4200
- onKeyDown: (v) => {
4201
- v.key === "Enter" && e.commands.replaceCurrent();
4175
+ onKeyDown: (C) => {
4176
+ C.key === "Enter" && e.commands.replaceCurrent();
4202
4177
  },
4203
4178
  placeholder: "Replace...",
4204
4179
  className: "find-replace-input"
4205
4180
  }
4206
4181
  ),
4207
- /* @__PURE__ */ g("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ g(It, { size: 15 }) }),
4208
- /* @__PURE__ */ g("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ g(Xr, { size: 15 }) })
4182
+ /* @__PURE__ */ f("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ f(Et, { 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
- }, _s = ({ editor: e }) => {
4186
+ }, Es = ({ editor: e }) => {
4212
4187
  const { editorLanguage: t } = k(), n = t === "zh", r = Te(() => {
4213
- const a = e.state, i = a.doc.textBetween(0, a.doc.content.size, " ", "\0").replace(/\s/g, "").length, { from: c, to: l } = a.selection;
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
- return c !== l && (d = a.doc.textBetween(c, l, " ", "\0").replace(/\s/g, "").length), { charCount: i, selectionCount: d };
4190
+ return l !== c && (d = a.doc.textBetween(l, c, " ", "\0").replace(/\s/g, "").length), { charCount: i, selectionCount: d };
4216
4191
  }, [e.state.doc, e.state.selection]);
4217
4192
  return /* @__PURE__ */ A("div", { className: "word-count-bar", children: [
4218
4193
  /* @__PURE__ */ A("span", { children: [
@@ -4226,130 +4201,130 @@ const Ns = ({ editor: e, onSelectionOptimize: t }) => {
4226
4201
  r.selectionCount
4227
4202
  ] })
4228
4203
  ] });
4229
- }, As = {
4204
+ }, Ns = {
4230
4205
  empty: "○",
4231
4206
  filled: "●"
4232
- }, Ls = {
4207
+ }, _s = {
4233
4208
  empty: "text-gray-400",
4234
4209
  filled: "text-green-500"
4235
- }, Ps = /* @__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
- ]), Rs = ({ editor: e }) => {
4216
+ ]), As = ({ editor: e }) => {
4242
4217
  const { editorLanguage: t } = k(), n = U(t), [r, a] = z(!1), [s, i] = z(0);
4243
4218
  B(() => {
4244
- const l = () => i((d) => d + 1);
4245
- return e.on("update", l), () => {
4246
- e.off("update", l);
4219
+ const c = () => i((d) => d + 1);
4220
+ return e.on("update", c), () => {
4221
+ e.off("update", c);
4247
4222
  };
4248
4223
  }, [e]);
4249
- const c = Te(() => {
4250
- const l = [];
4224
+ const l = Te(() => {
4225
+ const c = [];
4251
4226
  let d = !1;
4252
4227
  return e.state.doc.descendants((o, u) => {
4253
4228
  if (o.type.name === "patent_title") {
4254
4229
  if (!d) {
4255
- const f = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
4256
- l.push({
4230
+ const h = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
4231
+ c.push({
4257
4232
  type: "book-group",
4258
4233
  pos: u,
4259
- title: f,
4234
+ title: h,
4260
4235
  charCount: 0
4261
4236
  }), d = !0;
4262
4237
  }
4263
- const m = o.textContent || "", h = m.trim().length > 0, p = typeof n.patentTitlePlaceholder == "string" ? n.patentTitlePlaceholder : "Patent Title";
4264
- return l.push({
4238
+ const m = o.textContent || "", g = m.trim().length > 0, p = typeof n.patentTitlePlaceholder == "string" ? n.patentTitlePlaceholder : "Patent Title";
4239
+ return c.push({
4265
4240
  type: "section",
4266
4241
  pos: u,
4267
- title: h ? m.trim() : p,
4268
- state: h ? "filled" : "empty",
4242
+ title: g ? m.trim() : p,
4243
+ state: g ? "filled" : "empty",
4269
4244
  charCount: m.replace(/\s/g, "").length,
4270
4245
  indent: !0
4271
4246
  }), !1;
4272
4247
  }
4273
4248
  if (o.type.name === "patent_section") {
4274
- const m = o.attrs.sectionType, h = Ps.has(m), p = `sectionTitle_${m}`, f = typeof n[p] == "string" ? n[p] : m, C = o.textContent || "", w = C.trim().length > 0;
4275
- return l.push({
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;
4250
+ return c.push({
4276
4251
  type: "section",
4277
4252
  pos: u,
4278
- title: f,
4279
- state: w ? "filled" : "empty",
4280
- charCount: C.replace(/\s/g, "").length,
4281
- indent: h
4253
+ title: h,
4254
+ state: x ? "filled" : "empty",
4255
+ charCount: b.replace(/\s/g, "").length,
4256
+ indent: g
4282
4257
  }), !1;
4283
4258
  }
4284
4259
  if (o.type.name === "heading") {
4285
- const m = o.attrs.level, h = o.textContent || "";
4286
- return h.trim() && l.push({
4260
+ const m = o.attrs.level, g = o.textContent || "";
4261
+ return g.trim() && c.push({
4287
4262
  type: "heading",
4288
4263
  pos: u,
4289
- title: h,
4264
+ title: g,
4290
4265
  level: m,
4291
- charCount: h.replace(/\s/g, "").length
4266
+ charCount: g.replace(/\s/g, "").length
4292
4267
  }), !1;
4293
4268
  }
4294
4269
  return !0;
4295
- }), l;
4270
+ }), c;
4296
4271
  }, [e, s, n]);
4297
- return r ? /* @__PURE__ */ g("div", { className: "outline-panel outline-panel--collapsed", children: /* @__PURE__ */ g(
4272
+ return r ? /* @__PURE__ */ f("div", { className: "outline-panel outline-panel--collapsed", children: /* @__PURE__ */ f(
4298
4273
  "button",
4299
4274
  {
4300
4275
  onClick: () => a(!1),
4301
4276
  className: "outline-panel-toggle",
4302
4277
  title: t === "zh" ? "展开大纲" : "Expand Outline",
4303
- children: /* @__PURE__ */ g(Qr, { 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__ */ g(tn, { size: 14 }),
4308
- /* @__PURE__ */ g("span", { children: t === "zh" ? "文档大纲" : "Outline" }),
4309
- /* @__PURE__ */ g(
4282
+ /* @__PURE__ */ f(tn, { size: 14 }),
4283
+ /* @__PURE__ */ f("span", { children: t === "zh" ? "文档大纲" : "Outline" }),
4284
+ /* @__PURE__ */ f(
4310
4285
  "button",
4311
4286
  {
4312
4287
  onClick: () => a(!0),
4313
4288
  className: "outline-panel-toggle ml-auto",
4314
4289
  title: t === "zh" ? "收起大纲" : "Collapse Outline",
4315
- children: /* @__PURE__ */ g(Yr, { size: 14 })
4290
+ children: /* @__PURE__ */ f(Yr, { size: 14 })
4316
4291
  }
4317
4292
  )
4318
4293
  ] }),
4319
4294
  /* @__PURE__ */ A("div", { className: "outline-panel-list", children: [
4320
- c.length === 0 && /* @__PURE__ */ g("div", { className: "outline-panel-empty", children: t === "zh" ? "暂无章节" : "No sections yet" }),
4321
- c.map((l, d) => /* @__PURE__ */ A(
4295
+ l.length === 0 && /* @__PURE__ */ f("div", { className: "outline-panel-empty", children: t === "zh" ? "暂无章节" : "No sections yet" }),
4296
+ l.map((c, d) => /* @__PURE__ */ A(
4322
4297
  "button",
4323
4298
  {
4324
4299
  className: re(
4325
4300
  "outline-panel-item",
4326
- l.type === "heading" && `outline-panel-item--h${l.level}`,
4327
- l.type === "book-group" && "outline-panel-item--book",
4328
- l.indent && "outline-panel-item--indent"
4301
+ c.type === "heading" && `outline-panel-item--h${c.level}`,
4302
+ c.type === "book-group" && "outline-panel-item--book",
4303
+ c.indent && "outline-panel-item--indent"
4329
4304
  ),
4330
4305
  onClick: () => {
4331
- l.type !== "book-group" && (e.chain().setTextSelection(l.pos + 1).focus().run(), requestAnimationFrame(() => {
4332
- const o = e.view.nodeDOM(l.pos);
4306
+ c.type !== "book-group" && (e.chain().setTextSelection(c.pos + 1).focus().run(), requestAnimationFrame(() => {
4307
+ const o = e.view.nodeDOM(c.pos);
4333
4308
  o == null || o.scrollIntoView({ behavior: "smooth", block: "start" });
4334
4309
  }));
4335
4310
  },
4336
4311
  children: [
4337
- l.type === "section" && l.state && /* @__PURE__ */ g("span", { className: re("outline-item-state", Ls[l.state]), children: As[l.state] || "○" }),
4338
- /* @__PURE__ */ g("span", { className: "outline-item-title", children: l.title }),
4339
- l.type !== "book-group" && /* @__PURE__ */ g("span", { className: "outline-item-count", children: l.charCount })
4312
+ c.type === "section" && c.state && /* @__PURE__ */ f("span", { className: re("outline-item-state", _s[c.state]), children: Ns[c.state] || "○" }),
4313
+ /* @__PURE__ */ f("span", { className: "outline-item-title", children: c.title }),
4314
+ c.type !== "book-group" && /* @__PURE__ */ f("span", { className: "outline-item-count", children: c.charCount })
4340
4315
  ]
4341
4316
  },
4342
- `${l.pos}-${d}`
4317
+ `${c.pos}-${d}`
4343
4318
  ))
4344
4319
  ] })
4345
4320
  ] });
4346
- }, Ds = ({
4321
+ }, Ls = ({
4347
4322
  editor: e,
4348
4323
  mode: t = "edit",
4349
4324
  className: n
4350
4325
  }) => (B(() => {
4351
4326
  e.setEditable(t === "edit");
4352
- }, [e, t]), /* @__PURE__ */ g(
4327
+ }, [e, t]), /* @__PURE__ */ f(
4353
4328
  "div",
4354
4329
  {
4355
4330
  className: re(
@@ -4357,16 +4332,16 @@ const Ns = ({ editor: e, onSelectionOptimize: t }) => {
4357
4332
  t === "readonly" ? "cursor-default" : "cursor-text",
4358
4333
  n
4359
4334
  ),
4360
- children: /* @__PURE__ */ g(Pn, { editor: e, className: "h-full" })
4335
+ children: /* @__PURE__ */ f(Pn, { editor: e, className: "h-full" })
4361
4336
  }
4362
- )), vn = "patent-editor-draft", Ms = 1500, $s = () => {
4337
+ )), vn = "patent-editor-draft", Ps = 1500, Ds = () => {
4363
4338
  try {
4364
4339
  const e = localStorage.getItem(vn);
4365
4340
  return e ? JSON.parse(e) : null;
4366
4341
  } catch {
4367
4342
  return null;
4368
4343
  }
4369
- }, Os = ({
4344
+ }, Ms = ({
4370
4345
  initialContent: e,
4371
4346
  onChange: t,
4372
4347
  className: n,
@@ -4374,34 +4349,34 @@ const Ns = ({ editor: e, onSelectionOptimize: t }) => {
4374
4349
  onEditorReady: a,
4375
4350
  onSelectionOptimize: s
4376
4351
  }) => {
4377
- const { setEditor: i, setDocument: c, editorLanguage: l, autoSaveStatus: d } = k(), { setAutoSaveStatus: o, setLastSavedAt: u } = k(), m = X(null), h = e || (t ? null : $s()) || {
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
  {
4381
4356
  type: "paragraph",
4382
- content: [{ type: "text", text: "Welcome to the Patent Editor!" }]
4357
+ content: [{ type: "text", text: "" }]
4383
4358
  }
4384
4359
  ]
4385
- }, p = de((v) => {
4360
+ }, h = de((w) => {
4386
4361
  try {
4387
- o("saving"), localStorage.setItem(vn, JSON.stringify(v)), o("saved"), u(/* @__PURE__ */ new Date());
4362
+ u("saving"), localStorage.setItem(vn, JSON.stringify(w)), u("saved"), m(/* @__PURE__ */ new Date());
4388
4363
  } catch {
4389
- o("error");
4364
+ u("error");
4390
4365
  }
4391
- }, [o, u]), f = Rn(
4366
+ }, [u, m]), b = Dn(
4392
4367
  ss({
4393
- content: h,
4394
- onUpdate: ({ editor: v }) => {
4395
- const x = v.getJSON();
4396
- c(x), W.notifyStateChange(v), t && t(x), t || (m.current && clearTimeout(m.current), m.current = setTimeout(() => {
4397
- p(x);
4398
- }, Ms));
4368
+ content: p,
4369
+ onUpdate: ({ editor: w }) => {
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
- onCreate: ({ editor: v }) => {
4401
- i(v), a == null || a(v), W.initializePlugins(v), Ae(v).execCommand("patent.normalizeClaims"), W.notifyStateChange(v);
4375
+ onCreate: ({ editor: w }) => {
4376
+ i(w), a == null || a(w), W.initializePlugins(w), Ae(w).execCommand("patent.normalizeClaims"), W.notifyStateChange(w);
4402
4377
  },
4403
- onSelectionUpdate: ({ editor: v }) => {
4404
- W.notifySelectionChange(v);
4378
+ onSelectionUpdate: ({ editor: w }) => {
4379
+ W.notifySelectionChange(w);
4405
4380
  },
4406
4381
  editorProps: {
4407
4382
  attributes: {
@@ -4409,36 +4384,42 @@ const Ns = ({ editor: e, onSelectionOptimize: t }) => {
4409
4384
  }
4410
4385
  }
4411
4386
  })
4412
- ), C = X(!1);
4387
+ ), x = X(!1);
4413
4388
  if (B(() => {
4414
- if (!(!f || !e)) {
4415
- if (!C.current) {
4416
- C.current = !0;
4389
+ if (!(!b || !e)) {
4390
+ if (!x.current) {
4391
+ x.current = !0;
4417
4392
  return;
4418
4393
  }
4419
- f.commands.setContent(e);
4394
+ b.commands.setContent(e);
4420
4395
  }
4421
- }, [f, e]), B(() => () => {
4422
- m.current && clearTimeout(m.current), f && (W.destroyPlugins(f), f.destroy());
4423
- }, [f]), B(() => {
4424
- f && W.notifyStateChange(f);
4425
- }, [f, l]), !f)
4396
+ }, [b, e]), B(() => () => {
4397
+ g.current && clearTimeout(g.current), b && (W.destroyPlugins(b), b.destroy());
4398
+ }, [b]), B(() => {
4399
+ b && W.notifyStateChange(b);
4400
+ }, [b, c]), !b)
4426
4401
  return null;
4427
- const w = U(l), y = d === "saving" ? w.autoSaveSaving : d === "saved" ? w.autoSaveSaved : d === "error" ? w.autoSaveError : "";
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__ */ g(fs, { editor: f }),
4431
- y && /* @__PURE__ */ g("span", { className: `auto-save-indicator auto-save-indicator--${d} ml-2`, children: y })
4405
+ /* @__PURE__ */ f(fs, { editor: b }),
4406
+ C && /* @__PURE__ */ f("span", { className: `auto-save-indicator auto-save-indicator--${d} ml-2`, children: C })
4432
4407
  ] }),
4433
- !r && f && /* @__PURE__ */ g(gs, { editor: f }),
4434
- !r && f && /* @__PURE__ */ g(Ts, { editor: f }),
4435
- !r && f && /* @__PURE__ */ g(Ns, { editor: f, onSelectionOptimize: s }),
4436
- !r && f && /* @__PURE__ */ g(ks, { editor: f }),
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 }),
4411
+ !r && b && /* @__PURE__ */ f(Is, { editor: b }),
4437
4412
  /* @__PURE__ */ A("div", { className: "flex flex-1 overflow-hidden", children: [
4438
- !r && f && /* @__PURE__ */ g(Rs, { editor: f }),
4439
- /* @__PURE__ */ g("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ g(Ds, { editor: f, mode: r ? "readonly" : "edit" }) })
4413
+ !r && b && /* @__PURE__ */ f(As, { editor: b }),
4414
+ /* @__PURE__ */ f("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ f(
4415
+ Ls,
4416
+ {
4417
+ editor: b,
4418
+ mode: r || o.status === "streaming" && o.activeSectionType === "claims" ? "readonly" : "edit"
4419
+ }
4420
+ ) })
4440
4421
  ] }),
4441
- !r && /* @__PURE__ */ g(_s, { editor: f })
4422
+ !r && /* @__PURE__ */ f(Es, { editor: b })
4442
4423
  ] });
4443
4424
  };
4444
4425
  function Cn(e) {
@@ -4448,17 +4429,17 @@ function Cn(e) {
4448
4429
  async pull(a) {
4449
4430
  var s;
4450
4431
  for (; ; ) {
4451
- const { done: i, value: c } = await t.read();
4432
+ const { done: i, value: l } = await t.read();
4452
4433
  if (i) {
4453
4434
  a.close();
4454
4435
  return;
4455
4436
  }
4456
- r += n.decode(c, { stream: !0 });
4457
- const l = r.split(`
4437
+ r += n.decode(l, { stream: !0 });
4438
+ const c = r.split(`
4458
4439
  `);
4459
- r = l.pop() || "";
4440
+ r = c.pop() || "";
4460
4441
  let d = "";
4461
- for (const o of l) {
4442
+ for (const o of c) {
4462
4443
  if (o.startsWith("event: ")) {
4463
4444
  d = o.slice(7).trim();
4464
4445
  continue;
@@ -4470,18 +4451,18 @@ function Cn(e) {
4470
4451
  return;
4471
4452
  }
4472
4453
  try {
4473
- const m = JSON.parse(u), h = d || m.type;
4474
- if (h === "delta" || !h && m.content != null)
4454
+ const m = JSON.parse(u), g = d || m.type;
4455
+ if (g === "delta" || !g && m.content != null)
4475
4456
  a.enqueue({
4476
4457
  type: "delta",
4477
4458
  content: m.content ?? m.text ?? ((s = m.delta) == null ? void 0 : s.content) ?? ""
4478
4459
  });
4479
- else if (h === "patch")
4460
+ else if (g === "patch")
4480
4461
  a.enqueue({ type: "patch", patch: m });
4481
- else if (h === "done") {
4462
+ else if (g === "done") {
4482
4463
  a.enqueue({ type: "done", usage: m.usage }), a.close();
4483
4464
  return;
4484
- } else h === "error" && a.enqueue({ type: "error", message: m.message || "Unknown error" });
4465
+ } else g === "error" && a.enqueue({ type: "error", message: m.message || "Unknown error" });
4485
4466
  } catch {
4486
4467
  }
4487
4468
  d = "";
@@ -4493,7 +4474,7 @@ function Cn(e) {
4493
4474
  }
4494
4475
  });
4495
4476
  }
4496
- function Fs(e, t) {
4477
+ function Rs(e, t) {
4497
4478
  let n = null;
4498
4479
  return {
4499
4480
  async request(r) {
@@ -4515,32 +4496,32 @@ function Fs(e, t) {
4515
4496
  }
4516
4497
  };
4517
4498
  }
4518
- function zs(e, t) {
4499
+ function $s(e, t) {
4519
4500
  let n = null;
4520
4501
  const r = e.replace(/\/+$/, "");
4521
4502
  async function a(s, i) {
4522
- const c = await fetch(s, {
4503
+ const l = await fetch(s, {
4523
4504
  ...i,
4524
4505
  headers: { "Content-Type": "application/json", ...t, ...i == null ? void 0 : i.headers }
4525
4506
  });
4526
- if (!c.ok) throw new Error(`Chat API error: ${c.status} ${c.statusText}`);
4527
- const l = await c.json();
4528
- return l.data ?? l;
4507
+ if (!l.ok) throw new Error(`Chat API error: ${l.status} ${l.statusText}`);
4508
+ const c = await l.json();
4509
+ return c.data ?? c;
4529
4510
  }
4530
4511
  return {
4531
- async createSession(s, i, c) {
4512
+ async createSession(s, i, l) {
4532
4513
  return a(`${r}/api/v1/chat/sessions`, {
4533
4514
  method: "POST",
4534
- body: JSON.stringify({ patentId: s, title: i, language: c })
4515
+ body: JSON.stringify({ patentId: s, title: i, language: l })
4535
4516
  });
4536
4517
  },
4537
- async listSessions(s, i = 1, c = 20) {
4538
- const l = new URLSearchParams({ page: String(i), pageSize: String(c) });
4539
- return s && l.set("patentId", s), a(`${r}/api/v1/chat/sessions?${l}`);
4518
+ async listSessions(s, i = 1, l = 20) {
4519
+ const c = new URLSearchParams({ page: String(i), pageSize: String(l) });
4520
+ return s && c.set("patentId", s), a(`${r}/api/v1/chat/sessions?${c}`);
4540
4521
  },
4541
- async getMessages(s, i = 1, c = 50) {
4542
- const l = new URLSearchParams({ page: String(i), pageSize: String(c) });
4543
- return a(`${r}/api/v1/chat/sessions/${s}/messages?${l}`);
4522
+ async getMessages(s, i = 1, l = 50) {
4523
+ const c = new URLSearchParams({ page: String(i), pageSize: String(l) });
4524
+ return a(`${r}/api/v1/chat/sessions/${s}/messages?${c}`);
4544
4525
  },
4545
4526
  async deleteSession(s) {
4546
4527
  await fetch(`${r}/api/v1/chat/sessions/${s}`, {
@@ -4556,54 +4537,54 @@ function zs(e, t) {
4556
4537
  },
4557
4538
  async subscribeStream(s, i) {
4558
4539
  n = new AbortController();
4559
- const c = `${r}/api/v1/chat/sessions/${s}/stream?messageId=${i}`, l = await fetch(c, {
4540
+ const l = `${r}/api/v1/chat/sessions/${s}/stream?messageId=${i}`, c = await fetch(l, {
4560
4541
  headers: { Accept: "text/event-stream", ...t },
4561
4542
  signal: n.signal
4562
4543
  });
4563
- if (!l.ok) throw new Error(`Chat stream error: ${l.status} ${l.statusText}`);
4564
- if (!l.body) throw new Error("Chat stream returned no body");
4565
- return Cn(l.body);
4544
+ if (!c.ok) throw new Error(`Chat stream error: ${c.status} ${c.statusText}`);
4545
+ if (!c.body) throw new Error("Chat stream returned no body");
4546
+ return Cn(c.body);
4566
4547
  },
4567
4548
  abort() {
4568
4549
  n == null || n.abort(), n = null;
4569
4550
  }
4570
4551
  };
4571
4552
  }
4572
- const Bs = jt(
4573
- ({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, language: s, aiService: i, chatSessionAPI: c, aiBaseUrl: l, aiHeaders: d, onSelectionOptimize: o }, u) => {
4574
- const { setEditorLanguage: m, setAIService: h, setChatSessionAPI: p } = k(), f = X(null), C = de((y) => {
4575
- f.current = y;
4576
- }, []), w = De.useMemo(() => {
4553
+ const Os = jt(
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) => {
4555
+ const { setEditorLanguage: m, setAIService: g, setChatSessionAPI: p } = k(), h = X(null), b = de((v) => {
4556
+ h.current = v;
4557
+ }, []), x = Me.useMemo(() => {
4577
4558
  if (e) return e;
4578
4559
  if (t) return mn(t);
4579
4560
  }, [e, t]);
4580
- return De.useEffect(() => {
4561
+ return Me.useEffect(() => {
4581
4562
  s && m(s);
4582
- }, [s, m]), De.useEffect(() => {
4583
- i ? h(i) : l && h(Fs(l, d));
4584
- }, [i, l, d, h]), De.useEffect(() => {
4585
- c ? p(c) : l && p(zs(l, d));
4586
- }, [c, l, d, p]), Wt(u, () => ({
4563
+ }, [s, m]), Me.useEffect(() => {
4564
+ i ? g(i) : c && g(Rs(c, d));
4565
+ }, [i, c, d, g]), Me.useEffect(() => {
4566
+ l ? p(l) : c && p($s(c, d));
4567
+ }, [l, c, d, p]), Wt(u, () => ({
4587
4568
  getContent: () => {
4588
- var y;
4589
- return ((y = f.current) == null ? void 0 : y.getJSON()) ?? null;
4590
- },
4591
- setContent: (y) => {
4592
4569
  var v;
4593
- (v = f.current) == null || v.commands.setContent(y);
4570
+ return ((v = h.current) == null ? void 0 : v.getJSON()) ?? null;
4594
4571
  },
4595
- getEditor: () => f.current,
4596
- execCommand: async (y, v) => f.current ? Ae(f.current).execCommand(y, v) : null,
4572
+ setContent: (v) => {
4573
+ var C;
4574
+ (C = h.current) == null || C.commands.setContent(v);
4575
+ },
4576
+ getEditor: () => h.current,
4577
+ execCommand: async (v, C) => h.current ? Ae(h.current).execCommand(v, C) : null,
4597
4578
  focus: () => {
4598
- var y;
4599
- (y = f.current) == null || y.commands.focus();
4579
+ var v;
4580
+ (v = h.current) == null || v.commands.focus();
4600
4581
  }
4601
- })), /* @__PURE__ */ g(
4602
- Os,
4582
+ })), /* @__PURE__ */ f(
4583
+ Ms,
4603
4584
  {
4604
- initialContent: w,
4585
+ initialContent: x,
4605
4586
  onChange: n,
4606
- onEditorReady: C,
4587
+ onEditorReady: b,
4607
4588
  className: r,
4608
4589
  readOnly: a,
4609
4590
  onSelectionOptimize: o
@@ -4611,68 +4592,68 @@ const Bs = jt(
4611
4592
  );
4612
4593
  }
4613
4594
  );
4614
- Bs.displayName = "PatentEditor";
4615
- async function co(e, t, n) {
4616
- var a, s, i, c;
4595
+ Os.displayName = "PatentEditor";
4596
+ async function so(e, t, n) {
4597
+ var a, s, i, l;
4617
4598
  let r = !1;
4618
4599
  (a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && xn(e, n.targetSectionPos);
4619
4600
  try {
4620
- let l = wn(e, n);
4601
+ let c = wn(e, n);
4621
4602
  for (; ; ) {
4622
4603
  const { done: d, value: o } = await t.read();
4623
4604
  if (d) break;
4624
4605
  if (!o) continue;
4625
4606
  (s = n.onChunk) == null || s.call(n, o);
4626
- const u = e.state.tr.insertText(o, l);
4627
- e.view.dispatch(u), l = u.mapping.map(l, 1);
4607
+ const u = e.state.tr.insertText(o, c);
4608
+ e.view.dispatch(u), c = u.mapping.map(c, 1);
4628
4609
  }
4629
- (i = n.onComplete) == null || i.call(n);
4630
- } catch (l) {
4631
- (c = n.onError) == null || c.call(n, l instanceof Error ? l : new Error(String(l)));
4610
+ n.mode === "section" && typeof n.targetSectionPos == "number" && gt(e, n.targetSectionPos), (i = n.onComplete) == null || i.call(n);
4611
+ } catch (c) {
4612
+ (l = n.onError) == null || l.call(n, c instanceof Error ? c : new Error(String(c)));
4632
4613
  }
4633
4614
  }
4634
- async function lo(e, t, n, r) {
4635
- var s, i, c, l, d, o, u, m;
4615
+ async function io(e, t, n, r) {
4616
+ var s, i, l, c, d, o, u, m;
4636
4617
  const a = new AbortController();
4637
4618
  (s = r.onStart) == null || s.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && xn(e, r.targetSectionPos);
4638
4619
  try {
4639
- const h = await fetch(t, {
4620
+ const g = await fetch(t, {
4640
4621
  method: "POST",
4641
4622
  headers: { "Content-Type": "application/json" },
4642
4623
  body: JSON.stringify(n),
4643
4624
  signal: a.signal
4644
4625
  });
4645
- if (!h.ok)
4646
- throw new Error(`HTTP ${h.status}: ${h.statusText}`);
4647
- const p = (i = h.body) == null ? void 0 : i.getReader();
4626
+ if (!g.ok)
4627
+ throw new Error(`HTTP ${g.status}: ${g.statusText}`);
4628
+ const p = (i = g.body) == null ? void 0 : i.getReader();
4648
4629
  if (!p) throw new Error("No response body");
4649
- const f = new TextDecoder();
4650
- let C = wn(e, r), w = "";
4630
+ const h = new TextDecoder();
4631
+ let b = wn(e, r), x = "";
4651
4632
  for (; ; ) {
4652
- const { done: y, value: v } = await p.read();
4653
- if (y) break;
4654
- w += f.decode(v, { stream: !0 });
4655
- const x = w.split(`
4633
+ const { done: v, value: C } = await p.read();
4634
+ if (v) break;
4635
+ x += h.decode(C, { stream: !0 });
4636
+ const w = x.split(`
4656
4637
  `);
4657
- w = x.pop() || "";
4658
- for (const _ of x) {
4638
+ x = w.pop() || "";
4639
+ for (const _ of w) {
4659
4640
  if (!_.startsWith("data: ")) continue;
4660
4641
  const L = _.slice(6).trim();
4661
4642
  if (L === "[DONE]")
4662
- return (c = r.onComplete) == null || c.call(r), { abort: () => a.abort() };
4643
+ return r.mode === "section" && typeof r.targetSectionPos == "number" && gt(e, r.targetSectionPos), (l = r.onComplete) == null || l.call(r), { abort: () => a.abort() };
4663
4644
  try {
4664
- const P = JSON.parse(L), b = P.content || P.text || ((l = P.delta) == null ? void 0 : l.content) || "";
4665
- if (!b) continue;
4666
- (d = r.onChunk) == null || d.call(r, b);
4667
- const T = e.state.tr.insertText(b, C);
4668
- e.view.dispatch(T), C = T.mapping.map(C, 1);
4645
+ const P = JSON.parse(L), y = P.content || P.text || ((c = P.delta) == null ? void 0 : c.content) || "";
4646
+ if (!y) continue;
4647
+ (d = r.onChunk) == null || d.call(r, y);
4648
+ const T = e.state.tr.insertText(y, b);
4649
+ e.view.dispatch(T), b = T.mapping.map(b, 1);
4669
4650
  } catch {
4670
4651
  }
4671
4652
  }
4672
4653
  }
4673
- (o = r.onComplete) == null || o.call(r);
4674
- } catch (h) {
4675
- h.name === "AbortError" ? (u = r.onAbort) == null || u.call(r) : (m = r.onError) == null || m.call(r, h instanceof Error ? h : new Error(String(h)));
4654
+ r.mode === "section" && typeof r.targetSectionPos == "number" && gt(e, r.targetSectionPos), (o = r.onComplete) == null || o.call(r);
4655
+ } catch (g) {
4656
+ g.name === "AbortError" ? (u = r.onAbort) == null || u.call(r) : (m = r.onError) == null || m.call(r, g instanceof Error ? g : new Error(String(g)));
4676
4657
  }
4677
4658
  return { abort: () => a.abort() };
4678
4659
  }
@@ -4693,6 +4674,26 @@ function xn(e, t) {
4693
4674
  s.replaceWith(r, a, i), s.setMeta("addToHistory", !1), e.view.dispatch(s);
4694
4675
  }
4695
4676
  }
4677
+ function gt(e, t) {
4678
+ const n = e.state.doc.nodeAt(t);
4679
+ if (!n || n.type.name !== "patent_section") return;
4680
+ const r = e.state.tr, a = [];
4681
+ let s = t + 1, i = 0;
4682
+ n.forEach((c) => {
4683
+ i++;
4684
+ });
4685
+ let l = 0;
4686
+ if (n.forEach((c) => {
4687
+ c.type.name === "paragraph" && c.textContent.trim().length > 0 && l++;
4688
+ }), s = t + 1, n.forEach((c) => {
4689
+ const d = s, o = s + c.nodeSize;
4690
+ c.type.name === "paragraph" && c.textContent.trim().length === 0 && (l > 0 || a.length < i - 1) && a.push({ from: d, to: o }), s = o;
4691
+ }), a.length !== 0) {
4692
+ for (let c = a.length - 1; c >= 0; c--)
4693
+ r.delete(a[c].from, a[c].to);
4694
+ r.setMeta("addToHistory", !1), e.view.dispatch(r);
4695
+ }
4696
+ }
4696
4697
  const Ut = {
4697
4698
  technical_field: {
4698
4699
  zh: "本发明涉及航天器自主导航与控制技术领域,具体涉及一种基于多传感器融合的航天器自主避障控制方法、系统、电子设备及计算机可读存储介质。该方法综合利用激光雷达、红外传感器和星敏感器的探测数据,通过实时环境感知与路径规划算法,实现航天器在复杂空间环境中的自主安全避障机动。",
@@ -4823,7 +4824,7 @@ S104:安全验证。对计算得到的控制指令进行轨迹传播仿真,
4823
4824
  en: "That is a great question. As an AI patent writing assistant, I can help you with..."
4824
4825
  }
4825
4826
  }, oe = (e) => new Promise((t) => setTimeout(t, e));
4826
- function gt(e, t = 30) {
4827
+ function pt(e, t = 30) {
4827
4828
  let n = !1;
4828
4829
  return new ReadableStream({
4829
4830
  async pull(r) {
@@ -4841,19 +4842,19 @@ function gt(e, t = 30) {
4841
4842
  }
4842
4843
  });
4843
4844
  }
4844
- function Hs(e) {
4845
- const t = [], n = Ge(e, 3);
4845
+ function Fs(e) {
4846
+ const t = [], n = qe(e, 3);
4846
4847
  for (const r of n)
4847
4848
  t.push({ type: "delta", content: r });
4848
4849
  return t.push({ type: "done", usage: { tokens: e.length * 2 } }), t;
4849
4850
  }
4850
- function Ge(e, t) {
4851
+ function qe(e, t) {
4851
4852
  const n = [];
4852
4853
  for (let r = 0; r < e.length; r += t)
4853
4854
  n.push(e.slice(r, r + t));
4854
4855
  return n;
4855
4856
  }
4856
- function Us(e, t, n) {
4857
+ function zs(e, t, n) {
4857
4858
  const r = n === "zh", a = [];
4858
4859
  let s;
4859
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) {
@@ -4862,26 +4863,26 @@ function Us(e, t, n) {
4862
4863
  ` : `Analyzing ${t.length} referenced text(s) and generating suggestions...
4863
4864
 
4864
4865
  `;
4865
- for (const c of Ge(i, 4))
4866
- a.push({ type: "delta", content: c });
4867
- for (const c of Ge(s, 4))
4868
- a.push({ type: "delta", content: c });
4869
- for (let c = 0; c < t.length; c++) {
4870
- const l = t[c], d = l.text;
4866
+ for (const l of qe(i, 4))
4867
+ a.push({ type: "delta", content: l });
4868
+ for (const l of qe(s, 4))
4869
+ a.push({ type: "delta", content: l });
4870
+ for (let l = 0; l < t.length; l++) {
4871
+ const c = t[l], d = c.text;
4871
4872
  let o;
4872
- r ? (o = d.replace(/一种/g, "一种基于本发明的").replace(/方法/g, "技术方案").replace(/包括/g, "具体包括"), o === d && (o = `根据本发明优选实施例,${d}`)) : o = `According to a preferred embodiment, ${d.charAt(0).toLowerCase()}${d.slice(1)}`, l.from != null && l.to != null ? a.push({
4873
+ r ? (o = d.replace(/一种/g, "一种基于本发明的").replace(/方法/g, "技术方案").replace(/包括/g, "具体包括"), o === d && (o = `根据本发明优选实施例,${d}`)) : o = `According to a preferred embodiment, ${d.charAt(0).toLowerCase()}${d.slice(1)}`, c.from != null && c.to != null ? a.push({
4873
4874
  type: "patch",
4874
4875
  patch: {
4875
4876
  op: "replace",
4876
- target: { type: "ref", refIndex: c },
4877
+ target: { type: "ref", refIndex: l },
4877
4878
  content: o,
4878
4879
  reason: r ? "优化为更专业的专利表述" : "Optimized for professional patent language"
4879
4880
  }
4880
- }) : l.source ? a.push({
4881
+ }) : c.source ? a.push({
4881
4882
  type: "patch",
4882
4883
  patch: {
4883
4884
  op: "replace",
4884
- target: { type: "section", sectionType: l.source },
4885
+ target: { type: "section", sectionType: c.source },
4885
4886
  search: d,
4886
4887
  content: o,
4887
4888
  reason: r ? "优化为更专业的专利表述" : "Optimized for professional patent language"
@@ -4897,39 +4898,39 @@ function Us(e, t, n) {
4897
4898
  });
4898
4899
  }
4899
4900
  } else
4900
- for (const i of Ge(s, 4))
4901
+ for (const i of qe(s, 4))
4901
4902
  a.push({ type: "delta", content: i });
4902
4903
  return a.push({ type: "done", usage: { tokens: s.length * 2 } }), a;
4903
4904
  }
4904
- function uo() {
4905
+ function oo() {
4905
4906
  let e = null;
4906
4907
  return {
4907
4908
  async request(t) {
4908
- var c;
4909
+ var l;
4909
4910
  if (e = new AbortController(), await oe(300), e.signal.aborted)
4910
4911
  throw new DOMException("Aborted", "AbortError");
4911
- const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((c = Ut[r]) == null ? void 0 : c[n]) || Ut.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];
4912
4913
  let s = a;
4913
4914
  t.instruction && (s = (n === "zh" ? `[基于指令"${t.instruction}"生成]
4914
4915
 
4915
4916
  ` : `[Generated based on instruction "${t.instruction}"]
4916
4917
 
4917
4918
  `) + a);
4918
- const i = Hs(s);
4919
- return gt(i, 25);
4919
+ const i = Fs(s);
4920
+ return pt(i, 25);
4920
4921
  },
4921
4922
  abort() {
4922
4923
  e == null || e.abort(), e = null;
4923
4924
  }
4924
4925
  };
4925
4926
  }
4926
- function mo() {
4927
+ function co() {
4927
4928
  const e = /* @__PURE__ */ new Map();
4928
4929
  let t = null, n = null;
4929
4930
  return {
4930
4931
  async createSession(r, a, s) {
4931
4932
  await oe(100);
4932
- const i = `sess_${Date.now()}`, c = {
4933
+ const i = `sess_${Date.now()}`, l = {
4933
4934
  sessionId: i,
4934
4935
  patentId: r || void 0,
4935
4936
  title: a || (s === "zh" ? "新对话" : "New Chat"),
@@ -4937,7 +4938,7 @@ function mo() {
4937
4938
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
4938
4939
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
4939
4940
  };
4940
- return e.set(i, { session: c, messages: [] }), c;
4941
+ return e.set(i, { session: l, messages: [] }), l;
4941
4942
  },
4942
4943
  async listSessions() {
4943
4944
  await oe(50);
@@ -4966,39 +4967,39 @@ function mo() {
4966
4967
  status: "done",
4967
4968
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4968
4969
  }), s.session.messageCount = s.messages.length, s.session.lastMessage = a.content, s.session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
4969
- const c = Us(
4970
+ const l = zs(
4970
4971
  a.content,
4971
4972
  a.references || [],
4972
4973
  a.language
4973
4974
  );
4974
- return n = { messageId: i, events: c }, { messageId: i, sessionId: r, status: "processing" };
4975
+ return n = { messageId: i, events: l }, { messageId: i, sessionId: r, status: "processing" };
4975
4976
  },
4976
4977
  async subscribeStream(r, a) {
4977
4978
  t = new AbortController(), await oe(100);
4978
4979
  const s = e.get(r);
4979
4980
  if (!s) throw new Error("Session not found");
4980
4981
  if (!n || n.messageId !== a)
4981
- return gt([{ type: "done" }]);
4982
+ return pt([{ type: "done" }]);
4982
4983
  const i = n.events;
4983
4984
  n = null;
4984
- const c = gt(i, 18), l = `${a}_a`;
4985
+ const l = pt(i, 18), c = `${a}_a`;
4985
4986
  let d = "";
4986
4987
  for (const o of i)
4987
4988
  o.type === "delta" && (d += o.content);
4988
4989
  return s.messages.push({
4989
- messageId: l,
4990
+ messageId: c,
4990
4991
  role: "assistant",
4991
4992
  content: d,
4992
4993
  status: "done",
4993
4994
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4994
- }), s.session.messageCount = s.messages.length, s.session.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), c;
4995
+ }), s.session.messageCount = s.messages.length, s.session.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), l;
4995
4996
  },
4996
4997
  abort() {
4997
4998
  t == null || t.abort(), t = null;
4998
4999
  }
4999
5000
  };
5000
5001
  }
5001
- function js(e) {
5002
+ function Bs(e) {
5002
5003
  const t = [], n = e.replace(/\r\n/g, `
5003
5004
  `).trim();
5004
5005
  if (!n) return t;
@@ -5013,97 +5014,97 @@ function js(e) {
5013
5014
  if (a.length === 0)
5014
5015
  return t.push({ number: 1, text: n, dependsOn: [] }), t;
5015
5016
  for (let i = 0; i < a.length; i++) {
5016
- const c = a[i].index + a[i].matchLength, l = i + 1 < a.length ? a[i + 1].index : n.length, d = n.slice(c, l).trim(), o = a[i].number, u = Ws(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);
5017
5018
  t.push({ number: o, text: d, dependsOn: u });
5018
5019
  }
5019
5020
  return t;
5020
5021
  }
5021
- function Ws(e, t) {
5022
+ function Hs(e, t) {
5022
5023
  const n = [], r = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g;
5023
5024
  let a;
5024
5025
  for (; (a = r.exec(e)) !== null; ) {
5025
- const i = parseInt(a[1], 10), c = a[2] ? parseInt(a[2], 10) : i;
5026
- for (let l = i; l <= c; l++)
5027
- l !== t && l > 0 && n.push(l);
5026
+ const i = parseInt(a[1], 10), l = a[2] ? parseInt(a[2], 10) : i;
5027
+ for (let c = i; c <= l; c++)
5028
+ c !== t && c > 0 && n.push(c);
5028
5029
  }
5029
5030
  const s = /claims?\s+(\d+)(?:\s*[-~to]+\s*(\d+))?/gi;
5030
5031
  for (; (a = s.exec(e)) !== null; ) {
5031
- const i = parseInt(a[1], 10), c = a[2] ? parseInt(a[2], 10) : i;
5032
- for (let l = i; l <= c; l++)
5033
- l !== t && l > 0 && n.push(l);
5032
+ const i = parseInt(a[1], 10), l = a[2] ? parseInt(a[2], 10) : i;
5033
+ for (let c = i; c <= l; c++)
5034
+ c !== t && c > 0 && n.push(c);
5034
5035
  }
5035
- return [...new Set(n)].sort((i, c) => i - c);
5036
+ return [...new Set(n)].sort((i, l) => i - l);
5036
5037
  }
5037
- function qs() {
5038
+ function Us() {
5038
5039
  return `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
5039
5040
  }
5040
- function fo(e) {
5041
- return js(e).map((n) => ({
5041
+ function lo(e) {
5042
+ return Bs(e).map((n) => ({
5042
5043
  type: "claim",
5043
5044
  attrs: {
5044
5045
  number: n.number,
5045
- claimId: qs(),
5046
+ claimId: Us(),
5046
5047
  dependsOn: n.dependsOn,
5047
5048
  dependsOnClaimIds: []
5048
5049
  },
5049
5050
  content: n.text ? [{ type: "text", text: n.text }] : void 0
5050
5051
  }));
5051
5052
  }
5052
- const Gs = -1, Vs = 1, Ks = 0, Sn = new _e("docDiff");
5053
+ const js = -1, Ws = 1, Gs = 0, Sn = new ke("docDiff");
5053
5054
  let lt = null;
5054
- function Js() {
5055
- return lt || (lt = new Gt()), lt;
5055
+ function qs() {
5056
+ return lt || (lt = new qt()), lt;
5056
5057
  }
5057
- function Xs(e, t, n) {
5058
+ function Vs(e, t, n) {
5058
5059
  const r = [];
5059
5060
  return e.nodesBetween(t, n, (a, s) => {
5060
5061
  if (a.isTextblock) {
5061
- const i = s + 1, c = s + a.nodeSize - 1, l = Math.max(i, t), d = Math.min(c, n);
5062
- return d > l && r.push({ from: l, to: d }), !1;
5062
+ const i = s + 1, l = s + a.nodeSize - 1, c = Math.max(i, t), d = Math.min(l, n);
5063
+ return d > c && r.push({ from: c, to: d }), !1;
5063
5064
  }
5064
5065
  return !0;
5065
5066
  }), r;
5066
5067
  }
5067
- function go(e, t) {
5068
- const n = e.state.doc, r = n.content.size, { text: a, segments: s } = sn(e, 0, r), i = Js(), c = i.diff_main(t, a);
5069
- i.diff_cleanupSemantic(c);
5070
- const l = [];
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);
5070
+ i.diff_cleanupSemantic(l);
5071
+ const c = [];
5071
5072
  let d = 0;
5072
- for (const [m, h] of c)
5073
- if (m === Ks)
5074
- d += h.length;
5075
- else if (m === Vs) {
5073
+ for (const [m, g] of l)
5074
+ if (m === Gs)
5075
+ d += g.length;
5076
+ else if (m === Ws) {
5076
5077
  let p = 0;
5077
- for (; p < h.length; ) {
5078
- for (; p < h.length && h[p] === "\0"; ) p++;
5079
- if (p >= h.length) break;
5080
- const f = p;
5081
- for (; p < h.length && h[p] !== "\0"; ) p++;
5082
- const C = Ee(s, d + f), w = Ee(s, d + p);
5083
- if (C >= 0 && w >= 0 && w > C)
5084
- for (const y of Xs(n, C, w))
5085
- l.push(
5086
- le.inline(y.from, y.to, { class: "patch-diff-insert-inline" })
5078
+ for (; p < g.length; ) {
5079
+ for (; p < g.length && g[p] === "\0"; ) p++;
5080
+ if (p >= g.length) break;
5081
+ const h = p;
5082
+ for (; p < g.length && g[p] !== "\0"; ) p++;
5083
+ const b = Ee(s, d + h), x = Ee(s, d + p);
5084
+ if (b >= 0 && x >= 0 && x > b)
5085
+ for (const v of Vs(n, b, x))
5086
+ c.push(
5087
+ le.inline(v.from, v.to, { class: "patch-diff-insert-inline" })
5087
5088
  );
5088
5089
  }
5089
- d += h.length;
5090
- } else if (m === Gs) {
5090
+ d += g.length;
5091
+ } else if (m === js) {
5091
5092
  const p = Ee(s, d);
5092
5093
  if (p >= 0) {
5093
- const f = h.replace(/\0/g, " ");
5094
- l.push(
5094
+ const h = g.replace(/\0/g, " ");
5095
+ c.push(
5095
5096
  le.widget(
5096
5097
  p,
5097
5098
  () => {
5098
- const C = document.createElement("span");
5099
- return C.className = "patch-diff-delete", C.textContent = f, C;
5099
+ const b = document.createElement("span");
5100
+ return b.className = "patch-diff-delete", b.textContent = h, b;
5100
5101
  },
5101
5102
  { side: -1 }
5102
5103
  )
5103
5104
  );
5104
5105
  }
5105
5106
  }
5106
- const o = Ne.create(n, l), u = new Xe({
5107
+ const o = Ne.create(n, c), u = new Xe({
5107
5108
  key: Sn,
5108
5109
  props: {
5109
5110
  decorations() {
@@ -5113,109 +5114,109 @@ function go(e, t) {
5113
5114
  });
5114
5115
  e.registerPlugin(u);
5115
5116
  }
5116
- function po(e) {
5117
+ function mo(e) {
5117
5118
  e.unregisterPlugin(Sn);
5118
5119
  }
5119
- function ho(e, t) {
5120
+ function fo(e, t) {
5120
5121
  const n = [], r = t === "zh";
5121
5122
  let a = 0;
5122
5123
  const s = () => `v_${++a}`;
5123
- return e.state.doc.descendants((i, c) => {
5124
+ return e.state.doc.descendants((i, l) => {
5124
5125
  if (i.type.name === "patent_title") {
5125
- const l = i.textContent.trim();
5126
- if (l.length === 0)
5126
+ const c = i.textContent.trim();
5127
+ if (c.length === 0)
5127
5128
  n.push({
5128
5129
  id: s(),
5129
5130
  severity: "warning",
5130
5131
  message: r ? "专利名称为空" : "Patent title is empty",
5131
5132
  sectionType: "patent_title",
5132
- pos: c
5133
+ pos: l
5133
5134
  });
5134
5135
  else {
5135
- const d = l.replace(/\s/g, "").length;
5136
+ const d = c.replace(/\s/g, "").length;
5136
5137
  d > 25 && r && n.push({
5137
5138
  id: s(),
5138
5139
  severity: "error",
5139
5140
  message: `专利名称超过25个汉字(当前${d}字)`,
5140
5141
  sectionType: "patent_title",
5141
- pos: c
5142
+ pos: l
5142
5143
  });
5143
5144
  }
5144
5145
  return !1;
5145
5146
  }
5146
5147
  if (i.type.name === "patent_section") {
5147
- const l = i.attrs.sectionType, d = i.textContent.trim();
5148
+ const c = i.attrs.sectionType, d = i.textContent.trim();
5148
5149
  if (d.length === 0 && n.push({
5149
5150
  id: s(),
5150
5151
  severity: "warning",
5151
- message: r ? `章节"${l}"内容为空` : `Section "${l}" is empty`,
5152
- sectionType: l,
5153
- pos: c
5154
- }), l === "abstract") {
5152
+ message: r ? `章节"${c}"内容为空` : `Section "${c}" is empty`,
5153
+ sectionType: c,
5154
+ pos: l
5155
+ }), c === "abstract") {
5155
5156
  const o = d.replace(/\s/g, "").length;
5156
5157
  o > 0 && o < 50 && n.push({
5157
5158
  id: s(),
5158
5159
  severity: "warning",
5159
5160
  message: r ? `摘要字数过少(${o}字),建议50~300字` : `Abstract too short (${o} chars), recommend 50-300`,
5160
- sectionType: l,
5161
- pos: c
5161
+ sectionType: c,
5162
+ pos: l
5162
5163
  }), o > 300 && n.push({
5163
5164
  id: s(),
5164
5165
  severity: "warning",
5165
5166
  message: r ? `摘要字数过多(${o}字),建议不超过300字` : `Abstract too long (${o} chars), recommend ≤300`,
5166
- sectionType: l,
5167
- pos: c
5167
+ sectionType: c,
5168
+ pos: l
5168
5169
  });
5169
5170
  }
5170
5171
  return !1;
5171
5172
  }
5172
5173
  if (i.type.name === "claim") {
5173
- const l = i.textContent.trim();
5174
- l.length > 0 && !l.endsWith("。") && !l.endsWith(".") && n.push({
5174
+ const c = i.textContent.trim();
5175
+ c.length > 0 && !c.endsWith("。") && !c.endsWith(".") && n.push({
5175
5176
  id: s(),
5176
5177
  severity: "warning",
5177
5178
  message: r ? `权利要求${i.attrs.number}末尾应以句号结束` : `Claim ${i.attrs.number} should end with a period`,
5178
- pos: c
5179
+ pos: l
5179
5180
  });
5180
5181
  }
5181
5182
  return !0;
5182
5183
  }), n;
5183
5184
  }
5184
5185
  export {
5185
- Os as EditorView,
5186
+ Ms as EditorView,
5186
5187
  an as PatchDiffPluginKey,
5187
- Bs as PatentEditor,
5188
- ao as acceptAllPatches,
5189
- no as acceptPatch,
5190
- go as applyDocDiffDecorations,
5191
- oo as buildAIContext,
5192
- fo as buildClaimsJSONContent,
5188
+ Os as PatentEditor,
5189
+ to as acceptAllPatches,
5190
+ Zi as acceptPatch,
5191
+ uo as applyDocDiffDecorations,
5192
+ ao as buildAIContext,
5193
+ lo as buildClaimsJSONContent,
5193
5194
  mn as buildPatentDocument,
5194
- to as clearPatches,
5195
- zs as createChatSessionAPI,
5195
+ Yi as clearPatches,
5196
+ $s as createChatSessionAPI,
5196
5197
  Ae as createCommandExecutor,
5197
5198
  ss as createEditorConfig,
5198
- uo as createMockAIService,
5199
- mo as createMockChatSessionAPI,
5200
- Fs as createSSEAdapter,
5199
+ oo as createMockAIService,
5200
+ co as createMockChatSessionAPI,
5201
+ Rs as createSSEAdapter,
5201
5202
  us as exportToPdf,
5202
- Bt as exportToWord,
5203
- ys as extractClaimsFromEditor,
5204
- yn as findSectionAtCursor,
5205
- Is as getAllSections,
5206
- io as getMissingSectionDeps,
5207
- Zi as getPatches,
5208
- Yi as onPatchChange,
5203
+ Ht as exportToWord,
5204
+ bs as extractClaimsFromEditor,
5205
+ bn as findSectionAtCursor,
5206
+ xs as getAllSections,
5207
+ ro as getMissingSectionDeps,
5208
+ Xi as getPatches,
5209
+ Ji as onPatchChange,
5209
5210
  W as pluginManager,
5210
- so as rejectAllPatches,
5211
- ro as rejectPatch,
5212
- po as removeDocDiffDecorations,
5213
- Qi as resolvePatchTarget,
5214
- bn as sectionContextDeps,
5215
- eo as setPatches,
5211
+ no as rejectAllPatches,
5212
+ eo as rejectPatch,
5213
+ mo as removeDocDiffDecorations,
5214
+ Ki as resolvePatchTarget,
5215
+ yn as sectionContextDeps,
5216
+ Qi as setPatches,
5216
5217
  k as useEditorStore,
5217
- ho as validatePatentDocument,
5218
- co as writeStream,
5219
- lo as writeStreamFromSSE
5218
+ fo as validatePatentDocument,
5219
+ so as writeStream,
5220
+ io as writeStreamFromSSE
5220
5221
  };
5221
5222
  //# sourceMappingURL=lib.js.map