@fgbg/mdocs 1.1.2 → 1.2.1
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/agent-skills/changelog/SKILL.md +27 -0
- package/agent-skills/usage-knowledge-graph/SKILL.md +0 -2
- package/dist/server/agent/Agent/run.js.map +1 -1
- package/dist/server/agent/Agent/system-prompt.js +13 -6
- package/dist/server/agent/Agent/system-prompt.js.map +1 -1
- package/dist/server/agent/Agent/tools-overwrite.js +10 -0
- package/dist/server/agent/Agent/tools-overwrite.js.map +1 -1
- package/dist/server/agent/Config/config.js +26 -5
- package/dist/server/agent/Config/config.js.map +1 -1
- package/dist/server/agent/Config/config.test.js +23 -3
- package/dist/server/agent/Config/config.test.js.map +1 -1
- package/dist/server/documents/document.service.js +43 -19
- package/dist/server/documents/document.service.js.map +1 -1
- package/dist/server/documents/graph.integration.test.js +1 -0
- package/dist/server/documents/graph.integration.test.js.map +1 -1
- package/dist/server/documents/graph.service.js +4 -1
- package/dist/server/documents/graph.service.js.map +1 -1
- package/dist/server/documents/tree.service.js +1 -0
- package/dist/server/documents/tree.service.js.map +1 -1
- package/dist/server/routes/agent.routes.js +3 -0
- package/dist/server/routes/agent.routes.js.map +1 -1
- package/dist/server/routes/documents.routes.js +7 -1
- package/dist/server/routes/documents.routes.js.map +1 -1
- package/dist/server/routes/graph.routes.js +21 -4
- package/dist/server/routes/graph.routes.js.map +1 -1
- package/dist/server/routes/tree.routes.js +2 -1
- package/dist/server/routes/tree.routes.js.map +1 -1
- package/dist/shared/docPath.js +2 -2
- package/dist/shared/docPath.js.map +1 -1
- package/dist/shared/file-type-policy.js +120 -0
- package/dist/shared/file-type-policy.js.map +1 -0
- package/dist/shared/file-types.js +4 -2
- package/dist/shared/file-types.js.map +1 -1
- package/dist/shared/storagePath.js +11 -8
- package/dist/shared/storagePath.js.map +1 -1
- package/dist/web/assets/AgentChatPanel-B7IcnUpo.js +22 -0
- package/dist/web/assets/AgentSkillFormCard-BvGtfSYA.js +6 -0
- package/dist/web/assets/{AiWriteWorkbench-Boie5E_-.js → AiWriteWorkbench-CiCbou2k.js} +1 -1
- package/dist/web/assets/{DiagramEditor-NtNY3sZL-CZy-tmEe.js → DiagramEditor-NtNY3sZL-D8pO8wBI.js} +1 -1
- package/dist/web/assets/{DocumentEditor-1A6lpvV-.js → DocumentEditor-DO_AX4v-.js} +2 -2
- package/dist/web/assets/HtmlEditor-Bw2cVxtF.css +1 -0
- package/dist/web/assets/HtmlEditor-CneI2y4w.js +1 -0
- package/dist/web/assets/{MergeView-Dip0aW7s.js → MergeView-BiLf0JJw.js} +2 -2
- package/dist/web/assets/PlaygroundPage-C7glsS72.js +8 -0
- package/dist/web/assets/SettingsPage-CMbhjz76.js +1 -0
- package/dist/web/assets/{Toolbar-BHLX-ug4.js → Toolbar-CsA1tpSD.js} +24 -29
- package/dist/web/assets/{VisitorPickerModal-BPyEWlQo.js → VisitorPickerModal-D53YaNbf.js} +1 -1
- package/dist/web/assets/code-xml-6zfU0nfd.js +6 -0
- package/dist/web/assets/{copy-BE64wQqi.js → copy-CkzT-0Cs.js} +1 -1
- package/dist/web/assets/diagram-Bk84WZto.js +3320 -0
- package/dist/web/assets/index-DGnp1IRN.js +263 -0
- package/dist/web/assets/index-DTZrHyAu.css +1 -0
- package/dist/web/assets/{meta2dEngine-BD2XbzaV-z-eR7E_V.js → meta2dEngine-BD2XbzaV-BMzVEEHU.js} +1 -1
- package/dist/web/assets/{motion-DX3HNq_4.js → motion-DFABYlwt.js} +1 -1
- package/dist/web/assets/{plus-ECzYbQfA.js → plus-CmYtaPfl.js} +1 -1
- package/dist/web/assets/{react-GP8hKHRA.js → react-Dy2okueo.js} +3 -3
- package/dist/web/assets/{ui-BQStT3dY.js → ui-CvA4pq3d.js} +4 -4
- package/dist/web/index.html +5 -5
- package/package.json +2 -1
- package/dist/web/assets/AgentChatPanel-Bt38gm3b.js +0 -6
- package/dist/web/assets/AgentSkillFormCard-CtfWIf7Y.js +0 -6
- package/dist/web/assets/PlaygroundPage-C4X6Lj-Q.js +0 -8
- package/dist/web/assets/SettingsPage-nlnmzNZK.js +0 -1
- package/dist/web/assets/diagram-CT58wBdU.js +0 -5772
- package/dist/web/assets/index-BkKvQv2F.js +0 -248
- package/dist/web/assets/index-DKshvHIN.css +0 -1
|
@@ -1,121 +1,116 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as t}from"./index-DGnp1IRN.js";import{r as u,j as r}from"./react-vendor-BuABiQkA.js";import{F as _,G as C,L as v,H as c,J as l,K as N,M as L,q as j,N as z,P as H}from"./react-Dy2okueo.js";import{z as f,V as g}from"./editor-CL03se2B.js";import{C as $}from"./code-xml-6zfU0nfd.js";/**
|
|
2
2
|
* @license lucide-react v0.562.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const w=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],I=t("arrow-down-to-line",w);/**
|
|
7
7
|
* @license lucide-react v0.562.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const V=[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]],q=t("arrow-up-to-line",V);/**
|
|
12
12
|
* @license lucide-react v0.562.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const B=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],T=t("bold",B);/**
|
|
17
17
|
* @license lucide-react v0.562.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const A=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],P=t("file-up",A);/**
|
|
22
22
|
* @license lucide-react v0.562.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const E=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],ve=t("heading-1",E);/**
|
|
27
27
|
* @license lucide-react v0.562.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const U=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"
|
|
31
|
+
*/const U=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Ne=t("heading-2",U);/**
|
|
32
32
|
* @license lucide-react v0.562.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const F=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"
|
|
36
|
+
*/const F=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Le=t("heading-3",F);/**
|
|
37
37
|
* @license lucide-react v0.562.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const R=[["path",{d:"
|
|
41
|
+
*/const R=[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]],S=t("highlighter",R);/**
|
|
42
42
|
* @license lucide-react v0.562.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const
|
|
46
|
+
*/const D=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],O=t("image",D);/**
|
|
47
47
|
* @license lucide-react v0.562.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const
|
|
51
|
+
*/const G=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],W=t("italic",G);/**
|
|
52
52
|
* @license lucide-react v0.562.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const X=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],J=t("list-ordered",X);/**
|
|
57
57
|
* @license lucide-react v0.562.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const
|
|
61
|
+
*/const K=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Q=t("list-todo",K);/**
|
|
62
62
|
* @license lucide-react v0.562.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const
|
|
66
|
+
*/const Y=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Z=t("list",Y);/**
|
|
67
67
|
* @license lucide-react v0.562.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const
|
|
71
|
+
*/const ee=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],oe=t("message-square-quote",ee);/**
|
|
72
72
|
* @license lucide-react v0.562.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const
|
|
76
|
+
*/const te=[["path",{d:"M5 12h14",key:"1ays0h"}]],je=t("minus",te);/**
|
|
77
77
|
* @license lucide-react v0.562.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const ae=[["path",{d:"
|
|
81
|
+
*/const ae=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],ne=t("redo-2",ae);/**
|
|
82
82
|
* @license lucide-react v0.562.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const
|
|
86
|
+
*/const ie=[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]],ce=t("sigma",ie);/**
|
|
87
87
|
* @license lucide-react v0.562.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const le=[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]],se=t("square-dashed-bottom-code",le);/**
|
|
92
92
|
* @license lucide-react v0.562.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const de=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],ke=t("strikethrough",de);/**
|
|
97
97
|
* @license lucide-react v0.562.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const
|
|
101
|
+
*/const he=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],ze=t("table-2",he);/**
|
|
102
102
|
* @license lucide-react v0.562.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const ye=[["path",{d:"
|
|
106
|
+
*/const ye=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],re=t("underline",ye);/**
|
|
107
107
|
* @license lucide-react v0.562.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const
|
|
111
|
+
*/const pe=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],ue=t("undo-2",pe);/**
|
|
112
112
|
* @license lucide-react v0.562.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
117
|
-
* @license lucide-react v0.562.0 - ISC
|
|
118
|
-
*
|
|
119
|
-
* This source code is licensed under the ISC license.
|
|
120
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const Me=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],$e=o("workflow",Me);function m(e,n="*/*"){if(typeof document>"u")return;const a=document.createElement("input");a.type="file",a.accept=n,a.multiple=!1;const i=setTimeout(()=>a.remove(),5e3);a.onchange=s=>{var y;clearTimeout(i);const h=(y=s.target)==null?void 0:y.files;h&&h.length>0&&e(h),a.remove()},a.oncancel=()=>{clearTimeout(i),a.remove()},a.click()}function fe(e){const n=e.getLexicalEditor();n&&(n.update(()=>{const a=f(),i=g(),s=a.getFirstChild();s?s.insertBefore(i):a.append(i),i.selectStart()}),e.focus())}function ge(e){const n=e.getLexicalEditor();n&&(n.update(()=>{const a=f(),i=g();a.append(i),i.selectStart()}),e.focus())}function M(e,n){return[{active:e.isBold,icon:B,key:"bold",label:"Bold",onClick:e.bold,tooltipProps:{hotkey:c(l.Bold).keys}},{active:e.isItalic,icon:X,key:"italic",label:"Italic",onClick:e.italic,tooltipProps:{hotkey:c(l.Italic).keys}},{active:e.isUnderline,icon:pe,key:"underline",label:"Underline",onClick:e.underline,tooltipProps:{hotkey:c(l.Underline).keys}},{active:e.isStrikethrough,icon:he,key:"strikethrough",label:"Strikethrough",onClick:e.strikethrough,tooltipProps:{hotkey:c(l.Strikethrough).keys}},{type:"divider"},{active:!!e.textColor,editor:n,key:"textColor",label:"Text Color",onChange:e.setTextColor,type:"colorPicker",value:e.textColor},{active:!!e.bgColor,defaultColor:"#ffffff",editor:n,icon:D,key:"bgColor",label:"Background Color",onChange:e.setBgColor,type:"colorPicker",value:e.bgColor}]}const He=({editor:e,floating:n,outlineCollapseTitle:a,outlineExpandTitle:i,outlineToggle:s,style:h,className:y})=>{const t=_(e),d=C({collapseTitle:a,expandTitle:i}),b=u.useMemo(()=>[{disabled:!t.canUndo,icon:me,key:"undo",label:"Undo",onClick:t.undo,tooltipProps:{hotkey:c(l.Undo).keys}},{disabled:!t.canRedo,icon:ie,key:"redo",label:"Redo",onClick:t.redo,tooltipProps:{hotkey:c(l.Redo).keys}},{icon:I,key:"insertLineTop",label:"Insert line at top",onClick:()=>fe(e)},{icon:w,key:"insertLineBottom",label:"Insert line at end",onClick:()=>ge(e)},{type:"divider"},...M(t,e),{type:"divider"},{icon:ee,key:"bulletList",label:"Bullet List",onClick:t.bulletList,tooltipProps:{hotkey:c(l.BulletList).keys}},{icon:K,key:"numberlist",label:"Number list",onClick:t.numberList,tooltipProps:{hotkey:c(l.NumberList).keys}},{icon:Y,key:"tasklist",label:"Task list",onClick:t.checkList},{type:"divider"},{active:t.isBlockquote,icon:te,key:"blockquote",label:"Blockquote",onClick:t.blockquote},{icon:v,key:"link",label:"Link",onClick:t.insertLink,tooltipProps:{hotkey:c(l.Link).keys}},{icon:le,key:"math",label:"TeX",onClick:t.insertMath},{type:"divider"},{active:t.isCode,icon:A,key:"code",label:"Code",onClick:t.code,tooltipProps:{hotkey:c(l.CodeInline).keys}},{active:t.isCodeblock,icon:de,key:"codeblock",label:"Codeblock",onClick:t.codeblock},t.isCodeblock&&{children:r.jsx(N,{onSelect:k=>{console.log(k),t.updateCodeblockLang(k)},value:t.codeblockLang}),disabled:!t.isCodeblock,key:"codeblockLang"},{type:"divider"},{icon:G,key:"image",label:"Image",onClick:()=>{m(k=>{for(const p of k)e.dispatchCommand(L,{file:p})},"image/*")}},{icon:E,key:"file",label:"File",onClick:()=>{m(k=>{for(const p of k)e.dispatchCommand(j,{file:p})},".pdf,.zip,.txt,.md,.csv,.html,.htm,audio/*,*/*")}},...s&&d?[{type:"divider"},d]:[]].filter(Boolean),[e,t,d,s]),x=u.useMemo(()=>[...M(t,e),...s&&d?[{type:"divider"},d]:[]],[e,t,d,s]);return n?r.jsx(z,{items:x}):r.jsx("div",{className:["mdocs-toolbar",y].filter(Boolean).join(" "),style:h,children:r.jsx($,{items:b})})};export{ve as H,je as M,le as S,ze as T,$e as W,Ne as a,Le as b,He as c,m as o};
|
|
116
|
+
*/const me=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],He=t("workflow",me);function m(e,n="*/*"){if(typeof document>"u")return;const a=document.createElement("input");a.type="file",a.accept=n,a.multiple=!1;const i=setTimeout(()=>a.remove(),5e3);a.onchange=s=>{var y;clearTimeout(i);const h=(y=s.target)==null?void 0:y.files;h&&h.length>0&&e(h),a.remove()},a.oncancel=()=>{clearTimeout(i),a.remove()},a.click()}function Me(e){const n=e.getLexicalEditor();n&&(n.update(()=>{const a=f(),i=g(),s=a.getFirstChild();s?s.insertBefore(i):a.append(i),i.selectStart()}),e.focus())}function fe(e){const n=e.getLexicalEditor();n&&(n.update(()=>{const a=f(),i=g();a.append(i),i.selectStart()}),e.focus())}function M(e,n){return[{active:e.isBold,icon:T,key:"bold",label:"Bold",onClick:e.bold,tooltipProps:{hotkey:c(l.Bold).keys}},{active:e.isItalic,icon:W,key:"italic",label:"Italic",onClick:e.italic,tooltipProps:{hotkey:c(l.Italic).keys}},{active:e.isUnderline,icon:re,key:"underline",label:"Underline",onClick:e.underline,tooltipProps:{hotkey:c(l.Underline).keys}},{active:e.isStrikethrough,icon:ke,key:"strikethrough",label:"Strikethrough",onClick:e.strikethrough,tooltipProps:{hotkey:c(l.Strikethrough).keys}},{type:"divider"},{active:!!e.textColor,editor:n,key:"textColor",label:"Text Color",onChange:e.setTextColor,type:"colorPicker",value:e.textColor},{active:!!e.bgColor,defaultColor:"#ffffff",editor:n,icon:S,key:"bgColor",label:"Background Color",onChange:e.setBgColor,type:"colorPicker",value:e.bgColor}]}const $e=({editor:e,floating:n,outlineCollapseTitle:a,outlineExpandTitle:i,outlineToggle:s,style:h,className:y})=>{const o=_(e),d=C({collapseTitle:a,expandTitle:i}),b=u.useMemo(()=>[{disabled:!o.canUndo,icon:ue,key:"undo",label:"Undo",onClick:o.undo,tooltipProps:{hotkey:c(l.Undo).keys}},{disabled:!o.canRedo,icon:ne,key:"redo",label:"Redo",onClick:o.redo,tooltipProps:{hotkey:c(l.Redo).keys}},{icon:q,key:"insertLineTop",label:"Insert line at top",onClick:()=>Me(e)},{icon:I,key:"insertLineBottom",label:"Insert line at end",onClick:()=>fe(e)},{type:"divider"},...M(o,e),{type:"divider"},{icon:Z,key:"bulletList",label:"Bullet List",onClick:o.bulletList,tooltipProps:{hotkey:c(l.BulletList).keys}},{icon:J,key:"numberlist",label:"Number list",onClick:o.numberList,tooltipProps:{hotkey:c(l.NumberList).keys}},{icon:Q,key:"tasklist",label:"Task list",onClick:o.checkList},{type:"divider"},{active:o.isBlockquote,icon:oe,key:"blockquote",label:"Blockquote",onClick:o.blockquote},{icon:v,key:"link",label:"Link",onClick:o.insertLink,tooltipProps:{hotkey:c(l.Link).keys}},{icon:ce,key:"math",label:"TeX",onClick:o.insertMath},{type:"divider"},{active:o.isCode,icon:$,key:"code",label:"Code",onClick:o.code,tooltipProps:{hotkey:c(l.CodeInline).keys}},{active:o.isCodeblock,icon:se,key:"codeblock",label:"Codeblock",onClick:o.codeblock},o.isCodeblock&&{children:r.jsx(N,{onSelect:k=>{console.log(k),o.updateCodeblockLang(k)},value:o.codeblockLang}),disabled:!o.isCodeblock,key:"codeblockLang"},{type:"divider"},{icon:O,key:"image",label:"Image",onClick:()=>{m(k=>{for(const p of k)e.dispatchCommand(L,{file:p})},"image/*")}},{icon:P,key:"file",label:"File",onClick:()=>{m(k=>{for(const p of k)e.dispatchCommand(j,{file:p})},".pdf,.zip,.txt,.md,.csv,.html,.htm,audio/*,*/*")}},...s&&d?[{type:"divider"},d]:[]].filter(Boolean),[e,o,d,s]),x=u.useMemo(()=>[...M(o,e),...s&&d?[{type:"divider"},d]:[]],[e,o,d,s]);return n?r.jsx(z,{items:x}):r.jsx("div",{className:["mdocs-toolbar",y].filter(Boolean).join(" "),style:h,children:r.jsx(H,{items:b})})};export{ve as H,je as M,ce as S,ze as T,He as W,Ne as a,Le as b,$e as c,m as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as e}from"./react-vendor-BuABiQkA.js";import{b as G,B as ee,f as se,w as z}from"./index-BkKvQv2F.js";function ie({options:v,value:a,onChange:b}){const[d,f]=r.useState(!1),y=r.useRef(null),x=r.useRef(null),p=v.find(o=>o.value===a);r.useEffect(()=>{if(!d)return;const o=u=>{var N,k;!((N=y.current)!=null&&N.contains(u.target))&&!((k=x.current)!=null&&k.contains(u.target))&&f(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[d]),r.useEffect(()=>{if(!d)return;const o=u=>{var N;u.key==="Escape"&&(f(!1),(N=y.current)==null||N.focus())};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[d]);function j(o){b(o),f(!1)}return e.jsxs("div",{className:"mdocs-mini-select",style:{position:"relative"},children:[e.jsxs("button",{ref:y,type:"button",className:"mdocs-mini-select-trigger","aria-expanded":d,"aria-haspopup":"listbox",onClick:()=>f(o=>!o),children:[e.jsx("span",{children:p==null?void 0:p.label}),e.jsx("svg",{className:"mdocs-mini-select-chevron"+(d?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M1 1l4 4 4-4"})})]}),d&&e.jsx("div",{ref:x,className:"mdocs-mini-select-menu card",role:"listbox",children:v.map(o=>e.jsx("button",{type:"button",className:"mdocs-mini-select-option"+(o.value===a?" active":""),role:"option","aria-selected":o.value===a,onClick:()=>j(o.value),children:o.label},o.value))})]})}function te(v){return v.length<=6?v:`${v.slice(0,6)}…`}function re(v){const{visitors:a,loadState:b,searchFilter:d,onSearchChange:f,selectedIds:y,onToggle:x,selectedRows:p,lockedIds:j=new Set,myVisitorId:o,showPermissionSelect:u=!1,permissionOptions:N=[],onPermissionChange:k}=v,{t:i}=G(),w=r.useMemo(()=>{const t=d.trim().toLowerCase();let g=t?a.filter(m=>m.visitorName.toLowerCase().includes(t)||m.visitorId.toLowerCase().includes(t)):a;return o&&(g=[...g].sort((m,R)=>m.visitorId===o?-1:R.visitorId===o?1:0)),g},[a,d,o]);return e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"search",className:"mdocs-visitor-picker-search",placeholder:i("visitorPickerSearchPlaceholder"),value:d,onChange:t=>f(t.target.value),disabled:b!=="ok"}),b==="loading"&&e.jsx("div",{className:"mdocs-visitor-picker-loading",children:i("loading")}),b==="err"&&e.jsx("div",{className:"mdocs-visitor-picker-error",children:i("visitorPickerLoadError")}),b==="ok"&&e.jsxs("div",{className:"mdocs-visitor-picker-columns",children:[e.jsxs("div",{className:"mdocs-visitor-picker-col",children:[e.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:i("visitorPickerColumnAll")}),e.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:e.jsxs("table",{className:"mdocs-visitor-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:i("visitorPickerColIdShort")}),e.jsx("th",{scope:"col",children:i("visitorPickerColName")}),e.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col",children:i("visitorPickerColPick")})]})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"mdocs-visitor-picker-empty-cell",children:a.length===0?i("visitorPickerEmptyDirectory"):i("domainNoMatch")})}):w.map(t=>{const g=j.has(t.visitorId),m=y.has(t.visitorId);return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{className:"mdocs-visitor-picker-id-short",children:te(t.visitorId)})}),e.jsxs("td",{children:[t.visitorName,t.visitorId===o&&e.jsx("span",{className:"mdocs-visitor-picker-self-marker",children:i("visitorPickerSelfMarker")})]}),e.jsx("td",{className:"mdocs-visitor-picker-check-col",children:e.jsx("input",{type:"checkbox",checked:m,disabled:g,onChange:()=>x(t.visitorId),"aria-label":t.visitorName})})]},t.visitorId)})})]})})]}),e.jsxs("div",{className:"mdocs-visitor-picker-col",children:[e.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:i("visitorPickerColumnSelected")}),e.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:e.jsxs("table",{className:"mdocs-visitor-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:i("visitorPickerColIdFull")}),e.jsx("th",{scope:"col",children:i("visitorPickerColName")}),u&&e.jsx("th",{scope:"col",children:i("permissionLabel")}),e.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col"})]})}),e.jsx("tbody",{children:p.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:u?4:3,className:"mdocs-visitor-picker-empty-cell",children:i("visitorPickerNoSelection")})}):p.map(t=>{const g=j.has(t.visitorId);return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{className:"mdocs-visitor-picker-id-full",children:t.visitorId})}),e.jsx("td",{className:t.muted?"mdocs-visitor-picker-name-muted":void 0,children:t.name}),u&&e.jsx("td",{children:e.jsx(ie,{options:N,value:t.permission??"read",onChange:m=>k==null?void 0:k(t.visitorId,m)})}),e.jsx("td",{className:"mdocs-visitor-picker-check-col",children:g?e.jsx("span",{className:"mdocs-visitor-picker-locked",title:i("visitorPickerLockedHint"),children:"—"}):e.jsx("button",{type:"button",className:"mdocs-visitor-picker-remove",onClick:()=>x(t.visitorId),"aria-label":i("visitorPickerRemove"),children:"×"})})]},t.visitorId)})})]})})]})]})]})}function ne(v){var U;const{open:a,title:b,initialSelectedIds:d,lockedIds:f=[],seedMembers:y,excludeTemplateId:x,templates:p,onClose:j,onConfirm:o,showPermissionSelect:u=!1,permissionOptions:N=[],initialPermissions:k}=v,{t:i}=G(),w=r.useRef(i);w.current=i;const t=r.useMemo(()=>new Set(f),[f]),g=ee(),[m,R]=r.useState([]),[E,T]=r.useState("idle"),[P,V]=r.useState(()=>new Set),[O,L]=r.useState(()=>new Map),[J,F]=r.useState(""),[C,A]=r.useState(""),[M,B]=r.useState(!1),$=r.useRef(null),[K,W]=r.useState(!1),[q,I]=r.useState(null),D=r.useMemo(()=>p.filter(s=>x==null||s.id!==x),[p,x]),H=r.useMemo(()=>new Map((y??[]).map(s=>[s.visitorId,s])),[y]);r.useEffect(()=>{a&&(V(new Set(d)),L(k?new Map(k):new Map),F(""),A(""),I(null))},[a,d,k]),r.useEffect(()=>{if(!a)return;let s=!1;return T("loading"),se().then(n=>{s||(R(n),T("ok"))}).catch(n=>{s||(T("err"),I(z(w.current,n)))}),()=>{s=!0}},[a]),r.useEffect(()=>{if(!M)return;const s=n=>{var c;(c=$.current)!=null&&c.contains(n.target)||B(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[M]);const Q=r.useMemo(()=>{const s=new Map(m.map(c=>[c.visitorId,c])),n=[];for(const c of P){const l=O.get(c),h=s.get(c);if(h){n.push({visitorId:c,name:h.visitorName,muted:!1,permission:l});continue}const S=H.get(c);if(S){S.missing?n.push({visitorId:c,name:i("visitorPickerMemberMissing"),muted:!0,permission:l}):S.disabled?n.push({visitorId:c,name:`${S.visitorName} · ${i("visitorPickerDisabledTag")}`,muted:!0,permission:l}):n.push({visitorId:c,name:S.visitorName,muted:!1,permission:l});continue}n.push({visitorId:c,name:i("visitorPickerUnknownVisitor"),muted:!0,permission:l})}return n.sort((c,l)=>c.name.localeCompare(l.name,void 0,{sensitivity:"base"})),n},[m,P,H,O,i]),X=r.useCallback(s=>{t.has(s)||V(n=>{const c=new Set(n);return c.has(s)?(c.delete(s),L(l=>{const h=new Map(l);return h.delete(s),h})):(c.add(s),L(l=>{const h=new Map(l);return h.set(s,"read"),h})),c})},[t]),Y=r.useCallback((s,n)=>{L(c=>{const l=new Map(c);return l.set(s,n),l})},[]),Z=r.useCallback(()=>{const s=Number(C);if(!Number.isInteger(s)||s<1)return;const n=p.find(l=>l.id===s);if(!n)return;const c=new Set(m.map(l=>l.visitorId));V(l=>{const h=new Set(l);for(const S of n.visitorIds)c.has(S)&&h.add(S);return h})},[C,p,m]);async function _(){I(null),W(!0);try{if(u){const s=[...P].sort().map(n=>({visitorId:n,permission:O.get(n)??"read"}));await o(s)}else{const s=[...P].sort();await o(s)}j()}catch(s){I(z(i,s))}finally{W(!1)}}return a?e.jsx("div",{className:"mdocs-visitor-picker-overlay",role:"presentation",onMouseDown:s=>s.target===s.currentTarget&&j(),children:e.jsxs("div",{className:"mdocs-visitor-picker-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"mdocs-visitor-picker-title",children:[e.jsxs("header",{className:"mdocs-visitor-picker-header",children:[e.jsx("h2",{id:"mdocs-visitor-picker-title",className:"mdocs-visitor-picker-title",children:b}),e.jsx("button",{type:"button",className:"mdocs-visitor-picker-close",onClick:j,"aria-label":i("close"),children:"×"})]}),D.length>0&&e.jsx("div",{className:"mdocs-visitor-picker-toolbar",children:e.jsxs("div",{className:"mdocs-visitor-picker-template-bar",children:[e.jsxs("div",{ref:$,className:"mdocs-template-picker",children:[e.jsxs("button",{type:"button",className:"mdocs-template-picker-trigger",onClick:()=>B(s=>!s),disabled:E!=="ok","aria-haspopup":"listbox","aria-expanded":M,children:[e.jsx("span",{className:"mdocs-template-picker-text",children:C?(U=D.find(s=>String(s.id)===C))==null?void 0:U.displayName:i("visitorPickerPickTemplate")}),e.jsx("svg",{className:"mdocs-template-picker-chevron"+(M?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M1 1l4 4 4-4"})})]}),M&&e.jsx("div",{className:"mdocs-template-picker-menu card",role:"listbox",children:D.map(s=>e.jsx("button",{type:"button",className:"mdocs-template-picker-option"+(String(s.id)===C?" active":""),role:"option","aria-selected":String(s.id)===C,onClick:()=>{A(String(s.id)),B(!1)},children:s.displayName},s.id))})]}),e.jsx("button",{type:"button",className:"secondary",onClick:()=>{if(E!=="ok"){I(i("loading"));return}if(!C){I(i("visitorPickerPickTemplate"));return}Z()},children:i("visitorPickerApplyTemplate")})]})}),q&&e.jsx("div",{className:"mdocs-visitor-picker-error",role:"alert",children:q}),e.jsx("div",{style:{padding:"8px 18px 12px"},children:e.jsx(re,{visitors:m,loadState:E,searchFilter:J,onSearchChange:F,selectedIds:P,onToggle:X,selectedRows:Q,lockedIds:t,myVisitorId:g,showPermissionSelect:u,permissionOptions:N,onPermissionChange:Y})}),e.jsxs("footer",{className:"mdocs-visitor-picker-footer",children:[e.jsx("button",{type:"button",className:"secondary",onClick:j,children:i("cancel")}),e.jsx("button",{type:"button",className:"primary",onClick:()=>{if(E!=="ok"){I(i("loading"));return}_()},children:i(K?"saving":"visitorPickerConfirm")})]})]})}):null}export{ie as M,ne as V,re as a};
|
|
1
|
+
import{r,j as e}from"./react-vendor-BuABiQkA.js";import{b as G,B as ee,f as se,w as z}from"./index-DGnp1IRN.js";function ie({options:v,value:a,onChange:b}){const[d,f]=r.useState(!1),y=r.useRef(null),x=r.useRef(null),p=v.find(o=>o.value===a);r.useEffect(()=>{if(!d)return;const o=u=>{var N,k;!((N=y.current)!=null&&N.contains(u.target))&&!((k=x.current)!=null&&k.contains(u.target))&&f(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[d]),r.useEffect(()=>{if(!d)return;const o=u=>{var N;u.key==="Escape"&&(f(!1),(N=y.current)==null||N.focus())};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[d]);function j(o){b(o),f(!1)}return e.jsxs("div",{className:"mdocs-mini-select",style:{position:"relative"},children:[e.jsxs("button",{ref:y,type:"button",className:"mdocs-mini-select-trigger","aria-expanded":d,"aria-haspopup":"listbox",onClick:()=>f(o=>!o),children:[e.jsx("span",{children:p==null?void 0:p.label}),e.jsx("svg",{className:"mdocs-mini-select-chevron"+(d?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M1 1l4 4 4-4"})})]}),d&&e.jsx("div",{ref:x,className:"mdocs-mini-select-menu card",role:"listbox",children:v.map(o=>e.jsx("button",{type:"button",className:"mdocs-mini-select-option"+(o.value===a?" active":""),role:"option","aria-selected":o.value===a,onClick:()=>j(o.value),children:o.label},o.value))})]})}function te(v){return v.length<=6?v:`${v.slice(0,6)}…`}function re(v){const{visitors:a,loadState:b,searchFilter:d,onSearchChange:f,selectedIds:y,onToggle:x,selectedRows:p,lockedIds:j=new Set,myVisitorId:o,showPermissionSelect:u=!1,permissionOptions:N=[],onPermissionChange:k}=v,{t:i}=G(),w=r.useMemo(()=>{const t=d.trim().toLowerCase();let g=t?a.filter(m=>m.visitorName.toLowerCase().includes(t)||m.visitorId.toLowerCase().includes(t)):a;return o&&(g=[...g].sort((m,R)=>m.visitorId===o?-1:R.visitorId===o?1:0)),g},[a,d,o]);return e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"search",className:"mdocs-visitor-picker-search",placeholder:i("visitorPickerSearchPlaceholder"),value:d,onChange:t=>f(t.target.value),disabled:b!=="ok"}),b==="loading"&&e.jsx("div",{className:"mdocs-visitor-picker-loading",children:i("loading")}),b==="err"&&e.jsx("div",{className:"mdocs-visitor-picker-error",children:i("visitorPickerLoadError")}),b==="ok"&&e.jsxs("div",{className:"mdocs-visitor-picker-columns",children:[e.jsxs("div",{className:"mdocs-visitor-picker-col",children:[e.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:i("visitorPickerColumnAll")}),e.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:e.jsxs("table",{className:"mdocs-visitor-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:i("visitorPickerColIdShort")}),e.jsx("th",{scope:"col",children:i("visitorPickerColName")}),e.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col",children:i("visitorPickerColPick")})]})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"mdocs-visitor-picker-empty-cell",children:a.length===0?i("visitorPickerEmptyDirectory"):i("domainNoMatch")})}):w.map(t=>{const g=j.has(t.visitorId),m=y.has(t.visitorId);return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{className:"mdocs-visitor-picker-id-short",children:te(t.visitorId)})}),e.jsxs("td",{children:[t.visitorName,t.visitorId===o&&e.jsx("span",{className:"mdocs-visitor-picker-self-marker",children:i("visitorPickerSelfMarker")})]}),e.jsx("td",{className:"mdocs-visitor-picker-check-col",children:e.jsx("input",{type:"checkbox",checked:m,disabled:g,onChange:()=>x(t.visitorId),"aria-label":t.visitorName})})]},t.visitorId)})})]})})]}),e.jsxs("div",{className:"mdocs-visitor-picker-col",children:[e.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:i("visitorPickerColumnSelected")}),e.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:e.jsxs("table",{className:"mdocs-visitor-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:i("visitorPickerColIdFull")}),e.jsx("th",{scope:"col",children:i("visitorPickerColName")}),u&&e.jsx("th",{scope:"col",children:i("permissionLabel")}),e.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col"})]})}),e.jsx("tbody",{children:p.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:u?4:3,className:"mdocs-visitor-picker-empty-cell",children:i("visitorPickerNoSelection")})}):p.map(t=>{const g=j.has(t.visitorId);return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{className:"mdocs-visitor-picker-id-full",children:t.visitorId})}),e.jsx("td",{className:t.muted?"mdocs-visitor-picker-name-muted":void 0,children:t.name}),u&&e.jsx("td",{children:e.jsx(ie,{options:N,value:t.permission??"read",onChange:m=>k==null?void 0:k(t.visitorId,m)})}),e.jsx("td",{className:"mdocs-visitor-picker-check-col",children:g?e.jsx("span",{className:"mdocs-visitor-picker-locked",title:i("visitorPickerLockedHint"),children:"—"}):e.jsx("button",{type:"button",className:"mdocs-visitor-picker-remove",onClick:()=>x(t.visitorId),"aria-label":i("visitorPickerRemove"),children:"×"})})]},t.visitorId)})})]})})]})]})]})}function ne(v){var U;const{open:a,title:b,initialSelectedIds:d,lockedIds:f=[],seedMembers:y,excludeTemplateId:x,templates:p,onClose:j,onConfirm:o,showPermissionSelect:u=!1,permissionOptions:N=[],initialPermissions:k}=v,{t:i}=G(),w=r.useRef(i);w.current=i;const t=r.useMemo(()=>new Set(f),[f]),g=ee(),[m,R]=r.useState([]),[E,T]=r.useState("idle"),[P,V]=r.useState(()=>new Set),[O,L]=r.useState(()=>new Map),[J,F]=r.useState(""),[C,A]=r.useState(""),[M,B]=r.useState(!1),$=r.useRef(null),[K,W]=r.useState(!1),[q,I]=r.useState(null),D=r.useMemo(()=>p.filter(s=>x==null||s.id!==x),[p,x]),H=r.useMemo(()=>new Map((y??[]).map(s=>[s.visitorId,s])),[y]);r.useEffect(()=>{a&&(V(new Set(d)),L(k?new Map(k):new Map),F(""),A(""),I(null))},[a,d,k]),r.useEffect(()=>{if(!a)return;let s=!1;return T("loading"),se().then(n=>{s||(R(n),T("ok"))}).catch(n=>{s||(T("err"),I(z(w.current,n)))}),()=>{s=!0}},[a]),r.useEffect(()=>{if(!M)return;const s=n=>{var c;(c=$.current)!=null&&c.contains(n.target)||B(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[M]);const Q=r.useMemo(()=>{const s=new Map(m.map(c=>[c.visitorId,c])),n=[];for(const c of P){const l=O.get(c),h=s.get(c);if(h){n.push({visitorId:c,name:h.visitorName,muted:!1,permission:l});continue}const S=H.get(c);if(S){S.missing?n.push({visitorId:c,name:i("visitorPickerMemberMissing"),muted:!0,permission:l}):S.disabled?n.push({visitorId:c,name:`${S.visitorName} · ${i("visitorPickerDisabledTag")}`,muted:!0,permission:l}):n.push({visitorId:c,name:S.visitorName,muted:!1,permission:l});continue}n.push({visitorId:c,name:i("visitorPickerUnknownVisitor"),muted:!0,permission:l})}return n.sort((c,l)=>c.name.localeCompare(l.name,void 0,{sensitivity:"base"})),n},[m,P,H,O,i]),X=r.useCallback(s=>{t.has(s)||V(n=>{const c=new Set(n);return c.has(s)?(c.delete(s),L(l=>{const h=new Map(l);return h.delete(s),h})):(c.add(s),L(l=>{const h=new Map(l);return h.set(s,"read"),h})),c})},[t]),Y=r.useCallback((s,n)=>{L(c=>{const l=new Map(c);return l.set(s,n),l})},[]),Z=r.useCallback(()=>{const s=Number(C);if(!Number.isInteger(s)||s<1)return;const n=p.find(l=>l.id===s);if(!n)return;const c=new Set(m.map(l=>l.visitorId));V(l=>{const h=new Set(l);for(const S of n.visitorIds)c.has(S)&&h.add(S);return h})},[C,p,m]);async function _(){I(null),W(!0);try{if(u){const s=[...P].sort().map(n=>({visitorId:n,permission:O.get(n)??"read"}));await o(s)}else{const s=[...P].sort();await o(s)}j()}catch(s){I(z(i,s))}finally{W(!1)}}return a?e.jsx("div",{className:"mdocs-visitor-picker-overlay",role:"presentation",onMouseDown:s=>s.target===s.currentTarget&&j(),children:e.jsxs("div",{className:"mdocs-visitor-picker-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"mdocs-visitor-picker-title",children:[e.jsxs("header",{className:"mdocs-visitor-picker-header",children:[e.jsx("h2",{id:"mdocs-visitor-picker-title",className:"mdocs-visitor-picker-title",children:b}),e.jsx("button",{type:"button",className:"mdocs-visitor-picker-close",onClick:j,"aria-label":i("close"),children:"×"})]}),D.length>0&&e.jsx("div",{className:"mdocs-visitor-picker-toolbar",children:e.jsxs("div",{className:"mdocs-visitor-picker-template-bar",children:[e.jsxs("div",{ref:$,className:"mdocs-template-picker",children:[e.jsxs("button",{type:"button",className:"mdocs-template-picker-trigger",onClick:()=>B(s=>!s),disabled:E!=="ok","aria-haspopup":"listbox","aria-expanded":M,children:[e.jsx("span",{className:"mdocs-template-picker-text",children:C?(U=D.find(s=>String(s.id)===C))==null?void 0:U.displayName:i("visitorPickerPickTemplate")}),e.jsx("svg",{className:"mdocs-template-picker-chevron"+(M?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M1 1l4 4 4-4"})})]}),M&&e.jsx("div",{className:"mdocs-template-picker-menu card",role:"listbox",children:D.map(s=>e.jsx("button",{type:"button",className:"mdocs-template-picker-option"+(String(s.id)===C?" active":""),role:"option","aria-selected":String(s.id)===C,onClick:()=>{A(String(s.id)),B(!1)},children:s.displayName},s.id))})]}),e.jsx("button",{type:"button",className:"secondary",onClick:()=>{if(E!=="ok"){I(i("loading"));return}if(!C){I(i("visitorPickerPickTemplate"));return}Z()},children:i("visitorPickerApplyTemplate")})]})}),q&&e.jsx("div",{className:"mdocs-visitor-picker-error",role:"alert",children:q}),e.jsx("div",{style:{padding:"8px 18px 12px"},children:e.jsx(re,{visitors:m,loadState:E,searchFilter:J,onSearchChange:F,selectedIds:P,onToggle:X,selectedRows:Q,lockedIds:t,myVisitorId:g,showPermissionSelect:u,permissionOptions:N,onPermissionChange:Y})}),e.jsxs("footer",{className:"mdocs-visitor-picker-footer",children:[e.jsx("button",{type:"button",className:"secondary",onClick:j,children:i("cancel")}),e.jsx("button",{type:"button",className:"primary",onClick:()=>{if(E!=="ok"){I(i("loading"));return}_()},children:i(K?"saving":"visitorPickerConfirm")})]})]})}):null}export{ie as M,ne as V,re as a};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as e}from"./index-DGnp1IRN.js";/**
|
|
2
|
+
* @license lucide-react v0.562.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const o=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],m=e("code-xml",o);export{m as C};
|