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.
- package/dist/lib.js +1091 -1090
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/lib.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var Nn = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import
|
|
6
|
-
import { Extension as Je, ReactRenderer as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
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
|
|
19
|
-
import
|
|
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
|
|
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
|
|
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
|
|
50
|
-
import { Slice as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
174
|
-
|
|
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((
|
|
180
|
-
})), e.length ? /* @__PURE__ */
|
|
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 ${
|
|
184
|
-
onClick: () => s(
|
|
185
|
-
onMouseEnter: () => a(
|
|
183
|
+
className: `slash-menu-item ${l === r ? "slash-menu-item--active" : ""}`,
|
|
184
|
+
onClick: () => s(l),
|
|
185
|
+
onMouseEnter: () => a(l),
|
|
186
186
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ f("span", { className: "slash-menu-icon", children: i.icon }),
|
|
188
188
|
/* @__PURE__ */ A("div", { className: "slash-menu-text", children: [
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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
|
|
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
|
|
355
|
-
function
|
|
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
|
|
360
|
-
for (;
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
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,
|
|
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
|
|
369
|
-
if (d ===
|
|
370
|
-
return u =
|
|
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 ===
|
|
374
|
-
} else m.isBlock && d > 0 && (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 }),
|
|
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 =
|
|
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 =
|
|
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),
|
|
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),
|
|
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 =
|
|
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 =
|
|
416
|
+
let a = Re(e.state.doc, t, r);
|
|
417
417
|
const s = e.state.tr;
|
|
418
418
|
let i = 0;
|
|
419
|
-
for (const
|
|
420
|
-
const
|
|
421
|
-
s.insertText(n,
|
|
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
|
|
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,
|
|
469
|
+
const da = -1, ua = 1, _t = 0;
|
|
470
470
|
let nt = null;
|
|
471
471
|
function ma() {
|
|
472
|
-
return nt || (nt = new
|
|
472
|
+
return nt || (nt = new qt()), nt;
|
|
473
473
|
}
|
|
474
|
-
const an = new
|
|
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,
|
|
482
|
+
return e.state.doc.nodesBetween(t, n, (i, l) => {
|
|
483
483
|
if (i.isText) {
|
|
484
|
-
const
|
|
485
|
-
r.push({ textIdx: a.length, docPos:
|
|
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
|
|
498
|
-
for (;
|
|
499
|
-
const
|
|
500
|
-
if (
|
|
501
|
-
const d = Ee(i,
|
|
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
|
-
|
|
504
|
+
l = c + 1;
|
|
505
505
|
}
|
|
506
506
|
return null;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function Ki(e, t, n, r, a) {
|
|
509
509
|
const s = t.target;
|
|
510
510
|
let i = null;
|
|
511
|
-
const
|
|
511
|
+
const l = /* @__PURE__ */ new Set();
|
|
512
512
|
if (a)
|
|
513
513
|
for (const o of a)
|
|
514
|
-
|
|
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,
|
|
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
|
|
524
|
+
let c = i;
|
|
525
525
|
if (t.search) {
|
|
526
|
-
const o = kt(e, t.search, i.from, i.to,
|
|
527
|
-
o && (
|
|
526
|
+
const o = kt(e, t.search, i.from, i.to, l);
|
|
527
|
+
o && (c = o);
|
|
528
528
|
}
|
|
529
|
-
const d =
|
|
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:
|
|
534
|
-
to: t.op === "insert" ?
|
|
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
|
|
542
|
-
function
|
|
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
|
|
547
|
+
function be() {
|
|
548
548
|
Ue.forEach((e) => e());
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
return [...
|
|
550
|
+
function Xi() {
|
|
551
|
+
return [...G];
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
|
|
553
|
+
function Qi(e) {
|
|
554
|
+
G = e, be();
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
|
|
556
|
+
function Yi() {
|
|
557
|
+
G = [], be();
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
const n =
|
|
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
|
|
575
|
+
for (const s of G) {
|
|
576
576
|
if (s.id === t || s.status !== "pending") continue;
|
|
577
|
-
const i = a.map(s.from, 1),
|
|
578
|
-
i >=
|
|
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
|
|
580
|
+
return G = G.filter((s) => s.id !== t && s.status === "pending"), Ze(e), be(), !0;
|
|
581
581
|
}
|
|
582
|
-
function
|
|
583
|
-
const n =
|
|
584
|
-
return !n || n.status !== "pending" ? !1 : (n.status = "rejected",
|
|
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
|
|
587
|
-
const n = [...
|
|
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),
|
|
598
|
+
e.view.dispatch(r), G = [], Ze(e), be();
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
|
|
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,
|
|
611
|
-
return d >
|
|
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
|
|
620
|
-
if (
|
|
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(([
|
|
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 [
|
|
631
|
-
if (
|
|
632
|
-
i +=
|
|
633
|
-
else if (
|
|
634
|
-
const d = i +
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
680
|
-
return
|
|
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
|
|
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
|
-
}),
|
|
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
|
-
|
|
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
|
-
|
|
762
|
+
ya,
|
|
763
763
|
jn,
|
|
764
764
|
Wn,
|
|
765
|
-
|
|
766
|
-
|
|
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
|
-
|
|
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,
|
|
845
|
-
const s = Date.now(), i = a.transaction ?? !0,
|
|
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
|
|
860
|
-
!
|
|
861
|
-
const
|
|
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:
|
|
863
|
+
success: h,
|
|
864
864
|
durationMs: Date.now() - s
|
|
865
865
|
};
|
|
866
|
-
return (m = a.onComplete) == null || m.call(a,
|
|
866
|
+
return (m = a.onComplete) == null || m.call(a, b), h;
|
|
867
867
|
} catch (p) {
|
|
868
|
-
|
|
869
|
-
const
|
|
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 (
|
|
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
|
-
|
|
889
|
-
|
|
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(),
|
|
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" ?
|
|
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-
|
|
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
|
|
1179
|
-
|
|
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,
|
|
1182
|
-
const
|
|
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:
|
|
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
|
|
1187
|
-
const
|
|
1188
|
-
const T =
|
|
1189
|
-
if (T !==
|
|
1186
|
+
let b = "";
|
|
1187
|
+
const x = async (y) => {
|
|
1188
|
+
const T = y.trim();
|
|
1189
|
+
if (T !== b) {
|
|
1190
1190
|
if (!T) {
|
|
1191
|
-
|
|
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
|
|
1198
|
-
|
|
1197
|
+
const M = `standalone-mermaid-${$e}`, { svg: R } = await E.default.render(M, T);
|
|
1198
|
+
l.innerHTML = R, b = T;
|
|
1199
1199
|
} catch {
|
|
1200
|
-
|
|
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
|
-
},
|
|
1210
|
-
const
|
|
1209
|
+
}, w = async () => {
|
|
1210
|
+
const y = o.value;
|
|
1211
1211
|
m.textContent = "", m.style.display = "none";
|
|
1212
|
-
const T =
|
|
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
|
|
1218
|
-
|
|
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
|
-
|
|
1225
|
+
h({ code: y }), a = !1, _();
|
|
1226
1226
|
};
|
|
1227
|
-
i.addEventListener("dblclick", (
|
|
1228
|
-
|
|
1229
|
-
}), p.addEventListener("click", (
|
|
1230
|
-
|
|
1231
|
-
}),
|
|
1232
|
-
|
|
1233
|
-
}), o.addEventListener("mousedown", (
|
|
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
|
|
1236
|
-
i.style.display = a ? "none" : "block", d.style.display = a ? "block" : "none", p.textContent = T.mermaidSaveAndRender || "保存并渲染",
|
|
1237
|
-
const
|
|
1238
|
-
a || (
|
|
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((
|
|
1242
|
-
|
|
1241
|
+
const P = k.subscribe((y) => {
|
|
1242
|
+
y.editorLanguage !== L && (L = y.editorLanguage, _());
|
|
1243
1243
|
});
|
|
1244
1244
|
return _(), {
|
|
1245
1245
|
dom: s,
|
|
1246
|
-
stopEvent: (
|
|
1247
|
-
const T =
|
|
1246
|
+
stopEvent: (y) => {
|
|
1247
|
+
const T = y.target;
|
|
1248
1248
|
return !!(T === o || d.contains(T));
|
|
1249
1249
|
},
|
|
1250
1250
|
ignoreMutation: () => !0,
|
|
1251
|
-
update: (
|
|
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
|
|
1309
|
-
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1312
|
-
const d = (
|
|
1313
|
-
const
|
|
1314
|
-
typeof
|
|
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
|
|
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-
|
|
1324
|
-
const
|
|
1325
|
-
|
|
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()),
|
|
1328
|
-
const P =
|
|
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
|
|
1330
|
+
const y = m;
|
|
1331
1331
|
o = (T) => {
|
|
1332
|
-
var
|
|
1333
|
-
if (!
|
|
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
|
-
(
|
|
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
|
-
(
|
|
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),
|
|
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", (
|
|
1361
|
-
|
|
1360
|
+
i.addEventListener("dblclick", (v) => {
|
|
1361
|
+
v.preventDefault(), v.stopPropagation(), g();
|
|
1362
1362
|
});
|
|
1363
|
-
const
|
|
1364
|
-
const
|
|
1365
|
-
|
|
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
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1367
|
+
let b = k.getState().editorLanguage;
|
|
1368
|
+
const x = k.subscribe((v) => {
|
|
1369
|
+
v.editorLanguage !== b && (b = v.editorLanguage, h());
|
|
1370
1370
|
});
|
|
1371
|
-
return
|
|
1371
|
+
return h(), {
|
|
1372
1372
|
dom: s,
|
|
1373
1373
|
ignoreMutation: () => !0,
|
|
1374
|
-
update: (
|
|
1374
|
+
update: (v) => v.type.name !== "drawio" ? !1 : (r = v, h(), !0),
|
|
1375
1375
|
destroy: () => {
|
|
1376
|
-
|
|
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
|
-
}),
|
|
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),
|
|
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
|
-
|
|
1421
|
+
c.current || (c.current = !0, i(!0));
|
|
1422
1422
|
}, []), m = de(() => {
|
|
1423
|
-
var
|
|
1424
|
-
if (!
|
|
1425
|
-
|
|
1426
|
-
const p = ((
|
|
1427
|
-
d.current({ latex: p }), i(!1), (
|
|
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
|
|
1431
|
-
const p = !!((
|
|
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
|
|
1435
|
+
var h;
|
|
1436
1436
|
const p = a.current;
|
|
1437
|
-
p && (p.virtualKeyboardMode = "onfocus", (
|
|
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
|
|
1443
|
+
const h = () => {
|
|
1444
1444
|
setTimeout(() => {
|
|
1445
|
-
var
|
|
1446
|
-
if (!
|
|
1447
|
-
const
|
|
1448
|
-
(
|
|
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
|
-
},
|
|
1451
|
-
|
|
1450
|
+
}, b = (x) => {
|
|
1451
|
+
x.key === "Escape" && m();
|
|
1452
1452
|
};
|
|
1453
|
-
return p.addEventListener("focusout",
|
|
1454
|
-
p.removeEventListener("focusout",
|
|
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
|
|
1459
|
+
let g = "";
|
|
1460
1460
|
try {
|
|
1461
|
-
|
|
1461
|
+
g = hr.renderToString(e.attrs.latex || "", {
|
|
1462
1462
|
throwOnError: !1,
|
|
1463
|
-
displayMode:
|
|
1463
|
+
displayMode: l
|
|
1464
1464
|
});
|
|
1465
1465
|
} catch {
|
|
1466
|
-
|
|
1466
|
+
g = e.attrs.latex || "";
|
|
1467
1467
|
}
|
|
1468
|
-
return /* @__PURE__ */
|
|
1468
|
+
return /* @__PURE__ */ f(
|
|
1469
1469
|
An,
|
|
1470
1470
|
{
|
|
1471
|
-
as:
|
|
1472
|
-
className:
|
|
1473
|
-
children: s ? /* @__PURE__ */
|
|
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:
|
|
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__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ f("span", { dangerouslySetInnerHTML: { __html: g } }),
|
|
1482
|
+
/* @__PURE__ */ f("span", { className: "math-tooltip", children: "点击编辑" })
|
|
1483
1483
|
] })
|
|
1484
1484
|
}
|
|
1485
1485
|
);
|
|
1486
|
-
},
|
|
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
|
|
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
|
|
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: [
|
|
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,
|
|
1592
|
-
},
|
|
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,
|
|
1595
|
-
},
|
|
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
|
-
},
|
|
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 =
|
|
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
|
|
1629
|
-
const s = typeof t.position == "number" ? t.position : (
|
|
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
|
|
1636
|
-
return n.setNodeMarkup(s, void 0,
|
|
1637
|
-
}),
|
|
1638
|
-
var
|
|
1639
|
-
const s = typeof t.position == "number" ? t.position : (
|
|
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 =
|
|
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:
|
|
1648
|
-
if (!
|
|
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 =
|
|
1651
|
-
return d ? (r.wrap(
|
|
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
|
-
},
|
|
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" ?
|
|
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 =
|
|
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),
|
|
1690
|
-
if (!r || n.pos !==
|
|
1691
|
-
const
|
|
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((
|
|
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(
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
1731
|
+
let c = k.getState().editorLanguage;
|
|
1732
1732
|
const d = k.subscribe((o) => {
|
|
1733
|
-
o.editorLanguage !==
|
|
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
|
|
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),
|
|
1742
|
+
}), a.append(s, i), l(), {
|
|
1743
1743
|
dom: a,
|
|
1744
1744
|
contentDOM: i,
|
|
1745
|
-
update: (o) => o.type.name !== "claim" ? !1 : (r = o,
|
|
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
|
|
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,
|
|
1760
|
-
let
|
|
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
|
|
1763
|
-
ce && (window.removeEventListener("message", ce), ce = null),
|
|
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(
|
|
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(
|
|
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 =
|
|
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
|
|
1794
|
-
if (!
|
|
1795
|
-
let
|
|
1793
|
+
var c;
|
|
1794
|
+
if (!q || i.source !== q.contentWindow) return;
|
|
1795
|
+
let l;
|
|
1796
1796
|
try {
|
|
1797
|
-
|
|
1797
|
+
l = typeof i.data == "string" ? JSON.parse(i.data) : i.data;
|
|
1798
1798
|
} catch {
|
|
1799
1799
|
return;
|
|
1800
1800
|
}
|
|
1801
|
-
|
|
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
|
-
) :
|
|
1805
|
-
}, window.addEventListener("message", ce), r = setTimeout(() => a(""), Fa),
|
|
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
|
|
1843
|
-
|
|
1844
|
-
const
|
|
1845
|
-
|
|
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
|
|
1855
|
-
|
|
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
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1866
|
-
const
|
|
1867
|
-
|
|
1868
|
-
const
|
|
1869
|
-
|
|
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",
|
|
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
|
|
1877
|
-
|
|
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
|
|
1883
|
-
|
|
1884
|
-
const
|
|
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:
|
|
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
|
|
1892
|
-
|
|
1893
|
-
typeof
|
|
1894
|
-
},
|
|
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
|
-
}),
|
|
1898
|
+
}), l.addEventListener("dragover", (I) => {
|
|
1899
1899
|
r.attrs.contentType === "image" && (I.preventDefault(), I.stopPropagation(), d.classList.add("figure-upload-area--dragover"));
|
|
1900
|
-
}),
|
|
1900
|
+
}), l.addEventListener("dragleave", () => {
|
|
1901
1901
|
d.classList.remove("figure-upload-area--dragover");
|
|
1902
|
-
}),
|
|
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,
|
|
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 =
|
|
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
|
|
1917
|
-
|
|
1918
|
-
const j = `fig-mermaid-${Fe}`, { svg: F } = await
|
|
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
|
|
1923
|
-
_.textContent =
|
|
1922
|
+
const D = k.getState().editorLanguage;
|
|
1923
|
+
_.textContent = D === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", _.style.display = "inline";
|
|
1924
1924
|
return;
|
|
1925
1925
|
}
|
|
1926
|
-
|
|
1926
|
+
R({ mermaidCode: I }), a = !1, se();
|
|
1927
1927
|
};
|
|
1928
|
-
|
|
1928
|
+
g.addEventListener("dblclick", (I) => {
|
|
1929
1929
|
I.preventDefault(), I.stopPropagation(), Le();
|
|
1930
|
-
}),
|
|
1930
|
+
}), C.addEventListener("click", (I) => {
|
|
1931
1931
|
I.stopPropagation(), H();
|
|
1932
|
-
}),
|
|
1932
|
+
}), w.addEventListener("click", (I) => {
|
|
1933
1933
|
I.stopPropagation(), S();
|
|
1934
|
-
}),
|
|
1934
|
+
}), x.addEventListener("mousedown", (I) => I.stopPropagation()), x.addEventListener("keydown", (I) => I.stopPropagation()), x.addEventListener("keypress", (I) => I.stopPropagation());
|
|
1935
1935
|
let $ = null, O = null, K = null;
|
|
1936
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
|
|
1944
|
-
|
|
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(
|
|
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
|
-
),
|
|
1970
|
+
), R({ drawioXml: me });
|
|
1971
1971
|
} else if (J.event === "export") {
|
|
1972
1972
|
const me = J.data || "";
|
|
1973
|
-
|
|
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 ===
|
|
1984
|
-
const
|
|
1985
|
-
if (typeof
|
|
1986
|
-
const 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
|
|
1999
|
-
|
|
2000
|
-
const j = `fig-mermaid-${Fe}`, { svg: F } = await
|
|
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),
|
|
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 =
|
|
2012
|
-
|
|
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 || "更换图片",
|
|
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 ? (
|
|
2017
|
-
const
|
|
2018
|
-
J &&
|
|
2019
|
-
|
|
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
|
|
2022
|
+
let xt = k.getState().editorLanguage;
|
|
2023
2023
|
const En = k.subscribe((I) => {
|
|
2024
|
-
I.editorLanguage !==
|
|
2024
|
+
I.editorLanguage !== xt && (xt = I.editorLanguage, se());
|
|
2025
2025
|
});
|
|
2026
2026
|
return se(), {
|
|
2027
2027
|
dom: i,
|
|
2028
|
-
contentDOM:
|
|
2028
|
+
contentDOM: M,
|
|
2029
2029
|
stopEvent: (I) => {
|
|
2030
2030
|
const N = I.target;
|
|
2031
|
-
return !!(N ===
|
|
2031
|
+
return !!(N === x || b.contains(N) || N === u);
|
|
2032
2032
|
},
|
|
2033
2033
|
ignoreMutation: (I) => {
|
|
2034
2034
|
const N = I.target;
|
|
2035
|
-
return !!(
|
|
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),
|
|
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
|
|
2115
|
-
if (!
|
|
2114
|
+
const l = typeof n.attrs.targetFigureId == "string" ? n.attrs.targetFigureId : "";
|
|
2115
|
+
if (!l)
|
|
2116
2116
|
return;
|
|
2117
|
-
t.state.doc.descendants((
|
|
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((
|
|
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
|
-
}),
|
|
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
|
-
]),
|
|
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 &&
|
|
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
|
|
2198
|
-
|
|
2199
|
-
const
|
|
2200
|
-
const
|
|
2201
|
-
return typeof
|
|
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
|
|
2204
|
-
|
|
2203
|
+
const h = c();
|
|
2204
|
+
h !== null && k.getState().setActiveSection("patent_title", h);
|
|
2205
2205
|
}, o = () => {
|
|
2206
|
-
const
|
|
2207
|
-
|
|
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),
|
|
2209
|
+
i.addEventListener("click", o), l.addEventListener("focusin", d), l.addEventListener("click", d);
|
|
2210
2210
|
const u = () => {
|
|
2211
|
-
const
|
|
2212
|
-
s.textContent =
|
|
2213
|
-
const
|
|
2214
|
-
i.textContent = `[${
|
|
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,
|
|
2217
|
-
const p = k.subscribe((
|
|
2218
|
-
const
|
|
2219
|
-
m =
|
|
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:
|
|
2224
|
-
update: (
|
|
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),
|
|
2226
|
+
p(), i.removeEventListener("click", o), l.removeEventListener("focusin", d), l.removeEventListener("click", d);
|
|
2227
2227
|
}
|
|
2228
2228
|
};
|
|
2229
2229
|
};
|
|
2230
2230
|
}
|
|
2231
|
-
}),
|
|
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
|
|
2267
|
+
key: new ke("patentSectionLock"),
|
|
2268
2268
|
props: {
|
|
2269
2269
|
transformPasted: (t) => {
|
|
2270
2270
|
const n = e(t.content);
|
|
2271
|
-
return new
|
|
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-
|
|
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(
|
|
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
|
|
2306
|
-
return typeof
|
|
2305
|
+
const v = typeof n == "function" ? n() : null;
|
|
2306
|
+
return typeof v == "number" ? v : null;
|
|
2307
2307
|
}, u = () => {
|
|
2308
|
-
const
|
|
2309
|
-
if (
|
|
2310
|
-
k.getState().setActiveSection(r.attrs.sectionType,
|
|
2308
|
+
const v = o();
|
|
2309
|
+
if (v === null) return;
|
|
2310
|
+
k.getState().setActiveSection(r.attrs.sectionType, v);
|
|
2311
2311
|
}, m = () => {
|
|
2312
|
-
const
|
|
2313
|
-
if (
|
|
2314
|
-
k.getState().openDraftingPanel(r.attrs.sectionType,
|
|
2315
|
-
},
|
|
2316
|
-
|
|
2317
|
-
const
|
|
2318
|
-
let
|
|
2319
|
-
e.state.doc.descendants((E) => (E.type.name === "claim" &&
|
|
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:
|
|
2324
|
-
claimId:
|
|
2323
|
+
number: w + 1,
|
|
2324
|
+
claimId: C,
|
|
2325
2325
|
dependsOn: [],
|
|
2326
2326
|
dependsOnClaimIds: []
|
|
2327
|
-
}),
|
|
2328
|
-
|
|
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
|
-
|
|
2330
|
+
l.addEventListener("click", m), c.addEventListener("focusin", u), c.addEventListener("click", u), d.addEventListener("mousedown", g);
|
|
2331
2331
|
const p = () => {
|
|
2332
|
-
const
|
|
2333
|
-
a.className = `ps${E ? "" : " ps--empty"}${L ? " ps--sub" : ""}`, a.setAttribute("data-section-type",
|
|
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
|
|
2336
|
-
const
|
|
2337
|
-
const
|
|
2338
|
-
|
|
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:
|
|
2343
|
-
update: (
|
|
2342
|
+
contentDOM: c,
|
|
2343
|
+
update: (v) => v.type.name !== "patent_section" ? !1 : (r = v, p(), !0),
|
|
2344
2344
|
destroy: () => {
|
|
2345
|
-
|
|
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
|
-
}),
|
|
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
|
-
...
|
|
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() }),
|
|
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) =>
|
|
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
|
-
|
|
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 =
|
|
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
|
|
2414
|
-
const
|
|
2415
|
-
if (!Ya.exec(
|
|
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
|
-
|
|
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
|
|
2422
|
-
const
|
|
2423
|
-
!
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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(),
|
|
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
|
-
|
|
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) =>
|
|
2472
|
+
s.add(d), i.add(d), (a.get(d) || []).forEach((u) => c(u)), i.delete(d);
|
|
2473
2473
|
};
|
|
2474
|
-
return e.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 : "",
|
|
2486
|
-
return n.add(
|
|
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),
|
|
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:
|
|
2497
|
-
dependsOnClaimIds:
|
|
2496
|
+
dependsOn: b,
|
|
2497
|
+
dependsOnClaimIds: h
|
|
2498
2498
|
};
|
|
2499
|
-
return { claimId: o.claimId, number: o.number, dependsOnClaimIds:
|
|
2500
|
-
}),
|
|
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((
|
|
2503
|
-
const p = e.state.doc.nodeAt(
|
|
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
|
|
2507
|
-
(p.attrs.number !==
|
|
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(
|
|
2510
|
-
)) && (o.setNodeMarkup(
|
|
2509
|
+
rt(h.dependsOnClaimIds)
|
|
2510
|
+
)) && (o.setNodeMarkup(g.pos, void 0, h), m = !0);
|
|
2511
2511
|
}), m && u && u(o), !0;
|
|
2512
|
-
}), d =
|
|
2513
|
-
return d !== V.lastClaimGraphSignature && (V.lastClaimGraphSignature = d, V.claimGraphHandler && V.claimGraphHandler({ issues:
|
|
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
|
|
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:
|
|
2535
|
+
if (!e.commands.command(({ tr: l, state: c, dispatch: d }) => {
|
|
2536
2536
|
let o = !1;
|
|
2537
|
-
return
|
|
2537
|
+
return c.doc.descendants((u, m) => {
|
|
2538
2538
|
if (u.type.name !== "reference")
|
|
2539
2539
|
return !0;
|
|
2540
|
-
const
|
|
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:
|
|
2542
|
+
targetType: g,
|
|
2543
2543
|
targetClaimId: p,
|
|
2544
|
-
targetFigureId:
|
|
2545
|
-
resolvedNumber:
|
|
2546
|
-
resolvedFigureId:
|
|
2547
|
-
invalid:
|
|
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
|
-
) && (
|
|
2555
|
-
}), o && d && d(
|
|
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((
|
|
2559
|
-
return i !== V.lastInvalidReferenceSignature && (V.lastInvalidReferenceSignature = i, r.forEach((
|
|
2560
|
-
V.invalidReferenceHandler && V.invalidReferenceHandler(
|
|
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
|
-
},
|
|
2563
|
-
const t =
|
|
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((
|
|
2567
|
-
if (
|
|
2566
|
+
return a.doc.descendants((l, c) => {
|
|
2567
|
+
if (l.type.name !== "reference")
|
|
2568
2568
|
return !0;
|
|
2569
|
-
const d =
|
|
2570
|
-
return
|
|
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 >
|
|
2575
|
-
n !== V.lastClaimWarningSignature && (V.lastClaimWarningSignature = n, t.length !== 0 && console.warn(`Claim content is too long for ${t.length} block(s). Suggested max: ${
|
|
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 =
|
|
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
|
|
2589
|
-
return n.trim().length === 0 ? r.delete(
|
|
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,
|
|
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
|
-
},
|
|
2627
|
-
let
|
|
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
|
-
|
|
2630
|
+
c = Ve(e, { type: "claim", position: u, attrs: i, content: l });
|
|
2631
2631
|
} else
|
|
2632
|
-
|
|
2633
|
-
return !
|
|
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 : "",
|
|
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
|
|
2660
|
-
Number.isFinite(
|
|
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
|
|
2662
|
+
const c = Ge(n.dependsOn).filter(
|
|
2663
2663
|
(m) => Number.isFinite(s) && m > 0 && m < s
|
|
2664
|
-
), d =
|
|
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:
|
|
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" ?
|
|
2682
|
-
return e.commands.command(({ tr:
|
|
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
|
|
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(
|
|
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" || !
|
|
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) ||
|
|
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 =
|
|
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
|
|
2739
|
-
if (
|
|
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:
|
|
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
|
|
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,
|
|
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:
|
|
2794
|
+
lang: l,
|
|
2795
2795
|
invalid: !1,
|
|
2796
|
-
displayText:
|
|
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(),
|
|
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:
|
|
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
|
|
2846
|
-
return s.doc.descendants((
|
|
2847
|
-
...
|
|
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
|
-
}),
|
|
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 =
|
|
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),
|
|
2890
|
+
ie(e) && (Q(e), Ft(e), ts(e), Za(e));
|
|
2891
2891
|
},
|
|
2892
2892
|
onSelectionChange: (e) => {
|
|
2893
|
-
|
|
2893
|
+
Ft(e);
|
|
2894
2894
|
}
|
|
2895
|
-
}, as = [Ea,
|
|
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) =>
|
|
2921
|
+
removeNode: (t) => Ct(e, t),
|
|
2922
2922
|
wrapSelection: (t) => dn(e, t),
|
|
2923
|
-
applyTransactionBatch: (t) =>
|
|
2923
|
+
applyTransactionBatch: (t) => Ra(e, t),
|
|
2924
2924
|
findNodeByType: (t, n) => bt(e, t, n),
|
|
2925
|
-
findAncestorNode: (t) =>
|
|
2925
|
+
findAncestorNode: (t) => ye(e, t),
|
|
2926
2926
|
findCurrentBlock: () => Pa(e),
|
|
2927
|
-
findNodesByPredicate: (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}`,
|
|
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 &&
|
|
2957
|
-
}), r.push({ type: "patent_section", sectionType: s, title:
|
|
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
|
|
2962
|
+
function zt(e) {
|
|
2963
2963
|
return new Qe({
|
|
2964
2964
|
children: [new Ye({ text: e, bold: !0, size: 32, font: "黑体" })],
|
|
2965
|
-
alignment:
|
|
2965
|
+
alignment: yt.CENTER,
|
|
2966
2966
|
spacing: { before: 400, after: 200 }
|
|
2967
2967
|
});
|
|
2968
2968
|
}
|
|
2969
|
-
function
|
|
2969
|
+
function Bt(e) {
|
|
2970
2970
|
return new Qe({
|
|
2971
2971
|
children: [new Ye({ text: e, bold: !0, size: 28, font: "黑体" })],
|
|
2972
|
-
alignment:
|
|
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:
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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
|
-
},
|
|
3034
|
+
}, l = new Zr({
|
|
3035
3035
|
sections: [i]
|
|
3036
|
-
}),
|
|
3037
|
-
ta(
|
|
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,
|
|
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
|
-
|
|
3046
|
+
l({ top: d.bottom + 4, left: d.left });
|
|
3047
3047
|
}, []);
|
|
3048
3048
|
return B(() => {
|
|
3049
3049
|
if (!n) return;
|
|
3050
|
-
|
|
3050
|
+
c();
|
|
3051
3051
|
const d = (u) => {
|
|
3052
|
-
var
|
|
3052
|
+
var g, p;
|
|
3053
3053
|
const m = u.target;
|
|
3054
|
-
(
|
|
3055
|
-
}, o = () =>
|
|
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,
|
|
3060
|
-
/* @__PURE__ */
|
|
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__ */
|
|
3071
|
+
children: /* @__PURE__ */ f(e.icon, { size: 18 })
|
|
3072
3072
|
}
|
|
3073
3073
|
),
|
|
3074
|
-
/* @__PURE__ */
|
|
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__ */
|
|
3084
|
+
children: /* @__PURE__ */ f(nn, { size: 12 })
|
|
3085
3085
|
}
|
|
3086
3086
|
),
|
|
3087
3087
|
n && Cr(
|
|
3088
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
3415
|
+
Link2: ht,
|
|
3416
3416
|
Image: en
|
|
3417
|
-
},
|
|
3418
|
-
const T = W.getCommandMeta(
|
|
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:
|
|
3421
|
-
label:
|
|
3422
|
-
group:
|
|
3423
|
-
icon:
|
|
3424
|
-
isActive: d.isCommandActive(
|
|
3425
|
-
disabled: !d.canExecCommand(
|
|
3426
|
-
tooltip:
|
|
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(
|
|
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
|
|
3440
|
-
},
|
|
3441
|
-
{ label: o ? "导出 Word (.docx)" : "Export Word (.docx)", onClick: () => void
|
|
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
|
-
],
|
|
3444
|
-
group:
|
|
3445
|
-
items:
|
|
3446
|
-
})).filter((
|
|
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(
|
|
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:
|
|
3465
|
-
{ label:
|
|
3466
|
-
{ label:
|
|
3467
|
-
], P = (
|
|
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:
|
|
3471
|
-
disabled:
|
|
3470
|
+
onClick: y.run,
|
|
3471
|
+
disabled: y.disabled,
|
|
3472
3472
|
className: re(
|
|
3473
3473
|
"p-2 rounded transition-colors",
|
|
3474
|
-
|
|
3475
|
-
|
|
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:
|
|
3478
|
-
children: /* @__PURE__ */
|
|
3477
|
+
title: y.tooltip,
|
|
3478
|
+
children: /* @__PURE__ */ f(y.icon, { size: 18 })
|
|
3479
3479
|
},
|
|
3480
|
-
|
|
3480
|
+
y.id
|
|
3481
3481
|
);
|
|
3482
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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: (
|
|
3490
|
-
|
|
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__ */
|
|
3495
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ f("option", { value: "zh", children: "中文" }),
|
|
3495
|
+
/* @__PURE__ */ f("option", { value: "en", children: "English" })
|
|
3496
3496
|
]
|
|
3497
3497
|
}
|
|
3498
3498
|
)
|
|
3499
3499
|
] }),
|
|
3500
|
-
|
|
3501
|
-
const T = a.has(
|
|
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__ */
|
|
3503
|
+
n && /* @__PURE__ */ f(
|
|
3504
3504
|
"button",
|
|
3505
3505
|
{
|
|
3506
3506
|
onClick: () => {
|
|
3507
|
-
|
|
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(
|
|
3511
|
-
children: ot(
|
|
3510
|
+
title: T ? `Expand ${ot(y.group)}` : `Collapse ${ot(y.group)}`,
|
|
3511
|
+
children: ot(y.group)
|
|
3512
3512
|
}
|
|
3513
3513
|
),
|
|
3514
|
-
(!n || !T) &&
|
|
3515
|
-
] },
|
|
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(""),
|
|
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:
|
|
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"),
|
|
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
|
-
),
|
|
3546
|
-
if (!
|
|
3547
|
-
const H =
|
|
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
|
-
},
|
|
3550
|
-
|
|
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
|
-
|
|
3553
|
-
position:
|
|
3552
|
+
w && d.execCommand("patent.updateFigure", {
|
|
3553
|
+
position: w.pos,
|
|
3554
3554
|
contentType: S
|
|
3555
3555
|
});
|
|
3556
3556
|
}, Le = () => {
|
|
3557
|
-
if (!
|
|
3558
|
-
const S =
|
|
3557
|
+
if (!w) return;
|
|
3558
|
+
const S = y.trim();
|
|
3559
3559
|
S !== L && d.execCommand("patent.updateFigure", {
|
|
3560
|
-
position:
|
|
3560
|
+
position: w.pos,
|
|
3561
3561
|
id: S
|
|
3562
3562
|
});
|
|
3563
3563
|
};
|
|
3564
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
3575
|
-
o.map((S) => /* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
3590
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
3604
|
-
u.map((S) => /* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
3619
|
-
children: /* @__PURE__ */
|
|
3618
|
+
title: c.insertFigureReference,
|
|
3619
|
+
children: /* @__PURE__ */ f(en, { size: 16 })
|
|
3620
3620
|
}
|
|
3621
3621
|
)
|
|
3622
3622
|
] }),
|
|
3623
|
-
/* @__PURE__ */
|
|
3623
|
+
/* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
|
|
3624
3624
|
_ && /* @__PURE__ */ A(we, { children: [
|
|
3625
|
-
/* @__PURE__ */
|
|
3626
|
-
/* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
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:
|
|
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:
|
|
3639
|
+
placeholder: l === "en" ? "Fig.1" : "图1"
|
|
3640
3640
|
}
|
|
3641
3641
|
),
|
|
3642
|
-
/* @__PURE__ */
|
|
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__ */
|
|
3651
|
-
/* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
3662
|
-
["25%", "50%", "75%", "100%"].map((O) => /* @__PURE__ */
|
|
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__ */
|
|
3671
|
+
/* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" })
|
|
3672
3672
|
] });
|
|
3673
3673
|
})(),
|
|
3674
|
-
|
|
3675
|
-
/* @__PURE__ */
|
|
3676
|
-
|
|
3677
|
-
/* @__PURE__ */
|
|
3678
|
-
|
|
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: () =>
|
|
3682
|
-
className: `text-xs px-2 py-0.5 rounded border ${
|
|
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__ */
|
|
3689
|
-
/* @__PURE__ */
|
|
3690
|
-
/* @__PURE__ */
|
|
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 (
|
|
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:
|
|
3700
|
-
children: /* @__PURE__ */
|
|
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
|
-
},
|
|
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
|
|
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
|
-
},
|
|
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(),
|
|
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
|
-
|
|
3777
|
+
l.add(o);
|
|
3778
3778
|
return;
|
|
3779
3779
|
}
|
|
3780
|
-
s.has(o) || (s.add(o), i.add(o), (a.get(o) || []).forEach((u) =>
|
|
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) =>
|
|
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
|
|
3799
|
-
return
|
|
3800
|
-
}),
|
|
3801
|
-
const
|
|
3802
|
-
return
|
|
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 &&
|
|
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])),
|
|
3820
|
-
if (
|
|
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
|
-
|
|
3822
|
+
c.add(o);
|
|
3823
3823
|
const m = i.get(o);
|
|
3824
3824
|
if (!m)
|
|
3825
3825
|
return;
|
|
3826
|
-
|
|
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,
|
|
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)),
|
|
3833
|
-
}, ws = (
|
|
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) =>
|
|
3836
|
+
selector: (o) => bs(o.editor)
|
|
3841
3837
|
}), i = Te(
|
|
3842
3838
|
() => vs(s, r),
|
|
3843
3839
|
[s, r]
|
|
3844
|
-
),
|
|
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 =
|
|
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__ */
|
|
3854
|
-
/* @__PURE__ */
|
|
3855
|
-
/* @__PURE__ */
|
|
3856
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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 &&
|
|
3896
|
-
/* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
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
|
-
},
|
|
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
|
|
3928
|
-
return (
|
|
3902
|
+
function ro(e, t) {
|
|
3903
|
+
return (yn[e] || []).filter((r) => !t.has(r));
|
|
3929
3904
|
}
|
|
3930
|
-
function
|
|
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
|
|
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
|
|
3962
|
-
const n =
|
|
3936
|
+
function Ss(e, t) {
|
|
3937
|
+
const n = yn[t];
|
|
3963
3938
|
if (!n || n.length === 0) return [];
|
|
3964
|
-
const r =
|
|
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
|
|
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,
|
|
3950
|
+
let i = t.sectionType, l = t.targetSectionPos;
|
|
3976
3951
|
if (!i) {
|
|
3977
|
-
const u =
|
|
3978
|
-
u && (i = u.sectionType,
|
|
3952
|
+
const u = bn(e);
|
|
3953
|
+
u && (i = u.sectionType, l = u.pos);
|
|
3979
3954
|
}
|
|
3980
|
-
const
|
|
3955
|
+
const c = t.scope || (i ? "section" : s ? "selection" : "document"), d = i ? Ss(e, i) : void 0;
|
|
3981
3956
|
let o;
|
|
3982
|
-
if (
|
|
3983
|
-
const m = Math.max(0, r - 200),
|
|
3984
|
-
o = `...${p}[SELECTED]${
|
|
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:
|
|
3962
|
+
scope: c,
|
|
3988
3963
|
sectionType: i,
|
|
3989
|
-
targetSectionPos:
|
|
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
|
|
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
|
-
),
|
|
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 =
|
|
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
|
-
},
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
4004
|
+
children: /* @__PURE__ */ f(Vt, { size: 15 })
|
|
4030
4005
|
}
|
|
4031
4006
|
),
|
|
4032
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4013
|
+
children: /* @__PURE__ */ f(Kt, { size: 15 })
|
|
4039
4014
|
}
|
|
4040
4015
|
),
|
|
4041
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4022
|
+
children: /* @__PURE__ */ f(Jt, { size: 15 })
|
|
4048
4023
|
}
|
|
4049
4024
|
),
|
|
4050
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4031
|
+
children: /* @__PURE__ */ f(Xt, { size: 15 })
|
|
4057
4032
|
}
|
|
4058
4033
|
),
|
|
4059
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4040
|
+
children: /* @__PURE__ */ f(Qt, { size: 15 })
|
|
4066
4041
|
}
|
|
4067
4042
|
),
|
|
4068
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4049
|
+
children: /* @__PURE__ */ f(Yt, { size: 15 })
|
|
4075
4050
|
}
|
|
4076
4051
|
),
|
|
4077
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4058
|
+
children: /* @__PURE__ */ f(Zt, { size: 15 })
|
|
4084
4059
|
}
|
|
4085
4060
|
),
|
|
4086
|
-
/* @__PURE__ */
|
|
4087
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4068
|
+
children: /* @__PURE__ */ f(Gr, { size: 15 })
|
|
4094
4069
|
}
|
|
4095
4070
|
),
|
|
4096
|
-
/* @__PURE__ */
|
|
4071
|
+
/* @__PURE__ */ f(
|
|
4097
4072
|
"button",
|
|
4098
4073
|
{
|
|
4099
|
-
onClick:
|
|
4074
|
+
onClick: c,
|
|
4100
4075
|
className: i(e.isActive("link")),
|
|
4101
4076
|
title: "Link",
|
|
4102
|
-
children: /* @__PURE__ */
|
|
4077
|
+
children: /* @__PURE__ */ f(ht, { size: 15 })
|
|
4103
4078
|
}
|
|
4104
4079
|
),
|
|
4105
|
-
/* @__PURE__ */
|
|
4106
|
-
/* @__PURE__ */
|
|
4080
|
+
/* @__PURE__ */ f("div", { className: "bubble-menu-divider" }),
|
|
4081
|
+
/* @__PURE__ */ f(
|
|
4107
4082
|
"button",
|
|
4108
4083
|
{
|
|
4109
|
-
onClick:
|
|
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__ */
|
|
4087
|
+
children: /* @__PURE__ */ f(qr, { size: 15 })
|
|
4113
4088
|
}
|
|
4114
4089
|
)
|
|
4115
4090
|
] })
|
|
4116
4091
|
}
|
|
4117
4092
|
);
|
|
4118
|
-
},
|
|
4119
|
-
var
|
|
4120
|
-
const [t, n] = z(!1), [r, a] = z(!1), [s, i] = z(""), [
|
|
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
|
|
4097
|
+
const C = (w) => {
|
|
4123
4098
|
n(!0);
|
|
4124
|
-
const _ =
|
|
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",
|
|
4105
|
+
return window.addEventListener("editor:toggleSearch", C), () => window.removeEventListener("editor:toggleSearch", C);
|
|
4131
4106
|
}, []);
|
|
4132
|
-
const
|
|
4133
|
-
(
|
|
4134
|
-
i(
|
|
4107
|
+
const h = de(
|
|
4108
|
+
(C) => {
|
|
4109
|
+
i(C), e.commands.setSearchTerm(C);
|
|
4135
4110
|
},
|
|
4136
4111
|
[e]
|
|
4137
|
-
),
|
|
4112
|
+
), b = de(() => {
|
|
4138
4113
|
n(!1), e.commands.clearSearch(), e.commands.focus();
|
|
4139
4114
|
}, [e]);
|
|
4140
4115
|
B(() => {
|
|
4141
|
-
const
|
|
4142
|
-
|
|
4116
|
+
const C = (w) => {
|
|
4117
|
+
w.key === "Escape" && t && b();
|
|
4143
4118
|
};
|
|
4144
|
-
return window.addEventListener("keydown",
|
|
4145
|
-
}, [t,
|
|
4146
|
-
const
|
|
4147
|
-
const
|
|
4148
|
-
o(
|
|
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__ */
|
|
4128
|
+
/* @__PURE__ */ f(
|
|
4154
4129
|
"input",
|
|
4155
4130
|
{
|
|
4156
4131
|
ref: u,
|
|
4157
4132
|
type: "text",
|
|
4158
4133
|
value: s,
|
|
4159
|
-
onChange: (
|
|
4160
|
-
onKeyDown: (
|
|
4161
|
-
|
|
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__ */
|
|
4142
|
+
/* @__PURE__ */ f("span", { className: "find-replace-count", children: g > 0 ? `${p + 1}/${g}` : s ? "0" : "" })
|
|
4168
4143
|
] }),
|
|
4169
|
-
/* @__PURE__ */
|
|
4144
|
+
/* @__PURE__ */ f(
|
|
4170
4145
|
"button",
|
|
4171
4146
|
{
|
|
4172
|
-
onClick:
|
|
4147
|
+
onClick: x,
|
|
4173
4148
|
className: re("find-replace-btn", d && "find-replace-btn--active"),
|
|
4174
4149
|
title: "Case Sensitive",
|
|
4175
|
-
children: /* @__PURE__ */
|
|
4150
|
+
children: /* @__PURE__ */ f(Vr, { size: 15 })
|
|
4176
4151
|
}
|
|
4177
4152
|
),
|
|
4178
|
-
/* @__PURE__ */
|
|
4179
|
-
/* @__PURE__ */
|
|
4180
|
-
/* @__PURE__ */
|
|
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((
|
|
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__ */
|
|
4161
|
+
children: /* @__PURE__ */ f(Et, { size: 15 })
|
|
4187
4162
|
}
|
|
4188
4163
|
),
|
|
4189
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4167
|
+
/* @__PURE__ */ f(
|
|
4193
4168
|
"input",
|
|
4194
4169
|
{
|
|
4195
4170
|
type: "text",
|
|
4196
|
-
value:
|
|
4197
|
-
onChange: (
|
|
4198
|
-
|
|
4171
|
+
value: l,
|
|
4172
|
+
onChange: (C) => {
|
|
4173
|
+
c(C.target.value), e.commands.setReplaceTerm(C.target.value);
|
|
4199
4174
|
},
|
|
4200
|
-
onKeyDown: (
|
|
4201
|
-
|
|
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__ */
|
|
4208
|
-
/* @__PURE__ */
|
|
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
|
-
},
|
|
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:
|
|
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
|
|
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
|
-
},
|
|
4204
|
+
}, Ns = {
|
|
4230
4205
|
empty: "○",
|
|
4231
4206
|
filled: "●"
|
|
4232
|
-
},
|
|
4207
|
+
}, _s = {
|
|
4233
4208
|
empty: "text-gray-400",
|
|
4234
4209
|
filled: "text-green-500"
|
|
4235
|
-
},
|
|
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
|
-
]),
|
|
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
|
|
4245
|
-
return e.on("update",
|
|
4246
|
-
e.off("update",
|
|
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
|
|
4250
|
-
const
|
|
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
|
|
4256
|
-
|
|
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:
|
|
4234
|
+
title: h,
|
|
4260
4235
|
charCount: 0
|
|
4261
4236
|
}), d = !0;
|
|
4262
4237
|
}
|
|
4263
|
-
const m = o.textContent || "",
|
|
4264
|
-
return
|
|
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:
|
|
4268
|
-
state:
|
|
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,
|
|
4275
|
-
return
|
|
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:
|
|
4279
|
-
state:
|
|
4280
|
-
charCount:
|
|
4281
|
-
indent:
|
|
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,
|
|
4286
|
-
return
|
|
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:
|
|
4264
|
+
title: g,
|
|
4290
4265
|
level: m,
|
|
4291
|
-
charCount:
|
|
4266
|
+
charCount: g.replace(/\s/g, "").length
|
|
4292
4267
|
}), !1;
|
|
4293
4268
|
}
|
|
4294
4269
|
return !0;
|
|
4295
|
-
}),
|
|
4270
|
+
}), c;
|
|
4296
4271
|
}, [e, s, n]);
|
|
4297
|
-
return r ? /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
4308
|
-
/* @__PURE__ */
|
|
4309
|
-
/* @__PURE__ */
|
|
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__ */
|
|
4290
|
+
children: /* @__PURE__ */ f(Yr, { size: 14 })
|
|
4316
4291
|
}
|
|
4317
4292
|
)
|
|
4318
4293
|
] }),
|
|
4319
4294
|
/* @__PURE__ */ A("div", { className: "outline-panel-list", children: [
|
|
4320
|
-
|
|
4321
|
-
|
|
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
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
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
|
-
|
|
4332
|
-
const o = e.view.nodeDOM(
|
|
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
|
-
|
|
4338
|
-
/* @__PURE__ */
|
|
4339
|
-
|
|
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
|
-
`${
|
|
4317
|
+
`${c.pos}-${d}`
|
|
4343
4318
|
))
|
|
4344
4319
|
] })
|
|
4345
4320
|
] });
|
|
4346
|
-
},
|
|
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__ */
|
|
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__ */
|
|
4335
|
+
children: /* @__PURE__ */ f(Pn, { editor: e, className: "h-full" })
|
|
4361
4336
|
}
|
|
4362
|
-
)), vn = "patent-editor-draft",
|
|
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
|
-
},
|
|
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:
|
|
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: "
|
|
4357
|
+
content: [{ type: "text", text: "" }]
|
|
4383
4358
|
}
|
|
4384
4359
|
]
|
|
4385
|
-
},
|
|
4360
|
+
}, h = de((w) => {
|
|
4386
4361
|
try {
|
|
4387
|
-
|
|
4362
|
+
u("saving"), localStorage.setItem(vn, JSON.stringify(w)), u("saved"), m(/* @__PURE__ */ new Date());
|
|
4388
4363
|
} catch {
|
|
4389
|
-
|
|
4364
|
+
u("error");
|
|
4390
4365
|
}
|
|
4391
|
-
}, [
|
|
4366
|
+
}, [u, m]), b = Dn(
|
|
4392
4367
|
ss({
|
|
4393
|
-
content:
|
|
4394
|
-
onUpdate: ({ editor:
|
|
4395
|
-
const
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
},
|
|
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:
|
|
4401
|
-
i(
|
|
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:
|
|
4404
|
-
W.notifySelectionChange(
|
|
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
|
-
),
|
|
4387
|
+
), x = X(!1);
|
|
4413
4388
|
if (B(() => {
|
|
4414
|
-
if (!(!
|
|
4415
|
-
if (!
|
|
4416
|
-
|
|
4389
|
+
if (!(!b || !e)) {
|
|
4390
|
+
if (!x.current) {
|
|
4391
|
+
x.current = !0;
|
|
4417
4392
|
return;
|
|
4418
4393
|
}
|
|
4419
|
-
|
|
4394
|
+
b.commands.setContent(e);
|
|
4420
4395
|
}
|
|
4421
|
-
}, [
|
|
4422
|
-
|
|
4423
|
-
}, [
|
|
4424
|
-
|
|
4425
|
-
}, [
|
|
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
|
|
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__ */
|
|
4431
|
-
|
|
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 &&
|
|
4434
|
-
!r &&
|
|
4435
|
-
!r &&
|
|
4436
|
-
!r &&
|
|
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 &&
|
|
4439
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
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(
|
|
4457
|
-
const
|
|
4437
|
+
r += n.decode(l, { stream: !0 });
|
|
4438
|
+
const c = r.split(`
|
|
4458
4439
|
`);
|
|
4459
|
-
r =
|
|
4440
|
+
r = c.pop() || "";
|
|
4460
4441
|
let d = "";
|
|
4461
|
-
for (const o of
|
|
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),
|
|
4474
|
-
if (
|
|
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 (
|
|
4460
|
+
else if (g === "patch")
|
|
4480
4461
|
a.enqueue({ type: "patch", patch: m });
|
|
4481
|
-
else if (
|
|
4462
|
+
else if (g === "done") {
|
|
4482
4463
|
a.enqueue({ type: "done", usage: m.usage }), a.close();
|
|
4483
4464
|
return;
|
|
4484
|
-
} else
|
|
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
|
|
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
|
|
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
|
|
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 (!
|
|
4527
|
-
const
|
|
4528
|
-
return
|
|
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,
|
|
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:
|
|
4515
|
+
body: JSON.stringify({ patentId: s, title: i, language: l })
|
|
4535
4516
|
});
|
|
4536
4517
|
},
|
|
4537
|
-
async listSessions(s, i = 1,
|
|
4538
|
-
const
|
|
4539
|
-
return s &&
|
|
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,
|
|
4542
|
-
const
|
|
4543
|
-
return a(`${r}/api/v1/chat/sessions/${s}/messages?${
|
|
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
|
|
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 (!
|
|
4564
|
-
if (!
|
|
4565
|
-
return Cn(
|
|
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
|
|
4573
|
-
({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, language: s, aiService: i, chatSessionAPI:
|
|
4574
|
-
const { setEditorLanguage: m, setAIService:
|
|
4575
|
-
|
|
4576
|
-
}, []),
|
|
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
|
|
4561
|
+
return Me.useEffect(() => {
|
|
4581
4562
|
s && m(s);
|
|
4582
|
-
}, [s, m]),
|
|
4583
|
-
i ?
|
|
4584
|
-
}, [i,
|
|
4585
|
-
|
|
4586
|
-
}, [
|
|
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 =
|
|
4570
|
+
return ((v = h.current) == null ? void 0 : v.getJSON()) ?? null;
|
|
4594
4571
|
},
|
|
4595
|
-
|
|
4596
|
-
|
|
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
|
|
4599
|
-
(
|
|
4579
|
+
var v;
|
|
4580
|
+
(v = h.current) == null || v.commands.focus();
|
|
4600
4581
|
}
|
|
4601
|
-
})), /* @__PURE__ */
|
|
4602
|
-
|
|
4582
|
+
})), /* @__PURE__ */ f(
|
|
4583
|
+
Ms,
|
|
4603
4584
|
{
|
|
4604
|
-
initialContent:
|
|
4585
|
+
initialContent: x,
|
|
4605
4586
|
onChange: n,
|
|
4606
|
-
onEditorReady:
|
|
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
|
-
|
|
4615
|
-
async function
|
|
4616
|
-
var a, s, i,
|
|
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
|
|
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,
|
|
4627
|
-
e.view.dispatch(u),
|
|
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 (
|
|
4631
|
-
(
|
|
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
|
|
4635
|
-
var s, i,
|
|
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
|
|
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 (!
|
|
4646
|
-
throw new Error(`HTTP ${
|
|
4647
|
-
const p = (i =
|
|
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
|
|
4650
|
-
let
|
|
4630
|
+
const h = new TextDecoder();
|
|
4631
|
+
let b = wn(e, r), x = "";
|
|
4651
4632
|
for (; ; ) {
|
|
4652
|
-
const { done:
|
|
4653
|
-
if (
|
|
4654
|
-
|
|
4655
|
-
const
|
|
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
|
-
|
|
4658
|
-
for (const _ of
|
|
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 (
|
|
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),
|
|
4665
|
-
if (!
|
|
4666
|
-
(d = r.onChunk) == null || d.call(r,
|
|
4667
|
-
const T = e.state.tr.insertText(
|
|
4668
|
-
e.view.dispatch(T),
|
|
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 (
|
|
4675
|
-
|
|
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
|
|
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
|
|
4845
|
-
const t = [], n =
|
|
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
|
|
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
|
|
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
|
|
4866
|
-
a.push({ type: "delta", content:
|
|
4867
|
-
for (const
|
|
4868
|
-
a.push({ type: "delta", content:
|
|
4869
|
-
for (let
|
|
4870
|
-
const
|
|
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)}`,
|
|
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:
|
|
4877
|
+
target: { type: "ref", refIndex: l },
|
|
4877
4878
|
content: o,
|
|
4878
4879
|
reason: r ? "优化为更专业的专利表述" : "Optimized for professional patent language"
|
|
4879
4880
|
}
|
|
4880
|
-
}) :
|
|
4881
|
+
}) : c.source ? a.push({
|
|
4881
4882
|
type: "patch",
|
|
4882
4883
|
patch: {
|
|
4883
4884
|
op: "replace",
|
|
4884
|
-
target: { type: "section", sectionType:
|
|
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
|
|
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
|
|
4905
|
+
function oo() {
|
|
4905
4906
|
let e = null;
|
|
4906
4907
|
return {
|
|
4907
4908
|
async request(t) {
|
|
4908
|
-
var
|
|
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 = ((
|
|
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 =
|
|
4919
|
-
return
|
|
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
|
|
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()}`,
|
|
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:
|
|
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
|
|
4970
|
+
const l = zs(
|
|
4970
4971
|
a.content,
|
|
4971
4972
|
a.references || [],
|
|
4972
4973
|
a.language
|
|
4973
4974
|
);
|
|
4974
|
-
return n = { messageId: i, events:
|
|
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
|
|
4982
|
+
return pt([{ type: "done" }]);
|
|
4982
4983
|
const i = n.events;
|
|
4983
4984
|
n = null;
|
|
4984
|
-
const
|
|
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:
|
|
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(),
|
|
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
|
|
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
|
|
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
|
|
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),
|
|
5026
|
-
for (let
|
|
5027
|
-
|
|
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),
|
|
5032
|
-
for (let
|
|
5033
|
-
|
|
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,
|
|
5036
|
+
return [...new Set(n)].sort((i, l) => i - l);
|
|
5036
5037
|
}
|
|
5037
|
-
function
|
|
5038
|
+
function Us() {
|
|
5038
5039
|
return `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
5039
5040
|
}
|
|
5040
|
-
function
|
|
5041
|
-
return
|
|
5041
|
+
function lo(e) {
|
|
5042
|
+
return Bs(e).map((n) => ({
|
|
5042
5043
|
type: "claim",
|
|
5043
5044
|
attrs: {
|
|
5044
5045
|
number: n.number,
|
|
5045
|
-
claimId:
|
|
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
|
|
5053
|
+
const js = -1, Ws = 1, Gs = 0, Sn = new ke("docDiff");
|
|
5053
5054
|
let lt = null;
|
|
5054
|
-
function
|
|
5055
|
-
return lt || (lt = new
|
|
5055
|
+
function qs() {
|
|
5056
|
+
return lt || (lt = new qt()), lt;
|
|
5056
5057
|
}
|
|
5057
|
-
function
|
|
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,
|
|
5062
|
-
return d >
|
|
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
|
|
5068
|
-
const n = e.state.doc, r = n.content.size, { text: a, segments: s } = sn(e, 0, r), i =
|
|
5069
|
-
i.diff_cleanupSemantic(
|
|
5070
|
-
const
|
|
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,
|
|
5073
|
-
if (m ===
|
|
5074
|
-
d +=
|
|
5075
|
-
else if (m ===
|
|
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 <
|
|
5078
|
-
for (; p <
|
|
5079
|
-
if (p >=
|
|
5080
|
-
const
|
|
5081
|
-
for (; p <
|
|
5082
|
-
const
|
|
5083
|
-
if (
|
|
5084
|
-
for (const
|
|
5085
|
-
|
|
5086
|
-
le.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 +=
|
|
5090
|
-
} else if (m ===
|
|
5090
|
+
d += g.length;
|
|
5091
|
+
} else if (m === js) {
|
|
5091
5092
|
const p = Ee(s, d);
|
|
5092
5093
|
if (p >= 0) {
|
|
5093
|
-
const
|
|
5094
|
-
|
|
5094
|
+
const h = g.replace(/\0/g, " ");
|
|
5095
|
+
c.push(
|
|
5095
5096
|
le.widget(
|
|
5096
5097
|
p,
|
|
5097
5098
|
() => {
|
|
5098
|
-
const
|
|
5099
|
-
return
|
|
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,
|
|
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
|
|
5117
|
+
function mo(e) {
|
|
5117
5118
|
e.unregisterPlugin(Sn);
|
|
5118
5119
|
}
|
|
5119
|
-
function
|
|
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,
|
|
5124
|
+
return e.state.doc.descendants((i, l) => {
|
|
5124
5125
|
if (i.type.name === "patent_title") {
|
|
5125
|
-
const
|
|
5126
|
-
if (
|
|
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:
|
|
5133
|
+
pos: l
|
|
5133
5134
|
});
|
|
5134
5135
|
else {
|
|
5135
|
-
const d =
|
|
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:
|
|
5142
|
+
pos: l
|
|
5142
5143
|
});
|
|
5143
5144
|
}
|
|
5144
5145
|
return !1;
|
|
5145
5146
|
}
|
|
5146
5147
|
if (i.type.name === "patent_section") {
|
|
5147
|
-
const
|
|
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 ? `章节"${
|
|
5152
|
-
sectionType:
|
|
5153
|
-
pos:
|
|
5154
|
-
}),
|
|
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:
|
|
5161
|
-
pos:
|
|
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:
|
|
5167
|
-
pos:
|
|
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
|
|
5174
|
-
|
|
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:
|
|
5179
|
+
pos: l
|
|
5179
5180
|
});
|
|
5180
5181
|
}
|
|
5181
5182
|
return !0;
|
|
5182
5183
|
}), n;
|
|
5183
5184
|
}
|
|
5184
5185
|
export {
|
|
5185
|
-
|
|
5186
|
+
Ms as EditorView,
|
|
5186
5187
|
an as PatchDiffPluginKey,
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
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
|
-
|
|
5195
|
-
|
|
5195
|
+
Yi as clearPatches,
|
|
5196
|
+
$s as createChatSessionAPI,
|
|
5196
5197
|
Ae as createCommandExecutor,
|
|
5197
5198
|
ss as createEditorConfig,
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5199
|
+
oo as createMockAIService,
|
|
5200
|
+
co as createMockChatSessionAPI,
|
|
5201
|
+
Rs as createSSEAdapter,
|
|
5201
5202
|
us as exportToPdf,
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
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
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
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
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5218
|
+
fo as validatePatentDocument,
|
|
5219
|
+
so as writeStream,
|
|
5220
|
+
io as writeStreamFromSSE
|
|
5220
5221
|
};
|
|
5221
5222
|
//# sourceMappingURL=lib.js.map
|