patent-editor 0.2.8 → 0.2.9
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.css +1 -1
- package/dist/lib.js +226 -239
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/lib.js
CHANGED
|
@@ -49,12 +49,12 @@ import "mathlive";
|
|
|
49
49
|
import { findWrapping as fr } from "@tiptap/pm/transform";
|
|
50
50
|
import { Slice as pr, Fragment as hr } from "@tiptap/pm/model";
|
|
51
51
|
import { createPortal as yr } from "react-dom";
|
|
52
|
-
import { Undo2 as br, Redo2 as vr, Bold as Dt, Italic as Rt, Underline as Mt, Strikethrough as Ft, Code as $t, Superscript as zt, Subscript as Ot, Pilcrow as wr, Heading1 as xr, Heading2 as Cr, Heading3 as Tr, AlignLeft as Sr, AlignCenter as Er, AlignRight as kr, AlignJustify as _r, List as Ir, ListOrdered as Nr, Quote as Ar, FileCode2 as Lr, Table as Pr, Minus as Dr, CheckSquare as Rr, Image as Bt, Link2 as Ht, FileText as qt, Box as Mr, Workflow as Fr, FunctionSquare as $r, Sigma as zr, GitGraph as Or, Square as mt, ChevronDown as Ut,
|
|
52
|
+
import { Undo2 as br, Redo2 as vr, Bold as Dt, Italic as Rt, Underline as Mt, Strikethrough as Ft, Code as $t, Superscript as zt, Subscript as Ot, Pilcrow as wr, Heading1 as xr, Heading2 as Cr, Heading3 as Tr, AlignLeft as Sr, AlignCenter as Er, AlignRight as kr, AlignJustify as _r, List as Ir, ListOrdered as Nr, Quote as Ar, FileCode2 as Lr, Table as Pr, Minus as Dr, CheckSquare as Rr, Image as Bt, Link2 as Ht, FileText as qt, Box as Mr, Workflow as Fr, FunctionSquare as $r, Sigma as zr, GitGraph as Or, Square as mt, ChevronDown as Ut, Highlighter as Br, Sparkles as Hr, CaseSensitive as qr, ChevronUp as Ur, Replace as gt, X as Wr, ReplaceAll as jr, PanelLeft as Gr, PanelLeftClose as Vr } from "lucide-react";
|
|
53
53
|
import Y from "clsx";
|
|
54
|
-
import { BubbleMenu as
|
|
55
|
-
import { convertMillimetersToTwip as he, Document as
|
|
56
|
-
import { saveAs as
|
|
57
|
-
const
|
|
54
|
+
import { BubbleMenu as Jr } from "@tiptap/react/menus";
|
|
55
|
+
import { convertMillimetersToTwip as he, Document as Kr, Packer as Xr, Paragraph as He, AlignmentType as it, TextRun as qe } from "docx";
|
|
56
|
+
import { saveAs as Yr } from "file-saver";
|
|
57
|
+
const Zr = new we("slashCommand"), Qr = Oe.create({
|
|
58
58
|
name: "slashCommand",
|
|
59
59
|
addOptions() {
|
|
60
60
|
return {
|
|
@@ -71,11 +71,11 @@ const Qr = new we("slashCommand"), ea = Oe.create({
|
|
|
71
71
|
Qn({
|
|
72
72
|
editor: this.editor,
|
|
73
73
|
...this.options.suggestion,
|
|
74
|
-
pluginKey:
|
|
74
|
+
pluginKey: Zr
|
|
75
75
|
})
|
|
76
76
|
];
|
|
77
77
|
}
|
|
78
|
-
}),
|
|
78
|
+
}), ea = {
|
|
79
79
|
visible: !0,
|
|
80
80
|
activeTab: "chat",
|
|
81
81
|
activeSectionType: null,
|
|
@@ -94,7 +94,7 @@ const Qr = new we("slashCommand"), ea = Oe.create({
|
|
|
94
94
|
aiService: null,
|
|
95
95
|
chatSessionAPI: null,
|
|
96
96
|
chatSessionId: null,
|
|
97
|
-
rightPanel: { ...
|
|
97
|
+
rightPanel: { ...ea },
|
|
98
98
|
setEditor: (t) => e({ editor: t }),
|
|
99
99
|
setDocument: (t) => e({ document: t }),
|
|
100
100
|
setSelection: (t) => e({ selection: t }),
|
|
@@ -196,7 +196,7 @@ const Qr = new we("slashCommand"), ea = Oe.create({
|
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
198
|
Wt.displayName = "SlashMenuList";
|
|
199
|
-
function
|
|
199
|
+
function ta(e) {
|
|
200
200
|
const t = e === "zh";
|
|
201
201
|
return [
|
|
202
202
|
{
|
|
@@ -298,11 +298,11 @@ function na(e) {
|
|
|
298
298
|
}
|
|
299
299
|
];
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function na() {
|
|
302
302
|
return {
|
|
303
303
|
char: "/",
|
|
304
304
|
items: ({ query: e }) => {
|
|
305
|
-
const t = I.getState().editorLanguage, n =
|
|
305
|
+
const t = I.getState().editorLanguage, n = ta(t);
|
|
306
306
|
if (!e) return n;
|
|
307
307
|
const r = e.toLowerCase();
|
|
308
308
|
return n.filter(
|
|
@@ -343,7 +343,7 @@ function ra() {
|
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
|
-
const
|
|
346
|
+
const ra = new we("searchReplace");
|
|
347
347
|
function ke(e, t, n) {
|
|
348
348
|
if (!t) return [];
|
|
349
349
|
const r = [], a = e.textBetween(0, e.content.size, `
|
|
@@ -369,7 +369,7 @@ function ke(e, t, n) {
|
|
|
369
369
|
}
|
|
370
370
|
return r;
|
|
371
371
|
}
|
|
372
|
-
const
|
|
372
|
+
const aa = Oe.create({
|
|
373
373
|
name: "searchReplace",
|
|
374
374
|
addStorage() {
|
|
375
375
|
return {
|
|
@@ -433,7 +433,7 @@ const ia = Oe.create({
|
|
|
433
433
|
const e = this.storage;
|
|
434
434
|
return [
|
|
435
435
|
new Be({
|
|
436
|
-
key:
|
|
436
|
+
key: ra,
|
|
437
437
|
props: {
|
|
438
438
|
decorations: (t) => {
|
|
439
439
|
if (!e.searchTerm || e.results.length === 0)
|
|
@@ -458,13 +458,13 @@ function ft(e) {
|
|
|
458
458
|
}
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
|
-
const
|
|
461
|
+
const ia = -1, sa = 1, pt = 0;
|
|
462
462
|
let Ge = null;
|
|
463
|
-
function
|
|
463
|
+
function oa() {
|
|
464
464
|
return Ge || (Ge = new Pt()), Ge;
|
|
465
465
|
}
|
|
466
466
|
const jt = new we("patchDiff");
|
|
467
|
-
function
|
|
467
|
+
function ca(e, t) {
|
|
468
468
|
let n = null;
|
|
469
469
|
return e.state.doc.descendants((r, a) => n ? !1 : r.type.name === "patent_section" && r.attrs.sectionType === t ? (n = { from: a + 1, to: a + r.nodeSize - 1 }, !1) : !0), n;
|
|
470
470
|
}
|
|
@@ -504,7 +504,7 @@ function ht(e, t, n, r, a) {
|
|
|
504
504
|
}
|
|
505
505
|
return null;
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function Ds(e, t, n, r, a) {
|
|
508
508
|
const i = t.target;
|
|
509
509
|
let o = null;
|
|
510
510
|
const c = /* @__PURE__ */ new Set();
|
|
@@ -514,7 +514,7 @@ function Rs(e, t, n, r, a) {
|
|
|
514
514
|
if (!i)
|
|
515
515
|
t.from != null && t.to != null && (o = { from: t.from, to: t.to });
|
|
516
516
|
else if (i.type === "section" && i.sectionType)
|
|
517
|
-
o =
|
|
517
|
+
o = ca(e, i.sectionType);
|
|
518
518
|
else if (i.type === "ref" && i.refIndex != null) {
|
|
519
519
|
const d = n[i.refIndex];
|
|
520
520
|
(d == null ? void 0 : d.from) != null && (d == null ? void 0 : d.to) != null && (o = { from: d.from, to: d.to });
|
|
@@ -539,7 +539,7 @@ function Rs(e, t, n, r, a) {
|
|
|
539
539
|
}
|
|
540
540
|
const j = /* @__PURE__ */ new Map();
|
|
541
541
|
let De = [];
|
|
542
|
-
function
|
|
542
|
+
function Rs(e) {
|
|
543
543
|
return De.push(e), () => {
|
|
544
544
|
De = De.filter((t) => t !== e);
|
|
545
545
|
};
|
|
@@ -547,16 +547,16 @@ function Ms(e) {
|
|
|
547
547
|
function ue() {
|
|
548
548
|
De.forEach((e) => e());
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function Ms(e = "default") {
|
|
551
551
|
return [...j.get(e) || []];
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function Fs(e, t = "default") {
|
|
554
554
|
j.set(t, e), ue();
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function $s(e = "default") {
|
|
557
557
|
j.delete(e), ue();
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function zs(e, t, n = "default") {
|
|
560
560
|
const r = j.get(n) || [], a = r.find((c) => c.id === t);
|
|
561
561
|
if (!a || a.status !== "pending") return !1;
|
|
562
562
|
a.status = "accepted";
|
|
@@ -579,11 +579,11 @@ function Os(e, t, n = "default") {
|
|
|
579
579
|
}
|
|
580
580
|
return j.set(n, r.filter((c) => c.id !== t && c.status === "pending")), Ue(e), ue(), !0;
|
|
581
581
|
}
|
|
582
|
-
function
|
|
582
|
+
function Os(e, t, n = "default") {
|
|
583
583
|
const r = j.get(n) || [], a = r.find((i) => i.id === t);
|
|
584
584
|
return !a || a.status !== "pending" ? !1 : (a.status = "rejected", j.set(n, r.filter((i) => i.id !== t)), Ue(e), ue(), !0);
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function Bs(e, t = "default") {
|
|
587
587
|
const a = [...(j.get(t) || []).filter((o) => o.status === "pending")].sort((o, c) => c.from - o.from), { tr: i } = e.state;
|
|
588
588
|
for (const o of a)
|
|
589
589
|
if (o.type === "delete")
|
|
@@ -597,13 +597,13 @@ function Hs(e, t = "default") {
|
|
|
597
597
|
i.insertText(o.content, o.from, o.to);
|
|
598
598
|
e.view.dispatch(i), j.delete(t), Ue(e), ue();
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Hs(e, t = "default") {
|
|
601
601
|
j.delete(t), Ue(e), ue();
|
|
602
602
|
}
|
|
603
603
|
function Ue(e) {
|
|
604
604
|
e.view.dispatch(e.state.tr.setMeta(jt, !0));
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function la(e, t, n) {
|
|
607
607
|
const r = [];
|
|
608
608
|
return e.nodesBetween(t, n, (a, i) => {
|
|
609
609
|
if (a.isTextblock) {
|
|
@@ -613,7 +613,7 @@ function da(e, t, n) {
|
|
|
613
613
|
return !0;
|
|
614
614
|
}), r;
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function da(e, t) {
|
|
617
617
|
if (!t.originalText || !t.content) return null;
|
|
618
618
|
try {
|
|
619
619
|
const c = e.resolve(t.from), s = e.resolve(t.to);
|
|
@@ -621,7 +621,7 @@ function ua(e, t) {
|
|
|
621
621
|
} catch {
|
|
622
622
|
return null;
|
|
623
623
|
}
|
|
624
|
-
const n =
|
|
624
|
+
const n = oa(), r = n.diff_main(t.originalText, t.content);
|
|
625
625
|
n.diff_cleanupSemantic(r);
|
|
626
626
|
const a = r.filter(([c]) => c === pt).reduce((c, [, s]) => c + s.length, 0);
|
|
627
627
|
if (t.originalText.length > 0 && a / t.originalText.length < 0.3) return null;
|
|
@@ -630,7 +630,7 @@ function ua(e, t) {
|
|
|
630
630
|
for (const [c, s] of r)
|
|
631
631
|
if (c === pt)
|
|
632
632
|
o += s.length;
|
|
633
|
-
else if (c ===
|
|
633
|
+
else if (c === ia) {
|
|
634
634
|
const l = o + s.length;
|
|
635
635
|
i.push(
|
|
636
636
|
re.inline(o, l, {
|
|
@@ -638,7 +638,7 @@ function ua(e, t) {
|
|
|
638
638
|
"data-patch-id": t.id
|
|
639
639
|
})
|
|
640
640
|
), o = l;
|
|
641
|
-
} else c ===
|
|
641
|
+
} else c === sa && i.push(
|
|
642
642
|
re.widget(o, () => {
|
|
643
643
|
const l = document.createElement("span");
|
|
644
644
|
return l.className = "patch-diff-insert-inline", l.textContent = s, l.setAttribute("data-patch-id", t.id), l;
|
|
@@ -646,7 +646,7 @@ function ua(e, t) {
|
|
|
646
646
|
);
|
|
647
647
|
return i;
|
|
648
648
|
}
|
|
649
|
-
function
|
|
649
|
+
function ua(e = "default") {
|
|
650
650
|
return new Be({
|
|
651
651
|
key: jt,
|
|
652
652
|
props: {
|
|
@@ -656,14 +656,14 @@ function ma(e = "default") {
|
|
|
656
656
|
const r = [];
|
|
657
657
|
for (const a of n) {
|
|
658
658
|
if (a.type === "replace") {
|
|
659
|
-
const i =
|
|
659
|
+
const i = da(t.doc, a);
|
|
660
660
|
if (i) {
|
|
661
661
|
r.push(...i);
|
|
662
662
|
continue;
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
if (a.type === "delete" || a.type === "replace") {
|
|
666
|
-
const i =
|
|
666
|
+
const i = la(t.doc, a.from, a.to);
|
|
667
667
|
for (const o of i)
|
|
668
668
|
r.push(
|
|
669
669
|
re.inline(o.from, o.to, {
|
|
@@ -709,7 +709,7 @@ function Jt(e, t) {
|
|
|
709
709
|
);
|
|
710
710
|
});
|
|
711
711
|
}
|
|
712
|
-
const
|
|
712
|
+
const ma = Z.create({
|
|
713
713
|
name: "hardBreak",
|
|
714
714
|
inline: !0,
|
|
715
715
|
group: "inline",
|
|
@@ -730,7 +730,7 @@ const ga = Z.create({
|
|
|
730
730
|
}
|
|
731
731
|
};
|
|
732
732
|
}
|
|
733
|
-
}),
|
|
733
|
+
}), ga = Oe.create({
|
|
734
734
|
name: "dragDropUX",
|
|
735
735
|
addProseMirrorPlugins() {
|
|
736
736
|
return [
|
|
@@ -741,19 +741,19 @@ const ga = Z.create({
|
|
|
741
741
|
Xn()
|
|
742
742
|
];
|
|
743
743
|
}
|
|
744
|
-
}),
|
|
744
|
+
}), fa = Oe.create({
|
|
745
745
|
name: "patchDiff",
|
|
746
746
|
addOptions() {
|
|
747
747
|
return { editorId: "default" };
|
|
748
748
|
},
|
|
749
749
|
addProseMirrorPlugins() {
|
|
750
|
-
return [
|
|
750
|
+
return [ua(this.options.editorId)];
|
|
751
751
|
}
|
|
752
|
-
}),
|
|
752
|
+
}), pa = [
|
|
753
753
|
An,
|
|
754
754
|
Ln,
|
|
755
755
|
Pn,
|
|
756
|
-
|
|
756
|
+
ga,
|
|
757
757
|
Dn.configure({
|
|
758
758
|
levels: [1, 2, 3, 4, 5, 6]
|
|
759
759
|
}),
|
|
@@ -762,7 +762,7 @@ const ga = Z.create({
|
|
|
762
762
|
Fn,
|
|
763
763
|
$n,
|
|
764
764
|
zn,
|
|
765
|
-
|
|
765
|
+
ma,
|
|
766
766
|
On,
|
|
767
767
|
Bn,
|
|
768
768
|
Hn.configure({ nested: !0 }),
|
|
@@ -792,15 +792,15 @@ const ga = Z.create({
|
|
|
792
792
|
placeholder: ({ node: e }) => e.type.name === "heading" ? "Heading" : "Type / for commands..."
|
|
793
793
|
}),
|
|
794
794
|
Jn,
|
|
795
|
-
|
|
796
|
-
suggestion:
|
|
795
|
+
Qr.configure({
|
|
796
|
+
suggestion: na()
|
|
797
797
|
}),
|
|
798
|
-
|
|
798
|
+
aa,
|
|
799
799
|
Yn.configure({
|
|
800
800
|
types: ["heading", "paragraph"],
|
|
801
801
|
defaultAlignment: "left"
|
|
802
802
|
})
|
|
803
|
-
],
|
|
803
|
+
], ha = [
|
|
804
804
|
nr,
|
|
805
805
|
rr,
|
|
806
806
|
ar,
|
|
@@ -814,11 +814,11 @@ const ga = Z.create({
|
|
|
814
814
|
dr,
|
|
815
815
|
ur,
|
|
816
816
|
mr.configure({ multicolor: !0 })
|
|
817
|
-
],
|
|
818
|
-
...
|
|
819
|
-
...
|
|
817
|
+
], ya = [
|
|
818
|
+
...pa,
|
|
819
|
+
...ha
|
|
820
820
|
];
|
|
821
|
-
class
|
|
821
|
+
class ba {
|
|
822
822
|
constructor() {
|
|
823
823
|
Se(this, "commands", /* @__PURE__ */ new Map());
|
|
824
824
|
}
|
|
@@ -884,8 +884,8 @@ class va {
|
|
|
884
884
|
return Array.from(this.commands.keys()).sort();
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
|
-
const le = new
|
|
888
|
-
class
|
|
887
|
+
const le = new ba();
|
|
888
|
+
class va {
|
|
889
889
|
constructor() {
|
|
890
890
|
Se(this, "plugins", /* @__PURE__ */ new Map());
|
|
891
891
|
Se(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
|
|
@@ -970,7 +970,7 @@ class wa {
|
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
-
const B = new
|
|
973
|
+
const B = new va(), yt = {
|
|
974
974
|
zh: {
|
|
975
975
|
language: "语言",
|
|
976
976
|
bold: "加粗",
|
|
@@ -1223,7 +1223,7 @@ const Ie = () => {
|
|
|
1223
1223
|
document.querySelectorAll('body > svg[id^="standalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
|
|
1224
1224
|
(e.id.startsWith("dmermaid") || e.id.startsWith("dstandalone")) && e.remove();
|
|
1225
1225
|
}), document.querySelectorAll('body > div[id^="dstandalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > div[id^="dmermaid"]').forEach((e) => e.remove()), document.querySelectorAll('body > div[id^="standalone-mermaid-"]').forEach((e) => e.remove());
|
|
1226
|
-
},
|
|
1226
|
+
}, wa = Z.create({
|
|
1227
1227
|
name: "mermaid",
|
|
1228
1228
|
group: "block",
|
|
1229
1229
|
atom: !0,
|
|
@@ -1337,10 +1337,10 @@ const Ie = () => {
|
|
|
1337
1337
|
};
|
|
1338
1338
|
};
|
|
1339
1339
|
}
|
|
1340
|
-
}),
|
|
1340
|
+
}), xa = {
|
|
1341
1341
|
name: "mermaid",
|
|
1342
1342
|
version: "1.0.0",
|
|
1343
|
-
extensions: [
|
|
1343
|
+
extensions: [wa],
|
|
1344
1344
|
toolbarItems: [
|
|
1345
1345
|
{
|
|
1346
1346
|
id: "mermaid-insert",
|
|
@@ -1365,7 +1365,7 @@ const Ie = () => {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
1368
|
-
}, Ve = "https://draw.goatpatent.com",
|
|
1368
|
+
}, Ve = "https://draw.goatpatent.com", Ca = Z.create({
|
|
1369
1369
|
name: "drawio",
|
|
1370
1370
|
group: "block",
|
|
1371
1371
|
atom: !0,
|
|
@@ -1461,10 +1461,10 @@ const Ie = () => {
|
|
|
1461
1461
|
};
|
|
1462
1462
|
};
|
|
1463
1463
|
}
|
|
1464
|
-
}),
|
|
1464
|
+
}), Ta = {
|
|
1465
1465
|
name: "drawio",
|
|
1466
1466
|
version: "1.0.0",
|
|
1467
|
-
extensions: [
|
|
1467
|
+
extensions: [Ca],
|
|
1468
1468
|
toolbarItems: [
|
|
1469
1469
|
{
|
|
1470
1470
|
id: "drawio-insert",
|
|
@@ -1567,7 +1567,7 @@ const Ie = () => {
|
|
|
1567
1567
|
] })
|
|
1568
1568
|
}
|
|
1569
1569
|
);
|
|
1570
|
-
},
|
|
1570
|
+
}, Sa = Z.create({
|
|
1571
1571
|
name: "math_inline",
|
|
1572
1572
|
group: "inline",
|
|
1573
1573
|
inline: !0,
|
|
@@ -1600,7 +1600,7 @@ const Ie = () => {
|
|
|
1600
1600
|
}
|
|
1601
1601
|
});
|
|
1602
1602
|
}
|
|
1603
|
-
}),
|
|
1603
|
+
}), Ea = Z.create({
|
|
1604
1604
|
name: "math_block",
|
|
1605
1605
|
group: "block",
|
|
1606
1606
|
atom: !0,
|
|
@@ -1623,10 +1623,10 @@ const Ie = () => {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
});
|
|
1625
1625
|
}
|
|
1626
|
-
}),
|
|
1626
|
+
}), ka = {
|
|
1627
1627
|
name: "math",
|
|
1628
1628
|
version: "1.0.0",
|
|
1629
|
-
extensions: [
|
|
1629
|
+
extensions: [Sa, Ea],
|
|
1630
1630
|
toolbarItems: [
|
|
1631
1631
|
{
|
|
1632
1632
|
id: "math-inline-insert",
|
|
@@ -1689,7 +1689,7 @@ const Ie = () => {
|
|
|
1689
1689
|
};
|
|
1690
1690
|
}
|
|
1691
1691
|
return null;
|
|
1692
|
-
},
|
|
1692
|
+
}, _a = (e) => {
|
|
1693
1693
|
const { $from: t } = e.state.selection;
|
|
1694
1694
|
for (let n = t.depth; n >= 0; n -= 1) {
|
|
1695
1695
|
const r = t.node(n);
|
|
@@ -1700,7 +1700,7 @@ const Ie = () => {
|
|
|
1700
1700
|
};
|
|
1701
1701
|
}
|
|
1702
1702
|
return null;
|
|
1703
|
-
},
|
|
1703
|
+
}, Ia = (e, t) => e.state.schema.nodes[t] || null, Na = (e) => {
|
|
1704
1704
|
const t = Array.isArray(e.content) ? e.content : e.content ? [e.content] : void 0;
|
|
1705
1705
|
return {
|
|
1706
1706
|
type: e.type,
|
|
@@ -1708,7 +1708,7 @@ const Ie = () => {
|
|
|
1708
1708
|
content: t
|
|
1709
1709
|
};
|
|
1710
1710
|
}, Yt = (e, t) => {
|
|
1711
|
-
const n =
|
|
1711
|
+
const n = Na(t);
|
|
1712
1712
|
return typeof t.position == "number" ? e.chain().focus().insertContentAt(t.position, n).run() : e.chain().focus().insertContent(n).run();
|
|
1713
1713
|
}, ze = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
|
|
1714
1714
|
var s;
|
|
@@ -1728,7 +1728,7 @@ const Ie = () => {
|
|
|
1728
1728
|
const o = r.doc.nodeAt(i);
|
|
1729
1729
|
return !o || t.type && o.type.name !== t.type ? !1 : (n.delete(i, i + o.nodeSize), a && a(n), !0);
|
|
1730
1730
|
}), Qt = (e, t) => {
|
|
1731
|
-
const n =
|
|
1731
|
+
const n = Ia(e, t.type);
|
|
1732
1732
|
return n ? e.commands.command(({ tr: r, state: a, dispatch: i }) => {
|
|
1733
1733
|
const { from: o, to: c } = a.selection, s = a.selection.$from.blockRange(a.selection.$to);
|
|
1734
1734
|
if (!s)
|
|
@@ -1736,7 +1736,7 @@ const Ie = () => {
|
|
|
1736
1736
|
const l = fr(s, n, t.attrs);
|
|
1737
1737
|
return l ? (r.wrap(s, l), i && i(r.scrollIntoView()), o <= c) : !1;
|
|
1738
1738
|
}) : !1;
|
|
1739
|
-
},
|
|
1739
|
+
}, Aa = (e, t) => {
|
|
1740
1740
|
if (t.length === 0)
|
|
1741
1741
|
return !1;
|
|
1742
1742
|
const n = e.getJSON();
|
|
@@ -1748,13 +1748,13 @@ const Ie = () => {
|
|
|
1748
1748
|
let Ne = 0;
|
|
1749
1749
|
const Qe = [];
|
|
1750
1750
|
let Ae = !1;
|
|
1751
|
-
const
|
|
1751
|
+
const La = 2e4, bt = 6e4;
|
|
1752
1752
|
let F = null, Me = !1, ne = null, pe = null;
|
|
1753
1753
|
const et = /* @__PURE__ */ new Map();
|
|
1754
1754
|
function vt() {
|
|
1755
1755
|
ne && (window.removeEventListener("message", ne), ne = null), F && (F.src = "about:blank", F.remove(), F = null), Me = !1;
|
|
1756
1756
|
}
|
|
1757
|
-
function
|
|
1757
|
+
function Pa(e, t) {
|
|
1758
1758
|
const n = et.get(e);
|
|
1759
1759
|
if (n) {
|
|
1760
1760
|
t(n);
|
|
@@ -1796,13 +1796,13 @@ function tt() {
|
|
|
1796
1796
|
de
|
|
1797
1797
|
);
|
|
1798
1798
|
}, 1500) : c.event === "export" && a(c.data || "");
|
|
1799
|
-
}, window.addEventListener("message", ne), r = setTimeout(() => a(""),
|
|
1799
|
+
}, window.addEventListener("message", ne), r = setTimeout(() => a(""), La), F ? Me && i() : (F = document.createElement("iframe"), F.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:1920px;height:1080px;opacity:0;pointer-events:none;", document.body.appendChild(F), Me = !1, F.src = `${de}/?embed=1&proto=json&spin=0&chrome=0`);
|
|
1800
1800
|
}
|
|
1801
1801
|
const Le = () => {
|
|
1802
1802
|
document.querySelectorAll('body > svg[id^="fig-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
|
|
1803
1803
|
(e.id.startsWith("dmermaid") || e.id.startsWith("dfi")) && e.remove();
|
|
1804
1804
|
}), document.querySelectorAll("body > #dmermaid-svg").forEach((e) => e.remove()), document.querySelectorAll("body > style[data-mermaid-style]").forEach((e) => e.remove());
|
|
1805
|
-
},
|
|
1805
|
+
}, Da = Z.create({
|
|
1806
1806
|
name: "figure",
|
|
1807
1807
|
group: "block",
|
|
1808
1808
|
content: "inline*",
|
|
@@ -2014,7 +2014,7 @@ const Le = () => {
|
|
|
2014
2014
|
U && Cn && !oe && !xe && !i && (se && clearTimeout(se), se = setTimeout(() => {
|
|
2015
2015
|
se = null;
|
|
2016
2016
|
const dt = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "", Tn = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
|
|
2017
|
-
!dt || Tn || xe || (xe = !0,
|
|
2017
|
+
!dt || Tn || xe || (xe = !0, Pa(dt, (ut) => {
|
|
2018
2018
|
xe = !1, ut ? (Ce = 0, z({ drawioSvg: ut })) : Ce < yn && (Ce++, me = setTimeout(() => {
|
|
2019
2019
|
me = null, J();
|
|
2020
2020
|
}, vn * Ce));
|
|
@@ -2043,7 +2043,7 @@ const Le = () => {
|
|
|
2043
2043
|
};
|
|
2044
2044
|
};
|
|
2045
2045
|
}
|
|
2046
|
-
}),
|
|
2046
|
+
}), Ra = Z.create({
|
|
2047
2047
|
name: "reference",
|
|
2048
2048
|
group: "inline",
|
|
2049
2049
|
inline: !0,
|
|
@@ -2144,7 +2144,7 @@ const Le = () => {
|
|
|
2144
2144
|
design_description: "sectionTitle_design_description",
|
|
2145
2145
|
design_views: "sectionTitle_design_views",
|
|
2146
2146
|
design_brief: "sectionTitle_design_brief"
|
|
2147
|
-
},
|
|
2147
|
+
}, Ma = /* @__PURE__ */ new Set([
|
|
2148
2148
|
"abstract",
|
|
2149
2149
|
"abstract_drawing",
|
|
2150
2150
|
"claims",
|
|
@@ -2155,7 +2155,7 @@ const Le = () => {
|
|
|
2155
2155
|
"design_description",
|
|
2156
2156
|
"design_views",
|
|
2157
2157
|
"design_brief"
|
|
2158
|
-
]),
|
|
2158
|
+
]), Fa = /* @__PURE__ */ new Set([
|
|
2159
2159
|
"technical_field",
|
|
2160
2160
|
"background_art",
|
|
2161
2161
|
"summary",
|
|
@@ -2170,7 +2170,7 @@ const Le = () => {
|
|
|
2170
2170
|
return e.forEach((n) => {
|
|
2171
2171
|
!t && ot(n) && (t = !0);
|
|
2172
2172
|
}), t;
|
|
2173
|
-
},
|
|
2173
|
+
}, $a = Z.create({
|
|
2174
2174
|
name: "patent_title",
|
|
2175
2175
|
group: "block",
|
|
2176
2176
|
content: "inline*",
|
|
@@ -2233,7 +2233,7 @@ const Le = () => {
|
|
|
2233
2233
|
};
|
|
2234
2234
|
};
|
|
2235
2235
|
}
|
|
2236
|
-
}),
|
|
2236
|
+
}), za = Z.create({
|
|
2237
2237
|
name: "patent_section",
|
|
2238
2238
|
group: "block",
|
|
2239
2239
|
content: "block+",
|
|
@@ -2318,7 +2318,7 @@ const Le = () => {
|
|
|
2318
2318
|
};
|
|
2319
2319
|
c.addEventListener("click", m), s.addEventListener("focusin", d), s.addEventListener("click", d);
|
|
2320
2320
|
const u = () => {
|
|
2321
|
-
const b = I.getState(), w = H(b.editorLanguage), x = Object.keys(wt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", C =
|
|
2321
|
+
const b = I.getState(), w = H(b.editorLanguage), x = Object.keys(wt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", C = Ma.has(x), v = Fa.has(x), E = wt[x], h = typeof w[E] == "string" ? w[E] : x, _ = ot(r), T = b.rightPanel.activeSectionPos === l();
|
|
2322
2322
|
a.className = `ps${_ ? "" : " ps--empty"}${v ? " ps--sub" : ""}`, a.setAttribute("data-section-type", x), i.className = C ? "pb-heading" : "ps-heading ps-heading--sub", i.textContent = h, c.textContent = `[${h}]`, c.style.display = _ ? "none" : "", c.classList.toggle("ps-placeholder--active", T && !_), s.classList.toggle("ps-content--has-content", _);
|
|
2323
2323
|
};
|
|
2324
2324
|
let f = I.getState().editorLanguage, p = I.getState().rightPanel.activeSectionPos;
|
|
@@ -2336,21 +2336,21 @@ const Le = () => {
|
|
|
2336
2336
|
};
|
|
2337
2337
|
};
|
|
2338
2338
|
}
|
|
2339
|
-
}),
|
|
2339
|
+
}), Oa = [
|
|
2340
2340
|
"abstract",
|
|
2341
2341
|
// 说明书摘要
|
|
2342
2342
|
"abstract_drawing"
|
|
2343
2343
|
// 摘要附图
|
|
2344
|
-
],
|
|
2344
|
+
], Ba = [
|
|
2345
2345
|
"technical_field",
|
|
2346
2346
|
"background_art",
|
|
2347
2347
|
"summary",
|
|
2348
2348
|
"drawing_description",
|
|
2349
2349
|
"detailed_description"
|
|
2350
|
-
],
|
|
2350
|
+
], Ha = [
|
|
2351
2351
|
"drawing_figures"
|
|
2352
2352
|
// 说明书附图
|
|
2353
|
-
],
|
|
2353
|
+
], qa = [
|
|
2354
2354
|
"design_product_name",
|
|
2355
2355
|
"design_usage",
|
|
2356
2356
|
"design_description",
|
|
@@ -2370,15 +2370,15 @@ const Le = () => {
|
|
|
2370
2370
|
}), en = () => ({
|
|
2371
2371
|
type: "patent_title",
|
|
2372
2372
|
content: []
|
|
2373
|
-
}),
|
|
2373
|
+
}), Ua = () => [
|
|
2374
|
+
...Oa.map(Fe),
|
|
2375
|
+
en(),
|
|
2374
2376
|
...Ba.map(Fe),
|
|
2377
|
+
...Ha.map(Fe)
|
|
2378
|
+
], Wa = () => [
|
|
2375
2379
|
en(),
|
|
2376
|
-
...Ha.map(Fe),
|
|
2377
2380
|
...qa.map(Fe)
|
|
2378
|
-
],
|
|
2379
|
-
en(),
|
|
2380
|
-
...Ua.map(Fe)
|
|
2381
|
-
], tn = (e = "invention") => ({ type: "doc", content: e === "design" ? ja() : Wa() }), ve = (e) => Xt(e, (t) => t.type.name === "figure"), V = (e) => typeof e != "string" ? "" : e.trim(), xt = (e) => {
|
|
2381
|
+
], tn = (e = "invention") => ({ type: "doc", content: e === "design" ? Wa() : Ua() }), ve = (e) => Xt(e, (t) => t.type.name === "figure"), V = (e) => typeof e != "string" ? "" : e.trim(), xt = (e) => {
|
|
2382
2382
|
const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
|
|
2383
2383
|
ve(e).forEach((i) => {
|
|
2384
2384
|
const o = V(i.node.attrs.id);
|
|
@@ -2388,14 +2388,14 @@ const Le = () => {
|
|
|
2388
2388
|
for (; r.has(`${n}${a}`); )
|
|
2389
2389
|
a += 1;
|
|
2390
2390
|
return `${n}${a}`;
|
|
2391
|
-
},
|
|
2391
|
+
}, ja = /^(Fig\.|图)(\d+)$/, Ga = (e) => {
|
|
2392
2392
|
const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r = ve(e);
|
|
2393
2393
|
if (r.length === 0) return;
|
|
2394
2394
|
const a = [];
|
|
2395
2395
|
let i = 1;
|
|
2396
2396
|
for (const c of r) {
|
|
2397
2397
|
const s = V(c.node.attrs.id);
|
|
2398
|
-
if (!
|
|
2398
|
+
if (!ja.exec(s)) continue;
|
|
2399
2399
|
const d = `${n}${i}`;
|
|
2400
2400
|
s !== d && a.push({ pos: c.pos, expectedId: d, currentId: s }), i++;
|
|
2401
2401
|
}
|
|
@@ -2438,12 +2438,12 @@ const Le = () => {
|
|
|
2438
2438
|
return Object.keys(p).some(
|
|
2439
2439
|
(b) => p[b] !== c.attrs[b]
|
|
2440
2440
|
) && (r.setNodeMarkup(s, void 0, p), o = !0), !0;
|
|
2441
|
-
}), o && i && i(r), !0;
|
|
2441
|
+
}), o && i && (r.setMeta("addToHistory", !1), i(r)), !0;
|
|
2442
2442
|
});
|
|
2443
|
-
},
|
|
2443
|
+
}, Va = {
|
|
2444
2444
|
name: "patent",
|
|
2445
2445
|
version: "1.0.0",
|
|
2446
|
-
extensions: [Ra,
|
|
2446
|
+
extensions: [Da, Ra, $a, za],
|
|
2447
2447
|
toolbarItems: [
|
|
2448
2448
|
{
|
|
2449
2449
|
id: "patent-figure-insert",
|
|
@@ -2472,7 +2472,7 @@ const Le = () => {
|
|
|
2472
2472
|
return s.doc.descendants((m, u) => (m.type.name !== "reference" || i && u !== i.pos || m.attrs.lang !== r && (c.setNodeMarkup(u, void 0, {
|
|
2473
2473
|
...m.attrs,
|
|
2474
2474
|
lang: r
|
|
2475
|
-
}), d = !0), !0)), d && l && l(c), !0;
|
|
2475
|
+
}), d = !0), !0)), d && l && (c.setMeta("addToHistory", !1), l(c)), !0;
|
|
2476
2476
|
}) ? (Je(e), !0) : !1;
|
|
2477
2477
|
}
|
|
2478
2478
|
},
|
|
@@ -2589,13 +2589,13 @@ const Le = () => {
|
|
|
2589
2589
|
}
|
|
2590
2590
|
},
|
|
2591
2591
|
onStateChange: (e) => {
|
|
2592
|
-
|
|
2592
|
+
Ga(e), Je(e);
|
|
2593
2593
|
}
|
|
2594
|
-
},
|
|
2595
|
-
|
|
2596
|
-
const
|
|
2594
|
+
}, Ja = [xa, Ta, ka, Va];
|
|
2595
|
+
Ja.forEach((e) => B.register(e));
|
|
2596
|
+
const Ka = (e = {}) => {
|
|
2597
2597
|
const t = [
|
|
2598
|
-
...
|
|
2598
|
+
...ya,
|
|
2599
2599
|
...B.getExtensions(),
|
|
2600
2600
|
...e.extensions || []
|
|
2601
2601
|
];
|
|
@@ -2619,12 +2619,12 @@ const Xa = (e = {}) => {
|
|
|
2619
2619
|
updateNodeAttrs: (t) => ze(e, t),
|
|
2620
2620
|
removeNode: (t) => Zt(e, t),
|
|
2621
2621
|
wrapSelection: (t) => Qt(e, t),
|
|
2622
|
-
applyTransactionBatch: (t) =>
|
|
2622
|
+
applyTransactionBatch: (t) => Aa(e, t),
|
|
2623
2623
|
findNodeByType: (t, n) => st(e, t, n),
|
|
2624
2624
|
findAncestorNode: (t) => Re(e, t),
|
|
2625
|
-
findCurrentBlock: () =>
|
|
2625
|
+
findCurrentBlock: () => _a(e),
|
|
2626
2626
|
findNodesByPredicate: (t, n) => Xt(e, t, n)
|
|
2627
|
-
}),
|
|
2627
|
+
}), Xa = ["history", "text", "structure", "format", "technical", "patent"], Ya = {
|
|
2628
2628
|
history: "groupHistory",
|
|
2629
2629
|
text: "groupText",
|
|
2630
2630
|
structure: "groupStructure",
|
|
@@ -2633,7 +2633,7 @@ const Xa = (e = {}) => {
|
|
|
2633
2633
|
patent: "groupPatent"
|
|
2634
2634
|
}, Xe = (e, t) => {
|
|
2635
2635
|
if (t) {
|
|
2636
|
-
const n =
|
|
2636
|
+
const n = Ya[e];
|
|
2637
2637
|
if (n && typeof t[n] == "string") return t[n];
|
|
2638
2638
|
}
|
|
2639
2639
|
return e.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ");
|
|
@@ -2705,9 +2705,9 @@ const Xa = (e = {}) => {
|
|
|
2705
2705
|
document.body
|
|
2706
2706
|
)
|
|
2707
2707
|
] });
|
|
2708
|
-
},
|
|
2708
|
+
}, Za = ({
|
|
2709
2709
|
editor: e,
|
|
2710
|
-
groupOrder: t =
|
|
2710
|
+
groupOrder: t = Xa,
|
|
2711
2711
|
collapsibleGroups: n = !0,
|
|
2712
2712
|
defaultCollapsedGroups: r = []
|
|
2713
2713
|
}) => {
|
|
@@ -3101,7 +3101,7 @@ const Xa = (e = {}) => {
|
|
|
3101
3101
|
] }, h.group);
|
|
3102
3102
|
})
|
|
3103
3103
|
] }) });
|
|
3104
|
-
},
|
|
3104
|
+
}, Qa = ({ editor: e }) => {
|
|
3105
3105
|
const [t, n] = $(0), [r, a] = $(""), i = I((v) => v.editorLanguage), o = H(i);
|
|
3106
3106
|
if (M(() => {
|
|
3107
3107
|
if (!e) return;
|
|
@@ -3211,20 +3211,7 @@ const Xa = (e = {}) => {
|
|
|
3211
3211
|
)),
|
|
3212
3212
|
/* @__PURE__ */ g("div", { className: "h-6 w-px bg-gray-200 mx-1" })
|
|
3213
3213
|
] });
|
|
3214
|
-
})()
|
|
3215
|
-
/* @__PURE__ */ g(
|
|
3216
|
-
"button",
|
|
3217
|
-
{
|
|
3218
|
-
onClick: async () => {
|
|
3219
|
-
if (e.chain().focus().deleteSelection().run()) return;
|
|
3220
|
-
const { from: v } = e.state.selection;
|
|
3221
|
-
v > 1 && e.chain().focus().deleteRange({ from: v - 1, to: v }).run();
|
|
3222
|
-
},
|
|
3223
|
-
className: "p-2 hover:bg-red-50 text-red-600 rounded",
|
|
3224
|
-
title: o.deleteSelection,
|
|
3225
|
-
children: /* @__PURE__ */ g(Br, { size: 16 })
|
|
3226
|
-
}
|
|
3227
|
-
)
|
|
3214
|
+
})()
|
|
3228
3215
|
] }) });
|
|
3229
3216
|
}, sn = {
|
|
3230
3217
|
// Invention & Utility Model
|
|
@@ -3244,10 +3231,10 @@ const Xa = (e = {}) => {
|
|
|
3244
3231
|
design_views: ["design_description"],
|
|
3245
3232
|
design_brief: ["design_description", "design_views"]
|
|
3246
3233
|
};
|
|
3247
|
-
function
|
|
3234
|
+
function qs(e, t) {
|
|
3248
3235
|
return (sn[e] || []).filter((r) => !t.has(r));
|
|
3249
3236
|
}
|
|
3250
|
-
function
|
|
3237
|
+
function ei(e) {
|
|
3251
3238
|
const t = [];
|
|
3252
3239
|
return e.state.doc.descendants((n, r) => n.type.name === "patent_title" ? (t.push({
|
|
3253
3240
|
sectionType: "patent_title",
|
|
@@ -3278,10 +3265,10 @@ function on(e) {
|
|
|
3278
3265
|
}
|
|
3279
3266
|
return null;
|
|
3280
3267
|
}
|
|
3281
|
-
function
|
|
3268
|
+
function ti(e, t) {
|
|
3282
3269
|
const n = sn[t];
|
|
3283
3270
|
if (!n || n.length === 0) return [];
|
|
3284
|
-
const r =
|
|
3271
|
+
const r = ei(e), a = new Map(r.map((i) => [i.sectionType, i]));
|
|
3285
3272
|
return n.map((i) => {
|
|
3286
3273
|
const o = a.get(i);
|
|
3287
3274
|
return !o || o.content.trim().length === 0 ? null : {
|
|
@@ -3290,14 +3277,14 @@ function ni(e, t) {
|
|
|
3290
3277
|
};
|
|
3291
3278
|
}).filter((i) => i !== null && i.content.length > 0);
|
|
3292
3279
|
}
|
|
3293
|
-
function
|
|
3280
|
+
function Us(e, t = {}) {
|
|
3294
3281
|
const n = I.getState().editorLanguage, { from: r, to: a } = e.state.selection, i = r !== a ? e.state.doc.textBetween(r, a, " ", "\0") : void 0;
|
|
3295
3282
|
let o = t.sectionType, c = t.targetSectionPos;
|
|
3296
3283
|
if (!o) {
|
|
3297
3284
|
const m = on(e);
|
|
3298
3285
|
m && (o = m.sectionType, c = m.pos);
|
|
3299
3286
|
}
|
|
3300
|
-
const s = t.scope || (o ? "section" : i ? "selection" : "document"), l = o ?
|
|
3287
|
+
const s = t.scope || (o ? "section" : i ? "selection" : "document"), l = o ? ti(e, o) : void 0;
|
|
3301
3288
|
let d;
|
|
3302
3289
|
if (s === "selection" && r !== a) {
|
|
3303
3290
|
const u = Math.max(0, r - 200), f = Math.min(e.state.doc.content.size, a + 200), p = e.state.doc.textBetween(u, r, " ", "\0"), y = e.state.doc.textBetween(a, f, " ", "\0");
|
|
@@ -3314,7 +3301,7 @@ function Ws(e, t = {}) {
|
|
|
3314
3301
|
language: n
|
|
3315
3302
|
};
|
|
3316
3303
|
}
|
|
3317
|
-
const
|
|
3304
|
+
const ni = ({ editor: e, onSelectionOptimize: t }) => {
|
|
3318
3305
|
const { addChatReference: n, openChatPanel: r, editorLanguage: a } = I(), i = a === "zh", o = (l) => Y(
|
|
3319
3306
|
"p-1.5 rounded transition-colors",
|
|
3320
3307
|
l ? "bg-blue-100 text-blue-600" : "text-gray-600 hover:bg-gray-100"
|
|
@@ -3332,7 +3319,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3332
3319
|
d !== null && (d === "" ? e.chain().focus().extendMarkRange("link").unsetLink().run() : e.chain().focus().extendMarkRange("link").setLink({ href: d }).run());
|
|
3333
3320
|
};
|
|
3334
3321
|
return /* @__PURE__ */ g(
|
|
3335
|
-
|
|
3322
|
+
Jr,
|
|
3336
3323
|
{
|
|
3337
3324
|
editor: e,
|
|
3338
3325
|
shouldShow: ({ editor: l, state: d }) => {
|
|
@@ -3410,7 +3397,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3410
3397
|
onClick: () => e.chain().focus().toggleHighlight().run(),
|
|
3411
3398
|
className: o(e.isActive("highlight")),
|
|
3412
3399
|
title: "Highlight",
|
|
3413
|
-
children: /* @__PURE__ */ g(
|
|
3400
|
+
children: /* @__PURE__ */ g(Br, { size: 15 })
|
|
3414
3401
|
}
|
|
3415
3402
|
),
|
|
3416
3403
|
/* @__PURE__ */ g(
|
|
@@ -3429,13 +3416,13 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3429
3416
|
onClick: c,
|
|
3430
3417
|
className: "p-1.5 rounded transition-colors text-purple-500 hover:bg-purple-50",
|
|
3431
3418
|
title: i ? "AI 优化" : "AI Optimize",
|
|
3432
|
-
children: /* @__PURE__ */ g(
|
|
3419
|
+
children: /* @__PURE__ */ g(Hr, { size: 15 })
|
|
3433
3420
|
}
|
|
3434
3421
|
)
|
|
3435
3422
|
] })
|
|
3436
3423
|
}
|
|
3437
3424
|
);
|
|
3438
|
-
},
|
|
3425
|
+
}, ri = ({ editor: e }) => {
|
|
3439
3426
|
var x;
|
|
3440
3427
|
const [t, n] = $(!1), [r, a] = $(!1), [i, o] = $(""), [c, s] = $(""), [l, d] = $(!1), m = W(null), u = e.extensionStorage.searchReplace, f = ((x = u == null ? void 0 : u.results) == null ? void 0 : x.length) ?? 0, p = (u == null ? void 0 : u.currentIndex) ?? -1;
|
|
3441
3428
|
M(() => {
|
|
@@ -3492,10 +3479,10 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3492
3479
|
onClick: w,
|
|
3493
3480
|
className: Y("find-replace-btn", l && "find-replace-btn--active"),
|
|
3494
3481
|
title: "Case Sensitive",
|
|
3495
|
-
children: /* @__PURE__ */ g(
|
|
3482
|
+
children: /* @__PURE__ */ g(qr, { size: 15 })
|
|
3496
3483
|
}
|
|
3497
3484
|
),
|
|
3498
|
-
/* @__PURE__ */ g("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ g(
|
|
3485
|
+
/* @__PURE__ */ g("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ g(Ur, { size: 15 }) }),
|
|
3499
3486
|
/* @__PURE__ */ g("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ g(Ut, { size: 15 }) }),
|
|
3500
3487
|
/* @__PURE__ */ g(
|
|
3501
3488
|
"button",
|
|
@@ -3506,7 +3493,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3506
3493
|
children: /* @__PURE__ */ g(gt, { size: 15 })
|
|
3507
3494
|
}
|
|
3508
3495
|
),
|
|
3509
|
-
/* @__PURE__ */ g("button", { onClick: b, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ g(
|
|
3496
|
+
/* @__PURE__ */ g("button", { onClick: b, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ g(Wr, { size: 15 }) })
|
|
3510
3497
|
] }),
|
|
3511
3498
|
r && /* @__PURE__ */ L("div", { className: "find-replace-row", children: [
|
|
3512
3499
|
/* @__PURE__ */ g(
|
|
@@ -3525,10 +3512,10 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3525
3512
|
}
|
|
3526
3513
|
),
|
|
3527
3514
|
/* @__PURE__ */ g("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ g(gt, { size: 15 }) }),
|
|
3528
|
-
/* @__PURE__ */ g("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ g(
|
|
3515
|
+
/* @__PURE__ */ g("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ g(jr, { size: 15 }) })
|
|
3529
3516
|
] })
|
|
3530
3517
|
] }) : null;
|
|
3531
|
-
},
|
|
3518
|
+
}, ai = ({ editor: e }) => {
|
|
3532
3519
|
const { editorLanguage: t } = I(), n = t === "zh", r = At(() => {
|
|
3533
3520
|
const a = e.state, o = a.doc.textBetween(0, a.doc.content.size, " ", "\0").replace(/\s/g, "").length, { from: c, to: s } = a.selection;
|
|
3534
3521
|
let l = 0;
|
|
@@ -3546,19 +3533,19 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3546
3533
|
r.selectionCount
|
|
3547
3534
|
] })
|
|
3548
3535
|
] });
|
|
3549
|
-
},
|
|
3536
|
+
}, ii = {
|
|
3550
3537
|
empty: "○",
|
|
3551
3538
|
filled: "●"
|
|
3552
|
-
},
|
|
3539
|
+
}, si = {
|
|
3553
3540
|
empty: "text-gray-400",
|
|
3554
3541
|
filled: "text-green-500"
|
|
3555
|
-
},
|
|
3542
|
+
}, oi = /* @__PURE__ */ new Set([
|
|
3556
3543
|
"technical_field",
|
|
3557
3544
|
"background_art",
|
|
3558
3545
|
"summary",
|
|
3559
3546
|
"drawing_description",
|
|
3560
3547
|
"detailed_description"
|
|
3561
|
-
]),
|
|
3548
|
+
]), ci = ({ editor: e }) => {
|
|
3562
3549
|
const { editorLanguage: t } = I(), n = H(t), [r, a] = $(!1), [i, o] = $(0);
|
|
3563
3550
|
M(() => {
|
|
3564
3551
|
const s = () => o((l) => l + 1);
|
|
@@ -3591,7 +3578,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3591
3578
|
}), !1;
|
|
3592
3579
|
}
|
|
3593
3580
|
if (d.type.name === "patent_section") {
|
|
3594
|
-
const u = d.attrs.sectionType, f =
|
|
3581
|
+
const u = d.attrs.sectionType, f = oi.has(u), p = `sectionTitle_${u}`, y = typeof n[p] == "string" ? n[p] : u, b = d.textContent || "", w = b.trim().length > 0;
|
|
3595
3582
|
return s.push({
|
|
3596
3583
|
type: "section",
|
|
3597
3584
|
pos: m,
|
|
@@ -3620,7 +3607,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3620
3607
|
onClick: () => a(!1),
|
|
3621
3608
|
className: "outline-panel-toggle",
|
|
3622
3609
|
title: t === "zh" ? "展开大纲" : "Expand Outline",
|
|
3623
|
-
children: /* @__PURE__ */ g(
|
|
3610
|
+
children: /* @__PURE__ */ g(Gr, { size: 16 })
|
|
3624
3611
|
}
|
|
3625
3612
|
) }) : /* @__PURE__ */ L("div", { className: "outline-panel", children: [
|
|
3626
3613
|
/* @__PURE__ */ L("div", { className: "outline-panel-header", children: [
|
|
@@ -3632,7 +3619,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3632
3619
|
onClick: () => a(!0),
|
|
3633
3620
|
className: "outline-panel-toggle ml-auto",
|
|
3634
3621
|
title: t === "zh" ? "收起大纲" : "Collapse Outline",
|
|
3635
|
-
children: /* @__PURE__ */ g(
|
|
3622
|
+
children: /* @__PURE__ */ g(Vr, { size: 14 })
|
|
3636
3623
|
}
|
|
3637
3624
|
)
|
|
3638
3625
|
] }),
|
|
@@ -3654,7 +3641,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3654
3641
|
}));
|
|
3655
3642
|
},
|
|
3656
3643
|
children: [
|
|
3657
|
-
s.type === "section" && s.state && /* @__PURE__ */ g("span", { className: Y("outline-item-state",
|
|
3644
|
+
s.type === "section" && s.state && /* @__PURE__ */ g("span", { className: Y("outline-item-state", si[s.state]), children: ii[s.state] || "○" }),
|
|
3658
3645
|
/* @__PURE__ */ g("span", { className: "outline-item-title", children: s.title }),
|
|
3659
3646
|
s.type !== "book-group" && /* @__PURE__ */ g("span", { className: "outline-item-count", children: s.charCount })
|
|
3660
3647
|
]
|
|
@@ -3663,7 +3650,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3663
3650
|
))
|
|
3664
3651
|
] })
|
|
3665
3652
|
] });
|
|
3666
|
-
},
|
|
3653
|
+
}, li = ({
|
|
3667
3654
|
editor: e,
|
|
3668
3655
|
mode: t = "edit",
|
|
3669
3656
|
className: n
|
|
@@ -3679,14 +3666,14 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3679
3666
|
),
|
|
3680
3667
|
children: /* @__PURE__ */ g(In, { editor: e, className: "h-full" })
|
|
3681
3668
|
}
|
|
3682
|
-
)), cn = "patent-editor-draft",
|
|
3669
|
+
)), cn = "patent-editor-draft", di = 1500, ui = () => {
|
|
3683
3670
|
try {
|
|
3684
3671
|
const e = localStorage.getItem(cn);
|
|
3685
3672
|
return e ? JSON.parse(e) : null;
|
|
3686
3673
|
} catch {
|
|
3687
3674
|
return null;
|
|
3688
3675
|
}
|
|
3689
|
-
},
|
|
3676
|
+
}, mi = ({
|
|
3690
3677
|
initialContent: e,
|
|
3691
3678
|
onChange: t,
|
|
3692
3679
|
className: n,
|
|
@@ -3696,7 +3683,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3696
3683
|
onSelectionOptimize: o,
|
|
3697
3684
|
patchEditorId: c = "default"
|
|
3698
3685
|
}) => {
|
|
3699
|
-
const { setEditor: s, setDocument: l, editorLanguage: d, autoSaveStatus: m, ai: u } = I(), { setAutoSaveStatus: f, setLastSavedAt: p } = I(), y = W(null), b = e || (t ? null :
|
|
3686
|
+
const { setEditor: s, setDocument: l, editorLanguage: d, autoSaveStatus: m, ai: u } = I(), { setAutoSaveStatus: f, setLastSavedAt: p } = I(), y = W(null), b = e || (t ? null : ui()) || {
|
|
3700
3687
|
type: "doc",
|
|
3701
3688
|
content: [
|
|
3702
3689
|
{
|
|
@@ -3711,14 +3698,14 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3711
3698
|
f("error");
|
|
3712
3699
|
}
|
|
3713
3700
|
}, [f, p]), x = Nn(
|
|
3714
|
-
|
|
3715
|
-
extensions: [
|
|
3701
|
+
Ka({
|
|
3702
|
+
extensions: [fa.configure({ editorId: c })],
|
|
3716
3703
|
content: b,
|
|
3717
3704
|
onUpdate: ({ editor: h }) => {
|
|
3718
3705
|
const _ = h.getJSON();
|
|
3719
3706
|
l(_), B.notifyStateChange(h), t && t(_), t || (y.current && clearTimeout(y.current), y.current = setTimeout(() => {
|
|
3720
3707
|
w(_);
|
|
3721
|
-
},
|
|
3708
|
+
}, di));
|
|
3722
3709
|
},
|
|
3723
3710
|
onCreate: ({ editor: h }) => {
|
|
3724
3711
|
s(h), i == null || i(h), B.initializePlugins(h), B.notifyStateChange(h);
|
|
@@ -3750,23 +3737,23 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3750
3737
|
const v = H(d), E = m === "saving" ? v.autoSaveSaving : m === "saved" ? v.autoSaveSaved : m === "error" ? v.autoSaveError : "";
|
|
3751
3738
|
return /* @__PURE__ */ L("div", { className: `editor-container flex flex-col h-full ${n}`, children: [
|
|
3752
3739
|
!r && /* @__PURE__ */ L("div", { className: "flex items-center", children: [
|
|
3753
|
-
/* @__PURE__ */ g(
|
|
3740
|
+
/* @__PURE__ */ g(Za, { editor: x }),
|
|
3754
3741
|
E && /* @__PURE__ */ g("span", { className: `auto-save-indicator auto-save-indicator--${m} ml-2`, children: E })
|
|
3755
3742
|
] }),
|
|
3756
|
-
!r && x && /* @__PURE__ */ g(
|
|
3757
|
-
!r && x && /* @__PURE__ */ g(
|
|
3758
|
-
!r && x && /* @__PURE__ */ g(
|
|
3743
|
+
!r && x && /* @__PURE__ */ g(Qa, { editor: x }),
|
|
3744
|
+
!r && x && /* @__PURE__ */ g(ni, { editor: x, onSelectionOptimize: o }),
|
|
3745
|
+
!r && x && /* @__PURE__ */ g(ri, { editor: x }),
|
|
3759
3746
|
/* @__PURE__ */ L("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
3760
|
-
!r && x && /* @__PURE__ */ g(
|
|
3747
|
+
!r && x && /* @__PURE__ */ g(ci, { editor: x }),
|
|
3761
3748
|
/* @__PURE__ */ g("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ g(
|
|
3762
|
-
|
|
3749
|
+
li,
|
|
3763
3750
|
{
|
|
3764
3751
|
editor: x,
|
|
3765
3752
|
mode: r || !a || u.status === "streaming" && u.activeSectionType === "claims" ? "readonly" : "edit"
|
|
3766
3753
|
}
|
|
3767
3754
|
) })
|
|
3768
3755
|
] }),
|
|
3769
|
-
!r && /* @__PURE__ */ g(
|
|
3756
|
+
!r && /* @__PURE__ */ g(ai, { editor: x })
|
|
3770
3757
|
] });
|
|
3771
3758
|
};
|
|
3772
3759
|
function ln(e) {
|
|
@@ -3821,7 +3808,7 @@ function ln(e) {
|
|
|
3821
3808
|
}
|
|
3822
3809
|
});
|
|
3823
3810
|
}
|
|
3824
|
-
function
|
|
3811
|
+
function gi(e, t) {
|
|
3825
3812
|
let n = null;
|
|
3826
3813
|
return {
|
|
3827
3814
|
async request(r) {
|
|
@@ -3843,7 +3830,7 @@ function fi(e, t) {
|
|
|
3843
3830
|
}
|
|
3844
3831
|
};
|
|
3845
3832
|
}
|
|
3846
|
-
function
|
|
3833
|
+
function fi(e, t) {
|
|
3847
3834
|
let n = null;
|
|
3848
3835
|
const r = e.replace(/\/+$/, "");
|
|
3849
3836
|
async function a(i, o) {
|
|
@@ -3897,7 +3884,7 @@ function pi(e, t) {
|
|
|
3897
3884
|
}
|
|
3898
3885
|
};
|
|
3899
3886
|
}
|
|
3900
|
-
const
|
|
3887
|
+
const pi = It(
|
|
3901
3888
|
({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, editable: i = !0, language: o, aiService: c, chatSessionAPI: s, aiBaseUrl: l, aiHeaders: d, onSelectionOptimize: m, patchEditorId: u }, f) => {
|
|
3902
3889
|
const { setEditorLanguage: p, setAIService: y, setChatSessionAPI: b } = I(), w = W(null), x = ae((v) => {
|
|
3903
3890
|
w.current = v;
|
|
@@ -3908,9 +3895,9 @@ const hi = It(
|
|
|
3908
3895
|
return Ee.useEffect(() => {
|
|
3909
3896
|
o && p(o);
|
|
3910
3897
|
}, [o, p]), Ee.useEffect(() => {
|
|
3911
|
-
c ? y(c) : l && y(
|
|
3898
|
+
c ? y(c) : l && y(gi(l, d));
|
|
3912
3899
|
}, [c, l, d, y]), Ee.useEffect(() => {
|
|
3913
|
-
s ? b(s) : l && b(
|
|
3900
|
+
s ? b(s) : l && b(fi(l, d));
|
|
3914
3901
|
}, [s, l, d, b]), Nt(f, () => ({
|
|
3915
3902
|
getContent: () => {
|
|
3916
3903
|
var v;
|
|
@@ -3927,7 +3914,7 @@ const hi = It(
|
|
|
3927
3914
|
(v = w.current) == null || v.commands.focus();
|
|
3928
3915
|
}
|
|
3929
3916
|
})), /* @__PURE__ */ g(
|
|
3930
|
-
|
|
3917
|
+
mi,
|
|
3931
3918
|
{
|
|
3932
3919
|
initialContent: C,
|
|
3933
3920
|
onChange: n,
|
|
@@ -3941,8 +3928,8 @@ const hi = It(
|
|
|
3941
3928
|
);
|
|
3942
3929
|
}
|
|
3943
3930
|
);
|
|
3944
|
-
|
|
3945
|
-
async function
|
|
3931
|
+
pi.displayName = "PatentEditor";
|
|
3932
|
+
async function Ws(e, t, n) {
|
|
3946
3933
|
var a, i, o, c;
|
|
3947
3934
|
let r = !1;
|
|
3948
3935
|
(a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && un(e, n.targetSectionPos);
|
|
@@ -3961,7 +3948,7 @@ async function js(e, t, n) {
|
|
|
3961
3948
|
(c = n.onError) == null || c.call(n, s instanceof Error ? s : new Error(String(s)));
|
|
3962
3949
|
}
|
|
3963
3950
|
}
|
|
3964
|
-
async function
|
|
3951
|
+
async function js(e, t, n, r) {
|
|
3965
3952
|
var i, o, c, s, l, d, m, u;
|
|
3966
3953
|
const a = new AbortController();
|
|
3967
3954
|
(i = r.onStart) == null || i.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && un(e, r.targetSectionPos);
|
|
@@ -4191,7 +4178,7 @@ function rt(e, t = 30) {
|
|
|
4191
4178
|
}
|
|
4192
4179
|
});
|
|
4193
4180
|
}
|
|
4194
|
-
function
|
|
4181
|
+
function hi(e) {
|
|
4195
4182
|
const t = [], n = $e(e, 3);
|
|
4196
4183
|
for (const r of n)
|
|
4197
4184
|
t.push({ type: "delta", content: r });
|
|
@@ -4203,7 +4190,7 @@ function $e(e, t) {
|
|
|
4203
4190
|
n.push(e.slice(r, r + t));
|
|
4204
4191
|
return n;
|
|
4205
4192
|
}
|
|
4206
|
-
function
|
|
4193
|
+
function yi(e, t, n) {
|
|
4207
4194
|
const r = n === "zh", a = [];
|
|
4208
4195
|
let i;
|
|
4209
4196
|
if (e.includes("技术方案") || e.includes("draft") ? i = Pe["help-draft"][r ? "zh" : "en"] : e.includes("审查") || e.includes("review") || e.includes("Review") ? i = Pe.review[r ? "zh" : "en"] : e.includes("权利要求") || e.includes("claims") || e.includes("Optimize") ? i = Pe.claims[r ? "zh" : "en"] : i = Pe.default[r ? "zh" : "en"], t.length > 0) {
|
|
@@ -4251,7 +4238,7 @@ function bi(e, t, n) {
|
|
|
4251
4238
|
a.push({ type: "delta", content: o });
|
|
4252
4239
|
return a.push({ type: "done", usage: { tokens: i.length * 2 } }), a;
|
|
4253
4240
|
}
|
|
4254
|
-
function
|
|
4241
|
+
function Gs() {
|
|
4255
4242
|
let e = null;
|
|
4256
4243
|
return {
|
|
4257
4244
|
async request(t) {
|
|
@@ -4265,7 +4252,7 @@ function Vs() {
|
|
|
4265
4252
|
` : `[Generated based on instruction "${t.instruction}"]
|
|
4266
4253
|
|
|
4267
4254
|
`) + a);
|
|
4268
|
-
const o =
|
|
4255
|
+
const o = hi(i);
|
|
4269
4256
|
return rt(o, 25);
|
|
4270
4257
|
},
|
|
4271
4258
|
abort() {
|
|
@@ -4273,7 +4260,7 @@ function Vs() {
|
|
|
4273
4260
|
}
|
|
4274
4261
|
};
|
|
4275
4262
|
}
|
|
4276
|
-
function
|
|
4263
|
+
function Vs() {
|
|
4277
4264
|
const e = /* @__PURE__ */ new Map();
|
|
4278
4265
|
let t = null, n = null;
|
|
4279
4266
|
return {
|
|
@@ -4316,7 +4303,7 @@ function Js() {
|
|
|
4316
4303
|
status: "done",
|
|
4317
4304
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4318
4305
|
}), i.session.messageCount = i.messages.length, i.session.lastMessage = a.content, i.session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4319
|
-
const c =
|
|
4306
|
+
const c = yi(
|
|
4320
4307
|
a.content,
|
|
4321
4308
|
a.references || [],
|
|
4322
4309
|
a.language
|
|
@@ -4348,7 +4335,7 @@ function Js() {
|
|
|
4348
4335
|
}
|
|
4349
4336
|
};
|
|
4350
4337
|
}
|
|
4351
|
-
function
|
|
4338
|
+
function bi(e) {
|
|
4352
4339
|
const t = [], n = e.replace(/\r\n/g, `
|
|
4353
4340
|
`).trim();
|
|
4354
4341
|
if (!n) return t;
|
|
@@ -4363,12 +4350,12 @@ function vi(e) {
|
|
|
4363
4350
|
if (a.length === 0)
|
|
4364
4351
|
return t.push({ number: 1, text: n, dependsOn: [] }), t;
|
|
4365
4352
|
for (let o = 0; o < a.length; o++) {
|
|
4366
|
-
const c = a[o].index + a[o].matchLength, s = o + 1 < a.length ? a[o + 1].index : n.length, l = n.slice(c, s).trim(), d = a[o].number, m =
|
|
4353
|
+
const c = a[o].index + a[o].matchLength, s = o + 1 < a.length ? a[o + 1].index : n.length, l = n.slice(c, s).trim(), d = a[o].number, m = vi(l, d);
|
|
4367
4354
|
t.push({ number: d, text: l, dependsOn: m });
|
|
4368
4355
|
}
|
|
4369
4356
|
return t;
|
|
4370
4357
|
}
|
|
4371
|
-
function
|
|
4358
|
+
function vi(e, t) {
|
|
4372
4359
|
const n = [], r = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g;
|
|
4373
4360
|
let a;
|
|
4374
4361
|
for (; (a = r.exec(e)) !== null; ) {
|
|
@@ -4384,18 +4371,18 @@ function wi(e, t) {
|
|
|
4384
4371
|
}
|
|
4385
4372
|
return [...new Set(n)].sort((o, c) => o - c);
|
|
4386
4373
|
}
|
|
4387
|
-
function
|
|
4388
|
-
return
|
|
4374
|
+
function Js(e) {
|
|
4375
|
+
return bi(e).map((n) => ({
|
|
4389
4376
|
type: "paragraph",
|
|
4390
4377
|
content: n.text ? [{ type: "text", text: `${n.number}. ${n.text}` }] : [{ type: "text", text: `${n.number}. ` }]
|
|
4391
4378
|
}));
|
|
4392
4379
|
}
|
|
4393
|
-
const
|
|
4380
|
+
const wi = -1, xi = 1, Ci = 0, at = new we("docDiff");
|
|
4394
4381
|
let Ye = null;
|
|
4395
|
-
function
|
|
4382
|
+
function Ti() {
|
|
4396
4383
|
return Ye || (Ye = new Pt()), Ye;
|
|
4397
4384
|
}
|
|
4398
|
-
function
|
|
4385
|
+
function Si(e, t, n) {
|
|
4399
4386
|
const r = [];
|
|
4400
4387
|
return e.nodesBetween(t, n, (a, i) => {
|
|
4401
4388
|
if (a.isTextblock) {
|
|
@@ -4405,15 +4392,15 @@ function Ei(e, t, n) {
|
|
|
4405
4392
|
return !0;
|
|
4406
4393
|
}), r;
|
|
4407
4394
|
}
|
|
4408
|
-
function
|
|
4409
|
-
const n = e.state.doc, r = n.content.size, { text: a, segments: i } = Gt(e, 0, r), o =
|
|
4395
|
+
function Ks(e, t) {
|
|
4396
|
+
const n = e.state.doc, r = n.content.size, { text: a, segments: i } = Gt(e, 0, r), o = Ti(), c = o.diff_main(t, a);
|
|
4410
4397
|
o.diff_cleanupSemantic(c);
|
|
4411
4398
|
const s = [];
|
|
4412
4399
|
let l = 0;
|
|
4413
4400
|
for (const [u, f] of c)
|
|
4414
|
-
if (u ===
|
|
4401
|
+
if (u === Ci)
|
|
4415
4402
|
l += f.length;
|
|
4416
|
-
else if (u ===
|
|
4403
|
+
else if (u === xi) {
|
|
4417
4404
|
let p = 0;
|
|
4418
4405
|
for (; p < f.length; ) {
|
|
4419
4406
|
for (; p < f.length && f[p] === "\0"; ) p++;
|
|
@@ -4422,13 +4409,13 @@ function Xs(e, t) {
|
|
|
4422
4409
|
for (; p < f.length && f[p] !== "\0"; ) p++;
|
|
4423
4410
|
const b = ye(i, l + y), w = ye(i, l + p);
|
|
4424
4411
|
if (b >= 0 && w >= 0 && w > b)
|
|
4425
|
-
for (const x of
|
|
4412
|
+
for (const x of Si(n, b, w))
|
|
4426
4413
|
s.push(
|
|
4427
4414
|
re.inline(x.from, x.to, { class: "patch-diff-insert-inline" })
|
|
4428
4415
|
);
|
|
4429
4416
|
}
|
|
4430
4417
|
l += f.length;
|
|
4431
|
-
} else if (u ===
|
|
4418
|
+
} else if (u === wi) {
|
|
4432
4419
|
const p = ye(i, l);
|
|
4433
4420
|
if (p >= 0) {
|
|
4434
4421
|
const y = f.replace(/\0/g, " ");
|
|
@@ -4458,22 +4445,22 @@ function Xs(e, t) {
|
|
|
4458
4445
|
});
|
|
4459
4446
|
e.registerPlugin(m);
|
|
4460
4447
|
}
|
|
4461
|
-
function
|
|
4448
|
+
function Xs(e) {
|
|
4462
4449
|
e.unregisterPlugin(at);
|
|
4463
4450
|
}
|
|
4464
|
-
const
|
|
4451
|
+
const Ei = /* @__PURE__ */ new Set([
|
|
4465
4452
|
"abstract",
|
|
4466
4453
|
"abstract_drawing",
|
|
4467
4454
|
"claims",
|
|
4468
4455
|
"drawing_figures"
|
|
4469
|
-
]),
|
|
4456
|
+
]), ki = /* @__PURE__ */ new Set([
|
|
4470
4457
|
"technical_field",
|
|
4471
4458
|
"background_art",
|
|
4472
4459
|
"summary",
|
|
4473
4460
|
"drawing_description",
|
|
4474
4461
|
"detailed_description"
|
|
4475
4462
|
]);
|
|
4476
|
-
function
|
|
4463
|
+
function _i(e, t) {
|
|
4477
4464
|
const n = H(t), r = [];
|
|
4478
4465
|
return e.state.doc.descendants((a) => {
|
|
4479
4466
|
if (a.type.name === "patent_title") {
|
|
@@ -4509,7 +4496,7 @@ function Et(e) {
|
|
|
4509
4496
|
spacing: { before: 240, after: 120 }
|
|
4510
4497
|
});
|
|
4511
4498
|
}
|
|
4512
|
-
function
|
|
4499
|
+
function Ii(e) {
|
|
4513
4500
|
return new He({
|
|
4514
4501
|
children: [new qe({ text: e, bold: !0, size: 36, font: "宋体" })],
|
|
4515
4502
|
alignment: it.CENTER,
|
|
@@ -4523,11 +4510,11 @@ function Ze(e) {
|
|
|
4523
4510
|
indent: { firstLine: he(7) }
|
|
4524
4511
|
});
|
|
4525
4512
|
}
|
|
4526
|
-
function
|
|
4513
|
+
function Ni(e, t) {
|
|
4527
4514
|
const n = H(t), r = [];
|
|
4528
4515
|
let a = !1;
|
|
4529
4516
|
for (const i of e) {
|
|
4530
|
-
if (
|
|
4517
|
+
if (Ei.has(i.sectionType)) {
|
|
4531
4518
|
r.push(St(i.title));
|
|
4532
4519
|
for (const o of i.paragraphs)
|
|
4533
4520
|
r.push(Ze(o));
|
|
@@ -4539,10 +4526,10 @@ function Ai(e, t) {
|
|
|
4539
4526
|
r.push(St(o)), a = !0;
|
|
4540
4527
|
}
|
|
4541
4528
|
for (const o of i.paragraphs)
|
|
4542
|
-
r.push(
|
|
4529
|
+
r.push(Ii(o));
|
|
4543
4530
|
continue;
|
|
4544
4531
|
}
|
|
4545
|
-
if (
|
|
4532
|
+
if (ki.has(i.sectionType)) {
|
|
4546
4533
|
r.push(Et(i.title));
|
|
4547
4534
|
for (const o of i.paragraphs)
|
|
4548
4535
|
r.push(Ze(o));
|
|
@@ -4554,8 +4541,8 @@ function Ai(e, t) {
|
|
|
4554
4541
|
}
|
|
4555
4542
|
return r;
|
|
4556
4543
|
}
|
|
4557
|
-
async function
|
|
4558
|
-
const n =
|
|
4544
|
+
async function Ys(e, t) {
|
|
4545
|
+
const n = _i(e, t), r = Ni(n, t), a = n.find((l) => l.type === "patent_title"), i = a != null && a.paragraphs[0] ? `${a.paragraphs[0]}.docx` : "patent-document.docx", o = {
|
|
4559
4546
|
properties: {
|
|
4560
4547
|
page: {
|
|
4561
4548
|
margin: {
|
|
@@ -4567,15 +4554,15 @@ async function Zs(e, t) {
|
|
|
4567
4554
|
}
|
|
4568
4555
|
},
|
|
4569
4556
|
children: r
|
|
4570
|
-
}, c = new
|
|
4557
|
+
}, c = new Kr({
|
|
4571
4558
|
sections: [o]
|
|
4572
|
-
}), s = await
|
|
4573
|
-
|
|
4559
|
+
}), s = await Xr.toBlob(c);
|
|
4560
|
+
Yr(s, i);
|
|
4574
4561
|
}
|
|
4575
|
-
async function
|
|
4562
|
+
async function Zs(e) {
|
|
4576
4563
|
window.print();
|
|
4577
4564
|
}
|
|
4578
|
-
function
|
|
4565
|
+
function Qs(e, t) {
|
|
4579
4566
|
const n = [], r = t === "zh";
|
|
4580
4567
|
let a = 0;
|
|
4581
4568
|
const i = () => `v_${++a}`;
|
|
@@ -4646,8 +4633,8 @@ function eo(e, t) {
|
|
|
4646
4633
|
return !0;
|
|
4647
4634
|
}), n;
|
|
4648
4635
|
}
|
|
4649
|
-
const
|
|
4650
|
-
function
|
|
4636
|
+
const Ai = /^(\d+)\s*[.、]\s*/, kt = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g, _t = /claims?\s+(\d+)(?:\s*[-~to]+\s*(\d+))?/gi;
|
|
4637
|
+
function Li(e, t) {
|
|
4651
4638
|
const n = [];
|
|
4652
4639
|
let r;
|
|
4653
4640
|
for (kt.lastIndex = 0; (r = kt.exec(e)) !== null; ) {
|
|
@@ -4664,7 +4651,7 @@ function Pi(e, t) {
|
|
|
4664
4651
|
}
|
|
4665
4652
|
const mn = (e) => {
|
|
4666
4653
|
if (e.type.name === "reference")
|
|
4667
|
-
return
|
|
4654
|
+
return Pi(e);
|
|
4668
4655
|
if (e.type.name === "hardBreak")
|
|
4669
4656
|
return `
|
|
4670
4657
|
`;
|
|
@@ -4674,7 +4661,7 @@ const mn = (e) => {
|
|
|
4674
4661
|
return e.forEach((n) => {
|
|
4675
4662
|
t += mn(n);
|
|
4676
4663
|
}), t;
|
|
4677
|
-
},
|
|
4664
|
+
}, Pi = (e) => {
|
|
4678
4665
|
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() : "";
|
|
4679
4666
|
if (r)
|
|
4680
4667
|
return r;
|
|
@@ -4684,17 +4671,17 @@ const mn = (e) => {
|
|
|
4684
4671
|
}
|
|
4685
4672
|
const a = Number(e.attrs.resolvedNumber);
|
|
4686
4673
|
return Number.isFinite(a) ? t === "en" ? `Claim ${a}` : `权利要求${a}` : t === "en" ? "Claim ?" : "权利要求?";
|
|
4687
|
-
},
|
|
4674
|
+
}, eo = (e) => {
|
|
4688
4675
|
const t = [];
|
|
4689
4676
|
return e.state.doc.descendants((n, r) => {
|
|
4690
4677
|
if (n.type.name === "patent_section")
|
|
4691
4678
|
return n.attrs.sectionType === "claims";
|
|
4692
4679
|
if (n.type.name !== "paragraph") return !0;
|
|
4693
|
-
const a = mn(n).trim(), i =
|
|
4680
|
+
const a = mn(n).trim(), i = Ai.exec(a);
|
|
4694
4681
|
if (!i) return !0;
|
|
4695
4682
|
const o = parseInt(i[1], 10);
|
|
4696
4683
|
if (!Number.isFinite(o) || o <= 0) return !0;
|
|
4697
|
-
const c = a.slice(i[0].length).trim(), s =
|
|
4684
|
+
const c = a.slice(i[0].length).trim(), s = Li(c, o);
|
|
4698
4685
|
return t.push({
|
|
4699
4686
|
claimId: `claim_${o}`,
|
|
4700
4687
|
number: o,
|
|
@@ -4706,40 +4693,40 @@ const mn = (e) => {
|
|
|
4706
4693
|
}), t;
|
|
4707
4694
|
};
|
|
4708
4695
|
export {
|
|
4709
|
-
|
|
4696
|
+
mi as EditorView,
|
|
4710
4697
|
jt as PatchDiffPluginKey,
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4698
|
+
pi as PatentEditor,
|
|
4699
|
+
Bs as acceptAllPatches,
|
|
4700
|
+
zs as acceptPatch,
|
|
4701
|
+
Ks as applyDocDiffDecorations,
|
|
4702
|
+
Us as buildAIContext,
|
|
4703
|
+
Js as buildClaimsJSONContent,
|
|
4717
4704
|
tn as buildPatentDocument,
|
|
4718
|
-
|
|
4719
|
-
|
|
4705
|
+
$s as clearPatches,
|
|
4706
|
+
fi as createChatSessionAPI,
|
|
4720
4707
|
ct as createCommandExecutor,
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4708
|
+
Ka as createEditorConfig,
|
|
4709
|
+
Gs as createMockAIService,
|
|
4710
|
+
Vs as createMockChatSessionAPI,
|
|
4711
|
+
gi as createSSEAdapter,
|
|
4712
|
+
Zs as exportToPdf,
|
|
4713
|
+
Ys as exportToWord,
|
|
4714
|
+
eo as extractClaimsFromEditor,
|
|
4728
4715
|
on as findSectionAtCursor,
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4716
|
+
ei as getAllSections,
|
|
4717
|
+
qs as getMissingSectionDeps,
|
|
4718
|
+
Ms as getPatches,
|
|
4719
|
+
Rs as onPatchChange,
|
|
4733
4720
|
B as pluginManager,
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4721
|
+
Hs as rejectAllPatches,
|
|
4722
|
+
Os as rejectPatch,
|
|
4723
|
+
Xs as removeDocDiffDecorations,
|
|
4724
|
+
Ds as resolvePatchTarget,
|
|
4738
4725
|
sn as sectionContextDeps,
|
|
4739
|
-
|
|
4726
|
+
Fs as setPatches,
|
|
4740
4727
|
I as useEditorStore,
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4728
|
+
Qs as validatePatentDocument,
|
|
4729
|
+
Ws as writeStream,
|
|
4730
|
+
js as writeStreamFromSSE
|
|
4744
4731
|
};
|
|
4745
4732
|
//# sourceMappingURL=lib.js.map
|