@fgbg/mdocs 1.4.0 → 2.0.0
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/README.md +1 -1
- package/agent-skills/changelog/SKILL.md +25 -0
- package/dist/server/agent/Agent/run-manager.js +1 -0
- package/dist/server/agent/Agent/run-manager.js.map +1 -1
- package/dist/server/agent/Agent/run-pi-agent.js +22 -7
- package/dist/server/agent/Agent/run-pi-agent.js.map +1 -1
- package/dist/server/agent/Agent/run.js +29 -4
- package/dist/server/agent/Agent/run.js.map +1 -1
- package/dist/server/agent/Agent/session-manager.js +45 -5
- package/dist/server/agent/Agent/session-manager.js.map +1 -1
- package/dist/server/agent/Agent/system-prompt.js +5 -3
- package/dist/server/agent/Agent/system-prompt.js.map +1 -1
- package/dist/server/agent/Agent/tools-documents.js +13 -4
- package/dist/server/agent/Agent/tools-documents.js.map +1 -1
- package/dist/server/agent/Agent/tools-registry.test.js +1 -1
- package/dist/server/agent/Agent/tools-registry.test.js.map +1 -1
- package/dist/server/agent/Agent/tools-template.js +2 -1
- package/dist/server/agent/Agent/tools-template.js.map +1 -1
- package/dist/server/agent/Config/config.test.js +21 -0
- package/dist/server/agent/Config/config.test.js.map +1 -1
- package/dist/server/agent/attachments/capabilities.js +52 -0
- package/dist/server/agent/attachments/capabilities.js.map +1 -0
- package/dist/server/agent/attachments/capabilities.test.js +33 -0
- package/dist/server/agent/attachments/capabilities.test.js.map +1 -0
- package/dist/server/agent/attachments/index.js +6 -0
- package/dist/server/agent/attachments/index.js.map +1 -0
- package/dist/server/agent/attachments/inject.js +67 -0
- package/dist/server/agent/attachments/inject.js.map +1 -0
- package/dist/server/agent/attachments/inject.test.js +41 -0
- package/dist/server/agent/attachments/inject.test.js.map +1 -0
- package/dist/server/agent/attachments/object-fs.js +44 -0
- package/dist/server/agent/attachments/object-fs.js.map +1 -0
- package/dist/server/agent/attachments/parse/image.js +22 -0
- package/dist/server/agent/attachments/parse/image.js.map +1 -0
- package/dist/server/agent/attachments/parse/pdf.js +19 -0
- package/dist/server/agent/attachments/parse/pdf.js.map +1 -0
- package/dist/server/agent/attachments/parse/plain-text.js +18 -0
- package/dist/server/agent/attachments/parse/plain-text.js.map +1 -0
- package/dist/server/agent/attachments/prepare-turn.js +32 -0
- package/dist/server/agent/attachments/prepare-turn.js.map +1 -0
- package/dist/server/agent/attachments/store.js +120 -0
- package/dist/server/agent/attachments/store.js.map +1 -0
- package/dist/server/agent/attachments/tools-read-attachment.js +95 -0
- package/dist/server/agent/attachments/tools-read-attachment.js.map +1 -0
- package/dist/server/agent/attachments/types.js +6 -0
- package/dist/server/agent/attachments/types.js.map +1 -0
- package/dist/server/agent/attachments/upload-filename.test.js +39 -0
- package/dist/server/agent/attachments/upload-filename.test.js.map +1 -0
- package/dist/server/agent/attachments/upload.js +11 -0
- package/dist/server/agent/attachments/upload.js.map +1 -0
- package/dist/server/app.js +9 -1
- package/dist/server/app.js.map +1 -1
- package/dist/server/config/index.js +1 -0
- package/dist/server/config/index.js.map +1 -1
- package/dist/server/db/repositories/agent-attachment.repo.js +51 -0
- package/dist/server/db/repositories/agent-attachment.repo.js.map +1 -0
- package/dist/server/db/repositories/document.repo.js +9 -9
- package/dist/server/db/repositories/document.repo.js.map +1 -1
- package/dist/server/db/schema.js +64 -3
- package/dist/server/db/schema.js.map +1 -1
- package/dist/server/documents/document.service.js +2 -3
- 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/tree-and-folders.test.js +1 -0
- package/dist/server/documents/tree-and-folders.test.js.map +1 -1
- package/dist/server/domains/change-domain-permission.test.js +12 -0
- package/dist/server/domains/change-domain-permission.test.js.map +1 -1
- package/dist/server/routes/agent.routes.js +85 -2
- package/dist/server/routes/agent.routes.js.map +1 -1
- package/dist/server/routes/visitors.routes.js +2 -0
- package/dist/server/routes/visitors.routes.js.map +1 -1
- package/dist/server/search/document-index-manager.js +13 -4
- package/dist/server/search/document-index-manager.js.map +1 -1
- package/dist/server/search/document-index-manager.test.js +14 -3
- package/dist/server/search/document-index-manager.test.js.map +1 -1
- package/dist/server/search/embedding-store.js +9 -0
- package/dist/server/search/embedding-store.js.map +1 -1
- package/dist/server/search/embedding-store.test.js +27 -3
- package/dist/server/search/embedding-store.test.js.map +1 -1
- package/dist/shared/file-type-policy.js +1 -1
- package/dist/shared/file-type-policy.js.map +1 -1
- package/dist/shared/file-type-policy.test.js +2 -1
- package/dist/shared/file-type-policy.test.js.map +1 -1
- package/dist/web/assets/AgentChatPanel-Bhv57WUW.js +47 -0
- package/dist/web/assets/{AiWriteWorkbench-DzJAmRHY.js → AiWriteWorkbench-DOse9-oQ.js} +4 -4
- package/dist/web/assets/{DiagramEditor-NtNY3sZL-KWdKFFEL.js → DiagramEditor-NtNY3sZL-D7sapmVz.js} +1 -1
- package/dist/web/assets/DocChrome-Dj5rSAvl.js +16 -0
- package/dist/web/assets/{DocumentEditor-CrU6HKmU.js → DocumentEditor-BTxsH3UT.js} +1 -1
- package/dist/web/assets/{HtmlEditor-BBcreXJD.js → HtmlEditor-OEfTnjjz.js} +1 -1
- package/dist/web/assets/MergeView-CGz2CWUZ.js +10 -0
- package/dist/web/assets/{PlaygroundPage-Bo9rM8MY.js → PlaygroundPage-BsekHU2o.js} +1 -1
- package/dist/web/assets/{SettingsPage-D09P0j48.js → SettingsPage-cVFmyADe.js} +5 -5
- package/dist/web/assets/SheetEditor-1LMR2jA1.js +26 -0
- package/dist/web/assets/SheetEditor-DJOs2u-u.css +1 -0
- package/dist/web/assets/{Toolbar-C1HmC2Qc.js → Toolbar-CPIpQgP1.js} +1 -1
- package/dist/web/assets/VisitorPickerModal-aRuuDomz.js +6 -0
- package/dist/web/assets/{check-BAYRiedE.js → check-NyVbPIj8.js} +1 -1
- package/dist/web/assets/{copy-J9XXv57X.js → copy-C_H9wgwB.js} +1 -1
- package/dist/web/assets/file-type-policy-5jFXMeIz.js +1 -0
- package/dist/web/assets/index-CervldVc.css +1 -0
- package/dist/web/assets/index-Kp5r4mc7.js +299 -0
- package/dist/web/assets/{italic-BfR6fH81.js → italic-BqrahN0G.js} +1 -1
- package/dist/web/assets/{meta2dEngine-BD2XbzaV-MY1Hyyeh.js → meta2dEngine-BD2XbzaV-CUKxedXW.js} +1 -1
- package/dist/web/assets/{plus-DvWl4lHk.js → plus-D8tCpRfA.js} +1 -1
- package/dist/web/assets/{react-C7aGt3wN.js → react-DsdrF7vh.js} +3 -3
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/AgentChatPanel-_IV-LAS4.js +0 -42
- package/dist/web/assets/DocChrome-CtT7xOl6.js +0 -16
- package/dist/web/assets/MergeView-LV_hny8a.js +0 -10
- package/dist/web/assets/SheetEditor-BPTMQ2s5.css +0 -1
- package/dist/web/assets/SheetEditor-Dyk-jpRL.js +0 -26
- package/dist/web/assets/VisitorPickerModal-Cx03Papl.js +0 -6
- package/dist/web/assets/file-type-policy-aRrzC4LZ.js +0 -1
- package/dist/web/assets/index-Btfv_3-Q.js +0 -299
- package/dist/web/assets/index-C1Mc0Svw.css +0 -1
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocumentEditor-CrU6HKmU.js","assets/react-vendor-BVS1XoFi.js","assets/ui-CEFkTVnG.js","assets/motion-BAXVQJfN.js","assets/react-C7aGt3wN.js","assets/editor-DBWWidi3.js","assets/diagram-BF8g9yg4.js","assets/plus-DvWl4lHk.js","assets/copy-J9XXv57X.js","assets/check-BAYRiedE.js","assets/Toolbar-C1HmC2Qc.js","assets/italic-BfR6fH81.js","assets/DocChrome-CtT7xOl6.js","assets/file-type-policy-aRrzC4LZ.js","assets/VisitorPickerModal-Cx03Papl.js","assets/docPlainCharCount-DO5lb3Wt.js","assets/HtmlEditor-BBcreXJD.js","assets/HtmlEditor-iolk903a.css","assets/SheetEditor-Dyk-jpRL.js","assets/SheetEditor-BPTMQ2s5.css","assets/SettingsPage-D09P0j48.js","assets/AgentChatPanel-_IV-LAS4.js","assets/AiWriteWorkbench-DzJAmRHY.js","assets/MergeView-LV_hny8a.js","assets/PlaygroundPage-Bo9rM8MY.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var is=Object.defineProperty;var as=(e,n,o)=>n in e?is(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o;var Jt=(e,n,o)=>as(e,typeof n!="symbol"?n+"":n,o);import{r as x,j as c,R as zi,B as ss,_ as Pt,a9 as ls,aa as cs,ab as ds,ac as mo,c as us,ad as fs}from"./react-vendor-BVS1XoFi.js";import{a5 as ms,a6 as hs}from"./ui-CEFkTVnG.js";import{d as ps,s as Oo,p as gs,t as ys,a as vs,q as bs,o as xs,b as ws,c as _s,e as ht,f as Is,g as ks,y as Ss,m as Ar,h as Mr}from"./diagram-BF8g9yg4.js";import{f as Cs}from"./motion-BAXVQJfN.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function o(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=o(i);fetch(i.href,a)}})();/**
|
|
3
|
-
* @license lucide-react v0.562.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const Ds=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ns=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,o,r)=>r?r.toUpperCase():o.toLowerCase()),jr=e=>{const n=Ns(e);return n.charAt(0).toUpperCase()+n.slice(1)},$i=(...e)=>e.filter((n,o,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===o).join(" ").trim(),Ps=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};/**
|
|
8
|
-
* @license lucide-react v0.562.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/var Ts={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
13
|
-
* @license lucide-react v0.562.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const As=x.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:s,...l},u)=>x.createElement("svg",{ref:u,...Ts,width:n,height:n,stroke:e,strokeWidth:r?Number(o)*24/Number(n):o,className:$i("lucide",i),...!a&&!Ps(l)&&{"aria-hidden":"true"},...l},[...s.map(([d,h])=>x.createElement(d,h)),...Array.isArray(a)?a:[a]]));/**
|
|
18
|
-
* @license lucide-react v0.562.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const ve=(e,n)=>{const o=x.forwardRef(({className:r,...i},a)=>x.createElement(As,{ref:a,iconNode:n,className:$i(`lucide-${Ds(jr(e))}`,`lucide-${e}`,r),...i}));return o.displayName=jr(e),o};/**
|
|
23
|
-
* @license lucide-react v0.562.0 - ISC
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const Ms=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],js=ve("book-open",Ms);/**
|
|
28
|
-
* @license lucide-react v0.562.0 - ISC
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the ISC license.
|
|
31
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const Es=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Fo=ve("chevron-down",Es);/**
|
|
33
|
-
* @license lucide-react v0.562.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const Rs=[["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"}]],Os=ve("code-xml",Rs);/**
|
|
38
|
-
* @license lucide-react v0.562.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const Fs=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Ls=ve("code",Fs);/**
|
|
43
|
-
* @license lucide-react v0.562.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/const zs=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],$s=ve("ellipsis-vertical",zs);/**
|
|
48
|
-
* @license lucide-react v0.562.0 - ISC
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the ISC license.
|
|
51
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/const Us=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Bs=ve("eye",Us);/**
|
|
53
|
-
* @license lucide-react v0.562.0 - ISC
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the ISC license.
|
|
56
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/const Hs=[["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:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Er=ve("file-text",Hs);/**
|
|
58
|
-
* @license lucide-react v0.562.0 - ISC
|
|
59
|
-
*
|
|
60
|
-
* This source code is licensed under the ISC license.
|
|
61
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/const Vs=[["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"}]],Gs=ve("file",Vs);/**
|
|
63
|
-
* @license lucide-react v0.562.0 - ISC
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the ISC license.
|
|
66
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/const Ws=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],qs=ve("folder-plus",Ws);/**
|
|
68
|
-
* @license lucide-react v0.562.0 - ISC
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the ISC license.
|
|
71
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/const Ks=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ys=ve("folder",Ks);/**
|
|
73
|
-
* @license lucide-react v0.562.0 - ISC
|
|
74
|
-
*
|
|
75
|
-
* This source code is licensed under the ISC license.
|
|
76
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/const Js=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],On=ve("loader-circle",Js);/**
|
|
78
|
-
* @license lucide-react v0.562.0 - ISC
|
|
79
|
-
*
|
|
80
|
-
* This source code is licensed under the ISC license.
|
|
81
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const Xs=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Zs=ve("log-out",Xs);/**
|
|
83
|
-
* @license lucide-react v0.562.0 - ISC
|
|
84
|
-
*
|
|
85
|
-
* This source code is licensed under the ISC license.
|
|
86
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/const Qs=[["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"}]],el=ve("message-square",Qs);/**
|
|
88
|
-
* @license lucide-react v0.562.0 - ISC
|
|
89
|
-
*
|
|
90
|
-
* This source code is licensed under the ISC license.
|
|
91
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const tl=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],er=ve("network",tl);/**
|
|
93
|
-
* @license lucide-react v0.562.0 - ISC
|
|
94
|
-
*
|
|
95
|
-
* This source code is licensed under the ISC license.
|
|
96
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const nl=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Rr=ve("panel-left-close",nl);/**
|
|
98
|
-
* @license lucide-react v0.562.0 - ISC
|
|
99
|
-
*
|
|
100
|
-
* This source code is licensed under the ISC license.
|
|
101
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const ol=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Or=ve("panel-left-open",ol);/**
|
|
103
|
-
* @license lucide-react v0.562.0 - ISC
|
|
104
|
-
*
|
|
105
|
-
* This source code is licensed under the ISC license.
|
|
106
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/const rl=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Fr=ve("refresh-cw",rl);/**
|
|
108
|
-
* @license lucide-react v0.562.0 - ISC
|
|
109
|
-
*
|
|
110
|
-
* This source code is licensed under the ISC license.
|
|
111
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/const il=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ui=ve("search",il);/**
|
|
113
|
-
* @license lucide-react v0.562.0 - ISC
|
|
114
|
-
*
|
|
115
|
-
* This source code is licensed under the ISC license.
|
|
116
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/const al=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ho=ve("settings-2",al);/**
|
|
118
|
-
* @license lucide-react v0.562.0 - ISC
|
|
119
|
-
*
|
|
120
|
-
* This source code is licensed under the ISC license.
|
|
121
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/const sl=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ll=ve("star",sl);/**
|
|
123
|
-
* @license lucide-react v0.562.0 - ISC
|
|
124
|
-
*
|
|
125
|
-
* This source code is licensed under the ISC license.
|
|
126
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/const cl=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],dl=ve("table",cl);/**
|
|
128
|
-
* @license lucide-react v0.562.0 - ISC
|
|
129
|
-
*
|
|
130
|
-
* This source code is licensed under the ISC license.
|
|
131
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
-
*/const ul=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zt=ve("x",ul);/**
|
|
133
|
-
* @license lucide-react v0.562.0 - ISC
|
|
134
|
-
*
|
|
135
|
-
* This source code is licensed under the ISC license.
|
|
136
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/const fl=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Bi=ve("zap",fl),ml={loading:"loading...",saved:"Saved",saving:"Saving...",unsaved:"Editing...",publish:"Publish",publishing:"Publishing...",published:"Published",publishHotkeyHint:"Publish ({{hotkey}})",preview:"Preview",cancel:"Cancel",create:"Create",creating:"Creating...",close:"Close",delete:"Delete",save:"Save",gotIt:"got it",error:"error",brand:"mdocs",welcomeTitle:"Welcome to mdocs",welcomeDesc:"Enter a display name to create a visitor identity. A secure token will be stored in this browser to identify you on future visits.",visitorNamePlaceholder:"Your name",createVisitor:"Create visitor",nameRequired:"please enter a name",visitorIdNotice:"your visitor id is {{id}}, save it for recovery",newDocument:"Start writing",startWriting:"Start writing",newArticle:"New article",sheetDocument:"Sheet",sheetAddRow:"Add row",sheetAddColumn:"Add column",sheetDeleteRow:"Delete row",sheetDeleteColumn:"Delete column",sheetAddSheet:"Add sheet",sheetDeleteSheet:"Delete sheet",sheetBold:"Bold",sheetItalic:"Italic",sheetFontSize:"Size",sheetTextColor:"Text color",sheetBgColor:"Fill",sheetMerge:"Merge",sheetUnmerge:"Unmerge",newDirectory:"New folder",newFolder:"New folder",noDocumentsYet:"no documents yet",collapseFolder:"Collapse folder",expandFolder:"Expand folder",noDocsInDomain:"No documents in this workspace yet. Switch workspace below or create a document.",createDocToStart:"Click Start writing, or open a document from the sidebar.",domainLabel:"Workspace",defaultDomain:"Default",displayNamePlaceholder:"Display name",currentDomainAria:"Current workspace",insertDiagram:"Insert diagram",outlineHide:"Hide outline",outlineShow:"Show outline",readOnlyNotice:`> You don't have permission to edit
|
|
138
|
-
|
|
139
|
-
`,newDocumentTitle:"New document",newFolderTitle:"New folder",fileNameLabel:"File name",folderNameLabel:"Folder name",fileNameHint:"Names are shown as you type; stored paths are normalised (e.g. spaces → underscores). Use a .md file name.",folderNameHint:"Names are shown as you type; stored paths are normalised (e.g. folder 1 → folder_1).",untitledPlaceholder:"untitled.md",folderExamplePlaceholder:"e.g. research",pathExists:"this path already exists; pick another name",folderExists:"a folder with this name already exists",deleteConfirm:"delete {{name}}?",newDocIn:"New document in {{name}}",newDocAtRoot:"New document at root",newDocBeside:"New document beside this",newFolderIn:"New folder in {{name}}",newFolderAtRoot:"New folder at root",newFolderBeside:"New folder beside this",deleteItem:"Delete {{name}}",deleteFolder:"Delete {{name}}",copyDocumentId:"Copy document ID",copyDocumentUrl:"Copy URL",editDiagram:"Edit diagram",newDiagram:"New diagram",saveAndInsert:"Save and insert",deleteDiagram:"Delete diagram",openFailed:"open failed: {{message}}",components:"Components",dragToCanvas:"drag to canvas",shapeRectangle:"Rectangle",shapeRounded:"Rounded",shapeCircle:"Circle",shapeDiamond:"Diamond",shapeTriangle:"Triangle",shapePentagon:"Pentagon",shapeText:"Text",shapeLine:"Line",shapeData:"Data",shapeDatabase:"Database",shapeDocument:"Document",shapeDisplay:"Display",shapeManual:"Manual",shapeParallel:"Parallel",shapeComment:"Comment",shapeSubprocess:"Subprocess",shapeQueue:"Queue",shapeIntStorage:"Int. Storage",shapeExtStorage:"Ext. Storage",errUnauthenticated:"Please register first",errBadRequest:"Invalid request",errInvalidVisitorName:"Invalid visitor name",errDocExists:"Document already exists",errDocNotFound:"Document not found",errForbidden:"You don't have permission",errInternal:"Internal error",errInvalidPath:"Invalid path",errUnknown:"Unknown error",errUnknownVisitorIds:"Some visitor IDs are invalid or disabled.",errTemplateNotFound:"Member template not found.",errDomainNotRestricted:"Member import only applies to restricted workspaces.",pathRequired:"relative path is required",pathMustBeRelative:"path must be relative",useForwardSlashes:"use forward slashes",pathNoDotDot:"path must not contain ..",pathMustEndWithMd:"document path must end with .md",pathUnsupportedChars:"path contains unsupported characters",pathEscapesRoot:"path escapes docs root",enterFolderName:"enter a folder name",singleNameNotPath:"use a single name, not a path",invalidFolderName:"invalid folder name",folderNameTooLong:"folder name is too long",enterFileName:"enter a file name",singleFileNameNotPath:"use a file name, not a path",invalidFileName:"invalid file name",fileNameTooLong:"file name is too long",permissionLabel:"Permission",permissionPrivate:"Private",permissionInvite:"Invite",permissionDomainWrite:"Editable in workspace",permissionPublicRead:"Public read",permissionPublicEdit:"Public edit",invitePermissionRead:"Read only",invitePermissionEdit:"Can edit",personalDomainSuffix:"'s workspace",settings:"Settings",general:"General",settingsNavSearch:"Search settings…",settingsNavNoMatch:"No matches",language:"Language",backToDocs:"Back to documents",saveAndPublish:"Save & Publish",domainManagement:"Workspaces",createDomain:"New workspace",domainName:"Name",domainPermission:"Permission",domainPublic:"Public",domainRestricted:"Restricted",domainPrivate:"Private",docCount:"{{count}} documents",rename:"Rename",deleteDomain:"Delete workspace",deleteDomainConfirm:"Delete workspace {{name}}?",domainLocked:"Has documents, locked",noDomains:"No workspaces",domainNameRequired:"Enter a name",domainBuiltIn:"Built-in",domainNotCreator:"Only the creator can modify this workspace",domainSearchPlaceholder:"Search name…",domainFilterAll:"All",domainColName:"Name",domainColType:"Type",domainColDocCount:"Documents",domainColActions:"Actions",domainTypeBuiltinSuffix:"(built-in)",domainChangeType:"Change type",domainPermissionNoDowngrade:"Permission cannot be made more private.",domainPermissionAlreadyTop:"Already the most open permission.",domainNotModifiable:"System preset, cannot be changed",domainTooltipTypeLocked:"With documents, permission can only become more open.",deleteDomainConfirmDetail:"Delete workspace «{{name}}»? All {{count}} document(s) in it will be permanently removed.",domainNoMatch:"No matching workspaces.",memberTemplates:"Member templates",memberTemplateFormNew:"New template",memberTemplateSavedList:"Saved templates",memberTemplateIntro:"Save reusable member lists for restricted workspaces. Use Choose members… to pick people (left list = everyone, right = selected). You can also apply a template inside that dialog. Then save the template here.",memberTemplateStepName:"1. Name your template",memberTemplateStepMembers:"2. Choose members",memberTemplateStepSave:"3. Save",memberTemplateStep2Hint:"Select at least 1 member to continue",memberTemplateNameLabel:"Template name",memberTemplateNamePlaceholder:"e.g. Core team",memberTemplateIdsLabel:"Members",memberTemplateIdsHint:"Use Choose members… to pick people in the list; you can also apply a template inside that dialog.",memberTemplateCreate:"Save template",memberTemplateUpdate:"Update template",memberTemplateCancelEdit:"Cancel edit",memberTemplateDelete:"Delete",memberTemplateDeleteConfirm:"Delete template «{{name}}»?",memberTemplateConfirmDeleteCancel:"Cancel",memberTemplateConfirmDeleteDesc:"Delete template «{{name}}»? This cannot be undone.",memberTemplateConfirmDeleteSubmit:"Delete",memberTemplateEmpty:"No templates yet. Create one here, then use Members… on a restricted workspace in Workspaces.",memberTemplateEmptyAction:"Create first template",memberTemplateCount:"{{count}} visitors",memberTemplatePickerTitle:"Choose visitors for this template",memberTemplatePickMembersButton:"Choose members…",memberTemplateSelectedSummary:"{{count}} selected",memberTemplateWizardBack:"Back",memberTemplateWizardNext:"Next",domainMembersManageButton:"Members…",domainMembersPickerTitle:"Restricted workspace members",domainMembersSaved:"Saved {{count}} member(s).",visitorPickerSearchPlaceholder:"Search by name or visitor id…",visitorPickerColumnAll:"Everyone",visitorPickerColumnSelected:"Selected",visitorPickerApplyTemplate:"Apply template",visitorPickerPickTemplate:"Pick a template…",visitorPickerConfirm:"Done",visitorPickerLoadError:"Could not load visitor list.",visitorPickerEmptyDirectory:"No visitors yet.",visitorPickerNoSelection:"No one selected yet.",visitorPickerColIdShort:"ID (6)",visitorPickerColName:"Name",visitorPickerColPick:"Pick",visitorPickerColIdFull:"Visitor ID",visitorPickerRemove:"Remove from selection",visitorPickerLockedHint:"This member cannot be removed (workspace owner).",visitorPickerUnknownVisitor:"Unknown ID (not in directory)",visitorPickerMemberMissing:"Removed visitor (no longer in database)",visitorPickerDisabledTag:"inactive account",visitorPickerSelfMarker:"(you)",domainMemberImportPickTemplate:"Choose template…",domainMemberImportSection:"Members (from saved template)",domainMgmtRestrictedMemberHint:"For restricted workspaces you own: click Members… in the Actions column, then pick people in the dialog (or apply a saved template). The workspace owner always stays in the list.",domainMemberImportApply:"Import members",domainMemberImportDone:"Added {{count}} member(s).",domainMemberImportHint:"Add templates under “Member templates” first.",shared:"Shared",autoSave:"Auto Save (Local Snapshot)",autoSaveDesc:"When enabled, your content is protected from network outages, crashes, or accidental refreshes. Disabling this feature puts your data at high risk of loss.",autoSaveAlwaysOnDesc:"Always enabled — your content is continuously saved to a local snapshot, so you never lose work.",autoSaveBadge:"Recommended",autoSaveTurnOffTitle:"High Risk Operation",autoSaveTurnOffBody:"Without auto-save, content is only stored when you manually save or publish. If the browser crashes, closes unexpectedly, or refreshes, all unsaved content will be permanently lost.",autoSaveTurnOffConfirm:"Confirm Disable",autoSaveTurnOffCancel:"Keep Enabled",autoPublish:"Auto Sync to Cloud",autoPublishDesc:"Push changes to the server in real time. When network is unstable or multi-device editing conflicts occur, sync will pause to protect data integrity.",viewDrafts:"View Unpublished Drafts",unpublishedDrafts:"Unpublished Drafts",noDrafts:"No unpublished drafts",draftCount:"{{count}} unpublished",publishAll:"Publish all",conflictTitle:"Publish conflict",conflictBody:"Local version conflicts with remote. Please resolve the merge manually and re-publish.",conflictResolve:"Resolve conflict",conflictForce:"Force overwrite",conflictForceHint:"Document owner only. Cloud content will be replaced with your local draft; others' published edits will not appear in the body (still in commit history).",conflictForceConfirm:"Overwrite the cloud copy with your local draft and discard others' published body changes. This cannot be undone automatically. Continue?",conflictForceBusy:"Overwriting…",conflictClose:"Close",syncPull:"Pull update",syncBehindHint:"New version on server",pullConfirmTitle:"Pull remote version",pullConfirmBody:"Updates the editor from the server when there is no local draft.",mergeTitle:"Merge conflict",mergeLocal:"Local",mergeRemote:"Remote",mergeResult:"Merged",mergeSource:"Source",mergePreview:"Preview",mergeComplete:"Merge and publish",mergeLoadRemoteFailed:"Failed to load remote content",mergeLoadLocalFailed:"Failed to load local snapshot",mergeLoadingRemote:"Loading…",mergeConflictsUnresolved:"{{count}} unresolved conflict(s). Resolve all conflicts before publishing.",mergeConflictsPending:"Conflicts pending {{unresolved}} / {{total}}",mergeConflictsResolved:"All conflicts resolved ({{total}})",mergeConflictsPanel:"Conflicts",mergeConflictItem:"Conflict {{index}} / {{total}}",mergeConflictUnresolved:"Pending",mergeConflictResolved:"Resolved",mergeAcceptLocal:"Accept local",mergeAcceptRemote:"Accept remote",mergeAcceptBoth:"Keep both",mergeAcceptManual:"Edit manually",mergeReceive:"Accept",mergeReject:"Reject",mergeUseAllMine:"Use all mine",mergeUseAllTheirs:"Use all theirs",mergeReviewHint:"Red = mine · Green = theirs; Accept takes theirs, Reject keeps mine",mergeEditAfterResolve:"All conflicts resolved — you can edit the document",mergeNoConflicts:"Local and remote match — you can publish directly.",mergeResultHint:"Assembled from your choices; you may still edit below",mergeResultInlineHint:"Confirm every change from the merge base inline",mergeBase:"Base",mergeBaseMissing:"Could not load merge base — using two-way diff",pullBlockedConflict:"Unresolved conflict — merge first.",pullBlockedDraft:"Local draft exists — cannot overwrite with pull. Publish, or use Pull when behind to open merge.",syncHeadMissing:"Cannot publish: reopen the document to refresh version info.",syncPullDone:"Pulled latest from server",unsavedChanges:"You have unsaved changes.",edit:"Edit",autoEdit:"Auto Edit",autoEditDesc:"Automatically enter edit mode when opening a document",saveDraft:"Save Draft",continue:"Continue",draftDeleted:"Draft deleted",confirmDeleteDraft:"Permanently delete this draft? This action cannot be undone.",draftsEmptyState:"All drafts synced — no unpublished content.",localSnapshot:"Local snapshot",unknownTitle:"Untitled document",draftPublishFailedNotice:'Draft "{{name}}" publish failed: document not found',draftPublishFailedSyncHead:'Draft "{{name}}" publish failed: missing version baseline — reopen the document or fix on server',draftPublishFailedGeneric:'Draft "{{name}}" publish failed: {{reason}}',publishFailed:"Publish failed",recoverDraft:"Save As New Document",recoverDraftDesc:'Save the draft of "{{name}}" as a brand new document',recoverTargetFolder:"Target Folder",cliToken:"CLI Token",cliTokenDesc:"Identity token for CLI and Agent tools, inherits all your permissions",cliTokenCreate:"Create",cliTokenReset:"Reset",cliTokenGenerated:"New CLI Token generated",cliTokenCopy:"Copy",cliTokenCopied:"Copied",cliTokenCopyFailed:"Copy failed — select the token above and copy manually",cliTokenResetConfirm:"Resetting will revoke all existing tokens and generate a new one. Confirm?",cliTokenActive:"Active",cliTokenRevoked:"Revoked",docInfo:"Document info",docInfoCreator:"Creator",docInfoCreatedAt:"Created",docInfoSize:"Size",docInfoCharCount:"Characters",docInfoUpdatedAt:"Last edited",docInfoChangePermission:"Change permission",docInfoInviteMember:"Invite members",docInfoInviteSuccess:"Invited {{count}} member(s)",docInfoPermissionUpdated:"Permission updated",expandSidebar:"Expand sidebar",collapseSidebar:"Collapse sidebar",bookmark:"Bookmarks",bookmarkAdd:"Add to bookmarks",bookmarkRemove:"Remove from bookmarks",bookmarkTitle:"My Bookmarks",bookmarkEmpty:"No bookmarks yet",bookmarkOpen:"Open",bookmarkAdded:"Bookmark added",bookmarkRemoved:"Bookmark removed",bookmarkColTitle:"Title",bookmarkColDomain:"Workspace",bookmarkColAuthor:"Author",bookmarkColTime:"Bookmarked",bookmarkSearch:"Search bookmarks",bookmarkFilterAll:"All workspaces",bookmarkNoMatch:"No matching bookmarks",myDocuments:"My Documents",myDocumentsEmpty:"No documents yet",myDocumentsColTitle:"Title",myDocumentsColDomain:"Workspace",myDocumentsColCreator:"Creator",myDocumentsColUpdated:"Updated",myDocumentsColCreated:"Created",myDocumentsFilterDomain:"Filter by workspace",myDocumentsFilterAllDomains:"All workspaces",myDocumentsFilterCreator:"Filter by creator",myDocumentsFilterAllCreators:"All creators",myDocumentsGroupBy:"Group",myDocumentsGroupNone:"No grouping",myDocumentsGroupDomain:"Group by workspace",myDocumentsGroupCreator:"Group by creator",myDocumentsNoMatch:"No matching documents",myDocumentsPrev:"Previous",myDocumentsNext:"Next",myDocumentsJumpTo:"Go to",myDocumentsJump:"Go",myDocumentsPageInfo:"Page {{current}}/{{total}}, {{count}} total",myDocumentsSearchMode:"Search mode",myDocumentsModeAuto:"Default (hybrid)",myDocumentsModeKeyword:"Keyword",myDocumentsModeSemantic:"Semantic",myDocumentsSemanticNotReady:"Embedding model not ready; semantic search unavailable",myDocumentsSemanticNotReadyShort:"Model not ready; results may be incomplete",myDocumentsResultCount:"{{count}} results",embeddingIndex:"Semantic index",embeddingIndexDesc:"Select readable docs and rebuild local embedding vectors. Last build time comes from chunk rows.",embeddingIndexModel:"Model",embeddingIndexModelReady:"Ready",embeddingIndexModelPending:"Not ready (downloads/loads in background after start)",embeddingIndexOnlyMissing:"Missing only",embeddingIndexFilterBuilt:"Built",embeddingIndexFilterMissing:"Not built",embeddingIndexFilterReset:"Reset",embeddingIndexFilterOk:"OK",embeddingIndexPageTotal:"{{from}}–{{to}} of {{total}}",embeddingIndexPageSize:"Per page",embeddingIndexGoPage:"Page",embeddingIndexRefresh:"Refresh",embeddingIndexSearchPlaceholder:"Search title / path / ID…",embeddingIndexSearchSemanticPlaceholder:"Semantic search: describe what you're looking for…",embeddingIndexRebuildSelected:"Rebuild selected ({{count}})",embeddingIndexRebuilding:"Rebuilding…",embeddingIndexRebuildResult:"Done: ok {{ok}}, skipped {{skipped}}, failed {{failed}}",embeddingIndexRebuildFailed:"Rebuild failed",embeddingIndexLoadFailed:"Failed to load embedding index list",embeddingIndexEmpty:"No documents to manage",embeddingIndexSelectAll:"Select all in view",embeddingIndexColStatus:"Semantic status",embeddingIndexColBuiltAt:"Last semantic build",embeddingIndexColDocUpdated:"Doc updated",embeddingIndexStatusReady:"Indexed ({{chunks}} chunks)",embeddingIndexStatusBuiltUnknown:"Indexed",embeddingIndexStatusMissing:"Not indexed",agentConfig:"AI",agentConfigDesc:"Configure DeepSeek for mdocs 智能助手. Only you can use this key.",agentConfigName:"Config name",agentConfigNameDefault:"Default: {{name}}'s ds config",agentConfigModel:"Model",agentConfigContextWindow:"Context window",agentConfigContextWindowDesc:"Token budget for the assistant (default 128000). Used for the usage ring.",agentConfigRunTimeout:"Run timeout (seconds)",agentConfigRunTimeoutDesc:"Keeps running after the panel closes; stops automatically on timeout (default 300, range 60–3600).",agentConfigApiKey:"API Key",agentConfigApiKeyPlaceholder:"Paste DeepSeek API Key",agentConfigApiKeyConfigured:"Configured {{masked}}; leave blank to keep",agentConfigId:"Config ID",agentConfigShowKey:"Show API Key",agentConfigHideKey:"Hide API Key",agentFabOpen:"Open mdocs 智能助手",agentFabReset:"Reset position",docSearch:"Search documents",docSearchTitle:"Search documents",docSearchPlaceholder:"Search titles or body…",docSearchEmptyHint:"Type to search; all workspaces by default",docSearchNoResults:"No matching documents",docSearchHitTitle:"Title",docSearchHitBody:"Body",docSearchHitSemantic:"Semantic",docSearchNoDomain:"Select a workspace first",docSearchFailed:"Search failed",docSearchAllDomains:"All workspaces",docSearchDomainAria:"Search scope",docSearchDomainFilter:"Filter workspaces…",docSearchDomainNoMatch:"No matching workspaces",logout:"Sign out"},hl={loading:"加载中...",saved:"已保存",saving:"保存中...",unsaved:"编辑中...",publish:"发布",publishing:"发布中...",published:"已发布",publishHotkeyHint:"发布({{hotkey}})",preview:"预览",cancel:"取消",create:"创建",creating:"创建中...",close:"关闭",delete:"删除",save:"保存",gotIt:"知道了",error:"错误",brand:"mdocs",welcomeTitle:"欢迎使用 mdocs",welcomeDesc:"输入一个显示名称以创建访客身份。一个安全令牌将存储在此浏览器中,以便在后续访问时识别您。",visitorNamePlaceholder:"您的名字",createVisitor:"创建访客",nameRequired:"请输入名称",visitorIdNotice:"您的访客 ID 是 {{id}},请保存以便恢复",newDocument:"开始写作",startWriting:"开始写作",newArticle:"新建文章",sheetDocument:"表格",sheetAddRow:"加行",sheetAddColumn:"加列",sheetDeleteRow:"删除行",sheetDeleteColumn:"删除列",sheetAddSheet:"新建工作表",sheetDeleteSheet:"删除工作表",sheetBold:"加粗",sheetItalic:"斜体",sheetFontSize:"字号",sheetTextColor:"字体色",sheetBgColor:"底色",sheetMerge:"合并",sheetUnmerge:"拆分",newDirectory:"新建目录",newFolder:"新建文件夹",noDocumentsYet:"暂无文档",collapseFolder:"收起文件夹",expandFolder:"展开文件夹",noDocsInDomain:"此工作空间尚无文档。请在下方切换工作空间或创建文档。",createDocToStart:"点「开始写作」,或从左侧打开一篇文档。",domainLabel:"工作空间",defaultDomain:"默认",displayNamePlaceholder:"显示名称",currentDomainAria:"当前工作空间",insertDiagram:"插入图表",outlineHide:"隐藏大纲",outlineShow:"显示大纲",readOnlyNotice:`> 您无权限编辑
|
|
140
|
-
|
|
141
|
-
`,newDocumentTitle:"新建文档",newFolderTitle:"新建文件夹",fileNameLabel:"文件名",folderNameLabel:"文件夹名",fileNameHint:"名称按您输入的方式显示;存储路径会被规范化(例如空格 → 下划线)。请使用 .md 文件名。",folderNameHint:"名称按您输入的方式显示;存储路径会被规范化(例如 folder 1 → folder_1)。",untitledPlaceholder:"未命名.md",folderExamplePlaceholder:"例如 research",pathExists:"此路径已存在,请选择其他名称",folderExists:"此名称的文件夹已存在",deleteConfirm:"删除 {{name}}?",newDocIn:"在 {{name}} 中新建文档",newDocAtRoot:"在根目录新建文档",newDocBeside:"在同级新建文档",newFolderIn:"在 {{name}} 中新建文件夹",newFolderAtRoot:"在根目录新建文件夹",newFolderBeside:"在同级新建文件夹",deleteItem:"删除 {{name}}",deleteFolder:"删除「{{name}}」",copyDocumentId:"复制 documentId",copyDocumentUrl:"复制 URL",editDiagram:"编辑图表",newDiagram:"新建图表",saveAndInsert:"保存并插入",deleteDiagram:"删除图表",openFailed:"打开失败:{{message}}",components:"组件",dragToCanvas:"拖拽到画布",shapeRectangle:"矩形",shapeRounded:"圆角矩形",shapeCircle:"圆形",shapeDiamond:"菱形",shapeTriangle:"三角形",shapePentagon:"五边形",shapeText:"文本",shapeLine:"线条",shapeData:"数据",shapeDatabase:"数据库",shapeDocument:"文档",shapeDisplay:"显示",shapeManual:"手动",shapeParallel:"并行",shapeComment:"注释",shapeSubprocess:"子流程",shapeQueue:"队列",shapeIntStorage:"内部存储",shapeExtStorage:"外部存储",errUnauthenticated:"请先注册",errBadRequest:"请求无效",errInvalidVisitorName:"访客名称无效",errDocExists:"文档已存在",errDocNotFound:"文档不存在",errForbidden:"您没有权限",errInternal:"内部错误",errInvalidPath:"路径无效",errUnknown:"未知错误",errUnknownVisitorIds:"部分访客 ID 无效或已停用。",errTemplateNotFound:"找不到该成员模板。",errDomainNotRestricted:"仅受限工作空间可从模板导入成员。",pathRequired:"需要提供相对路径",pathMustBeRelative:"路径必须是相对路径",useForwardSlashes:"请使用正斜杠",pathNoDotDot:"路径不能包含 ..",pathMustEndWithMd:"文档路径必须以 .md 结尾",pathUnsupportedChars:"路径包含不支持的字符",pathEscapesRoot:"路径超出了文档根目录",enterFolderName:"请输入文件夹名称",singleNameNotPath:"请使用单个名称,而非路径",invalidFolderName:"文件夹名称无效",folderNameTooLong:"文件夹名称过长",enterFileName:"请输入文件名",singleFileNameNotPath:"请使用文件名,而非路径",invalidFileName:"文件名无效",fileNameTooLong:"文件名过长",permissionLabel:"权限",permissionPrivate:"私有",permissionInvite:"邀请",permissionDomainWrite:"工作空间内可编辑",permissionPublicRead:"公开可读",permissionPublicEdit:"公开可编辑",invitePermissionRead:"只读",invitePermissionEdit:"可编辑",personalDomainSuffix:"个人工作空间",settings:"设置",general:"通用",settingsNavSearch:"搜索设置…",settingsNavNoMatch:"无匹配项",language:"语言",backToDocs:"返回文档",saveAndPublish:"保存与发布",domainManagement:"工作空间",createDomain:"新建工作空间",domainName:"名称",domainPermission:"权限",domainPublic:"公开",domainRestricted:"受限",domainPrivate:"私有",docCount:"{{count}} 篇文档",rename:"重命名",deleteDomain:"删除工作空间",deleteDomainConfirm:"确定删除工作空间 {{name}}?",domainLocked:"有文档,不可修改",noDomains:"暂无工作空间",domainNameRequired:"请输入名称",domainBuiltIn:"系统内置",domainNotCreator:"您不是创建者,无权修改工作空间设置",domainSearchPlaceholder:"搜索名称…",domainFilterAll:"全部",domainColName:"名称",domainColType:"类型",domainColDocCount:"文档数",domainColActions:"操作",domainTypeBuiltinSuffix:"(内置)",domainChangeType:"改类型",domainPermissionNoDowngrade:"不能把权限改得更封闭。",domainPermissionAlreadyTop:"已经是最开放的权限。",domainNotModifiable:"系统预设,不可修改",domainTooltipTypeLocked:"已有文档时只能把权限改得更开放,不能收回。",deleteDomainConfirmDetail:"确定删除工作空间「{{name}}」吗?其中 {{count}} 篇文档将被永久删除。",domainNoMatch:"没有匹配的工作空间",memberTemplates:"成员模板",memberTemplateFormNew:"新建模板",memberTemplateSavedList:"已保存的模板",memberTemplateIntro:"把常用成员存成模板,供受限工作空间复用。点「选择成员…」在弹窗里左侧勾选、右侧为已选,也可在弹窗内应用模板。选好后在此保存模板。",memberTemplateStepName:"1. 填写名称",memberTemplateStepMembers:"2. 选择成员",memberTemplateStepSave:"3. 保存",memberTemplateStep2Hint:"至少选择 1 名成员才能继续",memberTemplateNameLabel:"模板名称",memberTemplateNamePlaceholder:"例如:核心开发组",memberTemplateIdsLabel:"成员",memberTemplateIdsHint:"通过下方「选择成员…」在列表中勾选;支持在弹窗内从模板自动勾选。",memberTemplateCreate:"保存模板",memberTemplateUpdate:"更新模板",memberTemplateCancelEdit:"取消编辑",memberTemplateDelete:"删除",memberTemplateDeleteConfirm:"删除模板「{{name}}」?",memberTemplateConfirmDeleteCancel:"取消",memberTemplateConfirmDeleteDesc:"确定删除模板「{{name}}」?此操作不可恢复。",memberTemplateConfirmDeleteSubmit:"确认删除",memberTemplateEmpty:"尚无模板。先在此创建,再在「工作空间」里对受限工作空间管理成员。",memberTemplateEmptyAction:"创建第一个模板",memberTemplateCount:"{{count}} 人",memberTemplatePickerTitle:"本模板包含的成员",memberTemplatePickMembersButton:"选择成员…",memberTemplateSelectedSummary:"已选 {{count}} 人",memberTemplateWizardBack:"上一步",memberTemplateWizardNext:"下一步",domainMembersManageButton:"成员…",domainMembersPickerTitle:"受限工作空间成员",domainMembersSaved:"已保存 {{count}} 名成员。",visitorPickerSearchPlaceholder:"按昵称或 visitor id 搜索…",visitorPickerColumnAll:"全部访客",visitorPickerColumnSelected:"已选成员",visitorPickerApplyTemplate:"套用模板",visitorPickerPickTemplate:"选择模板…",visitorPickerConfirm:"完成",visitorPickerLoadError:"无法加载访客列表。",visitorPickerEmptyDirectory:"暂无访客。",visitorPickerNoSelection:"尚未选择任何人。",visitorPickerColIdShort:"ID 前 6 位",visitorPickerColName:"昵称",visitorPickerColPick:"勾选",visitorPickerColIdFull:"Visitor ID(完整)",visitorPickerRemove:"从已选中移除",visitorPickerLockedHint:"创建者不可移除。",visitorPickerUnknownVisitor:"未知 ID(不在当前访客列表)",visitorPickerMemberMissing:"已删除的访客(库中无记录)",visitorPickerDisabledTag:"已停用",visitorPickerSelfMarker:"(你)",domainMemberImportPickTemplate:"选择模板…",domainMemberImportSection:"成员(从模板导入)",domainMgmtRestrictedMemberHint:"对你创建的受限工作空间:在「操作」列点「成员…」,在弹窗中勾选成员或套用模板;创建者会始终保留在已选列表中。",domainMemberImportApply:"导入成员",domainMemberImportDone:"新加入 {{count}} 名成员。",domainMemberImportHint:"请先在「成员模板」中创建模板。",shared:"共享",autoSave:"自动保存 (本地快照)",autoSaveDesc:"开启后,即使断网、崩溃或误刷新,内容也不会丢失。关闭此功能将面临极高的数据丢失风险。",autoSaveAlwaysOnDesc:"始终开启 — 内容会持续保存到本地快照,永不会丢失。",autoSaveBadge:"强烈推荐",autoSaveTurnOffTitle:"高风险操作",autoSaveTurnOffBody:"关闭自动保存后,编辑内容仅在手动保存或发布时才会被存储。一旦浏览器崩溃、误关闭或刷新页面,所有未保存的内容将永久丢失。",autoSaveTurnOffConfirm:"确认关闭",autoSaveTurnOffCancel:"保持开启",autoPublish:"自动同步至云端",autoPublishDesc:"实时推送到服务器。当网络不稳定或多端编辑冲突时,系统将暂停同步以保护数据完整性。",viewDrafts:"查看未发布草稿",unpublishedDrafts:"未发布草稿",noDrafts:"暂无未发布草稿",draftCount:"{{count}} 篇未发布",publishAll:"全部发布",conflictTitle:"发布冲突",conflictBody:"云端版本与本地版本冲突,请手动处理合并后重新发布。",conflictResolve:"解决冲突",conflictForce:"强制覆盖",conflictForceHint:"仅文档所有者可用。覆盖后云端以你的本地正文为准,他人已发布的改动不会进入正文(仍可在提交历史中查看)。",conflictForceConfirm:"将用本地正文覆盖云端,丢弃他人已发布的正文变更。此操作不可自动撤销。继续?",conflictForceBusy:"覆盖中…",conflictClose:"关闭",syncPull:"拉取更新",syncBehindHint:"云端有新版本",pullConfirmTitle:"拉取远端版本",pullConfirmBody:"无本地草稿时,用云端内容更新编辑区。",mergeTitle:"合并冲突",mergeLocal:"本地",mergeRemote:"远端",mergeResult:"合并结果",mergeSource:"源码",mergePreview:"预览",mergeComplete:"完成合并并发布",mergeLoadRemoteFailed:"加载远端内容失败",mergeLoadLocalFailed:"加载本地快照失败",mergeLoadingRemote:"加载中…",mergeConflictsUnresolved:"仍有 {{count}} 处冲突未解决,请处理后再发布",mergeConflictsPending:"冲突待处理 {{unresolved}} / {{total}}",mergeConflictsResolved:"冲突已全部处理({{total}})",mergeConflictsPanel:"冲突块",mergeConflictItem:"冲突 {{index}} / {{total}}",mergeConflictUnresolved:"待处理",mergeConflictResolved:"已处理",mergeAcceptLocal:"采用本地",mergeAcceptRemote:"采用远端",mergeAcceptBoth:"保留双方",mergeAcceptManual:"手动编辑",mergeReceive:"接收",mergeReject:"拒绝",mergeUseAllMine:"全部用我的",mergeUseAllTheirs:"全部用别人的",mergeReviewHint:"红=我的 · 绿=别人的;接收用别人的,拒绝留我的",mergeEditAfterResolve:"冲突已处理完,可继续修改正文",mergeNoConflicts:"本地与远端正文一致,可直接发布。",mergeResultHint:"由冲突决议自动拼接,也可直接修改",mergeResultInlineHint:"相对祖先有改动的行均需在正文中点选确认",mergeBase:"祖先",mergeBaseMissing:"无法加载公共祖先,已退化为两方比对",pullBlockedConflict:"存在未解决的冲突,请先合并。",pullBlockedDraft:"有未发布的本地草稿,无法覆盖拉取。可点「发布」或在落后时点「拉取更新」进入合并。",syncHeadMissing:"无法发布:缺少版本基准,请重新打开文档。",syncPullDone:"已拉取云端最新版本",unsavedChanges:"您有未保存的内容。",edit:"编辑",autoEdit:"自动编辑",autoEditDesc:"打开文档时自动进入编辑模式",saveDraft:"保存草稿",continue:"继续",draftDeleted:"草稿已删除",confirmDeleteDraft:"确定要永久删除这篇草稿吗?此操作不可恢复。",draftsEmptyState:"所有草稿已同步,当前无未发布内容。",localSnapshot:"本地快照",unknownTitle:"未命名文档",draftPublishFailedNotice:"草稿「{{name}}」发布失败:文档不存在",draftPublishFailedSyncHead:"草稿「{{name}}」发布失败:缺少版本基准,请重新打开文档",draftPublishFailedGeneric:"草稿「{{name}}」发布失败:{{reason}}",publishFailed:"发布失败",recoverDraft:"另存为新文档",recoverDraftDesc:"将「{{name}}」的草稿内容保存为一篇全新文档",recoverTargetFolder:"目标目录",cliToken:"CLI Token",cliTokenDesc:"用于命令行工具和 Agent 的身份令牌,继承你的所有权限",cliTokenCreate:"创建",cliTokenReset:"重置",cliTokenGenerated:"已生成新的 CLI Token",cliTokenCopy:"复制",cliTokenCopied:"已复制",cliTokenCopyFailed:"复制失败,请手动选中上方内容复制",cliTokenResetConfirm:"重置将吊销当前所有已有 Token,并生成新的 Token。确认重置?",cliTokenActive:"活跃",cliTokenRevoked:"已吊销",docInfo:"文档信息",docInfoCreator:"创建者",docInfoCreatedAt:"创建时间",docInfoSize:"大小",docInfoCharCount:"字符数",docInfoUpdatedAt:"上次编辑",docInfoChangePermission:"修改文章权限",docInfoInviteMember:"邀请成员",docInfoInviteSuccess:"已邀请 {{count}} 人",docInfoPermissionUpdated:"权限已更新",expandSidebar:"展开侧边栏",collapseSidebar:"收起侧边栏",bookmark:"收藏",bookmarkAdd:"添加收藏",bookmarkRemove:"取消收藏",bookmarkTitle:"我的收藏",bookmarkEmpty:"暂无收藏",bookmarkOpen:"打开",bookmarkAdded:"已添加收藏",bookmarkRemoved:"已取消收藏",bookmarkColTitle:"标题",bookmarkColDomain:"工作空间",bookmarkColAuthor:"作者",bookmarkColTime:"收藏时间",bookmarkSearch:"搜索收藏",bookmarkFilterAll:"全部工作空间",bookmarkNoMatch:"暂无匹配的收藏",myDocuments:"我的文章",myDocumentsEmpty:"暂无文章",myDocumentsColTitle:"标题",myDocumentsColDomain:"工作空间",myDocumentsColCreator:"创建者",myDocumentsColUpdated:"更新时间",myDocumentsColCreated:"创建时间",myDocumentsFilterDomain:"按工作空间筛选",myDocumentsFilterAllDomains:"全部工作空间",myDocumentsFilterCreator:"按创建者筛选",myDocumentsFilterAllCreators:"全部创建者",myDocumentsGroupBy:"分组",myDocumentsGroupNone:"不分组",myDocumentsGroupDomain:"按工作空间分组",myDocumentsGroupCreator:"按创建者分组",myDocumentsNoMatch:"暂无匹配的文章",myDocumentsPrev:"上一页",myDocumentsNext:"下一页",myDocumentsJumpTo:"跳至",myDocumentsJump:"跳转",myDocumentsPageInfo:"第 {{current}}/{{total}} 页,共 {{count}} 篇",myDocumentsSearchMode:"检索模式",myDocumentsModeAuto:"默认(混合)",myDocumentsModeKeyword:"关键词",myDocumentsModeSemantic:"语义",myDocumentsSemanticNotReady:"语义模型未就绪,暂无法语义检索",myDocumentsSemanticNotReadyShort:"语义模型未就绪,结果可能不全",myDocumentsResultCount:"共 {{count}} 条结果",embeddingIndex:"语义索引",embeddingIndexDesc:"勾选可读文档,手动重建本地语义向量。上次构建时间取自向量块。",embeddingIndexModel:"模型状态",embeddingIndexModelReady:"已就绪",embeddingIndexModelPending:"未就绪(启动后异步下载/加载)",embeddingIndexOnlyMissing:"仅未建",embeddingIndexFilterBuilt:"已建",embeddingIndexFilterMissing:"未建",embeddingIndexFilterReset:"重置",embeddingIndexFilterOk:"确定",embeddingIndexPageTotal:"第 {{from}}–{{to}} 条,共 {{total}} 篇",embeddingIndexPageSize:"每页",embeddingIndexGoPage:"页码",embeddingIndexRefresh:"刷新",embeddingIndexSearchPlaceholder:"搜索文章标题 / 路径 / ID…",embeddingIndexSearchSemanticPlaceholder:"语义搜索:用一句话描述要找的内容…",embeddingIndexRebuildSelected:"重建所选 ({{count}})",embeddingIndexRebuilding:"重建中…",embeddingIndexRebuildResult:"完成:成功 {{ok}},跳过 {{skipped}},失败 {{failed}}",embeddingIndexRebuildFailed:"重建失败",embeddingIndexLoadFailed:"加载语义索引列表失败",embeddingIndexEmpty:"没有可管理的文档",embeddingIndexSelectAll:"全选当前列表",embeddingIndexColStatus:"语义状态",embeddingIndexColBuiltAt:"上次语义构建",embeddingIndexColDocUpdated:"文章更新时间",embeddingIndexStatusReady:"已建 ({{chunks}} 块)",embeddingIndexStatusBuiltUnknown:"已建",embeddingIndexStatusMissing:"未建",agentConfig:"AI",agentConfigDesc:"配置 DeepSeek 用于 mdocs 智能助手。仅本人可用,不会分享给其他访客。",agentConfigName:"配置名称",agentConfigNameDefault:"不填则:{{name}}的 ds 配置",agentConfigModel:"模型",agentConfigContextWindow:"上下文窗口",agentConfigContextWindowDesc:"助手可用的 token 上限(默认 128000),用于占用圆环显示。",agentConfigRunTimeout:"单轮超时(秒)",agentConfigRunTimeoutDesc:"关闭面板后仍在后台跑;超时后自动停止(默认 300,范围 60–3600)。",agentConfigApiKey:"API Key",agentConfigApiKeyPlaceholder:"粘贴 DeepSeek API Key",agentConfigApiKeyConfigured:"已配置 {{masked}},留空不修改",agentConfigId:"配置 ID",agentConfigShowKey:"显示 API Key",agentConfigHideKey:"隐藏 API Key",agentFabOpen:"打开 mdocs 智能助手",agentFabReset:"重置位置",docSearch:"搜索文档",docSearchTitle:"搜索文档",docSearchPlaceholder:"搜索标题或正文…",docSearchEmptyHint:"输入关键词搜索;默认全部工作空间",docSearchNoResults:"没有匹配的文档",docSearchHitTitle:"标题",docSearchHitBody:"正文",docSearchHitSemantic:"语义",docSearchNoDomain:"请先选择工作空间",docSearchFailed:"搜索失败",docSearchAllDomains:"全部工作空间",docSearchDomainAria:"选择搜索范围",docSearchDomainFilter:"筛选工作空间…",docSearchDomainNoMatch:"没有匹配的工作空间",logout:"退出登录"},Hi="mdocs.lang",pl={en:ml,zh:hl};function gl(){const e=window.localStorage.getItem(Hi);return e==="zh"||e==="en"?e:navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}const Vi=x.createContext(null);function yl({children:e}){const[n,o]=x.useState(gl);x.useEffect(()=>{document.documentElement.lang=n==="zh"?"zh-CN":"en"},[n]);const r=x.useCallback(a=>{window.localStorage.setItem(Hi,a),o(a)},[]),i=x.useCallback((a,s)=>{let l=pl[n][a]??a;if(s)for(const[u,d]of Object.entries(s))l=l.replaceAll(`{{${u}}}`,d);return l},[n]);return c.jsx(Vi.Provider,{value:{lang:n,setLang:r,t:i},children:e})}function Ve(){const e=x.useContext(Vi);if(!e)throw new Error("useI18n must be used within I18nProvider");return e}function fn(e){const{content:n,contentHash:o,...r}=e;return r}function vl(){let e=Promise.resolve();return{execute:o=>{const r=e.then(o);return e=r.then(()=>{},()=>{}),r}}}const Lr=new Map;function po(e){let n=Lr.get(e);return n||(n=vl(),Lr.set(e,n)),n}const rt={PRIVATE:0,DOMAIN_READ:1,DOMAIN_WRITE:2,PUBLIC_READ:3,PUBLIC_WRITE:4};function go(e){return e===rt.PUBLIC_WRITE}function Tm(e){return e==="public"?[rt.PUBLIC_READ,rt.PUBLIC_WRITE]:e==="restricted"?[rt.DOMAIN_READ,rt.DOMAIN_WRITE]:[rt.PRIVATE,rt.DOMAIN_READ,rt.DOMAIN_WRITE,rt.PUBLIC_READ,rt.PUBLIC_WRITE]}const zr="___desc___.md";function bl(e){const n=e.trim();return n?`${n}/${zr}`:zr}class St extends Error{constructor(n){super(n),this.name="DocPathError"}}const xl=120,wl=200;function Lo(e){let n=e.trim().replace(/\s+/g,"_");for(n=n.replace(/[^A-Za-z0-9_\-\.\u4e00-\u9fa5]/g,"_"),n=n.replace(/_+/g,"_"),n=n.replace(/^[._]+|[._]+$/g,"");n.includes("..");)n=n.replace(/\.\./g,"_");return n==="."||n===".."||!n?"":n}function _l(e){const n=e.trim();return n?n.includes("/")||n.includes("\\")?{ok:!1,message:"use a single name, not a path"}:n==="."||n===".."?{ok:!1,message:"invalid folder name"}:n.length>xl?{ok:!1,message:"folder name is too long"}:{ok:!0,display:n}:{ok:!1,message:"enter a folder name"}}function $r(e,n=".md"){let o=e.trim();if(!o)return{ok:!1,message:"enter a file name"};if(o.includes("/")||o.includes("\\"))return{ok:!1,message:"use a file name, not a path"};if(o==="."||o==="..")return{ok:!1,message:"invalid file name"};const r=o.toLowerCase();return!r.endsWith(".md")&&!r.endsWith(".html")&&!r.endsWith(".sheet")&&(o+=n),o.length>wl?{ok:!1,message:"file name is too long"}:{ok:!0,displayFile:o}}function Ur(e){const n=e.trim().replace(/\\/g,"/");if(!n)throw new St("relative path is required");if(n.startsWith("/"))throw new St("path must be relative");if(n.includes(".."))throw new St("path must not contain ..");const o=n.split("/").filter(h=>h.length>0);if(o.length===0)throw new St("relative path is required");const r=[];for(let h=0;h<o.length-1;h+=1){const m=Lo(o[h]);if(!m)throw new St("invalid path segment");r.push(m)}const i=o[o.length-1],a=i.toLowerCase(),s=a.endsWith(".html")?".html":a.endsWith(".sheet")?".sheet":a.endsWith(".md")?".md":null;if(!s)throw new St("document path must end with .md, .html, or .sheet");const l=i.slice(0,-s.length),u=i.slice(-s.length),d=Lo(l);if(!d)throw new St("invalid file name");return r.push(d+u),r.join("/")}class et extends Error{constructor(o,r,i,a){super(i);Jt(this,"code");Jt(this,"status");Jt(this,"details");this.status=o,this.code=r,this.details=a}}const Il={children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"README",type:"text",version:1,id:"148"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h1",id:"147"},{children:[{detail:0,format:2,mode:"normal",style:"",text:"Hi",type:"text",version:1,id:"149"},{detail:0,format:0,mode:"normal",style:"",text:",",type:"text",version:1,id:"150"},{detail:0,format:1,mode:"normal",style:"",text:"你好",type:"text",version:1,id:"151"},{detail:0,format:0,mode:"normal",style:"",text:",欢迎使用 mdocs 文本。下面是一段用来",type:"text",version:1,id:"152"},{detail:0,format:1,mode:"normal",style:"",text:"展示 mdocs 特性",type:"text",version:1,id:"153"},{detail:0,format:0,mode:"normal",style:"",text:"的示例文档,你可以按需删改。",type:"text",version:1,id:"154"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:2,textStyle:"",id:"255"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"文本与排版",type:"text",version:1,id:"156"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"155"},{children:[{detail:0,format:1,mode:"normal",style:"",text:"粗体",type:"text",version:1,id:"157"},{detail:0,format:0,mode:"normal",style:"",text:"、",type:"text",version:1,id:"158"},{detail:0,format:2,mode:"normal",style:"",text:"斜体",type:"text",version:1,id:"159"},{detail:0,format:0,mode:"normal",style:"",text:"、",type:"text",version:1,id:"160"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"162"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"163"},{detail:0,format:0,mode:"normal",style:"",text:"行内代码",type:"text",version:1,id:"164"}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1,id:"161"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"165"},{detail:0,format:0,mode:"normal",style:"",text:"、",type:"text",version:1,id:"166"},{detail:0,format:4,mode:"normal",style:"",text:"删除线",type:"text",version:1,id:"167"},{detail:0,format:0,mode:"normal",style:"",text:"。",type:"text",version:1,id:"168"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:1,textStyle:"",id:"256"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"引用块:适合写结论、提示或引用原文。",type:"text",version:1,id:"170"}],direction:"ltr",format:"",indent:0,type:"quote",version:1,id:"169"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"有序列表:",type:"text",version:1,id:"171"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"257"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"用 Markdown 记笔记",type:"text",version:1,id:"173"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:1,id:"174"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"用侧边栏管文档树",type:"text",version:1,id:"175"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:2,id:"176"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"需要时再发布或同步",type:"text",version:1,id:"177"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:3,id:"178"}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"number",start:1,tag:"ol",id:"172"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"无序列表:",type:"text",version:1,id:"179"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"258"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"访客身份,无需单独注册账号(自建部署时由服务端配置)",type:"text",version:1,id:"181"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:1,id:"182"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"文档以 ",type:"text",version:1,id:"183"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:2,id:"184"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"186"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"187"},{detail:0,format:0,mode:"normal",style:"",text:".md",type:"text",version:1,id:"188"}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1,id:"185"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:3,id:"189"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"190"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:4,id:"191"},{children:[{detail:0,format:0,mode:"normal",style:"",text:" 为主存储,结构清晰",type:"text",version:1,id:"192"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:5,id:"193"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"支持个人域与协作域等能力(视部署与权限而定)",type:"text",version:1,id:"194"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:6,id:"195"}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"bullet",start:1,tag:"ul",id:"180"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"代码",type:"text",version:1,id:"197"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"196"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"行内常量如 ",type:"text",version:1,id:"198"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"200"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"201"},{detail:0,format:0,mode:"normal",style:"",text:"VITE_DEMO_MODE",type:"text",version:1,id:"202"}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1,id:"199"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"203"},{detail:0,format:0,mode:"normal",style:"",text:",或小段示例:",type:"text",version:1,id:"204"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"259"},{type:"code",version:1,code:`// 伪代码:表达「内容即文档」
|
|
142
|
-
const doc = { path: "notes/demo.md", content: "# Hello" };`,codeTheme:"default",language:"typescript",options:{indentWithTabs:!1,lineNumbers:!1,tabSize:2},id:"205"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"表格",type:"text",version:1,id:"207"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"206"},{children:[{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"能力",type:"text",version:1,id:"211"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"210"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"说明",type:"text",version:1,id:"213"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"212"}],direction:"ltr",format:"",indent:0,type:"tablerow",version:1,height:33,id:"209"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"编辑",type:"text",version:1,id:"216"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"215"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Markdown / 富文本流程按你们集成",type:"text",version:1,id:"218"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"217"}],direction:"ltr",format:"",indent:0,type:"tablerow",version:1,height:33,id:"214"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"图表",type:"text",version:1,id:"221"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"220"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"可按项目支持 Mermaid、meta2 等",type:"text",version:1,id:"223"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"222"}],direction:"ltr",format:"",indent:0,type:"tablerow",version:1,height:33,id:"219"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"草稿与发布",type:"text",version:1,id:"226"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"225"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"视前端与自建实例配置而定",type:"text",version:1,id:"228"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"227"}],direction:"ltr",format:"",indent:0,type:"tablerow",version:1,height:33,id:"224"}],direction:null,format:"",indent:0,type:"table",version:1,colWidths:[375,375],id:"208"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"链接与任务",type:"text",version:1,id:"230"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"229"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"仓库示例:",type:"text",version:1,id:"232"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:1,id:"233"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"https://github.com/xuhuafeifei/mdocs",type:"text",version:1,id:"235"}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:null,url:"https://github.com/xuhuafeifei/mdocs",id:"234"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:2,id:"236"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"站外链接用 Markdown 标注清楚即可,避免裸 URL 不易读。",type:"text",version:1,id:"237"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:3,id:"238"}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"bullet",start:1,tag:"ul",id:"231"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"任务清单:",type:"text",version:1,id:"239"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"260"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"写好这段 README Demo",type:"text",version:1,id:"241"}],direction:null,format:"",indent:0,type:"listitem",version:1,checked:!1,value:1,id:"242"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"按团队习惯补一页「目录规范」",type:"text",version:1,id:"243"}],direction:null,format:"",indent:0,type:"listitem",version:1,checked:!1,value:2,id:"244"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"需要时再加架构图或流程图",type:"text",version:1,id:"245"}],direction:null,format:"",indent:0,type:"listitem",version:1,checked:!1,value:3,id:"246"}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"check",start:1,tag:"ul",id:"240"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"示意图(若编辑器支持 Mermaid)",type:"text",version:1,id:"248"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"247"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"若当前实例的编辑器打开了 Mermaid,可解开下面代码块使用:",type:"text",version:1,id:"249"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"261"},{type:"code",version:1,code:`flowchart LR
|
|
143
|
-
A[写 Markdown] --> B[整理知识库]
|
|
144
|
-
B --> C[团队共享 / 自建部署]`,codeTheme:"default",language:"mermaid",options:{indentWithTabs:!1,lineNumbers:!1,tabSize:2},id:"250"},{type:"horizontalrule",version:1,id:"251"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"你以为这就完了?还有呢!",type:"text",version:1,id:"266"}],direction:null,format:"",indent:0,type:"heading",version:1,tag:"h2",id:"264"},{type:"meta2d",version:1,diagram:'{"x":0,"y":0,"scale":1,"pens":[{"background":"#fff","color":"#1f1f1f","height":100,"lineWidth":1,"textColor":"#1f1f1f","width":100,"name":"square","text":"我是一个流程图demo","id":"50d7f95","children":[],"x":279,"y":125,"fontSize":12,"lineHeight":1.5,"anchors":[{"x":0.5,"y":0,"id":"0","penId":"50d7f95"},{"x":1,"y":0.5,"id":"1","penId":"50d7f95"},{"x":0.5,"y":1,"id":"2","penId":"50d7f95"},{"x":0,"y":0.5,"id":"3","penId":"50d7f95"}],"rotate":0,"lineAnimateImages":[],"globalAlpha":1,"connectedLines":[{"lineId":"1a57bb5","lineAnchor":"a9246ca","anchor":"3"}]},{"background":"#fff","color":"#1f1f1f","height":80,"lineWidth":1,"textColor":"#1f1f1f","width":80,"name":"circle","text":"Circle","id":"7fd209d8","children":[],"x":161,"y":244,"fontSize":12,"lineHeight":1.5,"anchors":[{"x":0.5,"y":0,"id":"0","penId":"7fd209d8"},{"x":1,"y":0.5,"id":"1","penId":"7fd209d8"},{"x":0.5,"y":1,"id":"2","penId":"7fd209d8"},{"x":0,"y":0.5,"id":"3","penId":"7fd209d8"}],"rotate":0,"lineAnimateImages":[],"globalAlpha":1,"connectedLines":[{"lineId":"1a57bb5","lineAnchor":"72da2094","anchor":"0"}]},{"id":"1a57bb5","name":"line","lineName":"curve","x":201,"y":175,"type":1,"lineWidth":1,"length":119.98519897460938,"ex":279,"ey":244,"width":78,"height":69,"fontSize":12,"lineHeight":1.5,"anchors":[{"id":"a9246ca","x":1,"y":0,"penId":"1a57bb5","connectTo":"50d7f95","anchorId":"3","next":{"penId":"1a57bb5","connectTo":"50d7f95","x":0.358974358974359,"y":0},"start":true,"lineLength":119.98519897460938,"curvePoints":[{"x":273.46745803928,"y":175.08080907361838,"step":0.037504625891000655},{"x":268.1224860178494,"y":175.325768481332,"step":0.07500925178200131},{"x":262.9669830758521,"y":175.73867650342868,"step":0.11251387767300197},{"x":258.002848353432,"y":176.32333142019604,"step":0.15001850356400262},{"x":253.23198099073284,"y":177.0835315119218,"step":0.18752312945500327},{"x":248.65628012789855,"y":178.0230750588937,"step":0.22502775534600392},{"x":244.277644905073,"y":179.14576034139955,"step":0.26253238123700456},{"x":240.0979744624002,"y":180.45538563972715,"step":0.30003700712800524},{"x":236.11916794002371,"y":181.9557492341639,"step":0.3375416330190059},{"x":232.34312447808767,"y":183.65064940499792,"step":0.3750462589100066},{"x":228.77174321673573,"y":185.54388443251662,"step":0.41255088480100727},{"x":225.40692329611198,"y":187.639252597008,"step":0.45005551069200794},{"x":222.25056385636003,"y":189.94055217875956,"step":0.4875601365830086},{"x":219.304564037624,"y":192.4515814580592,"step":0.5250647624740092},{"x":216.57082298004758,"y":195.17613871519453,"step":0.5625693883650099},{"x":214.05123982377472,"y":198.11802223045333,"step":0.6000740142560106},{"x":211.74771370894916,"y":201.28103028412335,"step":0.6375786401470113},{"x":209.66214377571495,"y":204.6689611564923,"step":0.6750832660380119},{"x":207.79642916421585,"y":208.28561312784788,"step":0.7125878919290126},{"x":206.1524690145957,"y":212.13478447847785,"step":0.7500925178200133},{"x":204.73216246699843,"y":216.22027348866996,"step":0.787597143711014},{"x":203.53740866156784,"y":220.5458784387119,"step":0.8251017696020146},{"x":202.57010673844786,"y":225.11539760889139,"step":0.8626063954930153},{"x":201.83215583778232,"y":229.9326292794962,"step":0.900111021384016},{"x":201.3254550997151,"y":235.00137173081404,"step":0.9376156472750167},{"x":201.05190366439007,"y":240.32542324313266,"step":0.9751202731660173}]},{"x":0,"y":1,"id":"72da2094","penId":"1a57bb5","connectTo":"7fd209d8","prev":{"penId":"1a57bb5","connectTo":"7fd209d8","x":0,"y":0.2753623188405797},"anchorId":"0"}],"globalAlpha":1,"rotate":0,"lineAnimateImages":[]}],"origin":{"x":0,"y":0},"center":{"x":0,"y":0},"paths":{},"template":"a77b626","lineAnimateDraws":{},"iot":{},"version":"1.1.19","dataPoints":[]}',svg:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="238" height="219"><defs/><g><g transform="translate(-151,-115)"><path fill="none" stroke="none"/><g><path fill="#fff" stroke="none" paint-order="stroke fill markers" d=" M 279 125 L 379 125 L 379 225 L 279 225 L 279 125 Z"/></g><path fill="none" stroke="#1f1f1f" paint-order="fill stroke markers" d=" M 279 125 L 379 125 L 379 225 L 279 225 L 279 125 Z" stroke-linecap="square" stroke-miterlimit="10"/><g><text fill="#1f1f1f" stroke="none" font-family=""Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="287" y="166.9" text-anchor="start" dominant-baseline="central">我是一个流程图</text><text fill="#1f1f1f" stroke="none" font-family=""Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="312.26000213623047" y="184.9" text-anchor="start" dominant-baseline="central">demo</text></g></g><g transform="translate(-151,-115)"><path fill="none" stroke="none"/><g><g transform="translate(-151,-115)"><path fill="none" stroke="none"/><g><path fill="none" stroke="none"/></g><path fill="none" stroke="#222222" paint-order="fill stroke markers" d=" M 279 175 C 229 175 201 194 201 244" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10"/></g></g></g></g></svg>',id:"269"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"270"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"271"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"272"}],direction:"ltr",format:"",type:"root",version:1,id:"root"},kl={root:Il},Br=JSON.stringify(kl),it="demo-visitor-001",Am={visitorId:it,visitorName:"Demo User",createdAt:new Date().toISOString(),lastSeenAt:new Date().toISOString(),disabledAt:null,mergedIntoVisitorId:null};function Fn(e){let n=0;for(let o=0;o<e.length;o++){const r=e.charCodeAt(o);n=(n<<5)-n+r,n=n&n}return Math.abs(n).toString(16).padStart(64,"0")}const Hr=`# Markdown 语法指南
|
|
145
|
-
|
|
146
|
-
## 基础格式
|
|
147
|
-
|
|
148
|
-
**粗体文本**、*斜体文本*、~~删除线~~
|
|
149
|
-
|
|
150
|
-
## 列表
|
|
151
|
-
|
|
152
|
-
### 无序列表
|
|
153
|
-
- 项目一
|
|
154
|
-
- 项目二
|
|
155
|
-
- 嵌套项目
|
|
156
|
-
|
|
157
|
-
### 有序列表
|
|
158
|
-
1. 第一项
|
|
159
|
-
2. 第二项
|
|
160
|
-
3. 第三项
|
|
161
|
-
|
|
162
|
-
## 代码
|
|
163
|
-
|
|
164
|
-
\`\`\`typescript
|
|
165
|
-
function hello(name: string): string {
|
|
166
|
-
return \`Hello, \${name}!\`;
|
|
167
|
-
}
|
|
168
|
-
\`\`\`
|
|
169
|
-
|
|
170
|
-
## 表格
|
|
171
|
-
|
|
172
|
-
| 功能 | 支持 |
|
|
173
|
-
|------|------|
|
|
174
|
-
| Markdown | ✅ |
|
|
175
|
-
| 图表 | ✅ |
|
|
176
|
-
| 公式 | ✅ |
|
|
177
|
-
|
|
178
|
-
## 引用
|
|
179
|
-
|
|
180
|
-
> 这是一段引用文本
|
|
181
|
-
> 可以有多行
|
|
182
|
-
|
|
183
|
-
## 链接和图片
|
|
184
|
-
|
|
185
|
-
[访问 GitHub](https://github.com)
|
|
186
|
-
|
|
187
|
-
## 数学公式(KaTeX)
|
|
188
|
-
|
|
189
|
-
行内公式:$E = mc^2$
|
|
190
|
-
|
|
191
|
-
块级公式:
|
|
192
|
-
|
|
193
|
-
$$
|
|
194
|
-
\\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}
|
|
195
|
-
$$
|
|
196
|
-
`,Vr=`# 图表支持示例
|
|
197
|
-
|
|
198
|
-
mdocs 集成了多种图表类型。
|
|
199
|
-
|
|
200
|
-
## Mermaid 流程图
|
|
201
|
-
|
|
202
|
-
\`\`\`mermaid
|
|
203
|
-
flowchart LR
|
|
204
|
-
A[开始] --> B{判断}
|
|
205
|
-
B -->|是| C[处理]
|
|
206
|
-
B -->|否| D[结束]
|
|
207
|
-
C --> D
|
|
208
|
-
\`\`\`
|
|
209
|
-
|
|
210
|
-
## Mermaid 序列图
|
|
211
|
-
|
|
212
|
-
\`\`\`mermaid
|
|
213
|
-
sequenceDiagram
|
|
214
|
-
participant 用户
|
|
215
|
-
participant 前端
|
|
216
|
-
participant 后端
|
|
217
|
-
|
|
218
|
-
用户->>前端: 输入内容
|
|
219
|
-
前端->>后端: 提交数据
|
|
220
|
-
后端-->>前端: 返回结果
|
|
221
|
-
前端-->>用户: 显示成功
|
|
222
|
-
\`\`\`
|
|
223
|
-
|
|
224
|
-
## Mermaid 甘特图
|
|
225
|
-
|
|
226
|
-
\`\`\`mermaid
|
|
227
|
-
gantt
|
|
228
|
-
title 项目进度
|
|
229
|
-
dateFormat YYYY-MM-DD
|
|
230
|
-
section 设计
|
|
231
|
-
需求分析 :done, des1, 2024-01-01, 5d
|
|
232
|
-
技术选型 :done, des2, after des1, 3d
|
|
233
|
-
section 开发
|
|
234
|
-
前端开发 :active, dev1, 2024-01-09, 10d
|
|
235
|
-
后端开发 : dev2, 2024-01-09, 10d
|
|
236
|
-
\`\`\`
|
|
237
|
-
`,Gr=`# 个人笔记
|
|
238
|
-
|
|
239
|
-
这是我的私人域中的笔记,只有我能看到。
|
|
240
|
-
|
|
241
|
-
## 今日待办
|
|
242
|
-
|
|
243
|
-
- [x] 完成 mdocs demo 模式
|
|
244
|
-
- [ ] 测试所有功能
|
|
245
|
-
- [ ] 部署到 GitHub Pages
|
|
246
|
-
|
|
247
|
-
## 想法
|
|
248
|
-
|
|
249
|
-
Demo 模式的核心设计:
|
|
250
|
-
1. API 层透明切换
|
|
251
|
-
2. 数据存储在 IndexedDB
|
|
252
|
-
3. 用户无感知切换
|
|
253
|
-
|
|
254
|
-
`,Mm=[{documentId:"doc-welcome",relativePath:"README.md",displayName:"README",content:Br,contentHash:Fn(Br),permission:1,ownerVisitorId:it,domainId:"default",updatedBy:it,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-markdown-guide",relativePath:"指南/Markdown 语法.md",displayName:"Markdown 语法",content:Hr,contentHash:Fn(Hr),permission:1,ownerVisitorId:it,domainId:"default",updatedBy:it,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-diagram-guide",relativePath:"指南/图表支持.md",displayName:"图表支持",content:Vr,contentHash:Fn(Vr),permission:1,ownerVisitorId:it,domainId:"default",updatedBy:it,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-personal-note",relativePath:"个人笔记.md",displayName:"个人笔记",content:Gr,contentHash:Fn(Gr),permission:0,ownerVisitorId:it,domainId:it,updatedBy:it,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null}];const tr="mdocs.visitorId",zo="mdocs-api-error";function Sl(e){typeof window>"u"||window.dispatchEvent(new CustomEvent(zo,{detail:{status:e.status,code:e.code,message:e.message}}))}function Gi(){return!1}function jm(){return window.localStorage.getItem(tr)}function Vn(e){window.localStorage.setItem(tr,e)}function Cl(){window.localStorage.removeItem(tr)}async function H(e,n={}){try{Gi();const o=new Headers(n.headers);!o.has("Content-Type")&&n.body&&o.set("Content-Type","application/json");const r=await fetch(e,{...n,headers:o});if(r.status===204)return;const i=await r.text();let a;try{a=i?JSON.parse(i):null}catch{throw new et(r.status,"BAD_RESPONSE","response is not valid JSON")}if(!r.ok){const s=a==null?void 0:a.error;throw new et(r.status,(s==null?void 0:s.code)??"UNKNOWN",(s==null?void 0:s.message)??"request failed",s==null?void 0:s.details)}return a.data}catch(o){throw o instanceof et&&!n.silent&&Sl(o),o}}const Gn="default",Em=["public","restricted","private"];function Rm(e){return e===Gn}function Om(e,n){return n!==null&&e.creatorVisitorId===n}function Fm(e){return e.docCount>0}function Dl(e,n){return H("/api/visitors/register",{method:"POST",body:JSON.stringify({visitorName:e,password:n})})}function Nl(e){return H("/api/visitors/recover",{method:"POST",body:JSON.stringify({recoveryCode:e})})}function Pl(e,n){return H("/api/visitors/login",{method:"POST",body:JSON.stringify({visitorName:e,password:n})})}function Lm(e){return H("/api/visitors/set-password",{method:"POST",body:JSON.stringify({password:e})})}function zm(){return H("/api/visitors/recovery-code",{method:"POST"})}async function Wr(){return(await H("/api/visitors/me")).visitor}function $m(){return H("/api/visitors").then(e=>e.visitors)}function Tl(){return H("/api/domains")}function Um(e){return H("/api/domains",{method:"POST",body:JSON.stringify(e)})}function Bm(e,n){return H(`/api/domains/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({domainName:n})})}function Hm(e,n){return H(`/api/domains/${encodeURIComponent(e)}/permission`,{method:"PUT",body:JSON.stringify({permission:n})})}function Vm(e){return H(`/api/domains/${encodeURIComponent(e)}`,{method:"DELETE"})}function Gm(e){return H(`/api/domains/${encodeURIComponent(e)}/members`).then(n=>n.members)}function Wm(e,n){return H(`/api/domains/${encodeURIComponent(e)}/members`,{method:"PUT",body:JSON.stringify({visitorIds:n})})}function qm(){return H("/api/domain-member-templates")}function Km(e){return H("/api/domain-member-templates",{method:"POST",body:JSON.stringify(e)})}function Ym(e,n){return H(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"PUT",body:JSON.stringify(n)})}function Jm(e){return H(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"DELETE"})}function Al(e){const n=e!=null&&e.trim()?`?domainId=${encodeURIComponent(e.trim())}`:"";return H(`/api/tree${n}`)}function Xt(e){return H(`/api/documents/${encodeURIComponent(e)}`)}function $o(e){return H("/api/documents",{method:"POST",body:JSON.stringify(e)})}function yo(e,n){return H(`/api/documents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(n)})}function Ml(e,n){const o=n?`?localBaseCommitId=${encodeURIComponent(n)}`:"";return H(`/api/documents/${encodeURIComponent(e)}/sync-status${o}`,{silent:!0})}function Xm(e,n,o){const r=new URLSearchParams({localBaseCommitId:n,remoteCommitId:o});return H(`/api/documents/${encodeURIComponent(e)}/merge-context?${r}`)}function vo(e){return H("/api/documents/convert",{method:"POST",body:JSON.stringify(e)})}function jl(e){return H(`/api/documents/${encodeURIComponent(e)}`,{method:"DELETE"})}function El(e,n){return H(`/api/documents/${encodeURIComponent(e)}/move`,{method:"POST",body:JSON.stringify({parentId:n})})}function Zm(e){return H(`/api/documents/${encodeURIComponent(e)}/invites`)}function Qm(e,n,o){return H(`/api/documents/${encodeURIComponent(e)}/invites`,{method:"POST",body:JSON.stringify({targetVisitorId:n,targetPermission:o})})}function eh(e,n){return H(`/api/documents/${encodeURIComponent(e)}/invites/${encodeURIComponent(n)}`,{method:"DELETE"})}async function th(e,n){var d;const o=new FormData;o.append("file[]",e),o.append("documentId",n);const r=new Headers,i=await fetch("/api/assets/upload",{method:"POST",headers:r,body:o}),a=await i.json(),s=a;if(!i.ok||s.code===1){const h=a==null?void 0:a.error;throw new et(i.status,(h==null?void 0:h.code)??"UPLOAD_FAILED",(h==null?void 0:h.message)??s.msg??"upload failed")}const l=((d=s.data)==null?void 0:d.succMap)??{},u=Object.values(l);if(u.length===0)throw new Error("upload succeeded but no URL returned");return u[0]}function Rl(e){return H("/api/folders",{method:"POST",body:JSON.stringify(e)})}function Ol(e){return H(`/api/documents/folder/${encodeURIComponent(e)}`,{method:"DELETE"})}function nh(e){return H("/api/cli/tokens",{method:"POST",body:JSON.stringify({})})}function oh(){return H("/api/cli/tokens")}function Fl(e){return H("/api/documents/search",{method:"POST",body:JSON.stringify(e)})}function rh(e){return H("/api/documents/embedding-index")}function ih(e){return H("/api/documents/embedding-rebuild",{method:"POST",body:JSON.stringify({documentIds:e})})}function Ll(){return H("/api/bookmarks")}function ah(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`)}function sh(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"POST"})}function zl(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"DELETE"})}function lh(e={}){const n=new URLSearchParams({offset:String(e.offset??0),limit:String(e.limit??20)});return e.domainId&&n.set("domainId",e.domainId),e.creatorVisitorId&&n.set("creatorVisitorId",e.creatorVisitorId),e.groupBy&&n.set("groupBy",e.groupBy),H(`/api/visitors/me/documents?${n}`)}function $l(e){return H(`/api/documents/${encodeURIComponent(e)}/comments`)}function Ul(e,n){return H(`/api/documents/${encodeURIComponent(e)}/comments`,{method:"POST",body:JSON.stringify(n)})}function Bl(e,n){return H(`/api/documents/${encodeURIComponent(e)}/comments/${encodeURIComponent(n)}`,{method:"DELETE"})}function ch(){return H("/api/agent/configs")}function qr(e){return H("/api/agent/config",{method:"PUT",body:JSON.stringify(e)})}function dh(e){return H(`/api/agent/config/${encodeURIComponent(e)}/default`,{method:"POST"})}function uh(e){return H(`/api/agent/config/${encodeURIComponent(e)}`,{method:"DELETE"})}function fh(){return H("/api/agent/skills")}function mh(e){return H("/api/agent/skills",{method:"POST",body:JSON.stringify(e)})}function hh(e,n){return H(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)})}function ph(e){return H(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function gh(){return H("/api/agent/status")}function yh(){return H("/api/agent/context-usage")}function vh(e="normal",n){const o=new URLSearchParams;e==="coding"&&(o.set("mode","coding"),n&&o.set("documentId",n));const r=o.toString();return H(`/api/agent/session${r?`?${r}`:""}`)}function bh(e="normal",n){const o=new URLSearchParams;e==="coding"&&(o.set("mode","coding"),n&&o.set("documentId",n));const r=o.toString();return H(`/api/agent/sessions${r?`?${r}`:""}`)}function xh(e="normal",n,o){return H("/api/agent/sessions",{method:"POST",body:JSON.stringify({mode:e,...e==="coding"?{documentId:n??null}:{},...o?{domainId:o}:{}})})}function wh(e,n,o="normal"){return H("/api/agent/session/rename",{method:"POST",body:JSON.stringify({sessionId:e,title:n,mode:o})})}function _h(e,n,o="normal"){return H("/api/agent/session/pin",{method:"POST",body:JSON.stringify({sessionId:e,pinned:n,mode:o})})}function Ih(e,n="normal",o){return H("/api/agent/session/open",{method:"POST",body:JSON.stringify({sessionId:e,mode:n,...n==="coding"?{documentId:o??null}:{}})})}function kh(e,n){return H("/api/agent/session/bind-document",{method:"POST",body:JSON.stringify({sessionId:e,documentId:n})})}function Sh(e,n){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,choice:n})})}function Ch(e){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function Dh(e){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}function Nh(e,n){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,...n})})}function Ph(e){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function Th(e){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}async function Wi(e,n){var l,u,d;if(!e.body)throw new Error("empty response body");const o=e.body.getReader(),r=new TextDecoder;let i="";const a=()=>{o.cancel().catch(()=>{})};(l=n.signal)==null||l.addEventListener("abort",a,{once:!0});const s=h=>{const m=h.trim();if(!m.startsWith("data:"))return;const f=m.slice(5).trim();if(!(!f||f==="[DONE]"))try{n.onEvent(JSON.parse(f))}catch{}};try{for(;!((u=n.signal)!=null&&u.aborted);){const{done:h,value:m}=await o.read();if(h)break;i+=r.decode(m,{stream:!0});const f=i.split(`
|
|
255
|
-
`);i=f.pop()??"";for(const p of f)s(p)}i.trim()&&s(i)}finally{(d=n.signal)==null||d.removeEventListener("abort",a)}}async function Ah(e,n){var a,s;const o={message:e,mode:n.mode==="coding"?"coding":"normal"},r=n.skillNames&&n.skillNames.length>0?n.skillNames:n.skillIds&&n.skillIds.length>0?n.skillIds:void 0;r&&(o.skillNames=r),n.mode==="coding"?(n.documentId!==void 0&&(o.documentId=n.documentId),typeof n.workingMarkdown=="string"&&(o.workingMarkdown=n.workingMarkdown),typeof n.baseMarkdown=="string"&&(o.baseMarkdown=n.baseMarkdown)):n.references&&(o.references=n.references);const i=await fetch("/api/agent/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),signal:n.signal});if(!i.ok){let l=`HTTP ${i.status}`;try{const u=await i.json();if((a=u.error)!=null&&a.message&&(l=u.error.message),((s=u.error)==null?void 0:s.code)==="RUN_ACTIVE"){const d=new Error(l);throw d.code="RUN_ACTIVE",d}}catch(u){if(u instanceof Error&&u.code==="RUN_ACTIVE")throw u}throw new Error(l)}await Wi(i,n)}async function Mh(e,n){var a;const o=new URLSearchParams;n.afterSeq!=null&&n.afterSeq>0&&o.set("afterSeq",String(n.afterSeq));const r=o.toString(),i=await fetch(`/api/agent/runs/${encodeURIComponent(e)}/stream${r?`?${r}`:""}`,{signal:n.signal});if(!i.ok){let s=`HTTP ${i.status}`;try{const l=await i.json();(a=l.error)!=null&&a.message&&(s=l.error.message)}catch{}throw new Error(s)}await Wi(i,n)}function jh(e){return H(`/api/agent/runs/${encodeURIComponent(e)}/cancel`,{method:"POST",body:JSON.stringify({})})}function Kr(e){return H(`/api/graph/${e}`,{method:"GET"})}function Hl(e){return H(`/api/graph/${e}/analyze`,{method:"POST"})}function Yr(e){return H(`/api/graph/domain/${e}`,{method:"GET"})}function Vl(e){return H(`/api/graph/domain/${e}/analyze`,{method:"POST"})}function Gl(e){return H(`/api/graph/tasks/${encodeURIComponent(e)}`,{method:"GET"})}const Wl={domainId:Gn,domainName:"Default",permission:"public",creatorVisitorId:"",docCount:0};async function nr(){try{return await Tl()}catch{return[Wl]}}function ql(e,n){var o,r,i;return((o=e.find(a=>a.domainId===n))==null?void 0:o.domainId)??((r=e.find(a=>a.domainId===Gn))==null?void 0:r.domainId)??((i=e[0])==null?void 0:i.domainId)??Gn}function Kl(e){const{t:n}=Ve(),[o,r]=x.useState(!1),[i,a]=x.useState(null),[s,l]=x.useState("login"),[u,d]=x.useState(""),[h,m]=x.useState(""),[f,p]=x.useState("password"),[g,w]=x.useState(""),[b,v]=x.useState(""),[S,D]=x.useState("");function P(O){if(O.preventDefault(),!u.trim()){a(n("nameRequired"));return}a(null),l("register-password")}async function _(O){O.preventDefault(),r(!0),a(null);try{const $=h.trim();await e.onSubmit(u.trim(),$||void 0),d(""),m(""),l("login"),p("password"),w(u.trim()),v($||"")}catch($){a($ instanceof Error?$.message:String($)),l("register")}finally{r(!1)}}async function T(O){O.preventDefault();const $=g.trim(),V=b.trim();if(!$||!V){a("请输入用户名和密码");return}r(!0),a(null);try{const J=await Pl($,V);Vn(J.visitor.visitorId),await e.onRecover(J.visitor.visitorId)}catch(J){a(J instanceof Error?J.message:String(J))}finally{r(!1)}}async function I(O){O.preventDefault();const $=S.trim();if(!$){a("请输入恢复码");return}r(!0),a(null);try{const V=await Nl($);Vn(V.visitor.visitorId),await e.onRecover(V.visitor.visitorId)}catch(V){a(V instanceof Error?V.message:String(V))}finally{r(!1)}}const N=i??e.error;function L(){a(null),d(""),m(""),l("register")}function E(){a(null),l("login")}return c.jsx("div",{className:"mdocs-dialog-backdrop",children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:420},children:[s==="login"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",gap:16,marginBottom:16,fontSize:"0.875rem"},children:[c.jsx("button",{type:"button",onClick:()=>{a(null),p("password")},style:{background:"none",border:"none",color:f==="password"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:f==="password"?"2px solid var(--mdocs-accent)":"none",fontWeight:f==="password"?600:400},children:"用户名+密码"}),c.jsx("button",{type:"button",onClick:()=>{a(null),p("recovery")},style:{background:"none",border:"none",color:f==="recovery"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:f==="recovery"?"2px solid var(--mdocs-accent)":"none",fontWeight:f==="recovery"?600:400},children:"恢复码"})]}),f==="password"?c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"🔑 使用密码登录"}),c.jsx("p",{children:"输入用户名和密码,在其他设备上找回你的身份。"}),c.jsxs("form",{onSubmit:T,children:[c.jsx("input",{autoFocus:!0,placeholder:"用户名",value:g,onChange:O=>w(O.target.value),maxLength:60,style:{marginBottom:8}}),c.jsx("input",{type:"password",placeholder:"密码",value:b,onChange:O=>v(O.target.value)}),N&&c.jsx("div",{className:"mdocs-dialog-error",children:N}),c.jsx("button",{type:"submit",className:"primary",disabled:o,children:o?"验证中…":"登录"})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"🔑 使用恢复码找回"}),c.jsx("p",{children:"输入注册时保存的恢复码,系统将为您生成新的身份令牌。"}),c.jsxs("form",{onSubmit:I,children:[c.jsx("input",{autoFocus:!0,placeholder:"ABCD-EFGH-IJKL-MNOP",value:S,onChange:O=>D(O.target.value),style:{fontFamily:"monospace",letterSpacing:"0.1em"},maxLength:30}),N&&c.jsx("div",{className:"mdocs-dialog-error",children:N}),c.jsx("button",{type:"submit",className:"primary",disabled:o,children:o?"验证中…":"找回身份"})]})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:L,children:"没有账号?点击注册"})})]}),s==="register"&&c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:n("welcomeTitle")}),c.jsx("p",{children:n("welcomeDesc")}),c.jsxs("form",{onSubmit:P,children:[c.jsx("input",{autoFocus:!0,placeholder:n("visitorNamePlaceholder"),value:u,onChange:O=>d(O.target.value),maxLength:60}),N&&c.jsx("div",{className:"mdocs-dialog-error",children:N}),c.jsx("button",{type:"submit",className:"primary",disabled:o,children:"下一步"})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:E,children:"已有账号?点击登录"})})]}),s==="register-password"&&c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"设置密码(可选)"}),c.jsx("p",{style:{marginBottom:8},children:"设置密码后,你可以在其他浏览器或设备上使用「用户名+密码」登录。"}),c.jsx("p",{style:{color:"var(--mdocs-text-secondary)",fontSize:"0.875rem",marginBottom:16},children:"留空不设置密码也能正常使用,但只能在当前浏览器操作。"}),c.jsxs("form",{onSubmit:_,children:[c.jsx("input",{autoFocus:!0,type:"password",placeholder:"设置密码(至少 4 位)",value:h,onChange:O=>m(O.target.value),minLength:4}),N&&c.jsx("div",{className:"mdocs-dialog-error",children:N}),c.jsx("button",{type:"submit",className:"primary",disabled:o,style:{marginTop:8},children:o?n("creating"):"完成注册"})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-text-secondary)",cursor:"pointer",fontSize:"0.875rem",padding:0},onClick:()=>l("register"),children:"← 返回上一步"})})]})]})})}function Yl(e){const{t:n}=Ve();return c.jsxs("div",{className:"mdocs-notice card",children:[c.jsx("span",{children:n("visitorIdNotice",{id:e.visitorId})}),c.jsx("button",{type:"button",onClick:e.onDismiss,children:n("gotIt")})]})}const qi="application/x-mdocs-document-id",Uo="mdocs-doc:";let Bt=null;function Ki(e,n,o=[]){for(const r of e){if(r.type==="document"){if(r.documentId===n)return{forceOpenFolderIds:o,scrollTreeId:r.documentId};continue}if(r.descDocumentId===n)return{forceOpenFolderIds:o,scrollTreeId:r.documentId};const i=Ki(r.children,n,[...o,r.documentId]);if(i)return i}return null}function or(e){if(Bt)return Bt;try{const n=e.getData(qi);if(n)return n;const o=e.getData("text/plain")||e.getData("Text");if(o.startsWith(Uo))return o.slice(Uo.length)}catch{}return""}function Dt(e){return!!(e&&Bt)}function Jl(e){const{t:n}=Ve(),o=x.useRef(null),[r,i]=x.useState(null),[a,s]=x.useState(null),l=x.useMemo(()=>{var v,S;const b=((v=e.graphFocusAnchorId)==null?void 0:v.trim())||((S=e.activeDocumentId)==null?void 0:S.trim());return b?Ki(e.nodes,b):null},[e.nodes,e.activeDocumentId,e.graphFocusAnchorId]),u=x.useMemo(()=>new Set((l==null?void 0:l.forceOpenFolderIds)??[]),[l]);x.useEffect(()=>{if(!(l!=null&&l.scrollTreeId))return;const b=l.scrollTreeId,v=()=>{var P;const D=(P=o.current)==null?void 0:P.querySelector(`[data-tree-id="${CSS.escape(b)}"]`);D==null||D.scrollIntoView({block:"nearest",behavior:"smooth"})},S=requestAnimationFrame(()=>{requestAnimationFrame(v)});return()=>cancelAnimationFrame(S)},[l==null?void 0:l.scrollTreeId,u,e.nodes]);function d(){i(null)}function h(){Bt=null,s(null),d()}function m(b){Bt=b,s(b),d()}function f(b){if(!Dt(e.onMoveDocument))return;b.preventDefault(),b.dataTransfer.dropEffect="move",b.target.closest(".mdocs-tree-row")||i({kind:"root"})}function p(b){const v=b.relatedTarget;v&&b.currentTarget.contains(v)||i(S=>(S==null?void 0:S.kind)==="root"?null:S)}function g(b){if(!e.onMoveDocument||!Dt(e.onMoveDocument))return;b.preventDefault(),b.stopPropagation();const S=b.target.closest(".mdocs-tree-row"),D=or(b.dataTransfer);h(),!S&&D&&e.onMoveDocument(D,null)}const w="mdocs-sidebar-list"+((r==null?void 0:r.kind)==="root"?" mdocs-tree-drop-root":"");return e.nodes.length===0?c.jsx("div",{ref:o,className:w,onDragOver:f,onDragLeave:p,onDrop:g,children:c.jsx("div",{className:"muted",style:{padding:"8px 10px",fontSize:12},children:n("noDocumentsYet")})}):c.jsx("div",{ref:o,className:w,onClick:b=>{var S;b.target.closest(".mdocs-tree-row")||(S=e.onDeselect)==null||S.call(e)},onContextMenu:b=>{b.preventDefault(),e.onContextMenu({x:b.clientX,y:b.clientY,node:{type:"folder",name:"",path:"",documentId:"",children:e.nodes},parentPath:""})},onDragOver:f,onDragLeave:p,onDrop:g,children:e.nodes.map(b=>c.jsx(Yi,{node:b,depth:0,parentPath:"",parentFolderId:null,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId??null,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:u,dropHighlight:r,setDropHighlight:i,clearDropHighlight:d,beginDragSession:m,endDragSession:h,draggingId:a,onOpen:e.onOpen,onOpenFolder:e.onOpenFolder,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument,onOpenGraph:e.onOpenGraph,onGenerateGraph:e.onGenerateGraph},b.path))})}function Yi(e){const n={paddingLeft:8+e.depth*16};return e.node.type==="folder"?c.jsx(Ql,{folder:e.node,depth:e.depth,indent:n,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:e.forceOpenFolderIds,dropHighlight:e.dropHighlight,setDropHighlight:e.setDropHighlight,clearDropHighlight:e.clearDropHighlight,beginDragSession:e.beginDragSession,endDragSession:e.endDragSession,draggingId:e.draggingId,onOpen:e.onOpen,onOpenFolder:e.onOpenFolder,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument,onOpenGraph:e.onOpenGraph,onGenerateGraph:e.onGenerateGraph}):c.jsx(Xl,{doc:e.node,indent:n,parentPath:e.parentPath,parentFolderId:e.parentFolderId,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId,dropHighlight:e.dropHighlight,setDropHighlight:e.setDropHighlight,clearDropHighlight:e.clearDropHighlight,beginDragSession:e.beginDragSession,endDragSession:e.endDragSession,draggingId:e.draggingId,onOpen:e.onOpen,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument,onOpenGraph:e.onOpenGraph,onGenerateGraph:e.onGenerateGraph})}function Xl(e){var m;const n=e.doc,o=n.documentId===e.activeDocumentId,r=n.documentId===e.graphFocusAnchorId,i=!!e.onMoveDocument,a=e.draggingId===n.documentId,[s,l]=x.useState(!1),u=((m=e.dropHighlight)==null?void 0:m.kind)==="doc"&&e.dropHighlight.id===n.documentId,[d,h]=x.useState(!1);return c.jsxs("div",{role:"button",tabIndex:0,className:"mdocs-tree-row mdocs-tree-doc"+(o?" active":"")+(r?" mdocs-tree-row--graph-focus":"")+(a?" mdocs-tree-dragging":"")+(u?" mdocs-tree-drop-target":""),"data-tree-id":n.documentId,style:{...e.indent,cursor:i?"grab":void 0},draggable:i,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onDragStart:f=>{e.onMoveDocument&&(h(!0),e.beginDragSession(n.documentId),f.dataTransfer.setData(qi,n.documentId),f.dataTransfer.setData("text/plain",Uo+n.documentId),f.dataTransfer.effectAllowed="move")},onDragEnd:()=>{e.endDragSession(),queueMicrotask(()=>h(!1))},onDragEnter:f=>{!Dt(e.onMoveDocument)||Bt===n.documentId||(f.preventDefault(),f.stopPropagation(),e.setDropHighlight({kind:"doc",id:n.documentId}))},onDragOver:f=>{!Dt(e.onMoveDocument)||Bt===n.documentId||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"doc",id:n.documentId}))},onDrop:f=>{if(!e.onMoveDocument||!Dt(e.onMoveDocument))return;f.preventDefault(),f.stopPropagation();const p=or(f.dataTransfer),g=e.parentFolderId;e.endDragSession(),!(!p||p===n.documentId)&&e.onMoveDocument(p,g)},onClick:()=>{d||e.onOpen(n)},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),e.onOpen(n))},onContextMenu:f=>{f.preventDefault(),f.stopPropagation(),e.onContextMenu({x:f.clientX,y:f.clientY,node:n,parentPath:e.parentPath})},children:[c.jsx("span",{className:"mdocs-tree-caret-spacer","aria-hidden":!0}),c.jsx("span",{className:`mdocs-tree-icon${n.fileType==="html"?" mdocs-tree-icon-html":n.fileType==="sheet"?" mdocs-tree-icon-sheet":""}`,children:n.fileType==="html"?c.jsx("span",{className:"mdocs-tree-html-bracket",children:"</>"}):n.fileType==="sheet"?"sheet":"md"}),c.jsx("span",{className:"mdocs-tree-label",title:n.displayName||n.name,children:n.displayName||n.name}),(e.onOpenGraph||e.onGenerateGraph)&&c.jsxs("span",{className:"mdocs-tree-hover-actions",onClick:f=>f.stopPropagation(),children:[e.onOpenGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"查看图谱",onClick:f=>{var p;f.stopPropagation(),(p=e.onOpenGraph)==null||p.call(e,e.doc,e.parentFolderId??void 0)},children:c.jsx(er,{size:14,strokeWidth:1.75})}),e.onGenerateGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"生成图谱",onClick:f=>{var p;f.stopPropagation(),(p=e.onGenerateGraph)==null||p.call(e,e.doc,e.parentFolderId??void 0)},children:c.jsx(Bi,{size:14,strokeWidth:1.75})})]})]})}function Zl(){return c.jsx("span",{className:"mdocs-tree-icon mdocs-tree-icon-dir","aria-hidden":!0,children:c.jsx(Ys,{size:16})})}function Ql(e){var m,f,p;const{t:n}=Ve(),o=e.forceOpenFolderIds.has(e.folder.documentId),[r,i]=x.useState(e.depth<1||o),a=r;x.useEffect(()=>{o&&i(!0)},[o,e.activeDocumentId]);const s=!!e.folder.descDocumentId&&e.folder.descDocumentId===e.activeDocumentId,l=e.folder.documentId===e.graphFocusAnchorId,u=e.selectedParentPath===e.folder.path,d=((m=e.dropHighlight)==null?void 0:m.kind)==="folder"&&e.dropHighlight.id===e.folder.documentId;function h(){e.onOpenFolder(e.folder.path,e.folder.descDocumentId)}return c.jsxs("div",{children:[c.jsxs("div",{className:"mdocs-tree-row mdocs-tree-folder mdocs-tree-folder-row"+(s?" active":u?" mdocs-tree-select-target":"")+(l?" mdocs-tree-row--graph-focus":"")+(d?" mdocs-tree-drop-target":""),"data-tree-id":e.folder.documentId,style:e.indent,onClick:h,onContextMenu:g=>{g.preventDefault(),g.stopPropagation(),e.onContextMenu({x:g.clientX,y:g.clientY,node:e.folder,parentPath:e.folder.path})},onDragEnter:g=>{Dt(e.onMoveDocument)&&(g.preventDefault(),g.stopPropagation(),e.setDropHighlight({kind:"folder",id:e.folder.documentId}),i(!0))},onDragOver:g=>{Dt(e.onMoveDocument)&&(g.preventDefault(),g.stopPropagation(),g.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"folder",id:e.folder.documentId}))},onDrop:g=>{if(!e.onMoveDocument||!Dt(e.onMoveDocument))return;g.preventDefault(),g.stopPropagation();const w=or(g.dataTransfer),b=e.folder.documentId;e.endDragSession(),w&&e.onMoveDocument(w,b)},children:[c.jsx("span",{className:"mdocs-tree-caret",role:"button",tabIndex:0,"aria-expanded":a,"aria-label":n(a?"collapseFolder":"expandFolder"),onClick:g=>{g.stopPropagation(),i(w=>!w)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),i(w=>!w))},children:a?"▾":"▸"}),c.jsx(Zl,{}),c.jsx("span",{className:"mdocs-tree-folder-select",children:c.jsx("span",{className:"mdocs-tree-label",title:((f=e.folder.folderDisplayName)==null?void 0:f.trim())||e.folder.name,children:((p=e.folder.folderDisplayName)==null?void 0:p.trim())||e.folder.name})}),(e.onOpenGraph||e.onGenerateGraph)&&c.jsxs("span",{className:"mdocs-tree-hover-actions",onClick:g=>g.stopPropagation(),children:[e.onOpenGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"查看图谱",onClick:g=>{var w;g.stopPropagation(),(w=e.onOpenGraph)==null||w.call(e,e.folder)},children:c.jsx(er,{size:14,strokeWidth:1.75})}),e.onGenerateGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"生成图谱",onClick:g=>{var w;g.stopPropagation(),(w=e.onGenerateGraph)==null||w.call(e,e.folder)},children:c.jsx(Bi,{size:14,strokeWidth:1.75})})]})]}),a&&e.folder.children.map(g=>c.jsx(Yi,{node:g,depth:e.depth+1,parentPath:e.folder.path,parentFolderId:e.folder.documentId,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:e.forceOpenFolderIds,dropHighlight:e.dropHighlight,setDropHighlight:e.setDropHighlight,clearDropHighlight:e.clearDropHighlight,beginDragSession:e.beginDragSession,endDragSession:e.endDragSession,draggingId:e.draggingId,onOpen:e.onOpen,onOpenFolder:e.onOpenFolder,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument,onOpenGraph:e.onOpenGraph,onGenerateGraph:e.onGenerateGraph},g.path))]})}function ec(e,n){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r,i,a,s,l=[],u=!0,d=!1;try{if(a=(o=o.call(e)).next,n===0){if(Object(o)!==o)return;u=!1}else for(;!(u=(r=a.call(o)).done)&&(l.push(r.value),l.length!==n);u=!0);}catch(h){d=!0,i=h}finally{try{if(!u&&o.return!=null&&(s=o.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function tc(e,n,o){return n=cc(n),n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function Jr(e,n){return rc(e)||ec(e,n)||Ji(e,n)||sc()}function nc(e){return oc(e)||ic(e)||Ji(e)||ac()}function oc(e){if(Array.isArray(e))return Bo(e)}function rc(e){if(Array.isArray(e))return e}function ic(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ji(e,n){if(e){if(typeof e=="string")return Bo(e,n);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set")return Array.from(e);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return Bo(e,n)}}function Bo(e,n){(n==null||n>e.length)&&(n=e.length);for(var o=0,r=new Array(n);o<n;o++)r[o]=e[o];return r}function ac(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
256
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
257
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lc(e,n){if(typeof e!="object"||e===null)return e;var o=e[Symbol.toPrimitive];if(o!==void 0){var r=o.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function cc(e){var n=lc(e,"string");return typeof n=="symbol"?n:String(n)}var dc=function(n,o){var r=new Set(o);return Object.assign.apply(Object,[{}].concat(nc(Object.entries(n).filter(function(i){var a=Jr(i,1),s=a[0];return!r.has(s)}).map(function(i){var a=Jr(i,2),s=a[0],l=a[1];return tc({},s,l)}))))};function uc(e,{wrapperElementType:n="div",nodeMapper:o=a=>a,methodNames:r=[],initPropNames:i=[]}={}){return x.forwardRef((a,s)=>{const l=x.useRef(),u=x.useMemo(()=>{const m=Object.fromEntries(i.filter(f=>a.hasOwnProperty(f)).map(f=>[f,a[f]]));return e(m)},[]);Xr(()=>{u(o(l.current))},x.useLayoutEffect),Xr(()=>u._destructor instanceof Function?u._destructor:void 0);const d=x.useCallback((m,...f)=>u[m]instanceof Function?u[m](...f):void 0,[u]),h=x.useRef({});return Object.keys(dc(a,[...r,...i])).filter(m=>h.current[m]!==a[m]).forEach(m=>d(m,a[m])),h.current=a,x.useImperativeHandle(s,()=>Object.fromEntries(r.map(m=>[m,(...f)=>d(m,...f)])),[d]),zi.createElement(n,{ref:l})})}function Xr(e,n=x.useEffect){const o=x.useRef(),r=x.useRef(!1),i=x.useRef(!1),[a,s]=x.useState(0);r.current&&(i.current=!0),n(()=>(r.current||(o.current=e(),r.current=!0),s(l=>l+1),()=>{i.current&&(o.current&&o.current(),o.current=void 0,r.current=!1,i.current=!1)}),[])}var Ut=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Ut.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Ut.Bounce.In(e*2)*.5:Ut.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),vn=function(){return performance.now()},Xi=function(){function e(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,n)}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(o){return n._tweens[o]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var n,o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];for(var i=0,a=o;i<a.length;i++){var s=a[i];(n=s._group)===null||n===void 0||n.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];for(var r=0,i=n;r<i.length;r++){var a=i[r];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(n){return!n.isPlaying()})},e.prototype.update=function(n,o){n===void 0&&(n=vn()),o===void 0&&(o=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<r.length;i++){var a=this._tweens[r[i]],s=!o;a&&a.update(n,s)===!1&&!o&&this.remove(a)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Ho={Linear:function(e,n){var o=e.length-1,r=o*n,i=Math.floor(r),a=Ho.Utils.Linear;return n<0?a(e[0],e[1],r):n>1?a(e[o],e[o-1],o-r):a(e[i],e[i+1>o?o:i+1],r-i)},Utils:{Linear:function(e,n,o){return(n-e)*o+e}}},Zi=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Vo=new Xi,Zr=function(){function e(n,o){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ut.Linear.None,this._interpolationFunction=Ho.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Zi.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=n,typeof o=="object"?(this._group=o,o.add(this)):o===!0&&(this._group=Vo,Vo.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,o){if(o===void 0&&(o=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=o<0?0:o,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,o){if(n===void 0&&(n=vn()),o===void 0&&(o=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||o){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var a in this._valuesEnd)i[a]=this._valuesEnd[a];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,o)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,o,r,i,a){for(var s in r){var l=n[s],u=Array.isArray(l),d=u?"array":typeof l,h=!u&&Array.isArray(r[s]);if(!(d==="undefined"||d==="function")){if(h){var m=r[s];if(m.length===0)continue;for(var f=[l],p=0,g=m.length;p<g;p+=1){var w=this._handleRelativeValue(l,m[p]);if(isNaN(w)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(w)}h&&(r[s]=f)}if((d==="object"||u)&&l&&!h){o[s]=u?[]:{};var b=l;for(var v in b)o[s][v]=b[v];i[s]=u?[]:{};var m=r[s];if(!this._isDynamic){var S={};for(var v in m)S[v]=m[v];r[s]=m=S}this._setupProperties(b,o[s],m,i[s],a)}else(typeof o[s]>"u"||a)&&(o[s]=l),u||(o[s]*=1),h?i[s]=r[s].slice().reverse():i[s]=o[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(n){return n===void 0&&(n=vn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=vn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var n=0,o=this._chainedTweens.length;n<o;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n?(n.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var n;return(n=this._group)===null||n===void 0||n.remove(this),this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Ut.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=Ho.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,o){var r=this,i;if(n===void 0&&(n=vn()),o===void 0&&(o=e.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(o)this.start(n,!0);else return!1;if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=n-this._startTime,l=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),u=this._duration+this._repeat*l,d=function(){if(r._duration===0||s>u)return 1;var w=Math.trunc(s/l),b=s-w*l,v=Math.min(b/r._duration,1);return v===0&&s===r._duration?1:v},h=d(),m=this._easingFunction(h);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,m),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),this._duration===0||s>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((s-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,g=this._chainedTweens.length;p<g;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,o,r,i){for(var a in r)if(o[a]!==void 0){var s=o[a]||0,l=r[a],u=Array.isArray(n[a]),d=Array.isArray(l),h=!u&&d;h?n[a]=this._interpolationFunction(l,i):typeof l=="object"&&l?this._updateProperties(n[a],s,l,i):(l=this._handleRelativeValue(s,l),typeof l=="number"&&(n[a]=s+(l-s)*i))}},e.prototype._handleRelativeValue=function(n,o){return typeof o!="string"?o:o.charAt(0)==="+"||o.charAt(0)==="-"?n+parseFloat(o):parseFloat(o)},e.prototype._swapEndStartRepeatValues=function(n){var o=this._valuesStartRepeat[n],r=this._valuesEnd[n];typeof r=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(r):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=o},e.autoStartOnUpdate=!1,e}();Zi.nextId;var lt=Vo;lt.getAll.bind(lt);lt.removeAll.bind(lt);lt.add.bind(lt);lt.remove.bind(lt);lt.update.bind(lt);function Qr(e,n){(n==null||n>e.length)&&(n=e.length);for(var o=0,r=Array(n);o<n;o++)r[o]=e[o];return r}function fc(e){if(Array.isArray(e))return e}function mc(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function hc(e,n,o){return Object.defineProperty(e,"prototype",{writable:!1}),e}function pc(e,n){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r,i,a,s,l=[],u=!0,d=!1;try{if(a=(o=o.call(e)).next,n!==0)for(;!(u=(r=a.call(o)).done)&&(l.push(r.value),l.length!==n);u=!0);}catch(h){d=!0,i=h}finally{try{if(!u&&o.return!=null&&(s=o.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function gc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
258
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yc(e,n){return fc(e)||pc(e,n)||vc(e,n)||gc()}function vc(e,n){if(e){if(typeof e=="string")return Qr(e,n);var o={}.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Qr(e,n):void 0}}var bc=hc(function e(n,o){var r=o.default,i=r===void 0?null:r,a=o.triggerUpdate,s=a===void 0?!0:a,l=o.onChange,u=l===void 0?function(d,h){}:l;mc(this,e),this.name=n,this.defaultVal=i,this.triggerUpdate=s,this.onChange=u});function rr(e){var n=e.stateInit,o=n===void 0?function(){return{}}:n,r=e.props,i=r===void 0?{}:r,a=e.methods,s=a===void 0?{}:a,l=e.aliases,u=l===void 0?{}:l,d=e.init,h=d===void 0?function(){}:d,m=e.update,f=m===void 0?function(){}:m,p=Object.keys(i).map(function(g){return new bc(g,i[g])});return function g(){for(var w=arguments.length,b=new Array(w),v=0;v<w;v++)b[v]=arguments[v];var S=!!(this instanceof g&&this.constructor),D=S?b.shift():void 0,P=b[0],_=P===void 0?{}:P,T=Object.assign({},o instanceof Function?o(_):o,{initialised:!1}),I={};function N(O){return L(O,_),E(),N}var L=function($,V){h.call(N,$,T,V),T.initialised=!0},E=ps(function(){T.initialised&&(f.call(N,T,I),I={})},1);return p.forEach(function(O){N[O.name]=$(O);function $(V){var J=V.name,ne=V.triggerUpdate,B=ne===void 0?!1:ne,G=V.onChange,ce=G===void 0?function(ie,oe){}:G,ue=V.defaultVal,A=ue===void 0?null:ue;return function(ie){var oe=T[J];if(!arguments.length)return oe;var re=ie===void 0?A:ie;return T[J]=re,ce.call(N,re,T,oe),!I.hasOwnProperty(J)&&(I[J]=oe),B&&E(),N}}}),Object.keys(s).forEach(function(O){N[O]=function(){for(var $,V=arguments.length,J=new Array(V),ne=0;ne<V;ne++)J[ne]=arguments[ne];return($=s[O]).call.apply($,[N,T].concat(J))}}),Object.entries(u).forEach(function(O){var $=yc(O,2),V=$[0],J=$[1];return N[V]=N[J]}),N.resetProps=function(){return p.forEach(function(O){N[O.name](O.defaultVal)}),N},N.resetProps(),T._rerender=E,S&&D&&N(D),N}}var ae=function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}};function Wn(e){"@babel/helpers - typeof";return Wn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Wn(e)}var xc=/^\s+/,wc=/\s+$/;function Y(e,n){if(e=e||"",n=n||{},e instanceof Y)return e;if(!(this instanceof Y))return new Y(e,n);var o=_c(e);this._originalInput=e,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||o.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}Y.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),o,r,i,a,s,l;return o=n.r/255,r=n.g/255,i=n.b/255,o<=.03928?a=o/12.92:a=Math.pow((o+.055)/1.055,2.4),r<=.03928?s=r/12.92:s=Math.pow((r+.055)/1.055,2.4),i<=.03928?l=i/12.92:l=Math.pow((i+.055)/1.055,2.4),.2126*a+.7152*s+.0722*l},setAlpha:function(n){return this._a=Qi(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=ti(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=ti(this._r,this._g,this._b),o=Math.round(n.h*360),r=Math.round(n.s*100),i=Math.round(n.v*100);return this._a==1?"hsv("+o+", "+r+"%, "+i+"%)":"hsva("+o+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var n=ei(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=ei(this._r,this._g,this._b),o=Math.round(n.h*360),r=Math.round(n.s*100),i=Math.round(n.l*100);return this._a==1?"hsl("+o+", "+r+"%, "+i+"%)":"hsla("+o+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(n){return ni(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return Cc(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(pe(this._r,255)*100)+"%",g:Math.round(pe(this._g,255)*100)+"%",b:Math.round(pe(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(pe(this._r,255)*100)+"%, "+Math.round(pe(this._g,255)*100)+"%, "+Math.round(pe(this._b,255)*100)+"%)":"rgba("+Math.round(pe(this._r,255)*100)+"%, "+Math.round(pe(this._g,255)*100)+"%, "+Math.round(pe(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Lc[ni(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var o="#"+oi(this._r,this._g,this._b,this._a),r=o,i=this._gradientType?"GradientType = 1, ":"";if(n){var a=Y(n);r="#"+oi(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+o+",endColorstr="+r+")"},toString:function(n){var o=!!n;n=n||this._format;var r=!1,i=this._a<1&&this._a>=0,a=!o&&i&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return a?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(r=this.toRgbString()),n==="prgb"&&(r=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(r=this.toHexString()),n==="hex3"&&(r=this.toHexString(!0)),n==="hex4"&&(r=this.toHex8String(!0)),n==="hex8"&&(r=this.toHex8String()),n==="name"&&(r=this.toName()),n==="hsl"&&(r=this.toHslString()),n==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return Y(this.toString())},_applyModification:function(n,o){var r=n.apply(null,[this].concat([].slice.call(o)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Tc,arguments)},brighten:function(){return this._applyModification(Ac,arguments)},darken:function(){return this._applyModification(Mc,arguments)},desaturate:function(){return this._applyModification(Dc,arguments)},saturate:function(){return this._applyModification(Nc,arguments)},greyscale:function(){return this._applyModification(Pc,arguments)},spin:function(){return this._applyModification(jc,arguments)},_applyCombination:function(n,o){return n.apply(null,[this].concat([].slice.call(o)))},analogous:function(){return this._applyCombination(Oc,arguments)},complement:function(){return this._applyCombination(Ec,arguments)},monochromatic:function(){return this._applyCombination(Fc,arguments)},splitcomplement:function(){return this._applyCombination(Rc,arguments)},triad:function(){return this._applyCombination(ri,[3])},tetrad:function(){return this._applyCombination(ri,[4])}};Y.fromRatio=function(e,n){if(Wn(e)=="object"){var o={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?o[r]=e[r]:o[r]=bn(e[r]));e=o}return Y(e,n)};function _c(e){var n={r:0,g:0,b:0},o=1,r=null,i=null,a=null,s=!1,l=!1;return typeof e=="string"&&(e=Bc(e)),Wn(e)=="object"&&(ut(e.r)&&ut(e.g)&&ut(e.b)?(n=Ic(e.r,e.g,e.b),s=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):ut(e.h)&&ut(e.s)&&ut(e.v)?(r=bn(e.s),i=bn(e.v),n=Sc(e.h,r,i),s=!0,l="hsv"):ut(e.h)&&ut(e.s)&&ut(e.l)&&(r=bn(e.s),a=bn(e.l),n=kc(e.h,r,a),s=!0,l="hsl"),e.hasOwnProperty("a")&&(o=e.a)),o=Qi(o),{ok:s,format:e.format||l,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:o}}function Ic(e,n,o){return{r:pe(e,255)*255,g:pe(n,255)*255,b:pe(o,255)*255}}function ei(e,n,o){e=pe(e,255),n=pe(n,255),o=pe(o,255);var r=Math.max(e,n,o),i=Math.min(e,n,o),a,s,l=(r+i)/2;if(r==i)a=s=0;else{var u=r-i;switch(s=l>.5?u/(2-r-i):u/(r+i),r){case e:a=(n-o)/u+(n<o?6:0);break;case n:a=(o-e)/u+2;break;case o:a=(e-n)/u+4;break}a/=6}return{h:a,s,l}}function kc(e,n,o){var r,i,a;e=pe(e,360),n=pe(n,100),o=pe(o,100);function s(d,h,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?d+(h-d)*6*m:m<1/2?h:m<2/3?d+(h-d)*(2/3-m)*6:d}if(n===0)r=i=a=o;else{var l=o<.5?o*(1+n):o+n-o*n,u=2*o-l;r=s(u,l,e+1/3),i=s(u,l,e),a=s(u,l,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function ti(e,n,o){e=pe(e,255),n=pe(n,255),o=pe(o,255);var r=Math.max(e,n,o),i=Math.min(e,n,o),a,s,l=r,u=r-i;if(s=r===0?0:u/r,r==i)a=0;else{switch(r){case e:a=(n-o)/u+(n<o?6:0);break;case n:a=(o-e)/u+2;break;case o:a=(e-n)/u+4;break}a/=6}return{h:a,s,v:l}}function Sc(e,n,o){e=pe(e,360)*6,n=pe(n,100),o=pe(o,100);var r=Math.floor(e),i=e-r,a=o*(1-n),s=o*(1-i*n),l=o*(1-(1-i)*n),u=r%6,d=[o,s,a,a,l,o][u],h=[l,o,o,s,a,a][u],m=[a,a,l,o,o,s][u];return{r:d*255,g:h*255,b:m*255}}function ni(e,n,o,r){var i=[Xe(Math.round(e).toString(16)),Xe(Math.round(n).toString(16)),Xe(Math.round(o).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function Cc(e,n,o,r,i){var a=[Xe(Math.round(e).toString(16)),Xe(Math.round(n).toString(16)),Xe(Math.round(o).toString(16)),Xe(ea(r))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function oi(e,n,o,r){var i=[Xe(ea(r)),Xe(Math.round(e).toString(16)),Xe(Math.round(n).toString(16)),Xe(Math.round(o).toString(16))];return i.join("")}Y.equals=function(e,n){return!e||!n?!1:Y(e).toRgbString()==Y(n).toRgbString()};Y.random=function(){return Y.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Dc(e,n){n=n===0?0:n||10;var o=Y(e).toHsl();return o.s-=n/100,o.s=to(o.s),Y(o)}function Nc(e,n){n=n===0?0:n||10;var o=Y(e).toHsl();return o.s+=n/100,o.s=to(o.s),Y(o)}function Pc(e){return Y(e).desaturate(100)}function Tc(e,n){n=n===0?0:n||10;var o=Y(e).toHsl();return o.l+=n/100,o.l=to(o.l),Y(o)}function Ac(e,n){n=n===0?0:n||10;var o=Y(e).toRgb();return o.r=Math.max(0,Math.min(255,o.r-Math.round(255*-(n/100)))),o.g=Math.max(0,Math.min(255,o.g-Math.round(255*-(n/100)))),o.b=Math.max(0,Math.min(255,o.b-Math.round(255*-(n/100)))),Y(o)}function Mc(e,n){n=n===0?0:n||10;var o=Y(e).toHsl();return o.l-=n/100,o.l=to(o.l),Y(o)}function jc(e,n){var o=Y(e).toHsl(),r=(o.h+n)%360;return o.h=r<0?360+r:r,Y(o)}function Ec(e){var n=Y(e).toHsl();return n.h=(n.h+180)%360,Y(n)}function ri(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var o=Y(e).toHsl(),r=[Y(e)],i=360/n,a=1;a<n;a++)r.push(Y({h:(o.h+a*i)%360,s:o.s,l:o.l}));return r}function Rc(e){var n=Y(e).toHsl(),o=n.h;return[Y(e),Y({h:(o+72)%360,s:n.s,l:n.l}),Y({h:(o+216)%360,s:n.s,l:n.l})]}function Oc(e,n,o){n=n||6,o=o||30;var r=Y(e).toHsl(),i=360/o,a=[Y(e)];for(r.h=(r.h-(i*n>>1)+720)%360;--n;)r.h=(r.h+i)%360,a.push(Y(r));return a}function Fc(e,n){n=n||6;for(var o=Y(e).toHsv(),r=o.h,i=o.s,a=o.v,s=[],l=1/n;n--;)s.push(Y({h:r,s:i,v:a})),a=(a+l)%1;return s}Y.mix=function(e,n,o){o=o===0?0:o||50;var r=Y(e).toRgb(),i=Y(n).toRgb(),a=o/100,s={r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a};return Y(s)};Y.readability=function(e,n){var o=Y(e),r=Y(n);return(Math.max(o.getLuminance(),r.getLuminance())+.05)/(Math.min(o.getLuminance(),r.getLuminance())+.05)};Y.isReadable=function(e,n,o){var r=Y.readability(e,n),i,a;switch(a=!1,i=Hc(o),i.level+i.size){case"AAsmall":case"AAAlarge":a=r>=4.5;break;case"AAlarge":a=r>=3;break;case"AAAsmall":a=r>=7;break}return a};Y.mostReadable=function(e,n,o){var r=null,i=0,a,s,l,u;o=o||{},s=o.includeFallbackColors,l=o.level,u=o.size;for(var d=0;d<n.length;d++)a=Y.readability(e,n[d]),a>i&&(i=a,r=Y(n[d]));return Y.isReadable(e,r,{level:l,size:u})||!s?r:(o.includeFallbackColors=!1,Y.mostReadable(e,["#fff","#000"],o))};var Go=Y.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Lc=Y.hexNames=zc(Go);function zc(e){var n={};for(var o in e)e.hasOwnProperty(o)&&(n[e[o]]=o);return n}function Qi(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function pe(e,n){$c(e)&&(e="100%");var o=Uc(e);return e=Math.min(n,Math.max(0,parseFloat(e))),o&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function to(e){return Math.min(1,Math.max(0,e))}function ze(e){return parseInt(e,16)}function $c(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Uc(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Xe(e){return e.length==1?"0"+e:""+e}function bn(e){return e<=1&&(e=e*100+"%"),e}function ea(e){return Math.round(parseFloat(e)*255).toString(16)}function ii(e){return ze(e)/255}var Ye=function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",o="(?:"+n+")|(?:"+e+")",r="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?",i="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?";return{CSS_UNIT:new RegExp(o),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function ut(e){return!!Ye.CSS_UNIT.exec(e)}function Bc(e){e=e.replace(xc,"").replace(wc,"").toLowerCase();var n=!1;if(Go[e])e=Go[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var o;return(o=Ye.rgb.exec(e))?{r:o[1],g:o[2],b:o[3]}:(o=Ye.rgba.exec(e))?{r:o[1],g:o[2],b:o[3],a:o[4]}:(o=Ye.hsl.exec(e))?{h:o[1],s:o[2],l:o[3]}:(o=Ye.hsla.exec(e))?{h:o[1],s:o[2],l:o[3],a:o[4]}:(o=Ye.hsv.exec(e))?{h:o[1],s:o[2],v:o[3]}:(o=Ye.hsva.exec(e))?{h:o[1],s:o[2],v:o[3],a:o[4]}:(o=Ye.hex8.exec(e))?{r:ze(o[1]),g:ze(o[2]),b:ze(o[3]),a:ii(o[4]),format:n?"name":"hex8"}:(o=Ye.hex6.exec(e))?{r:ze(o[1]),g:ze(o[2]),b:ze(o[3]),format:n?"name":"hex"}:(o=Ye.hex4.exec(e))?{r:ze(o[1]+""+o[1]),g:ze(o[2]+""+o[2]),b:ze(o[3]+""+o[3]),a:ii(o[4]+""+o[4]),format:n?"name":"hex8"}:(o=Ye.hex3.exec(e))?{r:ze(o[1]+""+o[1]),g:ze(o[2]+""+o[2]),b:ze(o[3]+""+o[3]),format:n?"name":"hex"}:!1}function Hc(e){var n,o;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),o=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),o!=="small"&&o!=="large"&&(o="small"),{level:n,size:o}}function Wo(e,n){(n==null||n>e.length)&&(n=e.length);for(var o=0,r=Array(n);o<n;o++)r[o]=e[o];return r}function Vc(e){if(Array.isArray(e))return Wo(e)}function ta(e,n,o){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:o;throw new TypeError("Private element is not present on this object")}function Gc(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Wc(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function Ue(e,n){return e.get(ta(e,n))}function ai(e,n,o){Gc(e,n),n.set(e,o)}function si(e,n,o){return e.set(ta(e,n),o),o}function qc(e,n){for(var o=0;o<n.length;o++){var r=n[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Qc(r.key),r)}}function Kc(e,n,o){return n&&qc(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yc(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Jc(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
259
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xc(e){return Vc(e)||Yc(e)||ed(e)||Jc()}function Zc(e,n){if(typeof e!="object"||!e)return e;var o=e[Symbol.toPrimitive];if(o!==void 0){var r=o.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Qc(e){var n=Zc(e,"string");return typeof n=="symbol"?n:n+""}function ed(e,n){if(e){if(typeof e=="string")return Wo(e,n);var o={}.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Wo(e,n):void 0}}var td=123,nd=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},na=function(n,o,r){return(n<<16)+(o<<8)+r},od=function(n){var o=Y(n).toRgb(),r=o.r,i=o.g,a=o.b;return na(r,i,a)},li=function(n,o){return n*td%Math.pow(2,o)},Lt=new WeakMap,ft=new WeakMap,rd=function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;Wc(this,e),ai(this,Lt,void 0),ai(this,ft,void 0),si(ft,this,n),this.reset()}return Kc(e,[{key:"reset",value:function(){si(Lt,this,["__reserved for background__"])}},{key:"register",value:function(o){if(Ue(Lt,this).length>=Math.pow(2,24-Ue(ft,this)))return null;var r=Ue(Lt,this).length,i=li(r,Ue(ft,this)),a=nd(r+(i<<24-Ue(ft,this)));return Ue(Lt,this).push(o),a}},{key:"lookup",value:function(o){if(!o)return null;var r=typeof o=="string"?od(o):na.apply(void 0,Xc(o));if(!r)return null;var i=r&Math.pow(2,24-Ue(ft,this))-1,a=r>>24-Ue(ft,this)&Math.pow(2,Ue(ft,this))-1;return li(i,Ue(ft,this))!==a||i>=Ue(Lt,this).length?null:Ue(Lt,this)[i]}}])}(),Dn,ge,oa,ra,Ct,ci,ia,aa,bo,Un,xn,sa,ir,qo,Ko,qn={},Kn=[],id=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,no=Array.isArray;function at(e,n){for(var o in n)e[o]=n[o];return e}function ar(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ad(e,n,o){var r,i,a,s={};for(a in n)a=="key"?r=n[a]:a=="ref"?i=n[a]:s[a]=n[a];if(arguments.length>2&&(s.children=arguments.length>3?Dn.call(arguments,2):o),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return wn(e,s,r,i,null)}function wn(e,n,o,r,i){var a={type:e,props:n,key:o,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++oa,__i:-1,__u:0};return i==null&&ge.vnode!=null&&ge.vnode(a),a}function oo(e){return e.children}function Bn(e,n){this.props=e,this.context=n}function Ht(e,n){if(n==null)return e.__?Ht(e.__,e.__i+1):null;for(var o;n<e.__k.length;n++)if((o=e.__k[n])!=null&&o.__e!=null)return o.__e;return typeof e.type=="function"?Ht(e):null}function sd(e){if(e.__P&&e.__d){var n=e.__v,o=n.__e,r=[],i=[],a=at({},n);a.__v=n.__v+1,ge.vnode&&ge.vnode(a),sr(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[o]:null,r,o??Ht(n),!!(32&n.__u),i),a.__v=n.__v,a.__.__k[a.__i]=a,fa(r,a,i),n.__e=n.__=null,a.__e!=o&&la(a)}}function la(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),la(e)}function di(e){(!e.__d&&(e.__d=!0)&&Ct.push(e)&&!Yn.__r++||ci!=ge.debounceRendering)&&((ci=ge.debounceRendering)||ia)(Yn)}function Yn(){try{for(var e,n=1;Ct.length;)Ct.length>n&&Ct.sort(aa),e=Ct.shift(),n=Ct.length,sd(e)}finally{Ct.length=Yn.__r=0}}function ca(e,n,o,r,i,a,s,l,u,d,h){var m,f,p,g,w,b,v=r&&r.__k||Kn,S=n.length;for(u=ld(o,n,v,u,S),m=0;m<S;m++)(p=o.__k[m])!=null&&(f=p.__i!=-1&&v[p.__i]||qn,p.__i=m,b=sr(e,p,f,i,a,s,l,u,d,h),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&lr(f.ref,null,p),h.push(p.ref,p.__c||g,p)),w==null&&g!=null&&(w=g),4&p.__u?(u=da(p,u,e),f.__e&&(f.__e=null)):typeof p.type=="function"&&b!==void 0?u=b:g&&(u=g.nextSibling),p.__u&=-7);return o.__e=w,u}function ld(e,n,o,r,i){var a,s,l,u,d,h=o.length,m=h,f=0;for(e.__k=new Array(i),a=0;a<i;a++)(s=n[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=wn(null,s,null,null,null):no(s)?s=e.__k[a]=wn(oo,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=wn(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,u=a+f,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=cd(s,o,u,m))!=-1&&(m--,(l=o[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(i>h?f--:i<h&&f++),typeof s.type!="function"&&(s.__u|=4)):d!=u&&(d==u-1?f--:d==u+1?f++:(d>u?f--:f++,s.__u|=4))):e.__k[a]=null;if(m)for(a=0;a<h;a++)(l=o[a])!=null&&!(2&l.__u)&&(l.__e==r&&(r=Ht(l)),ha(l,l));return r}function da(e,n,o){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,n=da(r[i],n,o));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=Ht(e)),n=o.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function cd(e,n,o,r){var i,a,s,l=e.key,u=e.type,d=n[o],h=d!=null&&(2&d.__u)==0;if(d===null&&l==null||h&&l==d.key&&u==d.type)return o;if(r>(h?1:0)){for(i=o-1,a=o+1;i>=0||a<n.length;)if((d=n[s=i>=0?i--:a++])!=null&&!(2&d.__u)&&l==d.key&&u==d.type)return s}return-1}function ui(e,n,o){n[0]=="-"?e.setProperty(n,o??""):e[n]=o==null?"":typeof o!="number"||id.test(n)?o:o+"px"}function Ln(e,n,o,r,i){var a,s;e:if(n=="style")if(typeof o=="string")e.style.cssText=o;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(n in r)o&&n in o||ui(e.style,n,"");if(o)for(n in o)r&&o[n]==r[n]||ui(e.style,n,o[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(sa,"$1")),s=n.toLowerCase(),n=s in e||n=="onFocusOut"||n=="onFocusIn"?s.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=o,o?r?o[xn]=r[xn]:(o[xn]=ir,e.addEventListener(n,a?Ko:qo,a)):e.removeEventListener(n,a?Ko:qo,a);else{if(i=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=o??"";break e}catch{}typeof o=="function"||(o==null||o===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&o==1?"":o))}}function fi(e){return function(n){if(this.l){var o=this.l[n.type+e];if(n[Un]==null)n[Un]=ir++;else if(n[Un]<o[xn])return;return o(ge.event?ge.event(n):n)}}}function sr(e,n,o,r,i,a,s,l,u,d){var h,m,f,p,g,w,b,v,S,D,P,_,T,I,N,L,E=n.type;if(n.constructor!==void 0)return null;128&o.__u&&(u=!!(32&o.__u),a=[l=n.__e=o.__e]),(h=ge.__b)&&h(n);e:if(typeof E=="function"){m=s.length;try{if(S=n.props,D=E.prototype&&E.prototype.render,P=(h=E.contextType)&&r[h.__c],_=h?P?P.props.value:h.__:r,o.__c?v=(f=n.__c=o.__c).__=f.__E:(D?n.__c=f=new E(S,_):(n.__c=f=new Bn(S,_),f.constructor=E,f.render=ud),P&&P.sub(f),f.state||(f.state={}),f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),D&&f.__s==null&&(f.__s=f.state),D&&E.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=at({},f.__s)),at(f.__s,E.getDerivedStateFromProps(S,f.__s))),g=f.props,w=f.state,f.__v=n,p)D&&E.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),D&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(D&&E.getDerivedStateFromProps==null&&S!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(S,_),n.__v==o.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(S,f.__s,_)===!1){n.__v!=o.__v&&(f.props=S,f.state=f.__s,f.__d=!1),n.__e=o.__e,n.__k=o.__k,n.__k.some(function(O){O&&(O.__=n)}),Kn.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f),l=Ht(o);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(S,f.__s,_),D&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,w,b)})}if(f.context=_,f.props=S,f.__P=e,f.__e=!1,T=ge.__r,I=0,D)f.state=f.__s,f.__d=!1,T&&T(n),h=f.render(f.props,f.state,f.context),Kn.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(n),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++I<25);f.state=f.__s,f.getChildContext!=null&&(r=at(at({},r),f.getChildContext())),D&&!p&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(g,w)),N=h!=null&&h.type===oo&&h.key==null?ma(h.props.children):h,l=ca(e,no(N)?N:[N],n,o,r,i,a,s,l,u,d),f.base=n.__e,n.__u&=-161,f.__h.length&&s.push(f),v&&(f.__E=f.__=null)}catch(O){if(s.length=m,n.__v=null,u||a!=null){if(O.then){for(n.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),n.__e=l}else if(a!=null)for(L=a.length;L--;)ar(a[L])}else n.__e=o.__e;n.__k==null&&(n.__k=o.__k||[]),O.then||ua(n),ge.__e(O,n,o)}}else a==null&&n.__v==o.__v?(n.__k=o.__k,n.__e=o.__e):l=n.__e=dd(o.__e,n,o,r,i,a,s,u,d);return(h=ge.diffed)&&h(n),128&n.__u?void 0:l}function ua(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ua))}function fa(e,n,o){for(var r=0;r<o.length;r++)lr(o[r],o[++r],o[++r]);ge.__c&&ge.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){ge.__e(a,i.__v)}})}function ma(e){return typeof e!="object"||e==null||e.__b>0?e:no(e)?e.map(ma):e.constructor!==void 0?null:at({},e)}function dd(e,n,o,r,i,a,s,l,u){var d,h,m,f,p,g,w,b=o.props||qn,v=n.props,S=n.type;if(S=="svg"?i="http://www.w3.org/2000/svg":S=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((p=a[d])&&"setAttribute"in p==!!S&&(S?p.localName==S:p.nodeType==3)){e=p,a[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(v);e=document.createElementNS(i,S,v.is&&v),l&&(ge.__m&&ge.__m(n,a),l=!1),a=null}if(S==null)b===v||l&&e.data==v||(e.data=v);else{if(a=S=="textarea"&&v.defaultValue!=null?null:a&&Dn.call(e.childNodes),!l&&a!=null)for(b={},d=0;d<e.attributes.length;d++)b[(p=e.attributes[d]).name]=p.value;for(d in b)p=b[d],d=="dangerouslySetInnerHTML"?m=p:d=="children"||d in v||d=="value"&&"defaultValue"in v||d=="checked"&&"defaultChecked"in v||Ln(e,d,null,p,i);for(d in v)p=v[d],d=="children"?f=p:d=="dangerouslySetInnerHTML"?h=p:d=="value"?g=p:d=="checked"?w=p:l&&typeof p!="function"||b[d]===p||Ln(e,d,p,b[d],i);if(h)l||m&&(h.__html==m.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(m&&(e.innerHTML=""),ca(n.type=="template"?e.content:e,no(f)?f:[f],n,o,r,S=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:o.__k&&Ht(o,0),l,u),a!=null)for(d=a.length;d--;)ar(a[d]);l&&S!="textarea"||(d="value",S=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||S=="progress"&&!g||S=="option"&&g!=b[d])&&Ln(e,d,g,b[d],i),d="checked",w!=null&&w!=e[d]&&Ln(e,d,w,b[d],i))}return e}function lr(e,n,o){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&n==null||(e.__u=e(n))}else e.current=n}catch(i){ge.__e(i,o)}}function ha(e,n,o){var r,i;if(ge.unmount&&ge.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||lr(r,null,n)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){ge.__e(a,n)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&ha(r[i],n,o||typeof e.type!="function");o||ar(e.__e),e.__c=e.__=e.__e=void 0}function ud(e,n,o){return this.constructor(e,o)}function fd(e,n,o){var r,i,a,s;n==document&&(n=document.documentElement),ge.__&&ge.__(e,n),i=(r=!1)?null:n.__k,a=[],s=[],sr(n,e=n.__k=ad(oo,null,[e]),i||qn,qn,n.namespaceURI,i?null:n.firstChild?Dn.call(n.childNodes):null,a,i?i.__e:n.firstChild,r,s),fa(a,e,s),e.props.children=null}function pa(e,n,o){var r,i,a,s,l=at({},e.props);for(a in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),n)a=="key"?r=n[a]:a=="ref"?i=n[a]:l[a]=n[a]===void 0&&s!=null?s[a]:n[a];return arguments.length>2&&(l.children=arguments.length>3?Dn.call(arguments,2):o),wn(e.type,l,r||e.key,i||e.ref,null)}Dn=Kn.slice,ge={__e:function(e,n,o,r){for(var i,a,s;n=n.__;)if((i=n.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(l){e=l}throw e}},oa=0,ra=function(e){return e!=null&&e.constructor===void 0},Bn.prototype.setState=function(e,n){var o;o=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=at({},this.state),typeof e=="function"&&(e=e(at({},o),this.props)),e&&at(o,e),e!=null&&this.__v&&(n&&this._sb.push(n),di(this))},Bn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),di(this))},Bn.prototype.render=oo,Ct=[],ia=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,aa=function(e,n){return e.__v.__b-n.__v.__b},Yn.__r=0,bo=Math.random().toString(8),Un="__d"+bo,xn="__a"+bo,sa=/(PointerCapture)$|Capture$/i,ir=0,qo=fi(!1),Ko=fi(!0);function mi(e,n){(n==null||n>e.length)&&(n=e.length);for(var o=0,r=Array(n);o<n;o++)r[o]=e[o];return r}function md(e){if(Array.isArray(e))return e}function hd(e,n,o){return(n=xd(n))in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function pd(e,n){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r,i,a,s,l=[],u=!0,d=!1;try{if(a=(o=o.call(e)).next,n!==0)for(;!(u=(r=a.call(o)).done)&&(l.push(r.value),l.length!==n);u=!0);}catch(h){d=!0,i=h}finally{try{if(!u&&o.return!=null&&(s=o.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function gd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
260
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hi(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,r)}return o}function yd(e){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};n%2?hi(Object(o),!0).forEach(function(r){hd(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):hi(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function vd(e,n){return md(e)||pd(e,n)||wd(e,n)||gd()}function bd(e,n){if(typeof e!="object"||!e)return e;var o=e[Symbol.toPrimitive];if(o!==void 0){var r=o.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function xd(e){var n=bd(e,"string");return typeof n=="symbol"?n:n+""}function Jn(e){"@babel/helpers - typeof";return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Jn(e)}function wd(e,n){if(e){if(typeof e=="string")return mi(e,n);var o={}.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?mi(e,n):void 0}}var Yo=function(n){if(Jn(n)!=="object")return n;var o=pa(n);if(o.props){var r;o.props=yd({},o.props),o!=null&&(r=o.props)!==null&&r!==void 0&&r.children&&(o.props.children=Array.isArray(o.props.children)?o.props.children.map(Yo):Yo(o.props.children))}return o},_d=function(n){return ra(pa(n))},Id=function(n,o){delete o.__k,fd(Yo(n),o)};function kd(e,n){n===void 0&&(n={});var o=n.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",o==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var Sd=`.float-tooltip-kap {
|
|
261
|
-
position: absolute;
|
|
262
|
-
width: max-content; /* prevent shrinking near right edge */
|
|
263
|
-
max-width: max(50%, 150px);
|
|
264
|
-
padding: 3px 5px;
|
|
265
|
-
border-radius: 3px;
|
|
266
|
-
font: 12px sans-serif;
|
|
267
|
-
color: #eee;
|
|
268
|
-
background: rgba(0,0,0,0.6);
|
|
269
|
-
pointer-events: none;
|
|
270
|
-
}
|
|
271
|
-
`;kd(Sd);var Cd=rr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,o){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.style,a=i===void 0?{}:i,s=!!n&&Jn(n)==="object"&&!!n.node&&typeof n.node=="function",l=Oo(s?n.node():n);l.style("position")==="static"&&l.style("position","relative"),o.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(a).forEach(function(d){var h=vd(d,2),m=h[0],f=h[1];return o.tooltipEl.style(m,f)}),o.tooltipEl.style("left","-10000px").style("display","none");var u="tooltip-".concat(Math.round(Math.random()*1e12));o.mouseInside=!1,l.on("mousemove.".concat(u),function(d){o.mouseInside=!0;var h=gs(d),m=l.node(),f=m.offsetWidth,p=m.offsetHeight,g=[o.offsetX===null||o.offsetX===void 0?"-".concat(h[0]/f*100,"%"):typeof o.offsetX=="number"?"calc(-50% + ".concat(o.offsetX,"px)"):o.offsetX,o.offsetY===null||o.offsetY===void 0?p>130&&p-h[1]<100?"calc(-100% - 6px)":"21px":typeof o.offsetY=="number"?o.offsetY<0?"calc(-100% - ".concat(Math.abs(o.offsetY),"px)"):"".concat(o.offsetY,"px"):o.offsetY];o.tooltipEl.style("left",h[0]+"px").style("top",h[1]+"px").style("transform","translate(".concat(g.join(","),")")),o.content&&o.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(u),function(){o.mouseInside=!0,o.content&&o.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(u),function(){o.mouseInside=!1,o.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):_d(n.content)?(n.tooltipEl.text(""),Id(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});function Dd(e,n,o){var r,i=1;e==null&&(e=0),n==null&&(n=0),o==null&&(o=0);function a(){var s,l=r.length,u,d=0,h=0,m=0;for(s=0;s<l;++s)u=r[s],d+=u.x||0,h+=u.y||0,m+=u.z||0;for(d=(d/l-e)*i,h=(h/l-n)*i,m=(m/l-o)*i,s=0;s<l;++s)u=r[s],d&&(u.x-=d),h&&(u.y-=h),m&&(u.z-=m)}return a.initialize=function(s){r=s},a.x=function(s){return arguments.length?(e=+s,a):e},a.y=function(s){return arguments.length?(n=+s,a):n},a.z=function(s){return arguments.length?(o=+s,a):o},a.strength=function(s){return arguments.length?(i=+s,a):i},a}function Nd(e){const n=+this._x.call(null,e);return ga(this.cover(n),n,e)}function ga(e,n,o){if(isNaN(n))return e;var r,i=e._root,a={data:o},s=e._x0,l=e._x1,u,d,h,m,f;if(!i)return e._root=a,e;for(;i.length;)if((h=n>=(u=(s+l)/2))?s=u:l=u,r=i,!(i=i[m=+h]))return r[m]=a,e;if(d=+e._x.call(null,i.data),n===d)return a.next=i,r?r[m]=a:e._root=a,e;do r=r?r[m]=new Array(2):e._root=new Array(2),(h=n>=(u=(s+l)/2))?s=u:l=u;while((m=+h)==(f=+(d>=u)));return r[f]=i,r[m]=a,e}function Pd(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,o=new Float64Array(n);let r=1/0,i=-1/0;for(let a=0,s;a<n;++a)isNaN(s=+this._x.call(null,e[a]))||(o[a]=s,s<r&&(r=s),s>i&&(i=s));if(r>i)return this;this.cover(r).cover(i);for(let a=0;a<n;++a)ga(this,o[a],e[a]);return this}function Td(e){if(isNaN(e=+e))return this;var n=this._x0,o=this._x1;if(isNaN(n))o=(n=Math.floor(e))+1;else{for(var r=o-n||1,i=this._root,a,s;n>e||e>=o;)switch(s=+(e<n),a=new Array(2),a[s]=i,i=a,r*=2,s){case 0:o=n+r;break;case 1:n=o-r;break}this._root&&this._root.length&&(this._root=i)}return this._x0=n,this._x1=o,this}function Ad(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function Md(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function yt(e,n,o){this.node=e,this.x0=n,this.x1=o}function jd(e,n){var o,r=this._x0,i,a,s=this._x1,l=[],u=this._root,d,h;for(u&&l.push(new yt(u,r,s)),n==null?n=1/0:(r=e-n,s=e+n);d=l.pop();)if(!(!(u=d.node)||(i=d.x0)>s||(a=d.x1)<r))if(u.length){var m=(i+a)/2;l.push(new yt(u[1],m,a),new yt(u[0],i,m)),(h=+(e>=m))&&(d=l[l.length-1],l[l.length-1]=l[l.length-1-h],l[l.length-1-h]=d)}else{var f=Math.abs(e-+this._x.call(null,u.data));f<n&&(n=f,r=e-f,s=e+f,o=u.data)}return o}function Ed(e){if(isNaN(u=+this._x.call(null,e)))return this;var n,o=this._root,r,i,a,s=this._x0,l=this._x1,u,d,h,m,f;if(!o)return this;if(o.length)for(;;){if((h=u>=(d=(s+l)/2))?s=d:l=d,n=o,!(o=o[m=+h]))return this;if(!o.length)break;n[m+1&1]&&(r=n,f=m)}for(;o.data!==e;)if(i=o,!(o=o.next))return this;return(a=o.next)&&delete o.next,i?(a?i.next=a:delete i.next,this):n?(a?n[m]=a:delete n[m],(o=n[0]||n[1])&&o===(n[1]||n[0])&&!o.length&&(r?r[f]=o:this._root=o),this):(this._root=a,this)}function Rd(e){for(var n=0,o=e.length;n<o;++n)this.remove(e[n]);return this}function Od(){return this._root}function Fd(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Ld(e){var n=[],o,r=this._root,i,a,s;for(r&&n.push(new yt(r,this._x0,this._x1));o=n.pop();)if(!e(r=o.node,a=o.x0,s=o.x1)&&r.length){var l=(a+s)/2;(i=r[1])&&n.push(new yt(i,l,s)),(i=r[0])&&n.push(new yt(i,a,l))}return this}function zd(e){var n=[],o=[],r;for(this._root&&n.push(new yt(this._root,this._x0,this._x1));r=n.pop();){var i=r.node;if(i.length){var a,s=r.x0,l=r.x1,u=(s+l)/2;(a=i[0])&&n.push(new yt(a,s,u)),(a=i[1])&&n.push(new yt(a,u,l))}o.push(r)}for(;r=o.pop();)e(r.node,r.x0,r.x1);return this}function $d(e){return e[0]}function Ud(e){return arguments.length?(this._x=e,this):this._x}function ya(e,n){var o=new cr(n??$d,NaN,NaN);return e==null?o:o.addAll(e)}function cr(e,n,o){this._x=e,this._x0=n,this._x1=o,this._root=void 0}function pi(e){for(var n={data:e.data},o=n;e=e.next;)o=o.next={data:e.data};return n}var Oe=ya.prototype=cr.prototype;Oe.copy=function(){var e=new cr(this._x,this._x0,this._x1),n=this._root,o,r;if(!n)return e;if(!n.length)return e._root=pi(n),e;for(o=[{source:n,target:e._root=new Array(2)}];n=o.pop();)for(var i=0;i<2;++i)(r=n.source[i])&&(r.length?o.push({source:r,target:n.target[i]=new Array(2)}):n.target[i]=pi(r));return e};Oe.add=Nd;Oe.addAll=Pd;Oe.cover=Td;Oe.data=Ad;Oe.extent=Md;Oe.find=jd;Oe.remove=Ed;Oe.removeAll=Rd;Oe.root=Od;Oe.size=Fd;Oe.visit=Ld;Oe.visitAfter=zd;Oe.x=Ud;function Bd(e){const n=+this._x.call(null,e),o=+this._y.call(null,e),r=+this._z.call(null,e);return va(this.cover(n,o,r),n,o,r,e)}function va(e,n,o,r,i){if(isNaN(n)||isNaN(o)||isNaN(r))return e;var a,s=e._root,l={data:i},u=e._x0,d=e._y0,h=e._z0,m=e._x1,f=e._y1,p=e._z1,g,w,b,v,S,D,P,_,T,I,N;if(!s)return e._root=l,e;for(;s.length;)if((P=n>=(g=(u+m)/2))?u=g:m=g,(_=o>=(w=(d+f)/2))?d=w:f=w,(T=r>=(b=(h+p)/2))?h=b:p=b,a=s,!(s=s[I=T<<2|_<<1|P]))return a[I]=l,e;if(v=+e._x.call(null,s.data),S=+e._y.call(null,s.data),D=+e._z.call(null,s.data),n===v&&o===S&&r===D)return l.next=s,a?a[I]=l:e._root=l,e;do a=a?a[I]=new Array(8):e._root=new Array(8),(P=n>=(g=(u+m)/2))?u=g:m=g,(_=o>=(w=(d+f)/2))?d=w:f=w,(T=r>=(b=(h+p)/2))?h=b:p=b;while((I=T<<2|_<<1|P)===(N=(D>=b)<<2|(S>=w)<<1|v>=g));return a[N]=s,a[I]=l,e}function Hd(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,o=new Float64Array(n),r=new Float64Array(n),i=new Float64Array(n);let a=1/0,s=1/0,l=1/0,u=-1/0,d=-1/0,h=-1/0;for(let m=0,f,p,g,w;m<n;++m)isNaN(p=+this._x.call(null,f=e[m]))||isNaN(g=+this._y.call(null,f))||isNaN(w=+this._z.call(null,f))||(o[m]=p,r[m]=g,i[m]=w,p<a&&(a=p),p>u&&(u=p),g<s&&(s=g),g>d&&(d=g),w<l&&(l=w),w>h&&(h=w));if(a>u||s>d||l>h)return this;this.cover(a,s,l).cover(u,d,h);for(let m=0;m<n;++m)va(this,o[m],r[m],i[m],e[m]);return this}function Vd(e,n,o){if(isNaN(e=+e)||isNaN(n=+n)||isNaN(o=+o))return this;var r=this._x0,i=this._y0,a=this._z0,s=this._x1,l=this._y1,u=this._z1;if(isNaN(r))s=(r=Math.floor(e))+1,l=(i=Math.floor(n))+1,u=(a=Math.floor(o))+1;else{for(var d=s-r||1,h=this._root,m,f;r>e||e>=s||i>n||n>=l||a>o||o>=u;)switch(f=(o<a)<<2|(n<i)<<1|e<r,m=new Array(8),m[f]=h,h=m,d*=2,f){case 0:s=r+d,l=i+d,u=a+d;break;case 1:r=s-d,l=i+d,u=a+d;break;case 2:s=r+d,i=l-d,u=a+d;break;case 3:r=s-d,i=l-d,u=a+d;break;case 4:s=r+d,l=i+d,a=u-d;break;case 5:r=s-d,l=i+d,a=u-d;break;case 6:s=r+d,i=l-d,a=u-d;break;case 7:r=s-d,i=l-d,a=u-d;break}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=i,this._z0=a,this._x1=s,this._y1=l,this._z1=u,this}function Gd(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function Wd(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function de(e,n,o,r,i,a,s){this.node=e,this.x0=n,this.y0=o,this.z0=r,this.x1=i,this.y1=a,this.z1=s}function qd(e,n,o,r){var i,a=this._x0,s=this._y0,l=this._z0,u,d,h,m,f,p,g=this._x1,w=this._y1,b=this._z1,v=[],S=this._root,D,P;for(S&&v.push(new de(S,a,s,l,g,w,b)),r==null?r=1/0:(a=e-r,s=n-r,l=o-r,g=e+r,w=n+r,b=o+r,r*=r);D=v.pop();)if(!(!(S=D.node)||(u=D.x0)>g||(d=D.y0)>w||(h=D.z0)>b||(m=D.x1)<a||(f=D.y1)<s||(p=D.z1)<l))if(S.length){var _=(u+m)/2,T=(d+f)/2,I=(h+p)/2;v.push(new de(S[7],_,T,I,m,f,p),new de(S[6],u,T,I,_,f,p),new de(S[5],_,d,I,m,T,p),new de(S[4],u,d,I,_,T,p),new de(S[3],_,T,h,m,f,I),new de(S[2],u,T,h,_,f,I),new de(S[1],_,d,h,m,T,I),new de(S[0],u,d,h,_,T,I)),(P=(o>=I)<<2|(n>=T)<<1|e>=_)&&(D=v[v.length-1],v[v.length-1]=v[v.length-1-P],v[v.length-1-P]=D)}else{var N=e-+this._x.call(null,S.data),L=n-+this._y.call(null,S.data),E=o-+this._z.call(null,S.data),O=N*N+L*L+E*E;if(O<r){var $=Math.sqrt(r=O);a=e-$,s=n-$,l=o-$,g=e+$,w=n+$,b=o+$,i=S.data}}return i}const Kd=(e,n,o,r,i,a)=>Math.sqrt((e-r)**2+(n-i)**2+(o-a)**2);function Yd(e,n,o,r){const i=[],a=e-r,s=n-r,l=o-r,u=e+r,d=n+r,h=o+r;return this.visit((m,f,p,g,w,b,v)=>{if(!m.length)do{const S=m.data;Kd(e,n,o,this._x(S),this._y(S),this._z(S))<=r&&i.push(S)}while(m=m.next);return f>u||p>d||g>h||w<a||b<s||v<l}),i}function Jd(e){if(isNaN(f=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(g=+this._z.call(null,e)))return this;var n,o=this._root,r,i,a,s=this._x0,l=this._y0,u=this._z0,d=this._x1,h=this._y1,m=this._z1,f,p,g,w,b,v,S,D,P,_,T;if(!o)return this;if(o.length)for(;;){if((S=f>=(w=(s+d)/2))?s=w:d=w,(D=p>=(b=(l+h)/2))?l=b:h=b,(P=g>=(v=(u+m)/2))?u=v:m=v,n=o,!(o=o[_=P<<2|D<<1|S]))return this;if(!o.length)break;(n[_+1&7]||n[_+2&7]||n[_+3&7]||n[_+4&7]||n[_+5&7]||n[_+6&7]||n[_+7&7])&&(r=n,T=_)}for(;o.data!==e;)if(i=o,!(o=o.next))return this;return(a=o.next)&&delete o.next,i?(a?i.next=a:delete i.next,this):n?(a?n[_]=a:delete n[_],(o=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&o===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!o.length&&(r?r[T]=o:this._root=o),this):(this._root=a,this)}function Xd(e){for(var n=0,o=e.length;n<o;++n)this.remove(e[n]);return this}function Zd(){return this._root}function Qd(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function eu(e){var n=[],o,r=this._root,i,a,s,l,u,d,h;for(r&&n.push(new de(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));o=n.pop();)if(!e(r=o.node,a=o.x0,s=o.y0,l=o.z0,u=o.x1,d=o.y1,h=o.z1)&&r.length){var m=(a+u)/2,f=(s+d)/2,p=(l+h)/2;(i=r[7])&&n.push(new de(i,m,f,p,u,d,h)),(i=r[6])&&n.push(new de(i,a,f,p,m,d,h)),(i=r[5])&&n.push(new de(i,m,s,p,u,f,h)),(i=r[4])&&n.push(new de(i,a,s,p,m,f,h)),(i=r[3])&&n.push(new de(i,m,f,l,u,d,p)),(i=r[2])&&n.push(new de(i,a,f,l,m,d,p)),(i=r[1])&&n.push(new de(i,m,s,l,u,f,p)),(i=r[0])&&n.push(new de(i,a,s,l,m,f,p))}return this}function tu(e){var n=[],o=[],r;for(this._root&&n.push(new de(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=n.pop();){var i=r.node;if(i.length){var a,s=r.x0,l=r.y0,u=r.z0,d=r.x1,h=r.y1,m=r.z1,f=(s+d)/2,p=(l+h)/2,g=(u+m)/2;(a=i[0])&&n.push(new de(a,s,l,u,f,p,g)),(a=i[1])&&n.push(new de(a,f,l,u,d,p,g)),(a=i[2])&&n.push(new de(a,s,p,u,f,h,g)),(a=i[3])&&n.push(new de(a,f,p,u,d,h,g)),(a=i[4])&&n.push(new de(a,s,l,g,f,p,m)),(a=i[5])&&n.push(new de(a,f,l,g,d,p,m)),(a=i[6])&&n.push(new de(a,s,p,g,f,h,m)),(a=i[7])&&n.push(new de(a,f,p,g,d,h,m))}o.push(r)}for(;r=o.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function nu(e){return e[0]}function ou(e){return arguments.length?(this._x=e,this):this._x}function ru(e){return e[1]}function iu(e){return arguments.length?(this._y=e,this):this._y}function au(e){return e[2]}function su(e){return arguments.length?(this._z=e,this):this._z}function ba(e,n,o,r){var i=new dr(n??nu,o??ru,r??au,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function dr(e,n,o,r,i,a,s,l,u){this._x=e,this._y=n,this._z=o,this._x0=r,this._y0=i,this._z0=a,this._x1=s,this._y1=l,this._z1=u,this._root=void 0}function gi(e){for(var n={data:e.data},o=n;e=e.next;)o=o.next={data:e.data};return n}var Se=ba.prototype=dr.prototype;Se.copy=function(){var e=new dr(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,o,r;if(!n)return e;if(!n.length)return e._root=gi(n),e;for(o=[{source:n,target:e._root=new Array(8)}];n=o.pop();)for(var i=0;i<8;++i)(r=n.source[i])&&(r.length?o.push({source:r,target:n.target[i]=new Array(8)}):n.target[i]=gi(r));return e};Se.add=Bd;Se.addAll=Hd;Se.cover=Vd;Se.data=Gd;Se.extent=Wd;Se.find=qd;Se.findAllWithinRadius=Yd;Se.remove=Jd;Se.removeAll=Xd;Se.root=Zd;Se.size=Qd;Se.visit=eu;Se.visitAfter=tu;Se.x=ou;Se.y=iu;Se.z=su;function gt(e){return function(){return e}}function pt(e){return(e()-.5)*1e-6}function lu(e){return e.index}function yi(e,n){var o=e.get(n);if(!o)throw new Error("node not found: "+n);return o}function cu(e){var n=lu,o=f,r,i=gt(30),a,s,l,u,d,h,m=1;e==null&&(e=[]);function f(v){return 1/Math.min(u[v.source.index],u[v.target.index])}function p(v){for(var S=0,D=e.length;S<m;++S)for(var P=0,_,T,I,N=0,L=0,E=0,O,$;P<D;++P)_=e[P],T=_.source,I=_.target,N=I.x+I.vx-T.x-T.vx||pt(h),l>1&&(L=I.y+I.vy-T.y-T.vy||pt(h)),l>2&&(E=I.z+I.vz-T.z-T.vz||pt(h)),O=Math.sqrt(N*N+L*L+E*E),O=(O-a[P])/O*v*r[P],N*=O,L*=O,E*=O,I.vx-=N*($=d[P]),l>1&&(I.vy-=L*$),l>2&&(I.vz-=E*$),T.vx+=N*($=1-$),l>1&&(T.vy+=L*$),l>2&&(T.vz+=E*$)}function g(){if(s){var v,S=s.length,D=e.length,P=new Map(s.map((T,I)=>[n(T,I,s),T])),_;for(v=0,u=new Array(S);v<D;++v)_=e[v],_.index=v,typeof _.source!="object"&&(_.source=yi(P,_.source)),typeof _.target!="object"&&(_.target=yi(P,_.target)),u[_.source.index]=(u[_.source.index]||0)+1,u[_.target.index]=(u[_.target.index]||0)+1;for(v=0,d=new Array(D);v<D;++v)_=e[v],d[v]=u[_.source.index]/(u[_.source.index]+u[_.target.index]);r=new Array(D),w(),a=new Array(D),b()}}function w(){if(s)for(var v=0,S=e.length;v<S;++v)r[v]=+o(e[v],v,e)}function b(){if(s)for(var v=0,S=e.length;v<S;++v)a[v]=+i(e[v],v,e)}return p.initialize=function(v,...S){s=v,h=S.find(D=>typeof D=="function")||Math.random,l=S.find(D=>[1,2,3].includes(D))||2,g()},p.links=function(v){return arguments.length?(e=v,g(),p):e},p.id=function(v){return arguments.length?(n=v,p):n},p.iterations=function(v){return arguments.length?(m=+v,p):m},p.strength=function(v){return arguments.length?(o=typeof v=="function"?v:gt(+v),w(),p):o},p.distance=function(v){return arguments.length?(i=typeof v=="function"?v:gt(+v),b(),p):i},p}const du=1664525,uu=1013904223,vi=4294967296;function fu(){let e=1;return()=>(e=(du*e+uu)%vi)/vi}var bi=3;function xo(e){return e.x}function xi(e){return e.y}function mu(e){return e.z}var hu=10,pu=Math.PI*(3-Math.sqrt(5)),gu=Math.PI*20/(9+Math.sqrt(221));function yu(e,n){n=n||2;var o=Math.min(bi,Math.max(1,Math.round(n))),r,i=1,a=.001,s=1-Math.pow(a,1/300),l=0,u=.6,d=new Map,h=ys(p),m=vs("tick","end"),f=fu();e==null&&(e=[]);function p(){g(),m.call("tick",r),i<a&&(h.stop(),m.call("end",r))}function g(v){var S,D=e.length,P;v===void 0&&(v=1);for(var _=0;_<v;++_)for(i+=(l-i)*s,d.forEach(function(T){T(i)}),S=0;S<D;++S)P=e[S],P.fx==null?P.x+=P.vx*=u:(P.x=P.fx,P.vx=0),o>1&&(P.fy==null?P.y+=P.vy*=u:(P.y=P.fy,P.vy=0)),o>2&&(P.fz==null?P.z+=P.vz*=u:(P.z=P.fz,P.vz=0));return r}function w(){for(var v=0,S=e.length,D;v<S;++v){if(D=e[v],D.index=v,D.fx!=null&&(D.x=D.fx),D.fy!=null&&(D.y=D.fy),D.fz!=null&&(D.z=D.fz),isNaN(D.x)||o>1&&isNaN(D.y)||o>2&&isNaN(D.z)){var P=hu*(o>2?Math.cbrt(.5+v):o>1?Math.sqrt(.5+v):v),_=v*pu,T=v*gu;o===1?D.x=P:o===2?(D.x=P*Math.cos(_),D.y=P*Math.sin(_)):(D.x=P*Math.sin(_)*Math.cos(T),D.y=P*Math.cos(_),D.z=P*Math.sin(_)*Math.sin(T))}(isNaN(D.vx)||o>1&&isNaN(D.vy)||o>2&&isNaN(D.vz))&&(D.vx=0,o>1&&(D.vy=0),o>2&&(D.vz=0))}}function b(v){return v.initialize&&v.initialize(e,f,o),v}return w(),r={tick:g,restart:function(){return h.restart(p),r},stop:function(){return h.stop(),r},numDimensions:function(v){return arguments.length?(o=Math.min(bi,Math.max(1,Math.round(v))),d.forEach(b),r):o},nodes:function(v){return arguments.length?(e=v,w(),d.forEach(b),r):e},alpha:function(v){return arguments.length?(i=+v,r):i},alphaMin:function(v){return arguments.length?(a=+v,r):a},alphaDecay:function(v){return arguments.length?(s=+v,r):+s},alphaTarget:function(v){return arguments.length?(l=+v,r):l},velocityDecay:function(v){return arguments.length?(u=1-v,r):1-u},randomSource:function(v){return arguments.length?(f=v,d.forEach(b),r):f},force:function(v,S){return arguments.length>1?(S==null?d.delete(v):d.set(v,b(S)),r):d.get(v)},find:function(){var v=Array.prototype.slice.call(arguments),S=v.shift()||0,D=(o>1?v.shift():null)||0,P=(o>2?v.shift():null)||0,_=v.shift()||1/0,T=0,I=e.length,N,L,E,O,$,V;for(_*=_,T=0;T<I;++T)$=e[T],N=S-$.x,L=D-($.y||0),E=P-($.z||0),O=N*N+L*L+E*E,O<_&&(V=$,_=O);return V},on:function(v,S){return arguments.length>1?(m.on(v,S),r):m.on(v)}}}function vu(){var e,n,o,r,i,a=gt(-30),s,l=1,u=1/0,d=.81;function h(g){var w,b=e.length,v=(n===1?ya(e,xo):n===2?bs(e,xo,xi):n===3?ba(e,xo,xi,mu):null).visitAfter(f);for(i=g,w=0;w<b;++w)o=e[w],v.visit(p)}function m(){if(e){var g,w=e.length,b;for(s=new Array(w),g=0;g<w;++g)b=e[g],s[b.index]=+a(b,g,e)}}function f(g){var w=0,b,v,S=0,D,P,_,T,I=g.length;if(I){for(D=P=_=T=0;T<I;++T)(b=g[T])&&(v=Math.abs(b.value))&&(w+=b.value,S+=v,D+=v*(b.x||0),P+=v*(b.y||0),_+=v*(b.z||0));w*=Math.sqrt(4/I),g.x=D/S,n>1&&(g.y=P/S),n>2&&(g.z=_/S)}else{b=g,b.x=b.data.x,n>1&&(b.y=b.data.y),n>2&&(b.z=b.data.z);do w+=s[b.data.index];while(b=b.next)}g.value=w}function p(g,w,b,v,S){if(!g.value)return!0;var D=[b,v,S][n-1],P=g.x-o.x,_=n>1?g.y-o.y:0,T=n>2?g.z-o.z:0,I=D-w,N=P*P+_*_+T*T;if(I*I/d<N)return N<u&&(P===0&&(P=pt(r),N+=P*P),n>1&&_===0&&(_=pt(r),N+=_*_),n>2&&T===0&&(T=pt(r),N+=T*T),N<l&&(N=Math.sqrt(l*N)),o.vx+=P*g.value*i/N,n>1&&(o.vy+=_*g.value*i/N),n>2&&(o.vz+=T*g.value*i/N)),!0;if(g.length||N>=u)return;(g.data!==o||g.next)&&(P===0&&(P=pt(r),N+=P*P),n>1&&_===0&&(_=pt(r),N+=_*_),n>2&&T===0&&(T=pt(r),N+=T*T),N<l&&(N=Math.sqrt(l*N)));do g.data!==o&&(I=s[g.data.index]*i/N,o.vx+=P*I,n>1&&(o.vy+=_*I),n>2&&(o.vz+=T*I));while(g=g.next)}return h.initialize=function(g,...w){e=g,r=w.find(b=>typeof b=="function")||Math.random,n=w.find(b=>[1,2,3].includes(b))||2,m()},h.strength=function(g){return arguments.length?(a=typeof g=="function"?g:gt(+g),m(),h):a},h.distanceMin=function(g){return arguments.length?(l=g*g,h):Math.sqrt(l)},h.distanceMax=function(g){return arguments.length?(u=g*g,h):Math.sqrt(u)},h.theta=function(g){return arguments.length?(d=g*g,h):Math.sqrt(d)},h}function bu(e,n,o,r){var i,a,s=gt(.1),l,u;typeof e!="function"&&(e=gt(+e)),n==null&&(n=0),o==null&&(o=0),r==null&&(r=0);function d(m){for(var f=0,p=i.length;f<p;++f){var g=i[f],w=g.x-n||1e-6,b=(g.y||0)-o||1e-6,v=(g.z||0)-r||1e-6,S=Math.sqrt(w*w+b*b+v*v),D=(u[f]-S)*l[f]*m/S;g.vx+=w*D,a>1&&(g.vy+=b*D),a>2&&(g.vz+=v*D)}}function h(){if(i){var m,f=i.length;for(l=new Array(f),u=new Array(f),m=0;m<f;++m)u[m]=+e(i[m],m,i),l[m]=isNaN(u[m])?0:+s(i[m],m,i)}}return d.initialize=function(m,...f){i=m,a=f.find(p=>[1,2,3].includes(p))||2,h()},d.strength=function(m){return arguments.length?(s=typeof m=="function"?m:gt(+m),h(),d):s},d.radius=function(m){return arguments.length?(e=typeof m=="function"?m:gt(+m),h(),d):e},d.x=function(m){return arguments.length?(n=+m,d):n},d.y=function(m){return arguments.length?(o=+m,d):o},d.z=function(m){return arguments.length?(r=+m,d):r},d}const{abs:mn,cos:mt,sin:Zt,acos:xu,atan2:hn,sqrt:It,pow:Be}=Math;function pn(e){return e<0?-Be(-e,1/3):Be(e,1/3)}const xa=Math.PI,zn=2*xa,kt=xa/2,wu=1e-6,wo=Number.MAX_SAFE_INTEGER||9007199254740991,_o=Number.MIN_SAFE_INTEGER||-9007199254740991,_u={x:0,y:0,z:0},U={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const o=n(e);let r=o.x*o.x+o.y*o.y;return typeof o.z<"u"&&(r+=o.z*o.z),It(r)},compute:function(e,n,o){if(e===0)return n[0].t=0,n[0];const r=n.length-1;if(e===1)return n[r].t=1,n[r];const i=1-e;let a=n;if(r===0)return n[0].t=e,n[0];if(r===1){const l={x:i*a[0].x+e*a[1].x,y:i*a[0].y+e*a[1].y,t:e};return o&&(l.z=i*a[0].z+e*a[1].z),l}if(r<4){let l=i*i,u=e*e,d,h,m,f=0;r===2?(a=[a[0],a[1],a[2],_u],d=l,h=i*e*2,m=u):r===3&&(d=l*i,h=l*e*3,m=i*u*3,f=e*u);const p={x:d*a[0].x+h*a[1].x+m*a[2].x+f*a[3].x,y:d*a[0].y+h*a[1].y+m*a[2].y+f*a[3].y,t:e};return o&&(p.z=d*a[0].z+h*a[1].z+m*a[2].z+f*a[3].z),p}const s=JSON.parse(JSON.stringify(n));for(;s.length>1;){for(let l=0;l<s.length-1;l++)s[l]={x:s[l].x+(s[l+1].x-s[l].x)*e,y:s[l].y+(s[l+1].y-s[l].y)*e},typeof s[l].z<"u"&&(s[l].z=s[l].z+(s[l+1].z-s[l].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,n,o,r){const i=1-e,a=o,s=n;let l=a[0],u=a[1],d=a[2],h=a[3],m;if(l*=i,u*=e,s.length===2)return m=l+u,{x:(l*s[0].x+u*s[1].x)/m,y:(l*s[0].y+u*s[1].y)/m,z:r?(l*s[0].z+u*s[1].z)/m:!1,t:e};if(l*=i,u*=2*i,d*=e*e,s.length===3)return m=l+u+d,{x:(l*s[0].x+u*s[1].x+d*s[2].x)/m,y:(l*s[0].y+u*s[1].y+d*s[2].y)/m,z:r?(l*s[0].z+u*s[1].z+d*s[2].z)/m:!1,t:e};if(l*=i,u*=1.5*i,d*=3*i,h*=e*e*e,s.length===4)return m=l+u+d+h,{x:(l*s[0].x+u*s[1].x+d*s[2].x+h*s[3].x)/m,y:(l*s[0].y+u*s[1].y+d*s[2].y+h*s[3].y)/m,z:r?(l*s[0].z+u*s[1].z+d*s[2].z+h*s[3].z)/m:!1,t:e}},derive:function(e,n){const o=[];for(let r=e,i=r.length,a=i-1;i>1;i--,a--){const s=[];for(let l=0,u;l<a;l++)u={x:a*(r[l+1].x-r[l].x),y:a*(r[l+1].y-r[l].y)},n&&(u.z=a*(r[l+1].z-r[l].z)),s.push(u);o.push(s),r=s}return o},between:function(e,n,o){return n<=e&&e<=o||U.approximately(e,n)||U.approximately(e,o)},approximately:function(e,n,o){return mn(e-n)<=(o||wu)},length:function(e){const o=U.Tvalues.length;let r=0;for(let i=0,a;i<o;i++)a=.5*U.Tvalues[i]+.5,r+=U.Cvalues[i]*U.arcfn(a,e);return .5*r},map:function(e,n,o,r,i){const a=o-n,s=i-r,l=e-n,u=l/a;return r+s*u},lerp:function(e,n,o){const r={x:n.x+e*(o.x-n.x),y:n.y+e*(o.y-n.y)};return n.z!==void 0&&o.z!==void 0&&(r.z=n.z+e*(o.z-n.z)),r},pointToString:function(e){let n=e.x+"/"+e.y;return typeof e.z<"u"&&(n+="/"+e.z),n},pointsToString:function(e){return"["+e.map(U.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,o){const r=n.x-e.x,i=n.y-e.y,a=o.x-e.x,s=o.y-e.y,l=r*s-i*a,u=r*a+i*s;return hn(l,u)},round:function(e,n){const o=""+e,r=o.indexOf(".");return parseFloat(o.substring(0,r+1+n))},dist:function(e,n){const o=e.x-n.x,r=e.y-n.y;return It(o*o+r*r)},closest:function(e,n){let o=Be(2,63),r,i;return e.forEach(function(a,s){i=U.dist(n,a),i<o&&(o=i,r=s)}),{mdist:o,mpos:r}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const o=Be(e,n)+Be(1-e,n),r=o-1;return mn(r/o)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const o=Be(1-e,n),r=Be(e,n)+o;return o/r},lli8:function(e,n,o,r,i,a,s,l){const u=(e*r-n*o)*(i-s)-(e-o)*(i*l-a*s),d=(e*r-n*o)*(a-l)-(n-r)*(i*l-a*s),h=(e-o)*(a-l)-(n-r)*(i-s);return h==0?!1:{x:u/h,y:d/h}},lli4:function(e,n,o,r){const i=e.x,a=e.y,s=n.x,l=n.y,u=o.x,d=o.y,h=r.x,m=r.y;return U.lli8(i,a,s,l,u,d,h,m)},lli:function(e,n){return U.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new he(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=wo,o=wo,r=_o,i=_o;return e.forEach(function(a){const s=a.bbox();n>s.x.min&&(n=s.x.min),o>s.y.min&&(o=s.y.min),r<s.x.max&&(r=s.x.max),i<s.y.max&&(i=s.y.max)}),{x:{min:n,mid:(n+r)/2,max:r,size:r-n},y:{min:o,mid:(o+i)/2,max:i,size:i-o}}},shapeintersections:function(e,n,o,r,i){if(!U.bboxoverlap(n,r))return[];const a=[],s=[e.startcap,e.forward,e.back,e.endcap],l=[o.startcap,o.forward,o.back,o.endcap];return s.forEach(function(u){u.virtual||l.forEach(function(d){if(d.virtual)return;const h=u.intersects(d,i);h.length>0&&(h.c1=u,h.c2=d,h.s1=e,h.s2=o,a.push(h))})}),a},makeshape:function(e,n,o){const r=n.points.length,i=e.points.length,a=U.makeline(n.points[r-1],e.points[0]),s=U.makeline(e.points[i-1],n.points[0]),l={startcap:a,forward:e,back:n,endcap:s,bbox:U.findbbox([a,e,n,s])};return l.intersections=function(u){return U.shapeintersections(l,l.bbox,u,u.bbox,o)},l},getminmax:function(e,n,o){if(!o)return{min:0,max:0};let r=wo,i=_o,a,s;o.indexOf(0)===-1&&(o=[0].concat(o)),o.indexOf(1)===-1&&o.push(1);for(let l=0,u=o.length;l<u;l++)a=o[l],s=e.get(a),s[n]<r&&(r=s[n]),s[n]>i&&(i=s[n]);return{min:r,mid:(r+i)/2,max:i,size:i-r}},align:function(e,n){const o=n.p1.x,r=n.p1.y,i=-hn(n.p2.y-r,n.p2.x-o),a=function(s){return{x:(s.x-o)*mt(i)-(s.y-r)*Zt(i),y:(s.x-o)*Zt(i)+(s.y-r)*mt(i)}};return e.map(a)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const o=e.length-1,r=U.align(e,n),i=function(I){return 0<=I&&I<=1};if(o===2){const I=r[0].y,N=r[1].y,L=r[2].y,E=I-2*N+L;if(E!==0){const O=-It(N*N-I*L),$=-I+N,V=-(O+$)/E,J=-(-O+$)/E;return[V,J].filter(i)}else if(N!==L&&E===0)return[(2*N-L)/(2*N-2*L)].filter(i);return[]}const a=r[0].y,s=r[1].y,l=r[2].y,u=r[3].y;let d=-a+3*s-3*l+u,h=3*a-6*s+3*l,m=-3*a+3*s,f=a;if(U.approximately(d,0)){if(U.approximately(h,0))return U.approximately(m,0)?[]:[-f/m].filter(i);const I=It(m*m-4*h*f),N=2*h;return[(I-m)/N,(-m-I)/N].filter(i)}h/=d,m/=d,f/=d;const p=(3*m-h*h)/3,g=p/3,w=(2*h*h*h-9*h*m+27*f)/27,b=w/2,v=b*b+g*g*g;let S,D,P,_,T;if(v<0){const I=-p/3,N=I*I*I,L=It(N),E=-w/(2*L),O=E<-1?-1:E>1?1:E,$=xu(O),V=pn(L),J=2*V;return P=J*mt($/3)-h/3,_=J*mt(($+zn)/3)-h/3,T=J*mt(($+2*zn)/3)-h/3,[P,_,T].filter(i)}else{if(v===0)return S=b<0?pn(-b):-pn(b),P=2*S-h/3,_=-S-h/3,[P,_].filter(i);{const I=It(v);return S=pn(-b+I),D=pn(b+I),[S-D-h/3].filter(i)}}},droots:function(e){if(e.length===3){const n=e[0],o=e[1],r=e[2],i=n-2*o+r;if(i!==0){const a=-It(o*o-n*r),s=-n+o,l=-(a+s)/i,u=-(-a+s)/i;return[l,u]}else if(o!==r&&i===0)return[(2*o-r)/(2*(o-r))];return[]}if(e.length===2){const n=e[0],o=e[1];return n!==o?[n/(n-o)]:[]}return[]},curvature:function(e,n,o,r,i){let a,s,l,u,d=0,h=0;const m=U.compute(e,n),f=U.compute(e,o),p=m.x*m.x+m.y*m.y;if(r?(a=It(Be(m.y*f.z-f.y*m.z,2)+Be(m.z*f.x-f.z*m.x,2)+Be(m.x*f.y-f.x*m.y,2)),s=Be(p+m.z*m.z,3/2)):(a=m.x*f.y-m.y*f.x,s=Be(p,3/2)),a===0||s===0)return{k:0,r:0};if(d=a/s,h=s/a,!i){const g=U.curvature(e-.001,n,o,r,!0).k,w=U.curvature(e+.001,n,o,r,!0).k;u=(w-d+(d-g))/2,l=(mn(w-d)+mn(d-g))/2}return{k:d,r:h,dk:u,adk:l}},inflections:function(e){if(e.length<4)return[];const n=U.align(e,{p1:e[0],p2:e.slice(-1)[0]}),o=n[2].x*n[1].y,r=n[3].x*n[1].y,i=n[1].x*n[2].y,a=n[3].x*n[2].y,s=18*(-3*o+2*r+3*i-a),l=18*(3*o-r-3*i),u=18*(i-o);if(U.approximately(s,0)){if(!U.approximately(l,0)){let f=-u/l;if(0<=f&&f<=1)return[f]}return[]}const d=2*s;if(U.approximately(d,0))return[];const h=l*l-4*s*u;if(h<0)return[];const m=Math.sqrt(h);return[(m-l)/d,-(l+m)/d].filter(function(f){return 0<=f&&f<=1})},bboxoverlap:function(e,n){const o=["x","y"],r=o.length;for(let i=0,a,s,l,u;i<r;i++)if(a=o[i],s=e[a].mid,l=n[a].mid,u=(e[a].size+n[a].size)/2,mn(s-l)>=u)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,o){const r=e.bbox(),i=n.bbox(),a=1e5,s=o||.5;if(r.x.size+r.y.size<s&&i.x.size+i.y.size<s)return[(a*(e._t1+e._t2)/2|0)/a+"/"+(a*(n._t1+n._t2)/2|0)/a];let l=e.split(.5),u=n.split(.5),d=[{left:l.left,right:u.left},{left:l.left,right:u.right},{left:l.right,right:u.right},{left:l.right,right:u.left}];d=d.filter(function(m){return U.bboxoverlap(m.left.bbox(),m.right.bbox())});let h=[];return d.length===0||(d.forEach(function(m){h=h.concat(U.pairiteration(m.left,m.right,s))}),h=h.filter(function(m,f){return h.indexOf(m)===f})),h},getccenter:function(e,n,o){const r=n.x-e.x,i=n.y-e.y,a=o.x-n.x,s=o.y-n.y,l=r*mt(kt)-i*Zt(kt),u=r*Zt(kt)+i*mt(kt),d=a*mt(kt)-s*Zt(kt),h=a*Zt(kt)+s*mt(kt),m=(e.x+n.x)/2,f=(e.y+n.y)/2,p=(n.x+o.x)/2,g=(n.y+o.y)/2,w=m+l,b=f+u,v=p+d,S=g+h,D=U.lli8(m,f,w,b,p,g,v,S),P=U.dist(D,e);let _=hn(e.y-D.y,e.x-D.x),T=hn(n.y-D.y,n.x-D.x),I=hn(o.y-D.y,o.x-D.x),N;return _<I?((_>T||T>I)&&(_+=zn),_>I&&(N=I,I=_,_=N)):I<T&&T<_?(N=I,I=_,_=N):I+=zn,D.s=_,D.e=I,D.r=P,D},numberSort:function(e,n){return e-n}};class _n{constructor(n){this.curves=[],this._3d=!1,n&&(this.curves=n,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(n){return U.pointsToString(n.points)}).join(", ")+"]"}addCurve(n){this.curves.push(n),this._3d=this._3d||n._3d}length(){return this.curves.map(function(n){return n.length()}).reduce(function(n,o){return n+o})}curve(n){return this.curves[n]}bbox(){const n=this.curves;for(var o=n[0].bbox(),r=1;r<n.length;r++)U.expandbox(o,n[r].bbox());return o}offset(n){const o=[];return this.curves.forEach(function(r){o.push(...r.offset(n))}),new _n(o)}}const{abs:gn,min:wi,max:_i,cos:Iu,sin:ku,acos:Su,sqrt:yn}=Math,Cu=Math.PI;class he{constructor(n){let o=n&&n.forEach?n:Array.from(arguments).slice(),r=!1;if(typeof o[0]=="object"){r=o.length;const p=[];o.forEach(function(g){["x","y","z"].forEach(function(w){typeof g[w]<"u"&&p.push(g[w])})}),o=p}let i=!1;const a=o.length;if(r){if(r>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const s=this._3d=!i&&(a===9||a===12)||n&&n[0]&&typeof n[0].z<"u",l=this.points=[];for(let p=0,g=s?3:2;p<a;p+=g){var u={x:o[p],y:o[p+1]};s&&(u.z=o[p+2]),l.push(u)}const d=this.order=l.length-1,h=this.dims=["x","y"];s&&h.push("z"),this.dimlen=h.length;const m=U.align(l,{p1:l[0],p2:l[d]}),f=U.dist(l[0],l[d]);this._linear=m.reduce((p,g)=>p+gn(g.y),0)<f/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,o,r,i){if(typeof i>"u"&&(i=.5),i===0)return new he(o,o,r);if(i===1)return new he(n,o,o);const a=he.getABC(2,n,o,r,i);return new he(n,a.A,r)}static cubicFromPoints(n,o,r,i,a){typeof i>"u"&&(i=.5);const s=he.getABC(3,n,o,r,i);typeof a>"u"&&(a=U.dist(o,s.C));const l=a*(1-i)/i,u=U.dist(n,r),d=(r.x-n.x)/u,h=(r.y-n.y)/u,m=a*d,f=a*h,p=l*d,g=l*h,w={x:o.x-m,y:o.y-f},b={x:o.x+p,y:o.y+g},v=s.A,S={x:v.x+(w.x-v.x)/(1-i),y:v.y+(w.y-v.y)/(1-i)},D={x:v.x+(b.x-v.x)/i,y:v.y+(b.y-v.y)/i},P={x:n.x+(S.x-n.x)/i,y:n.y+(S.y-n.y)/i},_={x:r.x+(D.x-r.x)/(1-i),y:r.y+(D.y-r.y)/(1-i)};return new he(n,P,_,r)}static getUtils(){return U}getUtils(){return he.getUtils()}static get PolyBezier(){return _n}valueOf(){return this.toString()}toString(){return U.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,o=n[0].x,r=n[0].y,i=["M",o,r,this.order===2?"Q":"C"];for(let a=1,s=n.length;a<s;a++)i.push(n[a].x),i.push(n[a].y);return i.join(" ")}setRatios(n){if(n.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=n,this._lut=[]}verify(){const n=this.coordDigest();n!==this._print&&(this._print=n,this.update())}coordDigest(){return this.points.map(function(n,o){return""+o+n.x+n.y+(n.z?n.z:0)}).join("")}update(){this._lut=[],this.dpoints=U.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,o=U.angle(n[0],n[this.order],n[1]);this.clockwise=o>0}length(){return U.length(this.derivative.bind(this))}static getABC(n=2,o,r,i,a=.5){const s=U.projectionratio(a,n),l=1-s,u={x:s*o.x+l*i.x,y:s*o.y+l*i.y},d=U.abcratio(a,n);return{A:{x:r.x+(r.x-u.x)/d,y:r.y+(r.y-u.y)/d},B:r,C:u,S:o,E:i}}getABC(n,o){o=o||this.get(n);let r=this.points[0],i=this.points[this.order];return he.getABC(this.order,r,o,i,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let o=0,r,i;o<n;o++)i=o/(n-1),r=this.compute(i),r.t=i,this._lut.push(r);return this._lut}on(n,o){o=o||5;const r=this.getLUT(),i=[];for(let a=0,s,l=0;a<r.length;a++)s=r[a],U.dist(s,n)<o&&(i.push(s),l+=a/r.length);return i.length?t/=i.length:!1}project(n){const o=this.getLUT(),r=o.length-1,i=U.closest(o,n),a=i.mpos,s=(a-1)/r,l=(a+1)/r,u=.1/r;let d=i.mdist,h=s,m=h,f;d+=1;for(let p;h<l+u;h+=u)f=this.compute(h),p=U.dist(n,f),p<d&&(d=p,m=h);return m=m<0?0:m>1?1:m,f=this.compute(m),f.t=m,f.d=d,f}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?U.computeWithRatios(n,this.points,this.ratios,this._3d):U.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,o=[n[0]],r=n.length;for(let i=1,a,s;i<r;i++)a=n[i],s=n[i-1],o[i]={x:(r-i)/r*a.x+i/r*s.x,y:(r-i)/r*a.y+i/r*s.y};return o[r]=n[r-1],new he(o)}derivative(n){return U.compute(n,this.dpoints[0],this._3d)}dderivative(n){return U.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new he(U.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return U.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return U.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const o=this.derivative(n),r=yn(o.x*o.x+o.y*o.y);return{t:n,x:-o.y/r,y:o.x/r}}__normal3(n){const o=this.derivative(n),r=this.derivative(n+.01),i=yn(o.x*o.x+o.y*o.y+o.z*o.z),a=yn(r.x*r.x+r.y*r.y+r.z*r.z);o.x/=i,o.y/=i,o.z/=i,r.x/=a,r.y/=a,r.z/=a;const s={x:r.y*o.z-r.z*o.y,y:r.z*o.x-r.x*o.z,z:r.x*o.y-r.y*o.x},l=yn(s.x*s.x+s.y*s.y+s.z*s.z);s.x/=l,s.y/=l,s.z/=l;const u=[s.x*s.x,s.x*s.y-s.z,s.x*s.z+s.y,s.x*s.y+s.z,s.y*s.y,s.y*s.z-s.x,s.x*s.z-s.y,s.y*s.z+s.x,s.z*s.z];return{t:n,x:u[0]*o.x+u[1]*o.y+u[2]*o.z,y:u[3]*o.x+u[4]*o.y+u[5]*o.z,z:u[6]*o.x+u[7]*o.y+u[8]*o.z}}hull(n){let o=this.points,r=[],i=[],a=0;for(i[a++]=o[0],i[a++]=o[1],i[a++]=o[2],this.order===3&&(i[a++]=o[3]);o.length>1;){r=[];for(let s=0,l,u=o.length-1;s<u;s++)l=U.lerp(n,o[s],o[s+1]),i[a++]=l,r.push(l);o=r}return i}split(n,o){if(n===0&&o)return this.split(o).left;if(o===1)return this.split(n).right;const r=this.hull(n),i={left:this.order===2?new he([r[0],r[3],r[5]]):new he([r[0],r[4],r[7],r[9]]),right:this.order===2?new he([r[5],r[4],r[2]]):new he([r[9],r[8],r[6],r[3]]),span:r};return i.left._t1=U.map(0,0,1,this._t1,this._t2),i.left._t2=U.map(n,0,1,this._t1,this._t2),i.right._t1=U.map(n,0,1,this._t1,this._t2),i.right._t2=U.map(1,0,1,this._t1,this._t2),o?(o=U.map(o,n,1,0,1),i.right.split(o).left):i}extrema(){const n={};let o=[];return this.dims.forEach((function(r){let i=function(s){return s[r]},a=this.dpoints[0].map(i);n[r]=U.droots(a),this.order===3&&(a=this.dpoints[1].map(i),n[r]=n[r].concat(U.droots(a))),n[r]=n[r].filter(function(s){return s>=0&&s<=1}),o=o.concat(n[r].sort(U.numberSort))}).bind(this)),n.values=o.sort(U.numberSort).filter(function(r,i){return o.indexOf(r)===i}),n}bbox(){const n=this.extrema(),o={};return this.dims.forEach((function(r){o[r]=U.getminmax(this,r,n[r])}).bind(this)),o}overlaps(n){const o=this.bbox(),r=n.bbox();return U.bboxoverlap(o,r)}offset(n,o){if(typeof o<"u"){const r=this.get(n),i=this.normal(n),a={c:r,n:i,x:r.x+i.x*o,y:r.y+i.y*o};return this._3d&&(a.z=r.z+i.z*o),a}if(this._linear){const r=this.normal(0),i=this.points.map(function(a){const s={x:a.x+n*r.x,y:a.y+n*r.y};return a.z&&r.z&&(s.z=a.z+n*r.z),s});return[new he(i)]}return this.reduce().map(function(r){return r._linear?r.offset(n)[0]:r.scale(n)})}simple(){if(this.order===3){const i=U.angle(this.points[0],this.points[3],this.points[1]),a=U.angle(this.points[0],this.points[3],this.points[2]);if(i>0&&a<0||i<0&&a>0)return!1}const n=this.normal(0),o=this.normal(1);let r=n.x*o.x+n.y*o.y;return this._3d&&(r+=n.z*o.z),gn(Su(r))<Cu/3}reduce(){let n,o=0,r=0,i=.01,a,s=[],l=[],u=this.extrema().values;for(u.indexOf(0)===-1&&(u=[0].concat(u)),u.indexOf(1)===-1&&u.push(1),o=u[0],n=1;n<u.length;n++)r=u[n],a=this.split(o,r),a._t1=o,a._t2=r,s.push(a),o=r;return s.forEach(function(d){for(o=0,r=0;r<=1;)for(r=o+i;r<=1+i;r+=i)if(a=d.split(o,r),!a.simple()){if(r-=i,gn(o-r)<i)return[];a=d.split(o,r),a._t1=U.map(o,0,1,d._t1,d._t2),a._t2=U.map(r,0,1,d._t1,d._t2),l.push(a),o=r;break}o<1&&(a=d.split(o,1),a._t1=U.map(o,0,1,d._t1,d._t2),a._t2=d._t2,l.push(a))}),l}translate(n,o,r){r=typeof r=="number"?r:o;const i=this.order;let a=this.points.map((s,l)=>(1-l/i)*o+l/i*r);return new he(this.points.map((s,l)=>({x:s.x+n.x*a[l],y:s.y+n.y*a[l]})))}scale(n){const o=this.order;let r=!1;if(typeof n=="function"&&(r=n),r&&o===2)return this.raise().scale(r);const i=this.clockwise,a=this.points;if(this._linear)return this.translate(this.normal(0),r?r(0):n,r?r(1):n);const s=r?r(0):n,l=r?r(1):n,u=[this.offset(0,10),this.offset(1,10)],d=[],h=U.lli4(u[0],u[0].c,u[1],u[1].c);if(!h)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(m){const f=d[m*o]=U.copy(a[m*o]);f.x+=(m?l:s)*u[m].n.x,f.y+=(m?l:s)*u[m].n.y}),r?([0,1].forEach(function(m){if(!(o===2&&m)){var f=a[m+1],p={x:f.x-h.x,y:f.y-h.y},g=r?r((m+1)/o):n;r&&!i&&(g=-g);var w=yn(p.x*p.x+p.y*p.y);p.x/=w,p.y/=w,d[m+1]={x:f.x+g*p.x,y:f.y+g*p.y}}}),new he(d)):([0,1].forEach(m=>{if(o===2&&m)return;const f=d[m*o],p=this.derivative(m),g={x:f.x+p.x,y:f.y+p.y};d[m+1]=U.lli4(f,g,h,a[m+1])}),new he(d))}outline(n,o,r,i){if(o=o===void 0?n:o,this._linear){const _=this.normal(0),T=this.points[0],I=this.points[this.points.length-1];let N,L,E;r===void 0&&(r=n,i=o),N={x:T.x+_.x*n,y:T.y+_.y*n},E={x:I.x+_.x*r,y:I.y+_.y*r},L={x:(N.x+E.x)/2,y:(N.y+E.y)/2};const O=[N,L,E];N={x:T.x-_.x*o,y:T.y-_.y*o},E={x:I.x-_.x*i,y:I.y-_.y*i},L={x:(N.x+E.x)/2,y:(N.y+E.y)/2};const $=[E,L,N],V=U.makeline($[2],O[0]),J=U.makeline(O[2],$[0]),ne=[V,new he(O),J,new he($)];return new _n(ne)}const a=this.reduce(),s=a.length,l=[];let u=[],d,h=0,m=this.length();const f=typeof r<"u"&&typeof i<"u";function p(_,T,I,N,L){return function(E){const O=N/I,$=(N+L)/I,V=T-_;return U.map(E,0,1,_+O*V,_+$*V)}}a.forEach(function(_){const T=_.length();f?(l.push(_.scale(p(n,r,m,h,T))),u.push(_.scale(p(-o,-i,m,h,T)))):(l.push(_.scale(n)),u.push(_.scale(-o))),h+=T}),u=u.map(function(_){return d=_.points,d[3]?_.points=[d[3],d[2],d[1],d[0]]:_.points=[d[2],d[1],d[0]],_}).reverse();const g=l[0].points[0],w=l[s-1].points[l[s-1].points.length-1],b=u[s-1].points[u[s-1].points.length-1],v=u[0].points[0],S=U.makeline(b,g),D=U.makeline(w,v),P=[S].concat(l).concat([D]).concat(u);return new _n(P)}outlineshapes(n,o,r){o=o||n;const i=this.outline(n,o).curves,a=[];for(let s=1,l=i.length;s<l/2;s++){const u=U.makeshape(i[s],i[l-s],r);u.startcap.virtual=s>1,u.endcap.virtual=s<l/2-1,a.push(u)}return a}intersects(n,o){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof he&&(n=n.reduce()),this.curveintersects(this.reduce(),n,o)):this.selfintersects(o)}lineIntersects(n){const o=wi(n.p1.x,n.p2.x),r=wi(n.p1.y,n.p2.y),i=_i(n.p1.x,n.p2.x),a=_i(n.p1.y,n.p2.y);return U.roots(this.points,n).filter(s=>{var l=this.get(s);return U.between(l.x,o,i)&&U.between(l.y,r,a)})}selfintersects(n){const o=this.reduce(),r=o.length-2,i=[];for(let a=0,s,l,u;a<r;a++)l=o.slice(a,a+1),u=o.slice(a+2),s=this.curveintersects(l,u,n),i.push(...s);return i}curveintersects(n,o,r){const i=[];n.forEach(function(s){o.forEach(function(l){s.overlaps(l)&&i.push({left:s,right:l})})});let a=[];return i.forEach(function(s){const l=U.pairiteration(s.left,s.right,r);l.length>0&&(a=a.concat(l))}),a}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,o,r,i){const a=(i-r)/4,s=this.get(r+a),l=this.get(i-a),u=U.dist(n,o),d=U.dist(n,s),h=U.dist(n,l);return gn(d-u)+gn(h-u)}_iterate(n,o){let r=0,i=1,a;do{a=0,i=1;let s=this.get(r),l,u,d,h,m=!1,f=!1,p,g=i,w=1;do if(f=m,h=d,g=(r+i)/2,l=this.get(g),u=this.get(i),d=U.getccenter(s,l,u),d.interval={start:r,end:i},m=this._error(d,s,r,i)<=n,p=f&&!m,p||(w=i),m){if(i>=1){if(d.interval.end=w=1,h=d,i>1){let v={x:d.x+d.r*Iu(d.e),y:d.y+d.r*ku(d.e)};d.e+=U.angle({x:d.x,y:d.y},v,this.get(1))}break}i=i+(i-r)/2}else i=g;while(!p&&a++<100);if(a>=100)break;h=h||d,o.push(h),r=w}while(i<1);return o}}function Jo(e,n){(n==null||n>e.length)&&(n=e.length);for(var o=0,r=Array(n);o<n;o++)r[o]=e[o];return r}function Du(e){if(Array.isArray(e))return e}function Nu(e){if(Array.isArray(e))return Jo(e)}function Pu(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Tu(e,n){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r,i,a,s,l=[],u=!0,d=!1;try{if(a=(o=o.call(e)).next,n!==0)for(;!(u=(r=a.call(o)).done)&&(l.push(r.value),l.length!==n);u=!0);}catch(h){d=!0,i=h}finally{try{if(!u&&o.return!=null&&(s=o.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Au(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
272
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mu(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
273
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ju(e,n){if(e==null)return{};var o,r,i=Eu(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],n.includes(o)||{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}function Eu(e,n){if(e==null)return{};var o={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.includes(r))continue;o[r]=e[r]}return o}function Ru(e,n){return Du(e)||Tu(e,n)||wa(e,n)||Au()}function Ou(e){return Nu(e)||Pu(e)||wa(e)||Mu()}function Fu(e,n){if(typeof e!="object"||!e)return e;var o=e[Symbol.toPrimitive];if(o!==void 0){var r=o.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Lu(e){var n=Fu(e,"string");return typeof n=="symbol"?n:n+""}function wa(e,n){if(e){if(typeof e=="string")return Jo(e,n);var o={}.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Jo(e,n):void 0}}var zu=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=(n instanceof Array?n.length?n:[void 0]:[n]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),a=e.reduce(function(l,u){var d=l,h=u;return i.forEach(function(m,f){var p=m.keyAccessor,g=m.isProp,w;if(g){var b=h,v=b[p],S=ju(b,[p].map(Lu));w=v,h=S}else w=p(h,f);f+1<i.length?(d.hasOwnProperty(w)||(d[w]={}),d=d[w]):o?(d.hasOwnProperty(w)||(d[w]=[]),d[w].push(h)):d[w]=h}),l},{});o instanceof Function&&function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;d===i.length?Object.keys(u).forEach(function(h){return u[h]=o(u[h])}):Object.values(u).forEach(function(h){return l(h,d+1)})}(a);var s=a;return r&&(s=[],function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];d.length===i.length?s.push({keys:d,vals:u}):Object.entries(u).forEach(function(h){var m=Ru(h,2),f=m[0],p=m[1];return l(p,[].concat(Ou(d),[f]))})}(a),n instanceof Array&&n.length===0&&s.length===1&&(s[0].keys=[])),s};function $u(e,n){n===void 0&&(n={});var o=n.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",o==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var Uu=`.force-graph-container canvas {
|
|
274
|
-
display: block;
|
|
275
|
-
user-select: none;
|
|
276
|
-
outline: none;
|
|
277
|
-
-webkit-tap-highlight-color: transparent;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.force-graph-container .clickable {
|
|
281
|
-
cursor: pointer;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.force-graph-container .grabbable {
|
|
285
|
-
cursor: move;
|
|
286
|
-
cursor: grab;
|
|
287
|
-
cursor: -moz-grab;
|
|
288
|
-
cursor: -webkit-grab;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.force-graph-container .grabbable:active {
|
|
292
|
-
cursor: grabbing;
|
|
293
|
-
cursor: -moz-grabbing;
|
|
294
|
-
cursor: -webkit-grabbing;
|
|
295
|
-
}
|
|
296
|
-
`;$u(Uu);function Xo(e,n){(n==null||n>e.length)&&(n=e.length);for(var o=0,r=Array(n);o<n;o++)r[o]=e[o];return r}function Bu(e){if(Array.isArray(e))return e}function Hu(e){if(Array.isArray(e))return Xo(e)}function Ii(e,n,o){if(_a())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,n);var i=new(e.bind.apply(e,r));return i}function Sn(e,n,o){return(n=Yu(n))in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function _a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_a=function(){return!!e})()}function Vu(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gu(e,n){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r,i,a,s,l=[],u=!0,d=!1;try{if(a=(o=o.call(e)).next,n!==0)for(;!(u=(r=a.call(o)).done)&&(l.push(r.value),l.length!==n);u=!0);}catch(h){d=!0,i=h}finally{try{if(!u&&o.return!=null&&(s=o.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Wu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
297
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qu(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
298
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ki(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,r)}return o}function Qt(e){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};n%2?ki(Object(o),!0).forEach(function(r){Sn(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ki(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function In(e,n){return Bu(e)||Gu(e,n)||Ia(e,n)||Wu()}function He(e){return Hu(e)||Vu(e)||Ia(e)||qu()}function Ku(e,n){if(typeof e!="object"||!e)return e;var o=e[Symbol.toPrimitive];if(o!==void 0){var r=o.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Yu(e){var n=Ku(e,"string");return typeof n=="symbol"?n:n+""}function Zo(e){"@babel/helpers - typeof";return Zo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Zo(e)}function Ia(e,n){if(e){if(typeof e=="string")return Xo(e,n);var o={}.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Xo(e,n):void 0}}var Ju=xs(ws);function Si(e,n,o){!n||typeof o!="string"||e.filter(function(r){return!r[o]}).forEach(function(r){r[o]=Ju(n(r))})}function Xu(e,n){var o=e.nodes,r=e.links,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.nodeFilter,s=a===void 0?function(){return!0}:a,l=i.onLoopError,u=l===void 0?function(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:l,d={};o.forEach(function(p){return d[n(p)]={data:p,out:[],depth:-1,skip:!s(p)}}),r.forEach(function(p){var g=p.source,w=p.target,b=P(g),v=P(w);if(!d.hasOwnProperty(b))throw"Missing source node with id: ".concat(b);if(!d.hasOwnProperty(v))throw"Missing target node with id: ".concat(v);var S=d[b],D=d[v];S.out.push(D);function P(_){return Zo(_)==="object"?n(_):_}});var h=[];f(Object.values(d));var m=Object.assign.apply(Object,[{}].concat(He(Object.entries(d).filter(function(p){var g=In(p,2),w=g[1];return!w.skip}).map(function(p){var g=In(p,2),w=g[0],b=g[1];return Sn({},w,b.depth)}))));return m;function f(p){for(var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,b=function(){var P=p[v];if(g.indexOf(P)!==-1){var _=[].concat(He(g.slice(g.indexOf(P))),[P]).map(function(T){return n(T.data)});return h.some(function(T){return T.length===_.length&&T.every(function(I,N){return I===_[N]})})||(h.push(_),u(_)),1}w>P.depth&&(P.depth=w,f(P.out,[].concat(He(g),[P]),w+(P.skip?0:1)))},v=0,S=p.length;v<S;v++)b()}}var Zu=2,Te=function(n,o){return o.onNeedsRedraw&&o.onNeedsRedraw()},Ci=function(n,o){if(!o.isShadow){var r=ae(o.linkDirectionalParticles);o.graphData.links.forEach(function(i){var a=Math.round(Math.abs(r(i)));a?i.__photons=He(Array(a)).map(function(){return{}}):delete i.__photons})}},Xn=rr({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,o){o.engineRunning=!1,Ci(n,o)}},dagMode:{onChange:function(n,o){!n&&(o.graphData.nodes||[]).forEach(function(r){return r.fx=r.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:Te},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:Te},nodeColor:{default:"color",triggerUpdate:!1,onChange:Te},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:Te},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Te},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:Te},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:Te},linkColor:{default:"color",triggerUpdate:!1,onChange:Te},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:Te},linkWidth:{default:1,triggerUpdate:!1,onChange:Te},linkCurvature:{default:0,triggerUpdate:!1,onChange:Te},linkCanvasObject:{triggerUpdate:!1,onChange:Te},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Te},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:Te},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:Te},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:Te},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:Ci},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,o){o.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,o){o.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,o){o.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,o,r){return r===void 0?n.forceLayout.force(o):(n.forceLayout.force(o,r),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&o(),i(),!n.isShadow&&a(),!n.isShadow&&s(),r(),this;function o(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin?(n.engineRunning=!1,n.onEngineStop()):(n.forceLayout.tick(),n.onEngineTick()))}function r(){var l=ae(n.nodeVisibility),u=ae(n.nodeVal),d=ae(n.nodeColor),h=ae(n.nodeCanvasObjectMode),m=n.ctx,f=n.isShadow/n.globalScale,p=n.graphData.nodes.filter(l);m.save(),p.forEach(function(g){var w=h(g);if(n.nodeCanvasObject&&(w==="before"||w==="replace")&&(n.nodeCanvasObject(g,m,n.globalScale),w==="replace")){m.restore();return}var b=Math.sqrt(Math.max(0,u(g)||1))*n.nodeRelSize+f;m.beginPath(),m.arc(g.x,g.y,b,0,2*Math.PI,!1),m.fillStyle=d(g)||"rgba(31, 120, 180, 0.92)",m.fill(),n.nodeCanvasObject&&w==="after"&&n.nodeCanvasObject(g,n.ctx,n.globalScale)}),m.restore()}function i(){var l=ae(n.linkVisibility),u=ae(n.linkColor),d=ae(n.linkWidth),h=ae(n.linkLineDash),m=ae(n.linkCurvature),f=ae(n.linkCanvasObjectMode),p=n.ctx,g=n.isShadow*2,w=n.graphData.links.filter(l);w.forEach(T);var b=[],v=[],S=w;if(n.linkCanvasObject){var D=[],P=[];w.forEach(function(I){return({before:b,after:v,replace:D}[f(I)]||P).push(I)}),S=[].concat(He(b),v,P),b=b.concat(D)}p.save(),b.forEach(function(I){return n.linkCanvasObject(I,p,n.globalScale)}),p.restore();var _=zu(S,[u,d,h]);p.save(),Object.entries(_).forEach(function(I){var N=In(I,2),L=N[0],E=N[1],O=!L||L==="undefined"?"rgba(0,0,0,0.15)":L;Object.entries(E).forEach(function($){var V=In($,2),J=V[0],ne=V[1],B=(J||1)/n.globalScale+g;Object.entries(ne).forEach(function(G){var ce=In(G,2);ce[0];var ue=ce[1],A=h(ue[0]);p.beginPath(),ue.forEach(function(ie){var oe=ie.source,re=ie.target;if(!(!oe||!re||!oe.hasOwnProperty("x")||!re.hasOwnProperty("x"))){p.moveTo(oe.x,oe.y);var K=ie.__controlPoints;K?p[K.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(p,He(K).concat([re.x,re.y])):p.lineTo(re.x,re.y)}}),p.strokeStyle=O,p.lineWidth=B,p.setLineDash(A||[]),p.stroke()})})}),p.restore(),p.save(),v.forEach(function(I){return n.linkCanvasObject(I,p,n.globalScale)}),p.restore();function T(I){var N=m(I);if(!N){I.__controlPoints=null;return}var L=I.source,E=I.target;if(!(!L||!E||!L.hasOwnProperty("x")||!E.hasOwnProperty("x"))){var O=Math.sqrt(Math.pow(E.x-L.x,2)+Math.pow(E.y-L.y,2));if(O>0){var $=Math.atan2(E.y-L.y,E.x-L.x),V=O*N,J={x:(L.x+E.x)/2+V*Math.cos($-Math.PI/2),y:(L.y+E.y)/2+V*Math.sin($-Math.PI/2)};I.__controlPoints=[J.x,J.y]}else{var ne=N*70;I.__controlPoints=[E.x,E.y-ne,E.x+ne,E.y]}}}}function a(){var l=1.6,u=.2,d=ae(n.linkDirectionalArrowLength),h=ae(n.linkDirectionalArrowRelPos),m=ae(n.linkVisibility),f=ae(n.linkDirectionalArrowColor||n.linkColor),p=ae(n.nodeVal),g=n.ctx;g.save(),n.graphData.links.filter(m).forEach(function(w){var b=d(w);if(!(!b||b<0)){var v=w.source,S=w.target;if(!(!v||!S||!v.hasOwnProperty("x")||!S.hasOwnProperty("x"))){var D=Math.sqrt(Math.max(0,p(v)||1))*n.nodeRelSize,P=Math.sqrt(Math.max(0,p(S)||1))*n.nodeRelSize,_=Math.min(1,Math.max(0,h(w))),T=f(w)||"rgba(0,0,0,0.28)",I=b/l/2,N=w.__controlPoints&&Ii(he,[v.x,v.y].concat(He(w.__controlPoints),[S.x,S.y])),L=N?function(B){return N.get(B)}:function(B){return{x:v.x+(S.x-v.x)*B||0,y:v.y+(S.y-v.y)*B||0}},E=N?N.length():Math.sqrt(Math.pow(S.x-v.x,2)+Math.pow(S.y-v.y,2)),O=D+b+(E-D-P-b)*_,$=L(O/E),V=L((O-b)/E),J=L((O-b*(1-u))/E),ne=Math.atan2($.y-V.y,$.x-V.x)-Math.PI/2;g.beginPath(),g.moveTo($.x,$.y),g.lineTo(V.x+I*Math.cos(ne),V.y+I*Math.sin(ne)),g.lineTo(J.x,J.y),g.lineTo(V.x-I*Math.cos(ne),V.y-I*Math.sin(ne)),g.fillStyle=T,g.fill()}}}),g.restore()}function s(){var l=ae(n.linkDirectionalParticles),u=ae(n.linkDirectionalParticleSpeed),d=ae(n.linkDirectionalParticleOffset),h=ae(n.linkDirectionalParticleWidth),m=ae(n.linkVisibility),f=ae(n.linkDirectionalParticleColor||n.linkColor),p=n.ctx;p.save(),n.graphData.links.filter(m).forEach(function(g){var w=l(g);if(!(!g.hasOwnProperty("__photons")||!g.__photons.length)){var b=g.source,v=g.target;if(!(!b||!v||!b.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var S=u(g),D=Math.abs(d(g)),P=g.__photons||[],_=Math.max(0,h(g)/2)/Math.sqrt(n.globalScale),T=f(g)||"rgba(0,0,0,0.28)";p.fillStyle=T;var I=g.__controlPoints?Ii(he,[b.x,b.y].concat(He(g.__controlPoints),[v.x,v.y])):null,N=0,L=!1;P.forEach(function(E){var O=!!E.__singleHop;if(E.hasOwnProperty("__progressRatio")||(E.__progressRatio=O?S<0?1:0:(N+D)/w),!O&&N++,E.__progressRatio+=S,E.__progressRatio>=1||E.__progressRatio<0)if(!O)E.__progressRatio=E.__progressRatio%1,E.__progressRatio<0&&E.__progressRatio++;else{L=!0;return}var $=E.__progressRatio,V=I?I.get($):{x:b.x+(v.x-b.x)*$||0,y:b.y+(v.y-b.y)*$||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(V.x,V.y,g,p,n.globalScale):(p.beginPath(),p.arc(V.x,V.y,_,0,2*Math.PI,!1),p.fill())}),L&&(g.__photons=g.__photons.filter(function(E){return!E.__singleHop||E.__progressRatio<=1&&E.__progressRatio>=0}))}}}),p.restore()}},emitParticle:function(n,o){return o&&(!o.__photons&&(o.__photons=[]),o.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:yu().force("link",cu()).force("charge",vu()).force("center",Dd()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,o){o.ctx=n},update:function(n,o){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Si(n.graphData.nodes,ae(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Si(n.graphData.links,ae(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(f){f.source=f[n.linkSource],f.target=f[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var r=n.forceLayout.force("link");r&&r.id(function(f){return f[n.nodeId]}).links(n.graphData.links);var i=n.dagMode&&Xu(n.graphData,function(f){return f[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,He(Object.values(i||[]))),s=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*Zu*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(o.dagMode)){var l=["lr","rl"].includes(o.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(f){return delete f[l]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var u=["rl","bu"].includes(n.dagMode),d=function(p){return(i[p[n.nodeId]]-a/2)*s*(u?-1:1)},h=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(f){return f[h]=d(f)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?bu(function(f){var p=i[f[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-p:p)*s}).strength(function(f){return n.dagNodeFilter(f)?1:0}):null);for(var m=0;m<n.warmupTicks&&!(n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin);m++)n.forceLayout.tick();this.resetCountdown(),n.onFinishUpdate()}});function ka(e,n){var o=e instanceof Array?e:[e],r=new n;return r._destructor&&r._destructor(),{linkProp:function(a){return{default:r[a](),onChange:function(l,u){o.forEach(function(d){return u[d][a](l)})},triggerUpdate:!1}},linkMethod:function(a){return function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];var h=[];return o.forEach(function(m){var f=s[m],p=f[a].apply(f,u);p!==f&&h.push(p)}),h.length?h[0]:this}}}}var Qu=800,ef=4,tf=5,Sa=ka("forceGraph",Xn),nf=ka(["forceGraph","shadowGraph"],Xn),of=Object.assign.apply(Object,He(["nodeColor","nodeAutoColorBy","nodeCanvasObject","nodeCanvasObjectMode","linkColor","linkAutoColorBy","linkLineDash","linkWidth","linkCanvasObject","linkCanvasObjectMode","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleCanvasObject","dagMode","dagLevelDistance","dagNodeFilter","onDagError","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(e){return Sn({},e,Sa.linkProp(e))})).concat(He(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return Sn({},e,nf.linkProp(e))})))),rf=Object.assign.apply(Object,He(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return Sn({},e,Sa.linkMethod(e))})));function Io(e){if(e.canvas){var n=e.canvas.width,o=e.canvas.height;n===300&&o===150&&(n=o=0);var r=window.devicePixelRatio;n/=r,o/=r,[e.canvas,e.shadowCanvas].forEach(function(a){a.style.width="".concat(e.width,"px"),a.style.height="".concat(e.height,"px"),a.width=e.width*r,a.height=e.height*r,!n&&!o&&a.getContext("2d").scale(r,r)});var i=ht(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/i,(e.height-o)/2/i),e.needsRedraw=!0}}function Ca(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function Di(e,n,o){e.save(),Ca(e),e.clearRect(0,0,n,o),e.restore()}var af=rr({props:Qt({width:{default:window.innerWidth,onChange:function(n,o){return Io(o)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,o){return Io(o)},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(n,o){[n.nodes,n.links].every(function(i){return(i||[]).every(function(a){return!a.hasOwnProperty("__indexColor")})})&&o.colorTracker.reset(),[{type:"Node",objs:n.nodes},{type:"Link",objs:n.links}].forEach(r),o.forceGraph.graphData(n),o.shadowGraph.graphData(n);function r(i){var a=i.type,s=i.objs;s.filter(function(l){if(!l.hasOwnProperty("__indexColor"))return!0;var u=o.colorTracker.lookup(l.__indexColor);return!u||!u.hasOwnProperty("d")||u.d!==l}).forEach(function(l){l.__indexColor=o.colorTracker.register({type:a,d:l})})}},triggerUpdate:!1},backgroundColor:{onChange:function(n,o){o.canvas&&n&&(o.canvas.style.background=n)},triggerUpdate:!1},nodeLabel:{default:"name",triggerUpdate:!1},nodePointerAreaPaint:{onChange:function(n,o){o.shadowGraph.nodeCanvasObject(n?function(r,i,a){return n(r,r.__indexColor,i,a)}:null),o.flushShadowCanvas&&o.flushShadowCanvas()},triggerUpdate:!1},linkPointerAreaPaint:{onChange:function(n,o){o.shadowGraph.linkCanvasObject(n?function(r,i,a){return n(r,r.__indexColor,i,a)}:null),o.flushShadowCanvas&&o.flushShadowCanvas()},triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:4,triggerUpdate:!1},minZoom:{default:.01,onChange:function(n,o){o.zoom.scaleExtent([n,o.zoom.scaleExtent()[1]])},triggerUpdate:!1},maxZoom:{default:1e3,onChange:function(n,o){o.zoom.scaleExtent([o.zoom.scaleExtent()[0],n])},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},enableZoomInteraction:{default:!0,triggerUpdate:!1},enablePanInteraction:{default:!0,triggerUpdate:!1},enableZoomPanInteraction:{default:!0,triggerUpdate:!1},enablePointerInteraction:{default:!0,onChange:function(n,o){o.hoverObj=null},triggerUpdate:!1},autoPauseRedraw:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},onZoom:{triggerUpdate:!1},onZoomEnd:{triggerUpdate:!1},onRenderFramePre:{triggerUpdate:!1},onRenderFramePost:{triggerUpdate:!1}},of),aliases:{stopAnimation:"pauseAnimation"},methods:Qt({graph2ScreenCoords:function(n,o,r){var i=ht(n.canvas);return{x:o*i.k+i.x,y:r*i.k+i.y}},screen2GraphCoords:function(n,o,r){var i=ht(n.canvas);return{x:(o-i.x)/i.k,y:(r-i.y)/i.k}},centerAt:function(n,o,r,i){if(!n.canvas)return null;if(o!==void 0||r!==void 0){var a=Object.assign({},o!==void 0?{x:o}:{},r!==void 0?{y:r}:{});return i?n.tweenGroup.add(new Zr(s()).to(a,i).easing(Ut.Quadratic.Out).onUpdate(l).onComplete(function(){n.tweenGroup.remove(this)}).start()):l(a),this}return s();function s(){var u=ht(n.canvas);return{x:(n.width/2-u.x)/u.k,y:(n.height/2-u.y)/u.k}}function l(u){var d=u.x,h=u.y;n.zoom.translateTo(n.zoom.__baseElem,d===void 0?s().x:d,h===void 0?s().y:h),n.needsRedraw=!0}},zoom:function(n,o,r){if(!n.canvas)return null;if(o!==void 0)return r?n.tweenGroup.add(new Zr({k:i()}).to({k:o},r).easing(Ut.Quadratic.Out).onUpdate(function(s){var l=s.k;return a(l)}).onComplete(function(){n.tweenGroup.remove(this)}).start()):a(o),this;return i();function i(){return ht(n.canvas).k}function a(s){n.zoom.scaleTo(n.zoom.__baseElem,s),n.needsRedraw=!0}},zoomToFit:function(n){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];var l=this.getGraphBbox.apply(this,a);if(l){var u={x:(l.x[0]+l.x[1])/2,y:(l.y[0]+l.y[1])/2},d=Math.max(1e-12,Math.min(1e12,(n.width-r*2)/(l.x[1]-l.x[0]),(n.height-r*2)/(l.y[1]-l.y[0])));this.centerAt(u.x,u.y,o),this.zoom(d,o)}return this},getGraphBbox:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},r=ae(n.nodeVal),i=function(l){return Math.sqrt(Math.max(0,r(l)||1))*n.nodeRelSize},a=n.graphData.nodes.filter(o).map(function(s){return{x:s.x,y:s.y,r:i(s)}});return a.length?{x:[Ar(a,function(s){return s.x-s.r}),Mr(a,function(s){return s.x+s.r})],y:[Ar(a,function(s){return s.y-s.r}),Mr(a,function(s){return s.y+s.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},rf),stateInit:function(){return{lastSetZoom:1,zoom:Ss(),forceGraph:new Xn,shadowGraph:new Xn().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new rd,tweenGroup:new Xi}},init:function(n,o){var r=this;n.innerHTML="";var i=document.createElement("div");i.classList.add("force-graph-container"),i.style.position="relative",n.appendChild(i),o.canvas=document.createElement("canvas"),o.backgroundColor&&(o.canvas.style.background=o.backgroundColor),i.appendChild(o.canvas),o.shadowCanvas=document.createElement("canvas");var a=o.canvas.getContext("2d"),s=o.shadowCanvas.getContext("2d",{willReadFrequently:!0}),l={x:-1e12,y:-1e12},u=function(){var m=null,f=window.devicePixelRatio,p=l.x>0&&l.y>0?s.getImageData(l.x*f,l.y*f,1,1):null;return p&&(m=o.colorTracker.lookup(p.data)),m};Oo(o.canvas).call(_s().subject(function(){if(!o.enableNodeDrag)return null;var h=u();return h&&h.type==="Node"?h.d:null}).on("start",function(h){var m=h.subject;m.__initialDragPos={x:m.x,y:m.y,fx:m.fx,fy:m.fy},h.active||(m.fx=m.x,m.fy=m.y),o.canvas.classList.add("grabbable")}).on("drag",function(h){var m=h.subject,f=m.__initialDragPos,p=h,g=ht(o.canvas).k,w={x:f.x+(p.x-f.x)/g-m.x,y:f.y+(p.y-f.y)/g-m.y};["x","y"].forEach(function(b){return m["f".concat(b)]=m[b]=f[b]+(p[b]-f[b])/g}),!(!m.__dragged&&tf>=Math.sqrt(Is(["x","y"].map(function(b){return Math.pow(h[b]-f[b],2)}))))&&(o.forceGraph.d3AlphaTarget(.3).resetCountdown(),o.isPointerDragging=!0,m.__dragged=!0,o.onNodeDrag(m,w))}).on("end",function(h){var m=h.subject,f=m.__initialDragPos,p={x:m.x-f.x,y:m.y-f.y};f.fx===void 0&&(m.fx=void 0),f.fy===void 0&&(m.fy=void 0),delete m.__initialDragPos,o.forceGraph.d3AlphaTarget()&&o.forceGraph.d3AlphaTarget(0).resetCountdown(),o.canvas.classList.remove("grabbable"),o.isPointerDragging=!1,m.__dragged&&(delete m.__dragged,o.onNodeDragEnd(m,p))})),o.zoom(o.zoom.__baseElem=Oo(o.canvas)),o.zoom.__baseElem.on("dblclick.zoom",null),o.zoom.filter(function(h){return!h.button&&o.enableZoomPanInteraction&&(h.type!=="wheel"||ae(o.enableZoomInteraction)(h))&&(h.type==="wheel"||ae(o.enablePanInteraction)(h))}).on("zoom",function(h){var m=h.transform;[a,s].forEach(function(f){Ca(f),f.translate(m.x,m.y),f.scale(m.k,m.k)}),o.isPointerDragging=!0,o.onZoom&&o.onZoom(Qt(Qt({},m),r.centerAt())),o.needsRedraw=!0}).on("end",function(h){o.isPointerDragging=!1,o.onZoomEnd&&o.onZoomEnd(Qt(Qt({},h.transform),r.centerAt()))}),Io(o),o.forceGraph.onNeedsRedraw(function(){return o.needsRedraw=!0}).onFinishUpdate(function(){ht(o.canvas).k===o.lastSetZoom&&o.graphData.nodes.length&&(o.zoom.scaleTo(o.zoom.__baseElem,o.lastSetZoom=ef/Math.cbrt(o.graphData.nodes.length)),o.needsRedraw=!0)}),o.tooltip=new Cd(i),["pointermove","pointerdown"].forEach(function(h){return i.addEventListener(h,function(m){h==="pointerdown"&&(o.isPointerPressed=!0,o.pointerDownEvent=m),!o.isPointerDragging&&m.type==="pointermove"&&o.onBackgroundClick&&(m.pressure>0||o.isPointerPressed)&&(m.pointerType==="mouse"||m.movementX===void 0||[m.movementX,m.movementY].some(function(g){return Math.abs(g)>1}))&&(o.isPointerDragging=!0);var f=p(i);l.x=m.pageX-f.left,l.y=m.pageY-f.top;function p(g){var w=g.getBoundingClientRect(),b=window.pageXOffset||document.documentElement.scrollLeft,v=window.pageYOffset||document.documentElement.scrollTop;return{top:w.top+v,left:w.left+b}}},{passive:!0})}),i.addEventListener("pointerup",function(h){if(o.isPointerPressed){if(o.isPointerPressed=!1,o.isPointerDragging){o.isPointerDragging=!1;return}var m=[h,o.pointerDownEvent];requestAnimationFrame(function(){if(h.button===0)if(o.hoverObj){var f=o["on".concat(o.hoverObj.type,"Click")];f&&f.apply(void 0,[o.hoverObj.d].concat(m))}else o.onBackgroundClick&&o.onBackgroundClick.apply(o,m);if(h.button===2)if(o.hoverObj){var p=o["on".concat(o.hoverObj.type,"RightClick")];p&&p.apply(void 0,[o.hoverObj.d].concat(m))}else o.onBackgroundRightClick&&o.onBackgroundRightClick.apply(o,m)})}},{passive:!0}),i.addEventListener("contextmenu",function(h){return!o.onBackgroundRightClick&&!o.onNodeRightClick&&!o.onLinkRightClick?!0:(h.preventDefault(),!1)}),o.forceGraph(a),o.shadowGraph(s);var d=ks(function(){Di(s,o.width,o.height),o.shadowGraph.linkWidth(function(m){return ae(o.linkWidth)(m)+o.linkHoverPrecision});var h=ht(o.canvas);o.shadowGraph.globalScale(h.k).tickFrame()},Qu);o.flushShadowCanvas=d.flush,(this._animationCycle=function h(){var m=!o.autoPauseRedraw||!!o.needsRedraw||o.forceGraph.isEngineRunning()||o.graphData.links.some(function(D){return D.__photons&&D.__photons.length});if(o.needsRedraw=!1,o.enablePointerInteraction){var f=o.isPointerDragging?null:u();if(f!==o.hoverObj){var p=o.hoverObj,g=p?p.type:null,w=f?f.type:null;if(g&&g!==w){var b=o["on".concat(g,"Hover")];b&&b(null,p.d)}if(w){var v=o["on".concat(w,"Hover")];v&&v(f.d,g===w?p.d:null)}o.tooltip.content(f&&ae(o["".concat(f.type.toLowerCase(),"Label")])(f.d)||null),o.canvas.classList[(f&&o["on".concat(w,"Click")]||!f&&o.onBackgroundClick)&&ae(o.showPointerCursor)(f==null?void 0:f.d)?"add":"remove"]("clickable"),o.hoverObj=f}m&&d()}if(m){Di(a,o.width,o.height);var S=ht(o.canvas).k;o.onRenderFramePre&&o.onRenderFramePre(a,S),o.forceGraph.globalScale(S).tickFrame(),o.onRenderFramePost&&o.onRenderFramePost(a,S)}o.tweenGroup.update(),o.animationFrameRequestId=requestAnimationFrame(h)})()},update:function(n){}}),Da={exports:{}},sf="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",lf=sf,cf=lf;function Na(){}function Pa(){}Pa.resetWarningCache=Na;var df=function(){function e(r,i,a,s,l,u){if(u!==cf){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function n(){return e}var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:Pa,resetWarningCache:Na};return o.PropTypes=o,o};Da.exports=df();var uf=Da.exports;const C=ss(uf),ro={width:C.number,height:C.number,graphData:C.shape({nodes:C.arrayOf(C.object).isRequired,links:C.arrayOf(C.object).isRequired}),backgroundColor:C.string,nodeRelSize:C.number,nodeId:C.string,nodeLabel:C.oneOfType([C.string,C.func]),nodeVal:C.oneOfType([C.number,C.string,C.func]),nodeVisibility:C.oneOfType([C.bool,C.string,C.func]),nodeColor:C.oneOfType([C.string,C.func]),nodeAutoColorBy:C.oneOfType([C.string,C.func]),onNodeHover:C.func,onNodeClick:C.func,linkSource:C.string,linkTarget:C.string,linkLabel:C.oneOfType([C.string,C.func]),linkVisibility:C.oneOfType([C.bool,C.string,C.func]),linkColor:C.oneOfType([C.string,C.func]),linkAutoColorBy:C.oneOfType([C.string,C.func]),linkWidth:C.oneOfType([C.number,C.string,C.func]),linkCurvature:C.oneOfType([C.number,C.string,C.func]),linkDirectionalArrowLength:C.oneOfType([C.number,C.string,C.func]),linkDirectionalArrowColor:C.oneOfType([C.string,C.func]),linkDirectionalArrowRelPos:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticles:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticleSpeed:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticleOffset:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticleWidth:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticleColor:C.oneOfType([C.string,C.func]),onLinkHover:C.func,onLinkClick:C.func,dagMode:C.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:C.number,dagNodeFilter:C.func,onDagError:C.func,d3AlphaMin:C.number,d3AlphaDecay:C.number,d3VelocityDecay:C.number,warmupTicks:C.number,cooldownTicks:C.number,cooldownTime:C.number,onEngineTick:C.func,onEngineStop:C.func,getGraphBbox:C.func},Ta={zoomToFit:C.func,onNodeRightClick:C.func,onNodeDrag:C.func,onNodeDragEnd:C.func,onLinkRightClick:C.func,linkHoverPrecision:C.number,onBackgroundClick:C.func,onBackgroundRightClick:C.func,showPointerCursor:C.oneOfType([C.bool,C.func]),enablePointerInteraction:C.bool,enableNodeDrag:C.bool},ur={showNavInfo:C.bool,nodeOpacity:C.number,nodeResolution:C.number,nodeThreeObject:C.oneOfType([C.object,C.string,C.func]),nodeThreeObjectExtend:C.oneOfType([C.bool,C.string,C.func]),nodePositionUpdate:C.func,linkOpacity:C.number,linkResolution:C.number,linkCurveRotation:C.oneOfType([C.number,C.string,C.func]),linkMaterial:C.oneOfType([C.object,C.string,C.func]),linkThreeObject:C.oneOfType([C.object,C.string,C.func]),linkThreeObjectExtend:C.oneOfType([C.bool,C.string,C.func]),linkPositionUpdate:C.func,linkDirectionalArrowResolution:C.number,linkDirectionalParticleResolution:C.number,linkDirectionalParticleThreeObject:C.oneOfType([C.object,C.string,C.func]),forceEngine:C.oneOf(["d3","ngraph"]),ngraphPhysics:C.object,numDimensions:C.oneOf([1,2,3])},ff=Object.assign({},ro,Ta,{linkLineDash:C.oneOfType([C.arrayOf(C.number),C.string,C.func]),nodeCanvasObjectMode:C.oneOfType([C.string,C.func]),nodeCanvasObject:C.func,nodePointerAreaPaint:C.func,linkCanvasObjectMode:C.oneOfType([C.string,C.func]),linkCanvasObject:C.func,linkPointerAreaPaint:C.func,linkDirectionalParticleCanvasObject:C.func,autoPauseRedraw:C.bool,minZoom:C.number,maxZoom:C.number,enableZoomInteraction:C.oneOfType([C.bool,C.func]),enablePanInteraction:C.oneOfType([C.bool,C.func]),onZoom:C.func,onZoomEnd:C.func,onRenderFramePre:C.func,onRenderFramePost:C.func});Object.assign({},ro,Ta,ur,{enableNavigationControls:C.bool,controlType:C.oneOf(["trackball","orbit","fly"]),rendererConfig:C.object,extraRenderers:C.arrayOf(C.shape({render:C.func.isRequired}))});Object.assign({},ro,ur,{nodeDesc:C.oneOfType([C.string,C.func]),linkDesc:C.oneOfType([C.string,C.func])});Object.assign({},ro,ur,{markerAttrs:C.object,yOffset:C.number,glScale:C.number});const fr=uc(af,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});fr.displayName="ForceGraph2D";fr.propTypes=ff;const mf=[{value:"openai-completions",label:"OpenAI 兼容"},{value:"anthropic-messages",label:"Anthropic 兼容"}];function hf(e){const{t:n}=Ve(),[o,r]=x.useState("deepseek"),[i,a]=x.useState(""),[s,l]=x.useState(""),[u,d]=x.useState("openai-completions"),[h,m]=x.useState(""),[f,p]=x.useState(!1),[g,w]=x.useState(!1),[b,v]=x.useState(null),S=x.useRef(!1);function D(I){if(a(I),S.current)return;I.toLowerCase().includes("anthropic")?d("anthropic-messages"):d("openai-completions")}function P(I){S.current=!0,d(I)}async function _(){var N;const I=h.trim();if(!I){v("请输入 API Key");return}w(!0),v(null);try{if(o==="deepseek")await qr({kind:"deepseek",modelId:"deepseek-flash",apiKey:I});else{const L=i.trim();if(!L){v("请输入 API 地址");return}const E=s.trim();if(!E){v("请输入 Model ID");return}await qr({kind:"custom",baseUrl:L,modelId:E,apiType:u,apiKey:I})}m(""),a(""),l(""),await((N=e.onConfigured)==null?void 0:N.call(e))}catch(L){v(L instanceof Error?L.message:String(L))}finally{w(!1)}}const T=h.trim()&&(o==="deepseek"||i.trim()&&s.trim());return c.jsxs("div",{className:"mdocs-agent-apikey-inline",children:[c.jsx("p",{className:"mdocs-agent-apikey-inline-lead",children:"配置 AI 供应商后即可使用(仅本人可见,不会分享给其他访客)"}),c.jsxs("div",{className:"mdocs-agent-kind-tabs mdocs-agent-apikey-inline-tabs",role:"tablist","aria-label":"配置方式",children:[c.jsx("button",{type:"button",role:"tab","aria-selected":o==="deepseek",className:o==="deepseek"?"active":"",onClick:()=>r("deepseek"),disabled:g,children:"Deepseek"}),c.jsx("button",{type:"button",role:"tab","aria-selected":o==="custom",className:o==="custom"?"active":"",onClick:()=>r("custom"),disabled:g,children:"自定义"})]}),o==="custom"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"API 地址"}),c.jsx("input",{type:"url",value:i,onChange:I=>D(I.target.value),placeholder:"https://api.example.com/v1",className:"mdocs-agent-mono",disabled:g,onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),_())}})]}),c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"API 协议"}),c.jsx("div",{className:"mdocs-agent-apikey-inline-protocol",children:mf.map(I=>c.jsx("button",{type:"button",className:u===I.value?"active":"",onClick:()=>P(I.value),disabled:g,children:I.label},I.value))})]}),c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"Model ID"}),c.jsx("input",{type:"text",value:s,onChange:I=>l(I.target.value),placeholder:"模型名称,如 gpt-4o / claude-3-5-sonnet",className:"mdocs-agent-mono",disabled:g,onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),_())}})]})]}):null,c.jsxs("div",{className:"mdocs-agent-config-apikey mdocs-agent-apikey-inline-field",children:[c.jsx("input",{type:f?"text":"password",value:h,onChange:I=>m(I.target.value),placeholder:n("agentConfigApiKeyPlaceholder"),autoComplete:"off",disabled:g,onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),_())}}),c.jsx("button",{type:"button",className:"mdocs-agent-config-eye","aria-label":n(f?"agentConfigHideKey":"agentConfigShowKey"),onClick:()=>p(I=>!I),disabled:g,children:f?c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[c.jsx("path",{d:"M3 3l18 18"}),c.jsx("path",{d:"M10.6 10.6a2 2 0 002.8 2.8"}),c.jsx("path",{d:"M9.9 5.1A10.5 0 0121 12c-.6 1.1-1.4 2.1-2.4 2.9"}),c.jsx("path",{d:"M6.1 6.1C4.5 7.4 3.2 9.1 2.5 12c1.5 3.5 5 7 9.5 7 1.4 0 2.7-.3 3.9-.8"})]}):c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[c.jsx("path",{d:"M2.5 12C4 8.5 7.5 5 12 5s8 3.5 9.5 7c-1.5 3.5-5 7-9.5 7s-8-3.5-9.5-7z"}),c.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})]}),b?c.jsx("p",{className:"mdocs-agent-apikey-inline-error",children:b}):null,c.jsx("button",{type:"button",className:"mdocs-agent-apikey-inline-save",onClick:()=>void _(),disabled:g||!T,children:g?n("saving"):"保存并启用"})]})}function Ni(e){return e==="contains"}function pf(e){return e==="related_to"||e==="part_of"||e==="depends_on"}function gf(e,n){var h,m;const o=new Set(e),r=new Map,i=new Map,a=new Map;for(const f of e)r.set(f,[]),i.set(f,[]),a.set(f,0);for(const f of n)!o.has(f.from)||!o.has(f.to)||f.from===f.to||(r.get(f.from).push(f.to),i.get(f.to).push(f.from),a.set(f.to,(a.get(f.to)??0)+1));let s=e.filter(f=>(a.get(f)??0)===0);if(s.length===0&&e.length>0){const f=new Map;for(const w of e)f.set(w,(((h=r.get(w))==null?void 0:h.length)??0)+(((m=i.get(w))==null?void 0:m.length)??0));const p=[...e].sort((w,b)=>(f.get(b)??0)-(f.get(w)??0)),g=f.get(p[0])??0;s=p.filter(w=>(f.get(w)??0)===g).slice(0,12)}const l=new Map,u=[];for(const f of s)l.set(f,0),u.push(f);let d=0;for(;d<u.length;){const f=u[d++],p=l.get(f)??0;for(const g of r.get(f)??[]){const w=p+1;(!l.has(g)||w<(l.get(g)??1/0))&&(l.set(g,w),u.push(g))}}for(const f of e)l.has(f)||l.set(f,0);return{childrenOf:r,parentsOf:i,roots:s,depthMap:l}}function ko(e,n,o,r,i){return i.has(e)?!1:(o.get(e)??0)<n?!0:r.has(e)}function yf(e,n,o){const r=new Set(e),i=[...e];let a=0;for(;a<i.length;){const s=i[a++];if(o(s))for(const l of n.get(s)??[])r.has(l)||(r.add(l),i.push(l))}return r}function vf(e,n){const o=[],r=new Set,i=[...n.get(e)??[]];for(;i.length>0;){const a=i.pop();if(!r.has(a)){r.add(a),o.push(a);for(const s of n.get(a)??[])i.push(s)}}return o}function bf(e){const{event:n,data:o}=e;switch(n){case"task.started":return`🚀 开始生成,共 ${(o==null?void 0:o.totalDocs)??0} 篇文档`;case"doc.started":return`📄 处理中:${(o==null?void 0:o.docPath)??""}(${(o==null?void 0:o.index)??0}/${(o==null?void 0:o.total)??0})`;case"doc.completed":return`✅ ${(o==null?void 0:o.docPath)??""}(提取 ${(o==null?void 0:o.conceptsExtracted)??0} 个知识块)`;case"doc.failed":return`⚠️ ${(o==null?void 0:o.docPath)??""} 失败:${(o==null?void 0:o.error)??""}`;case"folder.started":return`📁 归纳目录:${(o==null?void 0:o.folderPath)??""}`;case"folder.completed":return`✅ 目录归纳完成:${(o==null?void 0:o.folderPath)??""}`;case"domain.started":return"🌐 开始 domain 级合成";case"domain.completed":return`✅ domain 合成完成(${(o==null?void 0:o.totalNodes)??0} 节点,${(o==null?void 0:o.totalEdges)??0} 边)`;case"task.yielded":return"⏸️ 让出资源,排队等待中...";case"task.progress":return`⏳ ${(o==null?void 0:o.phase)??"progress"} ${(o==null?void 0:o.current)??0}/${(o==null?void 0:o.total)??0}`;case"task.completed":return`🎉 生成完成!${(o==null?void 0:o.nodes)??0} 个节点,${(o==null?void 0:o.edges)??0} 条边`;case"task.failed":return`❌ 生成失败:${(o==null?void 0:o.error)??""}`;default:return`${n}${o?`: ${JSON.stringify(o)}`:""}`}}function So(e){return e<=1?"排队中,即将开始…":`排队中,前面还有 ${e-1} 个任务`}function Co(e,n,o){const r=Math.max(e,.2);return Math.max(o??n*.75,n)/r}function xf({scope:e,resourceId:n,name:o,onOpenDocument:r,onClose:i}){const[a,s]=x.useState(null),[l,u]=x.useState(!0),[d,h]=x.useState(null),[m,f]=x.useState(!1),[p,g]=x.useState(!1),[w,b]=x.useState(0),[v,S]=x.useState(()=>new Set),[D,P]=x.useState(()=>new Set),[_,T]=x.useState(null),[I,N]=x.useState(null),[L,E]=x.useState(null),O=x.useRef(null),$=x.useRef(new Map),[V,J]=x.useState("not_found"),[ne,B]=x.useState([]),[G,ce]=x.useState(null),[ue,A]=x.useState(0),ie=`graph:${e==="domain"?"domain":"dir"}:${n}`,oe=x.useRef(ie),re=x.useRef(null),[K,Z]=x.useState(!1),[we,se]=x.useState(!1),[tt,Tt]=x.useState(!1),[vt,rn]=x.useState(!1),[Vt,At]=x.useState(!1),nt=x.useRef(null),_e=V==="running"||V==="pending";x.useEffect(()=>{let k=!1;return u(!0),h(null),T(null),b(0),S(new Set),P(new Set),g(!1),E(null),$.current=new Map,(e==="domain"?Yr:Kr)(n).then(z=>{k||(s(z),u(!1))}).catch(z=>{k||(h(z.message||"加载失败"),u(!1))}),()=>{k=!0}},[n,e]),x.useEffect(()=>(oe.current=ie,We(),Ge(),()=>We()),[ie]);async function Ge(){try{const k=await Gl(oe.current);J(k.status),B(k.logs),ce(k.progress??null),A(k.position),k.status==="completed"?(We(),Mt()):k.status==="failed"||k.status==="stale"?(We(),k.error&&h(k.error)):(k.status==="running"||k.status==="pending")&&Pn()}catch{}}function Pn(){re.current||(re.current=window.setInterval(()=>{Ge()},2e3))}function We(){re.current&&(clearInterval(re.current),re.current=null)}async function Mt(){try{const j=await(e==="domain"?Yr:Kr)(n);s(j)}catch(k){h(k.message||"加载失败")}}const $e=async()=>{if(!_e){h(null),Z(!1);try{const j=await(e==="domain"?Vl:Hl)(n);oe.current=j.taskId,J(j.status),A(j.position),B([]),ce(null),Pn()}catch(k){if(k instanceof et&&k.code==="AI_NOT_CONFIGURED"){Z(!0),h(k.message);return}h((k==null?void 0:k.message)||"生成失败")}}},Gt=async()=>{se(!1),Z(!1),h(null),await $e()},Ee=x.useMemo(()=>a?m?a.nodes:a.nodes.filter(k=>k.type==="concept"):[],[a,m]),me=x.useMemo(()=>{if(!a)return[];const k=new Set(Ee.map(j=>j.id));return a.edges.filter(j=>k.has(j.from)&&k.has(j.to))},[a,Ee]),Ce=x.useMemo(()=>{const k=me.filter(j=>Ni(String(j.type))).map(j=>({from:j.from,to:j.to}));return gf(Ee.map(j=>j.id),k)},[Ee,me]),be=x.useMemo(()=>yf(Ce.roots,Ce.childrenOf,k=>ko(k,w,Ce.depthMap,v,D)),[Ce,w,v,D]),{displayNodes:xe,displayEdges:jt}=x.useMemo(()=>{const k=Ee.filter(z=>be.has(z.id)),j=me.filter(z=>{if(!be.has(z.from)||!be.has(z.to))return!1;const F=String(z.type);return!!(Ni(F)||p&&pf(F))});return{displayNodes:k,displayEdges:j}},[Ee,me,be,p]),bt=x.useMemo(()=>{const k=new Map;for(const j of Ee)k.set(j.id,j);return k},[Ee]);function ct(k){b(k),S(new Set),P(new Set)}function an(k){if((Ce.childrenOf.get(k)??[]).length===0)return;ko(k,w,Ce.depthMap,v,D)?(P(F=>new Set(F).add(k)),S(F=>{const q=new Set(F);return q.delete(k),q})):(P(F=>{const q=new Set(F);return q.delete(k),q}),S(F=>new Set(F).add(k)))}function Me(k){const j=vf(k.id,Ce.parentsOf);P(z=>{const F=new Set(z);for(const q of j)F.delete(q);return F}),S(z=>{const F=new Set(z);for(const q of j)F.add(q);return F}),T(k)}const sn=x.useMemo(()=>{const k=xe.map(F=>{var De;const q=((De=Ce.childrenOf.get(F.id))==null?void 0:De.length)??0,X=ko(F.id,w,Ce.depthMap,v,D),te=$.current.get(F.id);let Q=te==null?void 0:te.x,ye=te==null?void 0:te.y;if(Q==null||ye==null){const je=(Ce.parentsOf.get(F.id)??[]).map(Ne=>$.current.get(Ne)).find(Ne=>Ne!=null);je?(Q=je.x+(Math.random()-.5)*60,ye=je.y+50+Math.random()*40):(Q=(Math.random()-.5)*240,ye=(Math.random()-.5)*180),$.current.set(F.id,{x:Q,y:ye})}return{id:F.id,name:F.label,type:F.type,val:F.type==="concept"?4:2,x:Q,y:ye,__raw:F,__childCount:q,__expanded:X}}),j=new Map,z=jt.map(F=>{const q=`${F.from}->${F.to}`,X=j.get(q)??0;j.set(q,X+1);const te=X===0?.08:.08+X*.14;return{source:F.from,target:F.to,type:F.type,curvature:te,__raw:F}});return{nodes:k,links:z}},[xe,jt,Ce,w,v,D]),ot=x.useMemo(()=>{const k=Math.max(1,xe.length);return{linkDistance:Math.min(140,70+Math.sqrt(k)*8),chargeStrength:Math.max(-420,-120-k*6)}},[xe.length]),Fe=x.useRef(null),[qe,Tn]=x.useState({width:800,height:600});x.useEffect(()=>{if(!Fe.current)return;const k=()=>{Fe.current&&Tn({width:Fe.current.clientWidth,height:Fe.current.clientHeight})};k();const j=new ResizeObserver(k);return j.observe(Fe.current),()=>j.disconnect()},[]),x.useEffect(()=>{if(!a||l)return;const k=window.setTimeout(()=>{var j,z;(z=(j=O.current)==null?void 0:j.zoomToFit)==null||z.call(j,400,80)},450);return()=>window.clearTimeout(k)},[a,m,p,l,qe.width,qe.height,w,be]),x.useEffect(()=>{var F,q,X,te;if(!a||l)return;const k=O.current;if(!k)return;const j=k.d3Force("charge");(F=j==null?void 0:j.strength)==null||F.call(j,ot.chargeStrength);const z=k.d3Force("link");(q=z==null?void 0:z.distance)==null||q.call(z,ot.linkDistance),(X=z==null?void 0:z.strength)==null||X.call(z,.35),(te=k.d3ReheatSimulation)==null||te.call(k)},[ot,a,l,m,sn]);const xt=k=>(Ce.childrenOf.get(k)??[]).map(z=>bt.get(z)??(a==null?void 0:a.nodes.find(F=>F.id===z))).filter(z=>!!z),Wt=k=>(Ce.parentsOf.get(k)??[]).map(z=>bt.get(z)??(a==null?void 0:a.nodes.find(F=>F.id===z))).filter(z=>!!z),An=k=>{if(!a)return[];const j=new Set,z=[],F=[k];for(;F.length>0;){const q=F.shift();if(j.has(q))continue;j.add(q);const X=a.nodes.find(Q=>Q.id===q);(X==null?void 0:X.type)==="doc"&&z.push(X);const te=a.edges.filter(Q=>Q.from===q).map(Q=>Q.to);F.push(...te)}return z};return x.useEffect(()=>{if(!Vt)return;const k=j=>{nt.current&&!nt.current.contains(j.target)&&At(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[Vt]),c.jsxs("div",{className:"graph-page",children:[c.jsxs("div",{className:"graph-toolbar",children:[c.jsxs("div",{className:"graph-toolbar-left",children:[c.jsx("span",{className:"graph-icon",children:"🕸️"}),c.jsxs("span",{className:"graph-title-text",title:`知识图谱 — ${o}`,children:["知识图谱 — ",o]}),i&&c.jsx("button",{className:"graph-btn graph-btn-danger",onClick:i,children:"退出图谱"})]}),c.jsxs("div",{className:"graph-toolbar-right",children:[c.jsxs("div",{className:"graph-mobile-toggle-wrap",ref:nt,children:[c.jsx("button",{type:"button",className:"graph-mobile-toggle-btn",onClick:()=>At(k=>!k),"aria-label":"更多操作",children:c.jsx($s,{size:18,strokeWidth:1.75})}),Vt&&c.jsxs("div",{className:"graph-mobile-actions card",onClick:()=>At(!1),children:[c.jsxs("div",{className:"graph-mobile-action-group",children:[c.jsx("div",{className:"graph-mobile-action-label",children:"层级控制"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===1?"active":""}`,onMouseDown:()=>ct(1),children:"展开一级"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===2?"active":""}`,onMouseDown:()=>ct(2),children:"展开到二级"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===0&&v.size===0?"active":""}`,onMouseDown:()=>ct(0),children:"全部收起"})]}),c.jsxs("div",{className:"graph-mobile-action-group",children:[c.jsx("div",{className:"graph-mobile-action-label",children:"视图"}),c.jsxs("label",{className:"graph-mobile-action-switch",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:k=>g(k.target.checked)}),c.jsx("span",{children:"显示其它关系"})]}),c.jsxs("label",{className:"graph-mobile-action-switch",children:[c.jsx("input",{type:"checkbox",checked:m,onChange:k=>f(k.target.checked)}),c.jsx("span",{children:"显示 doc 节点"})]})]}),c.jsxs("button",{className:"graph-mobile-action-item",onMouseDown:()=>se(!0),children:[c.jsx(ho,{size:14}),"配置 AI"]}),c.jsx("button",{className:"graph-mobile-action-item graph-mobile-action-primary",onMouseDown:$e,disabled:_e,children:_e?c.jsxs(c.Fragment,{children:[c.jsx(On,{size:14,className:"spin"}),V==="pending"?So(ue):"生成中..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Fr,{size:14}),a?"重新生成":"生成图谱"]})})]})]}),c.jsxs("div",{className:"graph-desktop-actions",children:[c.jsxs("div",{className:"graph-dropdown",children:[c.jsxs("button",{type:"button",className:"graph-btn",onClick:()=>Tt(k=>!k),onBlur:()=>setTimeout(()=>Tt(!1),150),children:["层级控制 ",c.jsx(Fo,{size:12})]}),tt&&c.jsxs("div",{className:"graph-dropdown-menu graph-dropdown-menu--right",children:[c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===1?"active":""}`,onMouseDown:()=>{ct(1),Tt(!1)},children:"展开一级"}),c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===2?"active":""}`,onMouseDown:()=>{ct(2),Tt(!1)},children:"展开到二级"}),c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===0&&v.size===0?"active":""}`,onMouseDown:()=>{ct(0),Tt(!1)},children:"全部收起"})]})]}),c.jsxs("div",{className:"graph-dropdown",children:[c.jsxs("button",{type:"button",className:"graph-btn",onClick:()=>rn(k=>!k),onBlur:()=>setTimeout(()=>rn(!1),150),children:[c.jsx(Bs,{size:14})," 视图 ",c.jsx(Fo,{size:12})]}),vt&&c.jsxs("div",{className:"graph-dropdown-menu graph-dropdown-menu--right",children:[c.jsxs("label",{className:"graph-dropdown-switch",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:k=>g(k.target.checked)}),c.jsx("span",{children:"显示其它关系"})]}),c.jsxs("label",{className:"graph-dropdown-switch",children:[c.jsx("input",{type:"checkbox",checked:m,onChange:k=>f(k.target.checked)}),c.jsx("span",{children:"显示 doc 节点"})]})]})]}),c.jsxs("button",{className:"graph-btn graph-btn-ghost",onClick:()=>se(!0),title:"配置用于图谱分析的 AI 模型",children:[c.jsx(ho,{size:14}),"配置 AI"]}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:$e,disabled:_e,children:_e?c.jsxs(c.Fragment,{children:[c.jsx(On,{size:14,className:"spin"}),V==="pending"?So(ue):"生成中..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Fr,{size:14}),a?"重新生成":"生成图谱"]})})]})]})]}),c.jsxs("div",{className:"graph-canvas-container",ref:Fe,children:[l&&c.jsxs("div",{className:"graph-loading",children:[c.jsx(On,{size:32,className:"spin"}),c.jsx("p",{children:"加载图谱中..."})]}),d&&!l&&c.jsx("div",{className:"graph-error",children:K?c.jsxs(c.Fragment,{children:[c.jsx("p",{style:{fontSize:40,margin:0},children:"🔑"}),c.jsx("h3",{children:"还没有配置 AI 模型"}),c.jsx("p",{className:"muted",children:"图谱由 AI 分析生成,需要先配置一个可用的模型"}),c.jsxs("button",{className:"graph-btn graph-btn-primary",onClick:()=>se(!0),style:{marginTop:12},children:[c.jsx(ho,{size:14}),"配置 AI"]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("p",{children:["❌ ",d]}),c.jsx("button",{className:"graph-btn",onClick:$e,children:"重试生成"})]})}),!l&&!d&&!a&&!_e&&c.jsxs("div",{className:"graph-empty",children:[c.jsx("p",{style:{fontSize:48,margin:0},children:"🕸️"}),c.jsx("h3",{children:"还没有知识图谱"}),c.jsx("p",{className:"muted",children:"点击右上角「生成图谱」开始构建"}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:$e,disabled:_e,children:_e?"生成中...":"生成图谱"})]}),_e&&c.jsxs("div",{className:"graph-progress-panel",children:[c.jsxs("div",{className:"graph-progress-header",children:[c.jsx(On,{size:16,className:"spin"}),c.jsx("span",{children:V==="pending"?So(ue):G?`正在生成(${G.current}/${G.total})`:"正在生成..."})]}),G&&G.total>0&&c.jsx("div",{className:"graph-progress-bar",children:c.jsx("div",{className:"graph-progress-bar-fill",style:{width:`${G.current/G.total*100}%`}})}),c.jsx("div",{className:"graph-progress-logs",children:ne.slice(-10).map((k,j)=>c.jsx("div",{className:`graph-log-item graph-log-${k.level}`,children:c.jsx("span",{className:"graph-log-event",children:bf(k)})},j))})]}),!l&&!d&&a&&a.nodes.length===0&&!_e&&c.jsxs("div",{className:"graph-empty",children:[c.jsx("p",{style:{fontSize:48,margin:0},children:"📄"}),c.jsx("h3",{children:"图谱已生成"}),c.jsx("p",{className:"muted",children:"当前内容暂未提取到可关联的知识概念"}),c.jsx("p",{className:"muted",style:{fontSize:13,marginTop:4},children:"内容较少或结构较简单时可能出现这种情况,补充更多内容后可以重新生成"}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:$e,disabled:_e,style:{marginTop:12},children:"重新生成"})]}),!l&&!d&&a&&a.nodes.length>0&&c.jsx(fr,{ref:O,width:qe.width,height:qe.height,graphData:sn,nodeId:"id",nodeVal:k=>k.type==="concept"?6:3,nodeColor:k=>k.type==="concept"?"#8b5cf6":"#06b6d4",nodeCanvasObjectMode:()=>"replace",nodeCanvasObject:(k,j,z)=>{const F=String(k.name??""),q=k.type==="concept",X=k.id===(_==null?void 0:_.id)||k.id===I,te=(q?9:5)/Math.max(z,.35);if(j.beginPath(),j.arc(k.x,k.y,te,0,2*Math.PI),j.fillStyle=q?"#8b5cf6":"#06b6d4",j.globalAlpha=X||!_?1:.35,j.fill(),j.strokeStyle="#ffffff",j.lineWidth=1.5/Math.max(z,.35),j.stroke(),j.globalAlpha=1,k.__childCount>0){const _t=7/Math.max(z,.4),dt=k.x+te+_t*.9,fe=k.y-te*.2;j.beginPath(),j.arc(dt,fe,_t,0,2*Math.PI),j.fillStyle=k.__expanded?"#475569":"#6366f1",j.fill(),j.fillStyle="#ffffff";const Ke=k.__expanded?"−":"+",Et=Math.max(10/z,9/z);j.font=`700 ${Et}px -apple-system, BlinkMacSystemFont, sans-serif`,j.textAlign="center",j.textBaseline="middle",j.fillText(Ke,dt,fe+.5/z)}if(!(X||q&&z>=.55||!q&&z>=1.4))return;const ye=Math.max(10/z,q?11/z:9/z),De=q?z<.9?8:16:10,je=F.length>De?F.slice(0,De)+"…":F;j.font=`${q?"600":"400"} ${ye}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,j.textAlign="center",j.textBaseline="top";const Ne=k.y+te+3/z,ke=j.measureText(je).width,Pe=4/z,wt=2/z;j.fillStyle="rgba(255,255,255,0.88)",j.fillRect(k.x-ke/2-Pe,Ne-wt,ke+Pe*2,ye+wt*2),j.fillStyle=q?"#1e1b4b":"#0c4a6e",j.fillText(je,k.x,Ne)},linkDirectionalArrowLength:k=>{var F,q,X,te,Q,ye;const j=((q=(F=O.current)==null?void 0:F.zoom)==null?void 0:q.call(F))??1,z=((X=k.source)==null?void 0:X.id)===I||((te=k.target)==null?void 0:te.id)===I||((Q=k.source)==null?void 0:Q.id)===(_==null?void 0:_.id)||((ye=k.target)==null?void 0:ye.id)===(_==null?void 0:_.id);return Co(j,z?13:11,9)},linkDirectionalArrowRelPos:.86,linkDirectionalArrowColor:()=>"#475569",linkWidth:k=>{var F,q,X,te,Q,ye;const j=((q=(F=O.current)==null?void 0:F.zoom)==null?void 0:q.call(F))??1,z=((X=k.source)==null?void 0:X.id)===I||((te=k.target)==null?void 0:te.id)===I||((Q=k.source)==null?void 0:Q.id)===(_==null?void 0:_.id)||((ye=k.target)==null?void 0:ye.id)===(_==null?void 0:_.id);return Co(j,z?3.5:3,2.25)},linkColor:k=>{var z,F,q,X;return((z=k.source)==null?void 0:z.id)===I||((F=k.target)==null?void 0:F.id)===I||((q=k.source)==null?void 0:q.id)===(_==null?void 0:_.id)||((X=k.target)==null?void 0:X.id)===(_==null?void 0:_.id)?"#334155":"#64748b"},linkCurvature:k=>k.curvature??.12,linkCanvasObjectMode:()=>"after",linkCanvasObject:(k,j,z)=>{if(z<.45)return;const F=k.source,q=k.target;if(F.x==null||F.y==null||q.x==null||q.y==null)return;const te={contains:"包含",related_to:"相关",part_of:"属于",depends_on:"依赖"}[k.type]||String(k.type??""),Q=typeof k.curvature=="number"?k.curvature:.12,ye=(F.x+q.x)/2,De=(F.y+q.y)/2,je=ye-(q.y-F.y)*Q,Ne=De+(q.x-F.x)*Q,ke=.5,Pe=1-ke,wt=Pe*Pe*F.x+2*Pe*ke*je+ke*ke*q.x,_t=Pe*Pe*F.y+2*Pe*ke*Ne+ke*ke*q.y,dt=2*Pe*(je-F.x)+2*ke*(q.x-je),fe=2*Pe*(Ne-F.y)+2*ke*(q.y-Ne);let Ke=Math.atan2(fe,dt);(Ke>Math.PI/2||Ke<-Math.PI/2)&&(Ke+=Math.PI);const Et=Co(z,11,9);j.save(),j.translate(wt,_t),j.rotate(Ke),j.font=`500 ${Et}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,j.textAlign="center",j.textBaseline="middle";const ln=j.measureText(te).width,Rt=3/z,qt=1.5/z;j.fillStyle="rgba(255,255,255,0.92)",j.fillRect(-ln/2-Rt,-Et/2-qt,ln+Rt*2,Et+qt*2),j.fillStyle="#475569",j.fillText(te,0,0),j.restore()},onZoom:()=>{var k,j;(j=(k=O.current)==null?void 0:k.refresh)==null||j.call(k)},cooldownTicks:120,cooldownTime:4e3,d3AlphaDecay:.022,d3VelocityDecay:.3,onNodeClick:(k,j)=>{var q,X,te,Q,ye;const z=k.__childCount??0;if(z>0&&O.current&&Fe.current){const De=Fe.current.getBoundingClientRect(),je=O.current.screen2GraphCoords(j.clientX-De.left,j.clientY-De.top),Ne=((X=(q=O.current).zoom)==null?void 0:X.call(q))??1,ke=(k.type==="concept"?9:5)/Math.max(Ne,.35),Pe=7/Math.max(Ne,.4),wt=k.x+ke+Pe*.9,_t=k.y-ke*.2,dt=je.x-wt,fe=je.y-_t;if(dt*dt+fe*fe<=(Pe+4/Ne)**2){an(String(k.id)),T(k.__raw);return}}const F=k.__raw;if(T(F),z>0&&!k.__expanded&&an(String(k.id)),(F==null?void 0:F.type)==="doc"){const De=(ye=(Q=(te=F.sources)==null?void 0:te[0])==null?void 0:Q.documentId)==null?void 0:ye.trim();De&&r(De)}},onNodeHover:k=>{var z;if(!k){N(null),E(null);return}N(String(k.id));const j=String(k.name??((z=k.__raw)==null?void 0:z.label)??"");if(O.current&&j){const F=O.current.graph2ScreenCoords(k.x,k.y);E({text:j,x:F.x,y:F.y})}else E({text:j,x:0,y:0})},onBackgroundClick:()=>{T(null),N(null),E(null)},onEngineTick:()=>{var j,z;const k=(z=(j=O.current)==null?void 0:j.graphData)==null?void 0:z.call(j);if(k!=null&&k.nodes)for(const F of k.nodes)F.id!=null&&F.x!=null&&F.y!=null&&$.current.set(String(F.id),{x:F.x,y:F.y})},onEngineStop:()=>{var k,j;(j=(k=O.current)==null?void 0:k.zoomToFit)==null||j.call(k,300,72)},linkHoverPrecision:8,enableNodeDrag:!0,enableZoomInteraction:!0,enablePanInteraction:!0,nodePointerAreaPaint:(k,j,z,F)=>{const q=(k.type==="concept"?14:9)/Math.max(F,.35);if(z.fillStyle=j,z.beginPath(),z.arc(k.x,k.y,q,0,2*Math.PI),z.fill(),k.__childCount>0){const X=10/Math.max(F,.4),te=(k.type==="concept"?9:5)/Math.max(F,.35),Q=k.x+te+X*.7,ye=k.y-te*.2;z.beginPath(),z.arc(Q,ye,X,0,2*Math.PI),z.fill()}}}),L&&c.jsx("div",{className:"graph-node-tooltip",style:{left:L.x,top:L.y},children:L.text})]}),_&&c.jsxs("div",{className:"graph-detail-panel",children:[c.jsxs("div",{className:"graph-detail-header",children:[c.jsx("span",{className:`graph-node-type-badge ${_.type}`,children:_.type==="concept"?"概念":"知识要点"}),c.jsx("button",{type:"button",className:"graph-close-btn","aria-label":"关闭",onClick:()=>T(null),children:c.jsx(zt,{size:18,strokeWidth:2.25})})]}),c.jsx("h3",{className:"graph-detail-title",children:_.label}),_.definition&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"定义"}),c.jsx("p",{children:_.definition})]}),c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"描述"}),c.jsx("p",{children:_.description})]}),c.jsx("div",{className:"graph-detail-meta",children:c.jsxs("span",{children:["置信度: ",(_.confidence*100).toFixed(0),"%"]})}),_.type==="concept"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["包含的子节点 (",xt(_.id).length,")"]}),c.jsxs("ul",{className:"graph-node-list",children:[xt(_.id).slice(0,20).map(k=>c.jsxs("li",{className:`graph-node-item ${k.type}`,onClick:()=>Me(k),children:[c.jsx("span",{className:"dot"}),k.label]},k.id)),xt(_.id).length>20&&c.jsxs("li",{className:"muted",children:["还有 ",xt(_.id).length-20," 个..."]})]})]}),c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["相关文章 (",An(_.id).length,")"]}),c.jsx("ul",{className:"graph-doc-list",children:Array.from(new Set(An(_.id).flatMap(k=>{var j;return((j=k.sources)==null?void 0:j.map(z=>({documentId:z.documentId,title:z.title||z.documentId,heading:z.heading})))||[]}))).slice(0,10).map((k,j)=>c.jsx("li",{className:"graph-doc-item",children:c.jsxs("button",{onClick:()=>r(k.documentId),children:["📄 ",k.title,k.heading&&c.jsxs("span",{className:"muted",children:[" · ",k.heading]})]})},j))})]})]}),_.type==="doc"&&_.sources&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"来源"}),c.jsx("ul",{className:"graph-doc-list",children:_.sources.map((k,j)=>c.jsx("li",{className:"graph-doc-item",children:c.jsxs("button",{onClick:()=>r(k.documentId),children:["📄 ",k.title||k.documentId,k.heading&&c.jsxs("span",{className:"muted",children:[" · ",k.heading]})]})},j))})]}),Wt(_.id).length>0&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["所属概念 (",Wt(_.id).length,")"]}),c.jsx("ul",{className:"graph-node-list",children:Wt(_.id).map(k=>c.jsxs("li",{className:`graph-node-item ${k.type}`,onClick:()=>Me(k),children:[c.jsx("span",{className:"dot"}),k.label]},k.id))})]})]}),we&&c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:k=>{k.target===k.currentTarget&&se(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true","aria-label":"配置 AI 模型",children:[c.jsx("h2",{children:"配置 AI 模型"}),c.jsx(hf,{onConfigured:Gt}),c.jsx("div",{className:"mdocs-dialog-actions",children:c.jsx("button",{type:"button",onClick:()=>se(!1),children:"取消"})})]})})]})}async function Pi(e){var o;const n=e.replace(/\u00a0/g," ");if(!n)return!1;try{if(typeof navigator<"u"&&((o=navigator.clipboard)!=null&&o.writeText))return await navigator.clipboard.writeText(n),!0}catch{}try{const r=document.createElement("textarea");r.value=n,r.setAttribute("readonly",""),r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.width="1px",r.style.height="1px",r.style.padding="0",r.style.border="none",r.style.outline="none",r.style.boxShadow="none",r.style.background="transparent",r.style.opacity="0",document.body.appendChild(r),r.focus(),r.select(),r.setSelectionRange(0,n.length);const i=document.execCommand("copy");return document.body.removeChild(r),i}catch{return!1}}function wf(e){var d;const{t:n}=Ve(),o=x.useRef(null);x.useEffect(()=>{function h(f){o.current&&!o.current.contains(f.target)&&e.onClose()}function m(f){f.key==="Escape"&&e.onClose()}return window.addEventListener("mousedown",h),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",m)}},[e.onClose]);const r=e.node.type==="folder";let i="";if(e.node.type==="folder"){const h=e.node;i=((d=h.folderDisplayName)==null?void 0:d.trim())||h.path||""}const a=r?i?n("newDocIn",{name:i}):n("newDocAtRoot"):n("newDocBeside"),s=r?i?n("newFolderIn",{name:i}):n("newFolderAtRoot"):n("newFolderBeside"),l=e.node.documentId,u=e.node.type==="folder"&&e.node.descDocumentId||e.node.documentId;return c.jsxs("div",{ref:o,className:"mdocs-context-menu card",style:{left:e.x,top:e.y},children:[c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h=r?e.node.path:e.parentPath;e.onCreateChild(h),e.onClose()},children:a}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h=r?e.node.path:e.parentPath;e.onCreateFolder(h),e.onClose()},children:s}),c.jsx("div",{className:"mdocs-context-divider"}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{Pi(l).finally(e.onClose)},children:n("copyDocumentId")}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h="/",m=h.endsWith("/")?h:`${h}/`;Pi(`${window.location.origin}${m}#/doc/${u}`).finally(e.onClose)},children:n("copyDocumentUrl")}),c.jsx("div",{className:"mdocs-context-divider"}),c.jsx("button",{type:"button",className:"mdocs-context-item danger",onClick:()=>{e.node.type==="document"?e.onDeleteDocument(e.node):e.onDeleteFolder(e.node),e.onClose()},children:e.node.type==="folder"?n("deleteFolder",{name:i||e.node.name}):n("deleteItem",{name:e.node.name})})]})}function _f({domains:e,value:n,onChange:o,ariaLabel:r,localizeName:i,onDomainsChange:a}){const{t:s}=Ve(),[l,u]=x.useState(!1),[d,h]=x.useState(e),[m,f]=x.useState(""),p=x.useRef(null),g=x.useRef(null),w=x.useRef(null);x.useEffect(()=>{h(e)},[e]);const b=d.find(I=>I.domainId===n),v=(b==null?void 0:b.permission)==="private",S=x.useMemo(()=>{const I=m.trim().toLowerCase();return I?d.filter(N=>i(N.domainName).toLowerCase().includes(I)||N.domainName.toLowerCase().includes(I)):d},[d,m,i]);function D(){u(!1),f("")}x.useEffect(()=>{if(!l)return;const I=N=>{var L,E;!((L=p.current)!=null&&L.contains(N.target))&&!((E=g.current)!=null&&E.contains(N.target))&&D()};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[l]),x.useEffect(()=>{if(!l)return;const I=N=>{var L;N.key==="Escape"&&(D(),(L=p.current)==null||L.focus())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[l]),x.useEffect(()=>{var I;l&&((I=w.current)==null||I.focus())},[l]);function P(I){o(I),D()}function _(){if(l){D();return}u(!0),f(""),nr().then(I=>{h(I),a==null||a(I)})}function T(I){I.key==="Enter"&&S.length===1&&(I.preventDefault(),P(S[0].domainId))}return c.jsxs("div",{className:"mdocs-domain-select-wrapper",children:[c.jsxs("button",{ref:p,type:"button",className:"mdocs-domain-select-trigger","aria-label":r,"aria-expanded":l,"aria-haspopup":"listbox",onClick:_,children:[c.jsx("span",{className:"mdocs-domain-select-text",children:b?i(b.domainName):""}),v&&c.jsxs("svg",{className:"mdocs-domain-lock",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),c.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),c.jsx("svg",{className:"mdocs-domain-select-chevron"+(l?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"1.5",children:c.jsx("path",{d:"M1 1l4 4 4-4"})})]}),l&&c.jsxs("div",{ref:g,className:"mdocs-domain-select-menu card",role:"listbox","aria-label":r,children:[c.jsx("div",{className:"mdocs-domain-select-search",children:c.jsx("input",{ref:w,type:"search",className:"mdocs-domain-select-search-input",value:m,placeholder:s("domainSearchPlaceholder"),"aria-label":s("domainSearchPlaceholder"),autoComplete:"off",onChange:I=>f(I.target.value),onKeyDown:T,onClick:I=>I.stopPropagation()})}),c.jsx("div",{className:"mdocs-domain-select-options",children:S.length===0?c.jsx("div",{className:"mdocs-domain-select-empty muted",children:s("domainNoMatch")}):S.map(I=>c.jsxs("button",{type:"button",className:"mdocs-domain-select-option"+(I.domainId===n?" active":""),role:"option","aria-selected":I.domainId===n,onClick:()=>P(I.domainId),children:[c.jsx("span",{children:i(I.domainName)}),I.permission==="private"&&c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),c.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]},I.domainId))})]})]})}const Aa="data:image/svg+xml,%3csvg%20fill='%234D6BFE'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDeepSeek%3c/title%3e%3cpath%20d='M23.748%204.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434%201.202-.422%201.84.027%201.436.633%202.58%201.838%203.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526%205.526%200%2001-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365%2011.365%200%2000-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055%203.055%200%2001-.465.137%209.597%209.597%200%2000-2.883-.102c-1.885.21-3.39%201.102-4.497%202.623C.082%208.606-.231%2010.684.152%2012.85c.403%202.284%201.569%204.175%203.36%205.653%201.858%201.533%203.997%202.284%206.438%202.14%201.482-.085%203.133-.284%204.994-1.86.47.234.962.327%201.78.397.63.059%201.236-.03%201.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926%201.096-1.296%202.746-2.642%203.392-7.003.05-.347.007-.565%200-.845-.004-.17.035-.237.23-.256a4.173%204.173%200%20001.545-.475c1.396-.763%201.96-2.015%202.093-3.517.02-.23-.004-.467-.247-.588zM11.581%2018c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696%204.696%200%20011.529-.039c2.132.312%203.946%201.265%205.468%202.774.868.86%201.525%201.887%202.202%202.891.72%201.066%201.494%202.082%202.48%202.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306%200%2001.415-.287.302.302%200%2001.2.288.306.306%200%2001-.31.307.303.303%200%2001-.304-.308zm3.11%201.596c-.2.081-.399.151-.59.16a1.245%201.245%200%2001-.798-.254c-.274-.23-.47-.358-.552-.758a1.73%201.73%200%2001.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559%200%2001-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136%201.146.016.352.144.618.408%201.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z'%3e%3c/path%3e%3c/svg%3e",st={left:12,bottom:64},mr="mdocs.agentFabPosition",Zn=36,Ti=3;function hr(e){const o=Math.max(8,window.innerWidth-Zn-8),r=Math.max(8,window.innerHeight-Zn-8);return{left:Math.min(o,Math.max(8,e.left)),bottom:Math.min(r,Math.max(8,e.bottom))}}function If(e,n,o,r){const i=e-o,a=n-r,s=window.innerHeight-a-Zn;return hr({left:i,bottom:s})}function kf(){try{const e=localStorage.getItem(mr);if(!e)return st;const n=JSON.parse(e);return typeof n.left!="number"||typeof n.bottom!="number"?st:hr({left:n.left,bottom:n.bottom})}catch{return st}}function Ai(e){localStorage.setItem(mr,JSON.stringify(e))}function Sf(e){return e.left===st.left&&e.bottom===st.bottom}function Cf(e){const o=Math.min(480,window.innerWidth-72);let r=e.left+Zn+8;r+o>window.innerWidth-8&&(r=e.left-8-o),r=Math.max(8,r);const i=Math.max(8,e.bottom-8);return{left:r,bottom:i}}function Df(e){const{t:n}=Ve(),o=!!e.disableDrag,[r,i]=x.useState(!1),[a,s]=x.useState(e.position),l=x.useRef(null),u=x.useRef(null),d=x.useRef(a),h=x.useRef(e.onPositionChange),m=x.useRef(e.onToggle);d.current=a,h.current=e.onPositionChange,m.current=e.onToggle;const f=x.useRef(null),p=x.useRef(0),g=x.useRef(null);x.useEffect(()=>{f.current||(s(e.position),d.current=e.position)},[e.position]),x.useEffect(()=>{function D(){const P=hr(d.current);P.left===d.current.left&&P.bottom===d.current.bottom||(d.current=P,s(P),h.current(P),Ai(P))}return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]),x.useEffect(()=>{function D(){p.current=0;const T=g.current;if(!T)return;g.current=null,d.current=T,s(T);const I=u.current;I&&(I.style.left=`${T.left}px`,I.style.bottom=`${T.bottom}px`),h.current(T)}function P(T){const I=f.current;if(!I||T.pointerId!==I.pointerId)return;T.preventDefault();const N=T.clientX-I.startX,L=T.clientY-I.startY;!I.didMove&&N*N+L*L>=Ti*Ti&&(I.didMove=!0,i(!0)),I.didMove&&(g.current=If(T.clientX,T.clientY,I.offsetX,I.offsetY),p.current||(p.current=requestAnimationFrame(D)))}function _(T){var N;const I=f.current;if(!(!I||T.pointerId!==I.pointerId)){f.current=null,i(!1),p.current&&(cancelAnimationFrame(p.current),p.current=0),g.current&&(d.current=g.current,s(g.current),g.current=null);try{(N=l.current)==null||N.releasePointerCapture(T.pointerId)}catch{}if(I.didMove){const L=d.current;h.current(L),Ai(L);return}m.current()}}return window.addEventListener("pointermove",P,{passive:!1}),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),p.current&&cancelAnimationFrame(p.current)}},[]);function w(D){if(D.button!==0)return;if(o){D.preventDefault(),e.onToggle();return}D.preventDefault();const P=D.currentTarget.getBoundingClientRect();f.current={pointerId:D.pointerId,offsetX:D.clientX-P.left,offsetY:D.clientY-P.top,startX:D.clientX,startY:D.clientY,didMove:!1},D.currentTarget.setPointerCapture(D.pointerId)}function b(){d.current=st,s(st),e.onPositionChange(st),localStorage.removeItem(mr)}const v=o?st:a,S=!o&&!Sf(a);return c.jsxs("div",{ref:u,className:"mdocs-agent-fab-wrap"+(r?" dragging":""),style:{left:v.left,bottom:v.bottom},children:[c.jsx("button",{ref:l,type:"button",className:"mdocs-agent-fab"+(e.open?" open":"")+(r?" dragging":"")+(o?" mdocs-agent-fab--nodrag":""),"aria-label":n("agentFabOpen"),"aria-expanded":e.open,onPointerDown:w,children:c.jsx("img",{src:Aa,alt:"",draggable:!1})}),S&&c.jsx("button",{type:"button",className:"mdocs-agent-fab-reset",onClick:b,"aria-label":n("agentFabReset"),children:n("agentFabReset")})]})}function Nf(){const[e,n]=x.useState(()=>typeof window>"u"?st:kf());return[e,n]}function Pf({title:e,message:n,onClose:o}){const{t:r}=Ve();return c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:i=>{i.target===i.currentTarget&&o()},children:c.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&c.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),c.jsx("p",{className:"mdocs-message-dialog-body",children:n}),c.jsx("div",{className:"mdocs-message-dialog-actions",children:c.jsx("button",{type:"button",className:"primary",onClick:o,children:r("gotIt")})})]})})}function Ma({title:e,message:n,confirmLabel:o="确定",cancelLabel:r="取消",onConfirm:i,onCancel:a,busy:s=!1,danger:l=!1}){return c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:u=>{u.target===u.currentTarget&&!s&&a()},children:c.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&c.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),c.jsx("p",{className:"mdocs-message-dialog-body",children:n}),c.jsxs("div",{className:"mdocs-message-dialog-actions",style:{gap:8},children:[c.jsx("button",{type:"button",onClick:a,disabled:s,children:r}),c.jsx("button",{type:"button",className:l?"danger":"primary",onClick:i,disabled:s,children:s?"…":o})]})]})})}const Mi={"relative path is required":"pathRequired","path must be relative":"pathMustBeRelative","use forward slashes":"useForwardSlashes","path must not contain ..":"pathNoDotDot","document path must end with .md":"pathMustEndWithMd","path contains unsupported characters":"pathUnsupportedChars","path escapes docs root":"pathEscapesRoot"},ja={"enter a folder name":"enterFolderName","use a single name, not a path":"singleNameNotPath","invalid folder name":"invalidFolderName","folder name is too long":"folderNameTooLong","enter a file name":"enterFileName","use a file name, not a path":"singleFileNameNotPath","invalid file name":"invalidFileName","file name is too long":"fileNameTooLong"};function Je(e,n){if(n instanceof et)return n.message;if(n instanceof St){const o=Mi[n.message];return o?e(o):n.message}if(n instanceof Error){const o=Mi[n.message]??ja[n.message];return o?e(o):n.message}return String(n)}function kn(e,n,o){if(e==="Default")return o("defaultDomain");const r="个人域";return e.endsWith(r)?e.slice(0,-r.length)+o("personalDomainSuffix"):e}function Eh(e,n){return e==="public"?n("domainPublic"):e==="restricted"?n("domainRestricted"):e==="private"?n("domainPrivate"):e}function $n(e){const n=e.lastIndexOf("/");return n===-1?"":e.slice(0,n)}const Tf=280,en="";function Af(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Do(e,n){const o=Array.from(new Set(n.filter(u=>u.length>0))).sort((u,d)=>d.length-u.length);if(o.length===0)return e;const r=new RegExp(o.map(Af).join("|"),"gi"),i=[];let a=0,s,l=0;for(;(s=r.exec(e))!==null;)s.index>a&&i.push(e.slice(a,s.index)),i.push(c.jsx("mark",{children:s[0]},l++)),a=s.index+s[0].length,s[0].length===0&&r.lastIndex++;return a<e.length&&i.push(e.slice(a)),i}function Mf(e,n){const o=new Date(e);return Number.isNaN(o.getTime())?"":o.toLocaleString(n==="zh"?"zh-CN":"en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function jf(e){const{t:n,lang:o}=Ve(),r=x.useRef(null),i=x.useRef(null),[a,s]=x.useState(""),[l,u]=x.useState(en),[d,h]=x.useState("auto"),[m,f]=x.useState(!0),[p,g]=x.useState(!1),[w,b]=x.useState(""),[v,S]=x.useState(e.domains),[D,P]=x.useState([]),[_,T]=x.useState([]),[I,N]=x.useState(!1),[L,E]=x.useState(null),O=x.useRef(0);x.useEffect(()=>{S(e.domains)},[e.domains]);const $=x.useMemo(()=>{const B=new Map;for(const G of v)B.set(G.domainId,kn(G.domainName,o,n));return B},[v,o,n]),V=x.useMemo(()=>{const B=w.trim().toLowerCase();return B?v.filter(G=>kn(G.domainName,o,n).toLowerCase().includes(B)||G.domainName.toLowerCase().includes(B)||G.domainId.toLowerCase().includes(B)):v},[v,w,o,n]),J=l===en?n("docSearchAllDomains"):$.get(l)??n("docSearchAllDomains");function ne(){nr().then(B=>{var G;S(B),(G=e.onDomainsChange)==null||G.call(e,B)})}return x.useEffect(()=>{if(!e.open)return;s(""),u(en),g(!1),b(""),P([]),E(null),N(!1),ne();const B=window.setTimeout(()=>{var G;return(G=r.current)==null?void 0:G.focus()},0);return()=>window.clearTimeout(B)},[e.open]),x.useEffect(()=>{if(!e.open)return;const B=G=>{if(G.key==="Escape"){if(G.preventDefault(),p){g(!1);return}e.onClose()}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[e.open,e.onClose,p]),x.useEffect(()=>{if(!p)return;const B=G=>{var ce;(ce=i.current)!=null&&ce.contains(G.target)||g(!1)};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[p]),x.useEffect(()=>{if(!e.open)return;const B=a.trim();if(!B){P([]),N(!1),E(null);return}N(!0),E(null);const G=++O.current,ce=window.setTimeout(()=>{Fl({query:B,mode:d,domainId:l||void 0,topN:20}).then(ue=>{G===O.current&&(P(ue.results),f(ue.modelReady),T(ue.tokens??[]),N(!1))}).catch(ue=>{G===O.current&&(P([]),f(!0),T([]),N(!1),E(Je(n,ue)||n("docSearchFailed")))})},Tf);return()=>window.clearTimeout(ce)},[a,e.open,l,d,n]),e.open?c.jsx("div",{className:"mdocs-doc-search-backdrop",role:"presentation",onMouseDown:B=>{B.target===B.currentTarget&&e.onClose()},children:c.jsxs("div",{className:"mdocs-doc-search-panel",role:"dialog","aria-modal":"true","aria-label":n("docSearchTitle"),children:[c.jsxs("div",{className:"mdocs-doc-search-bar",children:[c.jsx(Ui,{size:18,strokeWidth:1.75,"aria-hidden":!0}),c.jsx("input",{ref:r,className:"mdocs-doc-search-input",type:"search",value:a,placeholder:n("docSearchPlaceholder"),"aria-label":n("docSearchPlaceholder"),onChange:B=>s(B.target.value)}),c.jsxs("select",{className:"mdocs-doc-search-mode",value:d,"aria-label":n("myDocumentsSearchMode"),onChange:B=>h(B.target.value),children:[c.jsx("option",{value:"auto",children:n("myDocumentsModeAuto")}),c.jsx("option",{value:"keyword",children:n("myDocumentsModeKeyword")}),c.jsx("option",{value:"semantic",children:n("myDocumentsModeSemantic")})]}),c.jsxs("div",{className:"mdocs-doc-search-domain",ref:i,children:[c.jsxs("button",{type:"button",className:"mdocs-doc-search-domain-trigger","aria-label":n("docSearchDomainAria"),"aria-expanded":p,"aria-haspopup":"listbox",onClick:()=>{if(p){g(!1);return}g(!0),b(""),ne()},children:[c.jsx("span",{className:"mdocs-doc-search-domain-label",children:J}),c.jsx(Fo,{size:14,strokeWidth:1.75})]}),p&&c.jsxs("div",{className:"mdocs-doc-search-domain-menu",role:"listbox","aria-label":n("docSearchDomainAria"),children:[c.jsx("input",{className:"mdocs-doc-search-domain-filter",type:"search",value:w,placeholder:n("docSearchDomainFilter"),"aria-label":n("docSearchDomainFilter"),autoFocus:!0,onChange:B=>b(B.target.value),onClick:B=>B.stopPropagation()}),c.jsx("button",{type:"button",className:"mdocs-doc-search-domain-option"+(l===en?" active":""),role:"option","aria-selected":l===en,onClick:()=>{u(en),g(!1)},children:c.jsx("span",{className:"mdocs-doc-search-domain-option-name",children:n("docSearchAllDomains")})}),V.map(B=>{const G=kn(B.domainName,o,n),ce=B.permission==="private";return c.jsxs("button",{type:"button",className:"mdocs-doc-search-domain-option"+(B.domainId===l?" active":""),role:"option","aria-selected":B.domainId===l,onClick:()=>{u(B.domainId),g(!1)},children:[c.jsx("span",{className:"mdocs-doc-search-domain-option-name",children:G}),ce?c.jsx("span",{className:"mdocs-doc-search-domain-option-tag","aria-hidden":!0,children:c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),c.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}):null]},B.domainId)}),V.length===0&&c.jsx("p",{className:"mdocs-doc-search-domain-empty",children:n("docSearchDomainNoMatch")})]})]}),c.jsx("button",{type:"button",className:"mdocs-doc-search-close","aria-label":n("close"),onClick:e.onClose,children:c.jsx(zt,{size:16,strokeWidth:1.75})})]}),c.jsxs("div",{className:"mdocs-doc-search-results",children:[!a.trim()&&c.jsx("p",{className:"mdocs-doc-search-hint",children:n("docSearchEmptyHint")}),I&&c.jsx("p",{className:"mdocs-doc-search-hint",children:n("loading")}),L&&c.jsx("p",{className:"mdocs-doc-search-error",children:L}),!I&&!L&&a.trim()&&D.length===0&&c.jsx("p",{className:"mdocs-doc-search-hint",children:n(d==="semantic"&&!m?"myDocumentsSemanticNotReady":"docSearchNoResults")}),D.map(B=>{var ie;const G=Mf(B.updatedAt,o),ue=[$.get(B.domainId),(ie=B.ownerVisitorName)==null?void 0:ie.trim(),G].filter(Boolean),A=[];return B.titleHit&&A.push(n("docSearchHitTitle")),B.bodyHit&&A.push(n("docSearchHitBody")),B.semanticHit&&A.push(n("docSearchHitSemantic")),c.jsxs("button",{type:"button",className:"mdocs-doc-search-row",onClick:()=>{e.onOpenDocument(B.documentId),e.onClose()},children:[c.jsxs("span",{className:"mdocs-doc-search-row-head",children:[c.jsx("span",{className:"mdocs-doc-search-row-title",children:Do(B.displayName,_)}),A.length>0&&c.jsx("span",{className:"mdocs-doc-search-row-sources",children:A.map(oe=>c.jsx("span",{className:"mdocs-doc-search-row-source",children:oe},oe))})]}),ue.length>0&&c.jsx("span",{className:"mdocs-doc-search-row-meta",children:ue.join(" · ")}),B.relativePath&&c.jsx("span",{className:"mdocs-doc-search-row-path",children:Do(B.relativePath,_)}),B.snippet&&c.jsx("span",{className:"mdocs-doc-search-row-snippet",children:Do(B.snippet,_)})]},B.documentId)})]})]})}):null}const Qn=2,Ea=12,Ra=24,Ef=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function Nt(e){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${e}_${crypto.randomUUID().slice(0,8)}`:`${e}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Nn(e=""){return{v:e}}function Rh(e){return e==null?"":typeof e=="string"?e:e.v??""}function Oh(e){if(!(e==null||typeof e=="string"))return e.style}function Rf(e){if(typeof e=="string")return{v:e};if(e==null)return{v:""};if(typeof e=="object"&&!Array.isArray(e)){const n=e,o=typeof n.v=="string"?n.v:n.v==null?"":String(n.v),r=Oa(n.style);return r?{v:o,style:r}:{v:o}}return{v:String(e)}}function eo(e){return Ef.test(e.trim())}function Oa(e){if(e==null||typeof e!="object"||Array.isArray(e))return;const n=e,o={};if(typeof n.bg=="string"&&n.bg.trim()){const r=n.bg.trim();eo(r)&&(o.bg=r)}if(typeof n.color=="string"&&n.color.trim()){const r=n.color.trim();eo(r)&&(o.color=r)}if(n.bold===!0&&(o.bold=!0),n.italic===!0&&(o.italic=!0),typeof n.fontSize=="number"&&Number.isFinite(n.fontSize)){const r=Math.round(n.fontSize);r>=Ea&&r<=Ra&&(o.fontSize=r)}return Object.keys(o).length>0?o:void 0}function Of(e,n){if(n===null)return;if(n==null)return e;const o={...e??{}};if("bg"in n&&(n.bg==null||n.bg===""?delete o.bg:eo(n.bg)&&(o.bg=n.bg.trim())),"color"in n&&(n.color==null||n.color===""?delete o.color:eo(n.color)&&(o.color=n.color.trim())),"bold"in n&&(n.bold?o.bold=!0:delete o.bold),"italic"in n&&(n.italic?o.italic=!0:delete o.italic),"fontSize"in n)if(n.fontSize==null)delete o.fontSize;else{const r=Math.round(Number(n.fontSize));r>=Ea&&r<=Ra&&(o.fontSize=r)}return Object.keys(o).length>0?o:void 0}function Ff(e){const n=Oa(e.style);return n?{v:e.v,style:n}:e.v}function Lf(e){const n=(e.merges??[]).filter(Boolean);return{id:e.id,name:e.name,columns:e.columns,rows:e.rows.map(o=>({id:o.id,cells:Object.fromEntries(Object.entries(o.cells).map(([r,i])=>[r,Ff(i)]))})),...n.length>0?{merges:n}:{}}}function Fa(e){var a;const n=Math.max(1,(e==null?void 0:e.columnCount)??3),o=Math.max(0,(e==null?void 0:e.rowCount)??5),r=[];for(let s=0;s<n;s+=1)r.push({id:Nt("c"),name:`列${s+1}`});const i=[];for(let s=0;s<o;s+=1){const l={};for(const u of r)l[u.id]=Nn();i.push({id:Nt("r"),cells:l})}return{id:Nt("s"),name:((a=e==null?void 0:e.name)==null?void 0:a.trim())||"Sheet1",columns:r,rows:i,merges:[]}}function tn(e){const n=Fa(e);return{version:Qn,sheets:[n],activeSheetId:n.id}}function zf(e){const n={version:Qn,activeSheetId:e.activeSheetId,sheets:e.sheets.map(Lf)};return`${JSON.stringify(n,null,2)}
|
|
299
|
-
`}function $f(e,n){if(!Array.isArray(e))return[];const o=new Set(n.rows.map(a=>a.id)),r=new Set(n.columns.map(a=>a.id)),i=[];for(const a of e){if(!a||typeof a!="object")continue;const s=a,l=typeof s.startRowId=="string"?s.startRowId:"",u=typeof s.startColId=="string"?s.startColId:"",d=typeof s.endRowId=="string"?s.endRowId:"",h=typeof s.endColId=="string"?s.endColId:"";!o.has(l)||!o.has(d)||!r.has(u)||!r.has(h)||i.push({startRowId:l,startColId:u,endRowId:d,endColId:h})}return i}function ji(e,n){if(!e||typeof e!="object")return null;const o=e,r=Array.isArray(o.columns)?o.columns:[],i=Array.isArray(o.rows)?o.rows:[],a=[];for(const h of r){if(!h||typeof h!="object")continue;const m=h,f=typeof m.id=="string"&&m.id?m.id:Nt("c"),p=typeof m.name=="string"?m.name:f;a.push({id:f,name:p})}if(a.length===0)return null;const s=[];for(const h of i){if(!h||typeof h!="object")continue;const m=h,f=typeof m.id=="string"&&m.id?m.id:Nt("r"),p=m.cells&&typeof m.cells=="object"&&!Array.isArray(m.cells)?m.cells:{},g={};for(const w of a)g[w.id]=Rf(p[w.id]);s.push({id:f,cells:g})}const l=typeof o.id=="string"&&o.id?o.id:Nt("s"),u=typeof o.name=="string"&&o.name.trim()?o.name.trim():n,d=$f(o.merges,{columns:a,rows:s});return{id:l,name:u,columns:a,rows:s,merges:d}}function Fh(e){const n=e.trim();if(!n)return tn();let o;try{o=JSON.parse(n)}catch{return tn()}if(!o||typeof o!="object")return tn();const r=o;if(Array.isArray(r.sheets)&&r.sheets.length>0){const a=[];for(let u=0;u<r.sheets.length;u+=1){const d=ji(r.sheets[u],`Sheet${u+1}`);d&&a.push(d)}if(a.length===0)return tn();const s=typeof r.activeSheetId=="string"?r.activeSheetId:"",l=a.some(u=>u.id===s)?s:a[0].id;return{version:Qn,sheets:a,activeSheetId:l}}const i=ji(r,"Sheet1");return i?{version:Qn,sheets:[i],activeSheetId:i.id}:tn()}function pr(e,n){const o=n==null?void 0:n.trim();if(!o)return e.sheets.find(s=>s.id===e.activeSheetId)??e.sheets[0]??null;const r=e.sheets.find(s=>s.id===o);if(r)return r;const i=e.sheets.find(s=>s.name===o);if(i)return i;const a=o.toLowerCase();return e.sheets.find(s=>s.name.toLowerCase()===a)??null}function Uf(e,n){if(!e.sheets.some(o=>o.id===n.id))throw new Error(`unknown sheet: ${n.id}`);return{...e,sheets:e.sheets.map(o=>o.id===n.id?n:o)}}function Lh(e,n){const o=pr(e,n);if(!o)throw new Error(`unknown sheet: ${n}`);return{...e,activeSheetId:o.id}}function zh(e,n){let o=`Sheet${e.sheets.length+1}`;const r=new Set(e.sheets.map(a=>a.name));if(r.has(o)){let a=2;for(;r.has(`${o}${a}`);)a+=1;o=`${o}${a}`}const i=Fa({name:o});return{doc:{...e,sheets:[...e.sheets,i],activeSheetId:i.id},tab:i}}function $h(e,n,o){const r=pr(e,n);if(!r)throw new Error(`unknown sheet: ${n}`);const i=o.trim();if(!i)throw new Error("sheet name is required");if(e.sheets.find(s=>s.id!==r.id&&s.name===i))throw new Error(`sheet name already exists: ${i}`);return Uf(e,{...r,name:i})}function Uh(e,n){const o=pr(e,n);if(!o)throw new Error(`unknown sheet: ${n}`);if(e.sheets.length<=1)throw new Error("cannot delete the last sheet");const r=e.sheets.filter(a=>a.id!==o.id),i=e.activeSheetId===o.id?r[0].id:e.activeSheetId;return{...e,sheets:r,activeSheetId:i}}function Ze(e,n){return e.rows.findIndex(o=>o.id===n)}function Qe(e,n){return e.columns.findIndex(o=>o.id===n)}function La(e,n){const o=Ze(e,n.startRowId),r=Ze(e,n.endRowId),i=Qe(e,n.startColId),a=Qe(e,n.endColId);if(o<0||r<0||i<0||a<0)return null;const s=Math.min(o,r),l=Math.max(o,r),u=Math.min(i,a),d=Math.max(i,a);return s===l&&u===d?null:{startRowId:e.rows[s].id,startColId:e.columns[u].id,endRowId:e.rows[l].id,endColId:e.columns[d].id}}function Bf(e,n,o){const r=Ze(e,n.startRowId),i=Ze(e,n.endRowId),a=Qe(e,n.startColId),s=Qe(e,n.endColId),l=Ze(e,o.startRowId),u=Ze(e,o.endRowId),d=Qe(e,o.startColId),h=Qe(e,o.endColId);if(r<0||i<0||l<0||u<0||a<0||s<0||d<0||h<0)return!1;const m=Math.min(r,i),f=Math.max(r,i),p=Math.min(a,s),g=Math.max(a,s),w=Math.min(l,u),b=Math.max(l,u),v=Math.min(d,h),S=Math.max(d,h);return!(f<w||b<m||g<v||S<p)}function io(e,n,o){const r=Ze(e,n),i=Qe(e,o);if(r<0||i<0)return null;for(const a of e.merges??[]){const s=Ze(e,a.startRowId),l=Ze(e,a.endRowId),u=Qe(e,a.startColId),d=Qe(e,a.endColId);if(s<0||l<0||u<0||d<0)continue;const h=Math.min(s,l),m=Math.max(s,l),f=Math.min(u,d),p=Math.max(u,d);if(r>=h&&r<=m&&i>=f&&i<=p)return a}return null}function Bh(e,n,o){const r=io(e,n,o);return r?r.startRowId===n&&r.startColId===o:!0}function Hh(e,n,o){const r=io(e,n,o);return r?!(r.startRowId===n&&r.startColId===o):!1}function Vh(e,n){const o=Ze(e,n.startRowId),r=Ze(e,n.endRowId),i=Qe(e,n.startColId),a=Qe(e,n.endColId);return{rowSpan:Math.abs(r-o)+1,colSpan:Math.abs(a-i)+1}}function za(e){const n=new Set(e.rows.map(i=>i.id)),o=new Set(e.columns.map(i=>i.id)),r=(e.merges??[]).filter(i=>n.has(i.startRowId)&&n.has(i.endRowId)&&o.has(i.startColId)&&o.has(i.endColId)&&La(e,i)!=null);return{...e,merges:r}}function Gh(e,n){const o=La(e,n);if(!o)throw new Error("invalid merge range (need at least 2 cells)");for(const r of e.merges??[])if(Bf(e,r,o))throw new Error("merge overlaps existing merge");return{...e,merges:[...e.merges??[],o]}}function Wh(e,n,o){const r=io(e,n,o);return r?{tab:{...e,merges:(e.merges??[]).filter(i=>i!==r)},removed:r}:{tab:e,removed:null}}function $a(e,n,o){const r=io(e,n,o);return!r||r.startRowId===n&&r.startColId===o?{rowId:n,columnId:o,redirected:!1}:{rowId:r.startRowId,columnId:r.startColId,redirected:!0}}function qh(e,n){const o={id:Nt("c"),name:`列${e.columns.length+1}`};return{...e,columns:[...e.columns,o],rows:e.rows.map(r=>({...r,cells:{...r.cells,[o.id]:Nn()}}))}}function Kh(e){const n={};for(const o of e.columns)n[o.id]=Nn();return{...e,rows:[...e.rows,{id:Nt("r"),cells:n}]}}function Yh(e,n,o,r){const i=$a(e,n,o);return{...e,rows:e.rows.map(a=>{if(a.id!==i.rowId)return a;const s=a.cells[i.columnId]??Nn();return{...a,cells:{...a.cells,[i.columnId]:{v:r,...s.style?{style:s.style}:{}}}}})}}function Jh(e,n,o,r){const i=$a(e,n,o);return{...e,rows:e.rows.map(a=>{if(a.id!==i.rowId)return a;const s=a.cells[i.columnId]??Nn(),l=Of(s.style,r),u=l?{v:s.v,style:l}:{v:s.v};return{...a,cells:{...a.cells,[i.columnId]:u}}})}}function Xh(e,n,o){return{...e,columns:e.columns.map(r=>r.id===n?{...r,name:o}:r)}}function Zh(e,n){return za({...e,rows:e.rows.filter(o=>o.id!==n)})}function Qh(e,n){const o=[],r=new Set,i=[];for(const l of n){const u=Hf(e,l);if(!u){o.push(`unknown column: ${l}`);continue}r.has(u.id)||(r.add(u.id),i.push({id:u.id,name:u.name}))}if(r.size===0)return{tab:e,removed:[],errors:o};if(e.columns.length-r.size<1)throw new Error("cannot delete all columns; at least one column required");const a=e.columns.filter(l=>!r.has(l.id)),s=e.rows.map(l=>{const u={...l.cells};for(const d of r)delete u[d];return{...l,cells:u}});return{tab:za({...e,columns:a,rows:s}),removed:i,errors:o}}function Hf(e,n){const o=n.trim();if(!o)return null;const r=e.columns.find(s=>s.id===o);if(r)return r;const i=e.columns.find(s=>s.name===o);if(i)return i;const a=o.toLowerCase();return e.columns.find(s=>s.name.toLowerCase()===a)??null}function Vf(e){return JSON.stringify({root:{children:[{children:[{detail:0,format:0,mode:"normal",text:e,type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"heading",tag:"h1",version:1}],direction:"ltr",type:"root",version:1}})}function No(e,n){const o=e.trim(),r=n.trim();return r?o?`${o}/${r}`:r:o}function Ua(e,n=new Set){for(const o of e)o.type==="document"?n.add(o.path):(o.descDocumentId&&n.add(bl(o.path)),Ua(o.children,n));return n}function Hn(e,n){for(const o of e){if(o.type==="folder"&&o.path===n)return o.documentId;if(o.type==="folder"){const r=Hn(o.children,n);if(r)return r}}return null}function Po(e,n){const o=ja[n];return o?e(o):n}function Gf(e){const{tree:n,currentDomainId:o,selectedCreateParentPath:r,t:i,onDocCreated:a,refreshTree:s}=e,[l,u]=x.useState(null),[d,h]=x.useState(null),[m,f]=x.useState(!1),p=x.useRef(null);x.useEffect(()=>{if(!l)return;const v=window.setTimeout(()=>{var S;return(S=p.current)==null?void 0:S.focus()},0);return()=>window.clearTimeout(v)},[l]);function g(v,S="md"){const D=v!==void 0;h(null),u({kind:"document",parentMode:D?"fixed":"selection",parentPath:D?v:"",draft:S==="html"?"untitled.html":S==="sheet"?"untitled.sheet":"untitled.md",fileType:S})}function w(v){const S=v!==void 0;h(null),u({kind:"folder",parentMode:S?"fixed":"selection",parentPath:S?v:"",draft:""})}async function b(v){if(v.preventDefault(),!l)return;f(!0),h(null);const S=Ua(n),D=l.parentMode==="selection"?r:l.parentPath;try{if(l.kind==="document"){const N=l.fileType;if(N==="html"||N==="sheet"){const ne=N==="html"?".html":".sheet",B=$r(l.draft,ne);if(!B.ok){h(Po(i,B.message));return}const G=B.displayFile,ce=G.replace(/\.html$/i,"").replace(/\.sheet$/i,"").replace(/\.md$/i,"");let ue;try{ue=Ur(No(D,G))}catch(re){h(Je(i,re));return}if(S.has(ue)){h(i("pathExists"));return}const A=D?Hn(n,D)??void 0:void 0,ie=N==="sheet"?zf(tn()):"",oe=await $o({fileName:G,displayName:ce,content:ie,domainId:o,parentId:A,fileType:N});await s(),a(oe),u(null);return}const L=$r(l.draft);if(!L.ok){h(Po(i,L.message));return}const E=L.displayFile,O=E.replace(/\.md$/i,"");let $;try{$=Ur(No(D,E))}catch(ne){h(Je(i,ne));return}if(S.has($)){h(i("pathExists"));return}const V=D?Hn(n,D)??void 0:void 0,J=await $o({fileName:E,displayName:O,content:Vf(O),domainId:o,parentId:V});await s(),a(J),u(null);return}const P=_l(l.draft);if(!P.ok){h(Po(i,P.message));return}const _=Lo(P.display);if(!_){h(i("invalidFolderName"));return}const T=No(D,_);if(S.has(T)){h(i("folderExists"));return}const I=D?Hn(n,D)??void 0:void 0;await Rl({name:_,parentId:I,domainId:o}),await s(),u(null)}catch(P){h(Je(i,P))}finally{f(!1)}}return{createModal:l,setCreateModal:u,createModalError:d,createModalBusy:m,createModalInputRef:p,openNewDocumentModal:g,openNewFolderModal:w,submitCreateModal:b}}const Ei="(max-width: 768px)";function Wf(){const[e,n]=x.useState(()=>typeof window<"u"?window.matchMedia(Ei).matches:!1);return x.useEffect(()=>{const o=window.matchMedia(Ei),r=()=>n(o.matches);return r(),o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[]),e}const qf=64,Ri=44,Kf=.75;function Yf(e,n,o){const r=!!(o!=null&&o.open),i=x.useRef(n),a=x.useRef(o==null?void 0:o.onClose);i.current=n,a.current=o==null?void 0:o.onClose,x.useEffect(()=>{if(!e)return;let s=null,l=0,u=0;const d=f=>{const p=f.touches[0];if(!p)return;const g=f.target;if(!(g instanceof Element&&g.closest(".mdocs-agent-fab-wrap"))){if(r){if(!a.current)return;s="close"}else{if(p.clientX>qf)return;s="open"}l=p.clientX,u=p.clientY}},h=f=>{var b;if(!s)return;const p=f.touches[0];if(!p)return;const g=p.clientX-l,w=Math.abs(p.clientY-u);if(w>Math.abs(g)*Kf&&w>24){s=null;return}if(s==="open"&&g>=Ri){s=null,i.current();return}s==="close"&&g<=-Ri&&(s=null,(b=a.current)==null||b.call(a))},m=()=>{s=null};return window.addEventListener("touchstart",d,{passive:!0}),window.addEventListener("touchmove",h,{passive:!0}),window.addEventListener("touchend",m,{passive:!0}),window.addEventListener("touchcancel",m,{passive:!0}),()=>{window.removeEventListener("touchstart",d),window.removeEventListener("touchmove",h),window.removeEventListener("touchend",m),window.removeEventListener("touchcancel",m)}},[e,r])}function Jf({open:e,onClose:n,onResolve:o,onForceOverwrite:r,forceBusy:i}){const{t:a}=Ve();return e?c.jsx("div",{className:"mdocs-conflict-modal-root",role:"alertdialog","aria-modal":"true",children:c.jsxs("div",{className:"mdocs-conflict-modal-panel",children:[c.jsx("h2",{className:"mdocs-conflict-modal-title",children:a("conflictTitle")}),c.jsx("p",{className:"mdocs-conflict-modal-body",children:a("conflictBody")}),r?c.jsx("p",{className:"mdocs-conflict-modal-force-hint",children:a("conflictForceHint")}):null,c.jsxs("div",{className:"mdocs-conflict-modal-actions",children:[c.jsx("button",{type:"button",className:"primary",onClick:o,disabled:i,children:a("conflictResolve")}),r?c.jsx("button",{type:"button",className:"mdocs-conflict-force-btn",disabled:i,onClick:r,children:a(i?"conflictForceBusy":"conflictForce")}):null,c.jsx("button",{type:"button",className:"secondary",onClick:n,disabled:i,children:a("conflictClose")})]})]})}):null}function Oi({documentId:e,visitorId:n,visitorName:o,documentOwnerId:r,onClose:i}){const[a,s]=x.useState([]),[l,u]=x.useState(""),[d,h]=x.useState(null),[m,f]=x.useState(!0),[p,g]=x.useState(!1),[w,b]=x.useState(null),[v,S]=x.useState(null),[D,P]=x.useState(360),[_,T]=x.useState(80),I=x.useRef(!1),N=x.useRef(!1),L=300,E=80,O=x.useRef(null);function $(){const K=O.current;if(!K)return;K.style.height="auto";const Z=K.scrollHeight,we=Math.min(Math.max(Z,E),L);K.style.height=`${we}px`,T(we)}x.useEffect(()=>{setTimeout(()=>$(),0)},[d]);function V(K){return n?K.visitorId===n||r===n:!1}const{rootComments:J,repliesByParentId:ne,totalCount:B}=x.useMemo(()=>{const K=[],Z=new Map;let we=0;for(const se of a)se.isDeleted||(we++,se.parentId?(Z.has(se.parentId)||Z.set(se.parentId,[]),Z.get(se.parentId).push(se)):K.push(se));return{rootComments:K,repliesByParentId:Z,totalCount:we}},[a]),G=x.useRef(e);x.useEffect(()=>{G.current=e,u(""),h(null),S(null),ce()},[e]);async function ce(){const K=G.current;f(!0);try{const Z=await $l(e);if(G.current!==K)return;s(Z.comments)}catch(Z){if(G.current!==K)return;S("加载评论失败"),console.error("Failed to load comments:",Z)}finally{G.current===K&&f(!1)}}async function ue(){var K;if(!(!l.trim()||!n)){g(!0),S(null);try{await Ul(e,{content:l,parentId:(d==null?void 0:d.commentId)||null,replyToVisitorId:d?((K=a.find(Z=>Z.commentId===d.commentId))==null?void 0:K.visitorId)??null:null,replyToVisitorName:(d==null?void 0:d.visitorName)||null}),u(""),h(null),setTimeout(()=>$(),0),await ce()}catch(Z){S(Z.message||"发表失败,请重试")}finally{g(!1)}}}async function A(K){S(null);try{await Bl(e,K),await ce()}catch(Z){S(Z.message||"删除失败,请重试")}finally{b(null)}}function ie(K){const Z=Date.now()-new Date(K).getTime(),we=Math.floor(Z/6e4),se=Math.floor(Z/36e5),tt=Math.floor(Z/864e5);return we<1?"刚刚":we<60?`${we}分钟前`:se<24?`${se}小时前`:`${tt}天前`}function oe(K){I.current=!0,K.preventDefault()}function re(K){N.current=!0,K.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="row-resize"}return x.useEffect(()=>{function K(we){if(I.current){const se=Math.max(280,Math.min(600,window.innerWidth-we.clientX));P(se)}if(N.current){const se=-we.movementY;T(tt=>Math.max(60,Math.min(600,tt+se)))}}function Z(){I.current=!1,N.current=!1,document.body.style.userSelect="",document.body.style.cursor=""}return window.addEventListener("mousemove",K),window.addEventListener("mouseup",Z),()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",Z)}},[]),c.jsxs("div",{className:"mdocs-comments-panel",style:{width:D},children:[c.jsx("div",{className:"mdocs-comments-resize-handle",onMouseDown:oe}),c.jsxs("div",{className:"mdocs-comments-header",children:[c.jsxs("h3",{style:{margin:0,fontSize:"1rem",display:"flex",alignItems:"center",gap:6},children:[c.jsx(el,{size:18}),"评论 (",B,")"]}),c.jsx("button",{type:"button",onClick:i,className:"mdocs-comments-close-btn",children:c.jsx(zt,{size:18})})]}),v&&c.jsxs("div",{className:"mdocs-comments-error",children:[v,c.jsx("button",{type:"button",onClick:()=>S(null),children:c.jsx(zt,{size:14})})]}),c.jsx("div",{className:"mdocs-comments-list",children:m?c.jsx("div",{className:"mdocs-comments-empty",children:"加载中..."}):J.length===0?c.jsx("div",{className:"mdocs-comments-empty",children:"暂无评论,来发表第一条吧~"}):J.map(K=>c.jsxs("div",{className:"mdocs-comment-root",children:[c.jsxs("div",{className:"mdocs-comment-header",children:[c.jsx("span",{className:"mdocs-comment-avatar",children:K.visitorName.charAt(0).toUpperCase()}),c.jsx("span",{className:"mdocs-comment-author",children:K.visitorName}),c.jsx("span",{className:"mdocs-comment-time",children:ie(K.createdAt)}),V(K)&&c.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>b(K.commentId),title:"删除",children:c.jsx(zt,{size:14})})]}),c.jsx("div",{className:"mdocs-comment-content",children:K.content}),n&&c.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>h({commentId:K.commentId,visitorName:K.visitorName}),children:"回复"}),(ne.get(K.commentId)??[]).length>0&&c.jsx("div",{className:"mdocs-comment-replies",children:(ne.get(K.commentId)??[]).map(Z=>c.jsxs("div",{className:"mdocs-comment-reply",children:[c.jsxs("div",{className:"mdocs-comment-header",children:[c.jsx("span",{className:"mdocs-comment-avatar mdocs-comment-avatar-small",children:Z.visitorName.charAt(0).toUpperCase()}),c.jsx("span",{className:"mdocs-comment-author",children:Z.visitorName}),Z.replyToVisitorName&&c.jsxs("span",{className:"mdocs-comment-reply-to",children:["回复 ",Z.replyToVisitorName]}),c.jsx("span",{className:"mdocs-comment-time",children:ie(Z.createdAt)}),V(Z)&&c.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>b(Z.commentId),title:"删除",children:c.jsx(zt,{size:12})})]}),c.jsx("div",{className:"mdocs-comment-content",children:Z.content}),n&&c.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>h({commentId:K.commentId,visitorName:Z.visitorName}),children:"回复"})]},Z.commentId))})]},K.commentId))}),n?c.jsxs("div",{className:"mdocs-comments-input-wrapper",children:[c.jsx("div",{className:"mdocs-comments-input-drag-handle",onMouseDown:re}),d&&c.jsxs("div",{className:"mdocs-comment-reply-notice",children:[c.jsxs("span",{children:["回复 ",c.jsx("span",{className:"mdocs-comment-reply-to-name",children:d.visitorName})]}),c.jsxs("button",{type:"button",onClick:()=>h(null),children:[c.jsx(zt,{size:14})," 取消"]})]}),c.jsx("textarea",{ref:O,value:l,onChange:K=>{u(K.target.value.slice(0,512)),setTimeout(()=>$(),0)},placeholder:d?`回复 ${d.visitorName}...`:"发表评论...",className:"mdocs-comments-input",style:{height:_},maxLength:512,onKeyDown:K=>{K.key==="Enter"&&(K.metaKey||K.ctrlKey)&&ue()}}),c.jsxs("div",{className:`mdocs-comments-char-count${l.length>=460?" mdocs-char-count--warn":""}`,children:[l.length,"/512"]}),c.jsx("div",{className:"mdocs-comments-input-actions",children:c.jsx("button",{type:"button",className:"mdocs-btn-primary",onClick:ue,disabled:p||!l.trim(),children:p?"发表中...":"发表"})})]}):c.jsx("div",{className:"mdocs-comments-input-wrapper",style:{textAlign:"center"},children:c.jsx("div",{style:{color:"#666",fontSize:"0.9rem"},children:"请先创建访客身份以发表评论"})}),w&&c.jsx(Ma,{title:"删除评论",message:"确定要删除这条评论吗?",confirmLabel:"删除",danger:!0,onConfirm:()=>A(w),onCancel:()=>b(null)})]})}const Xf="mdocs-drafts",Zf=5,Ae="drafts";let Ba=0;const Qo=new Set;function ep(e){return Qo.add(e),()=>{Qo.delete(e)}}function tp(){return Ba}function Ha(e,n){Ba+=1;for(const o of Qo)o(e,n)}const nn={DOC_NOT_FOUND:"DOC_NOT_FOUND",SYNC_HEAD_MISSING:"SYNC_HEAD_MISSING"};let To=null;function on(){return To||(To=new Promise((e,n)=>{const o=indexedDB.open(Xf,Zf);o.onupgradeneeded=r=>{const i=o.result;i.objectStoreNames.contains(Ae)||i.createObjectStore(Ae,{keyPath:"documentId"});const a=r.oldVersion;if(a>0&&a<4){const u=o.transaction.objectStore(Ae).openCursor();u.onsuccess=()=>{const d=u.result;if(!d)return;const h=d.value;typeof h.baseCommitId=="string"&&!h.localBaseCommitId&&(h.localBaseCommitId=h.baseCommitId,delete h.baseCommitId);const m=h.conflict;m&&(typeof m.baseCommitId=="string"&&!m.localBaseCommitId&&(m.localBaseCommitId=m.baseCommitId,delete m.baseCommitId),typeof m.expectedHeadCommitId=="string"&&!m.remoteCommitId&&(m.remoteCommitId=m.expectedHeadCommitId,delete m.expectedHeadCommitId)),d.update(h),d.continue()}}if(a>0&&a<5){const u=o.transaction.objectStore(Ae).openCursor();u.onsuccess=()=>{const d=u.result;if(!d)return;const h=d.value;h.contentKind==null&&(h.contentKind="lexical",d.update(h)),d.continue()}}},o.onsuccess=()=>e(o.result),o.onerror=()=>n(o.error)})),To}async function Qf(e){var r;const n=await Re(e.documentId),o={documentId:e.documentId,content:e.content,contentKind:e.contentKind??(n==null?void 0:n.contentKind)??"lexical",displayName:e.displayName,updatedAt:Date.now(),published:!1};if(n!=null&&n.localBaseCommitId)o.localBaseCommitId=n.localBaseCommitId;else{const i=(r=e.localBaseCommitIdAtEditStart)==null?void 0:r.trim();i&&(o.localBaseCommitId=i)}(n==null?void 0:n.permission)!=null?o.permission=n.permission:e.snapshotMeta&&(o.permission=e.snapshotMeta.permission),n!=null&&n.ownerVisitorId?o.ownerVisitorId=n.ownerVisitorId:e.snapshotMeta&&(o.ownerVisitorId=e.snapshotMeta.ownerVisitorId),n!=null&&n.domainId?o.domainId=n.domainId:e.snapshotMeta&&(o.domainId=e.snapshotMeta.domainId),n!=null&&n.publishError&&(o.publishError=n.publishError,o.publishErrorAt=n.publishErrorAt),n!=null&&n.conflictStatus&&(o.conflictStatus=n.conflictStatus),n!=null&&n.conflict&&(o.conflict=n.conflict),await $t(o)}function gr(e){const n={documentId:e.documentId,content:e.content,displayName:e.displayName,updatedAt:e.updatedAt,published:e.published};return e.permission!=null&&(n.permission=e.permission),e.ownerVisitorId&&(n.ownerVisitorId=e.ownerVisitorId),e.domainId&&(n.domainId=e.domainId),e.publishError!=null&&(n.publishError=e.publishError),e.publishErrorAt!=null&&(n.publishErrorAt=e.publishErrorAt),e.localBaseCommitId&&(n.localBaseCommitId=e.localBaseCommitId),e.conflictStatus!=null&&(n.conflictStatus=e.conflictStatus),e.conflict!=null&&(n.conflict=e.conflict),n}async function $t(e){const n=await on(),o=gr(e);return new Promise((r,i)=>{const a=n.transaction(Ae,"readwrite");a.objectStore(Ae).put(o),a.oncomplete=()=>{Ha(o.documentId,!o.published),r()},a.onerror=()=>i(a.error)})}async function Re(e){const n=await on();return new Promise((o,r)=>{const a=n.transaction(Ae,"readonly").objectStore(Ae).get(e);a.onsuccess=()=>o(a.result),a.onerror=()=>r(a.error)})}async function Ao(e){const n=await on();return new Promise((o,r)=>{const i=n.transaction(Ae,"readwrite");i.objectStore(Ae).delete(e),i.oncomplete=()=>{Ha(e,!1),o()},i.onerror=()=>r(i.error)})}async function em(e){const n=await on();return new Promise((o,r)=>{const a=n.transaction(Ae,"readonly").objectStore(Ae).getAll();a.onsuccess=()=>{let s=a.result;e!=null&&e.skipFailed&&(s=s.filter(l=>!l.publishError)),o(s)},a.onerror=()=>r(a.error)})}async function tm(e,n){const o=await on();return new Promise((r,i)=>{const s=o.transaction(Ae,"readwrite").objectStore(Ae),l=s.get(e);l.onsuccess=()=>{const u=l.result;u&&s.put(gr({...u,publishError:n,publishErrorAt:Date.now()})),r()},l.onerror=()=>i(l.error)})}async function Mo(e){const n=await on();return new Promise((o,r)=>{const a=n.transaction(Ae,"readwrite").objectStore(Ae),s=a.get(e);s.onsuccess=()=>{const l=s.result;l&&a.put(gr({...l,publishError:void 0,publishErrorAt:void 0})),o()},s.onerror=()=>r(s.error)})}async function jo(e,n){const o=await Re(e);o&&await $t({...o,localBaseCommitId:n.localBaseCommitId,conflictStatus:n.conflictStatus,conflict:n.conflict})}async function Eo(e){const n=await Re(e);n&&await $t({...n,conflict:void 0,conflictStatus:"none"})}class Cn extends Error{constructor(o,r){super(o);Jt(this,"code");Jt(this,"cause");this.name="DraftPublishAborted",this.code=o,this.cause=r==null?void 0:r.cause}}function nm(e){return e instanceof Cn?e.code:e instanceof et?e.status===404?nn.DOC_NOT_FOUND:e.code||`HTTP_${e.status}`:e instanceof Error&&e.message.trim()?e.message.trim().slice(0,120):"UNKNOWN"}function om(e,n,o,r){const i=(n==null?void 0:n.displayName)||e("unknownTitle");if(o===nn.SYNC_HEAD_MISSING)return e("draftPublishFailedSyncHead",{name:i});if(o===nn.DOC_NOT_FOUND)return e("draftPublishFailedNotice",{name:i});const a=r instanceof et||r instanceof Error&&r.message?r.message:o;return e("draftPublishFailedGeneric",{name:i,reason:a})}async function rm(e,n,o){const r=nm(n);throw await tm(e,r),n instanceof Cn?n:new Cn(r,{cause:n})}function im(e,n){const o=x.useRef(n);o.current=n,x.useEffect(()=>{if(!e)return;const r=3e4,i=1e4,a=async()=>{const l=await em({skipFailed:!0}),u=Date.now();for(const d of l)if(!d.published&&!(u-d.updatedAt<r))try{await o.current(d.documentId)}catch(h){console.log("[autoPublish] scan publish failed:",h)}};a();const s=setInterval(a,i);return()=>clearInterval(s)},[e])}const am=1e4;function sm(e,n){const[o,r]=x.useState(null),[i,a]=x.useState("up_to_date");return x.useEffect(()=>{if(!e){r(null),a("up_to_date");return}let l=!1;const u=e;async function d(){try{const m=await Ml(u,n??void 0);if(l)return;r(m.headCommitId),a(m.status)}catch{}}d();const h=window.setInterval(()=>void d(),am);return()=>{l=!0,window.clearInterval(h)}},[e,n]),{remoteCommitId:o,syncStatus:i,syncBehind:!!(n&&o&&n!==o)||i==="behind"}}function Fi(e){return e.trim()}function lm(e){return e.trim()}const cm=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".ico",".bmp",".jfif",".pjpeg"]);function dm(e){const n=e.split("/").pop()??"",o=n.lastIndexOf(".");return o<=0?"":n.slice(o).toLowerCase()}function um(e,n,o){let r,i;try{r=new URL(o),i=new URL(e,o)}catch{return null}if(i.origin!==r.origin||!i.pathname.startsWith("/api/assets/")||cm.has(dm(i.pathname)))return null;const a=n==null?void 0:n.trim();return a&&!i.searchParams.has("name")&&i.searchParams.set("name",a),i.toString()}function fm(){const e=n=>{if(n.button!==0)return;const r=n.composedPath().find(a=>a instanceof HTMLAnchorElement);if(!r)return;const i=um(r.href,r.getAttribute("download"),window.location.href);i&&(n.preventDefault(),n.stopPropagation(),window.location.assign(i))};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)}const Le={DOCUMENT:"md",HTML:"html",SHEET:"sheet",FOLDER:"dir",FOLDER_DESC:"folder_desc",GRAPH_FILE:"graph_file",GRAPH_DIR:"graph_dir"},mm="/assets/mdocs-logo-Dsv_2t6v.svg",hm=x.lazy(()=>Pt(()=>import("./DocumentEditor-CrU6HKmU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(e=>({default:e.DocumentEditor}))),pm=x.lazy(()=>Pt(()=>import("./HtmlEditor-BBcreXJD.js"),__vite__mapDeps([16,1,12,13,14,15,2,3,6,17])).then(e=>({default:e.HtmlEditor}))),gm=x.lazy(()=>Pt(()=>import("./SheetEditor-Dyk-jpRL.js"),__vite__mapDeps([18,1,12,13,14,7,11,2,3,6,19])).then(e=>({default:e.SheetEditor}))),ym=x.lazy(()=>Pt(()=>import("./SettingsPage-D09P0j48.js"),__vite__mapDeps([20,1,14,9,2,3,6])).then(e=>({default:e.SettingsPage}))),vm=x.lazy(()=>Pt(()=>import("./AgentChatPanel-_IV-LAS4.js"),__vite__mapDeps([21,1,9,8,7,2,3,6])).then(e=>({default:e.AgentChatPanel}))),bm=x.lazy(()=>Pt(()=>import("./AiWriteWorkbench-DzJAmRHY.js"),__vite__mapDeps([22,1,21,9,8,7,2,3,6])).then(e=>({default:e.AiWriteWorkbench}))),xm=x.lazy(()=>Pt(()=>import("./MergeView-LV_hny8a.js"),__vite__mapDeps([23,1,4,5,2,3,6,7,8,9,13])).then(e=>({default:e.MergeView})));function wm(e,n){try{const o=new Intl.RelativeTimeFormat(n,{numeric:"auto"}),r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),a=Math.floor(i/60),s=Math.floor(a/24);return s>30?o.format(-Math.floor(s/30),"month"):s>0?o.format(-s,"day"):a>0?o.format(-a,"hour"):i>0?o.format(-i,"minute"):o.format(-Math.floor(r/1e3),"second")}catch{return e.slice(0,10)}}async function Ro(e,n,o,r){const i=await nr();n(i);const a=localStorage.getItem("mdocs.currentDomainId"),l=a&&i.some(u=>u.domainId===a)?a:ql(i,e);o(l),await r(l)}function Li(){const{t:e,lang:n,setLang:o}=Ve(),[r,i]=x.useState("loading"),[a,s]=x.useState(()=>localStorage.getItem("mdocs.sidebarCollapsed")==="true"),l=Wf(),[u,d]=x.useState(!1),h=()=>{if(l){d(R=>!R);return}const y=!a;s(y),localStorage.setItem("mdocs.sidebarCollapsed",String(y))};x.useEffect(()=>{l||d(!1)},[l]),x.useEffect(()=>fm(),[]);const[m,f]=x.useState(!1),[p,g]=x.useState(0),w=x.useRef(null),[b,v]=x.useState(null),[S,D]=x.useState(null),[P,_]=x.useState(null),[T,I]=x.useState([]),[N,L]=x.useState([]),[E,O]=x.useState("default"),[$,V]=x.useState(!1),J=x.useRef(null),{documentId:ne}=ls(),B=cs(),[G,ce]=x.useState(null),ue=(G==null?void 0:G.kind)==="document"?G.documentId:null,[A,ie]=x.useState(null),[oe,re]=x.useState(null),K=x.useRef(oe);K.current=oe;const[Z,we]=x.useState(0),[se,tt]=x.useState(null),[Tt,vt]=x.useState(!1),[rn,Vt]=x.useState(!1),[At,nt]=x.useState(!1),[_e,Ge]=x.useState(!1),Pn=(A==null?void 0:A.documentId)??null,{syncBehind:We,remoteCommitId:Mt}=sm(Pn,se),[$e,Gt]=x.useState(null);x.useEffect(()=>{if(!At||!A){Gt(null);return}(async()=>{const y=await Re(A.documentId);if(y!=null&&y.conflict){Gt(y.conflict);return}if(y&&se&&Mt){const R=y.localBaseCommitId??se;if(!R)return;const M={localBaseCommitId:R,remoteCommitId:Mt,localSnapshotContent:y.content};await jo(A.documentId,{localBaseCommitId:M.localBaseCommitId,conflictStatus:"diverged",conflict:M}),Gt(M)}})()},[At,A,se,Mt]),x.useEffect(()=>{!A||!We||!_e||Re(A.documentId).then(async y=>{!y||y.conflict||y.conflictStatus==="publish_conflict"||y.conflictStatus!=="diverged"&&await $t({...y,conflictStatus:"diverged"})})},[A==null?void 0:A.documentId,We,_e]),x.useEffect(()=>{if(!A){tt(null);return}let y=!1;return Re(A.documentId).then(R=>{y||(R&&!R.published&&R.localBaseCommitId?tt(R.localBaseCommitId):tt(A.headCommitId??null))}),()=>{y=!0}},[A==null?void 0:A.documentId,A==null?void 0:A.headCommitId,_e]);const[Ee,me]=x.useState(null),[Ce,be]=x.useState(null),[xe,jt]=x.useState(null),[bt,ct]=x.useState(null),[an,Me]=x.useState(""),[sn,ot]=x.useState("docs");Yf(l&&sn==="docs",()=>d(!0),{open:u,onClose:()=>d(!1)});const[Fe,qe]=x.useState(!1),[Tn,xt]=x.useState(!1),[Wt,An]=Nf(),k=x.useRef(null),[j,z]=x.useState(!1),[F,q]=x.useState(null),X=x.useRef(void 0),te=x.useRef(void 0);im(localStorage.getItem("mdocs.autoPublish")==="true",Sr);async function Q(y){var R;await((R=X.current)==null?void 0:R.call(X)),y()}function ye(y){const M=(y.trim()||"untitled").replace(/[\\/:*?"<>|]/g,"-").slice(0,80);return M.endsWith(".md")?M:`${M}.md`}async function De(){var M,W;if(!A||!oe||A.fileType===Le.SHEET)return;await((M=X.current)==null?void 0:M.call(X));const y=A.fileType===Le.HTML;let R="";if(y)R=Fi(oe.content);else if(R=((W=te.current)==null?void 0:W.call(te))??"",!R.trim())try{R=(await vo({content:oe.content,from:"lexical",to:"markdown"})).content}catch{R=""}q({markdown:R,documentId:A.documentId,displayName:oe.displayName||A.displayName||"未命名",fileType:y?Le.HTML:Le.DOCUMENT}),z(!0),qe(!1)}function je(){q({markdown:"",documentId:null,displayName:"未命名",fileType:Le.DOCUMENT}),z(!0),qe(!1)}async function Ne(y){var le,Ie;const R=y.documentId.trim();if(!R)return;await((le=X.current)==null?void 0:le.call(X));let M="",W=y.displayName.trim()||"未命名",ee=Le.DOCUMENT;try{const Ft=await Xt(R);if(W=((Ie=Ft.displayName)==null?void 0:Ie.trim())||W,Ft.fileType===Le.SHEET)return;if(ee=Ft.fileType===Le.HTML?Le.HTML:Le.DOCUMENT,ee===Le.HTML)M=Fi(Ft.content);else try{M=(await vo({content:Ft.content,from:"lexical",to:"markdown"})).content}catch{M=""}}catch{}q({markdown:M,documentId:R,displayName:W,fileType:ee}),z(!0),qe(!1),ot("docs"),Q(()=>B(`/doc/${R}`))}async function ke(y){(A==null?void 0:A.documentId)===y.documentId&&await En()}async function Pe(y){const M=(y.documentId&&(F==null?void 0:F.documentId)===y.documentId?F.fileType:(A==null?void 0:A.documentId)===y.documentId?A.fileType:Le.DOCUMENT)===Le.HTML;if(y.documentId){const ee=(A==null?void 0:A.documentId)===y.documentId?A:null;let le;return M?le=lm(y.markdown):le=(await vo({content:y.markdown,from:"markdown",to:"lexical"})).content,await Qf({documentId:y.documentId,content:le,displayName:y.displayName,localBaseCommitIdAtEditStart:(ee==null?void 0:ee.headCommitId)??null,contentKind:M?"html":"lexical",snapshotMeta:ee?{permission:ee.permission,ownerVisitorId:ee.ownerVisitorId,domainId:ee.domainId}:void 0}),(A==null?void 0:A.documentId)===y.documentId?(re({documentId:y.documentId,content:le,displayName:y.displayName}),we(Ie=>Ie+1),Ge(!0)):await cn(y.documentId),me("帮写已写入草稿,可在编辑器中继续修改后发布"),{documentId:y.documentId}}const W=await $o({fileName:ye(y.displayName),displayName:y.displayName,content:y.markdown,contentFormat:"markdown",domainId:E||void 0,parentId:void 0});return await fe(),await cn(W.documentId),me("已创建文档"),{documentId:W.documentId}}x.useEffect(()=>{wt()},[]),x.useEffect(()=>{if(!Ee)return;const y=()=>{me(null)};return window.addEventListener("pointerdown",y,!0),()=>window.removeEventListener("pointerdown",y,!0)},[Ee]),x.useEffect(()=>{const y=R=>{var ee,le,Ie;const M=R;if(((ee=M.detail)==null?void 0:ee.status)===409||((le=M.detail)==null?void 0:le.code)==="AI_NOT_CONFIGURED")return;const W=(Ie=M.detail)==null?void 0:Ie.message;W&&be(W)};return window.addEventListener(zo,y),()=>window.removeEventListener(zo,y)},[]);async function wt(){try{const y=await Wr();v(y),Vn(y.visitorId),await Ro(y.visitorId,L,O,fe),i("ready")}catch(y){if(y instanceof et&&y.status===401){i("needsRegister");return}be(Je(e,y)),i("needsRegister")}}async function _t(y,R){const M=await Dl(y,R);v(M.visitor),D(M.visitor.visitorId),_(M.recoveryCode),Vn(M.visitor.visitorId),await Ro(M.visitor.visitorId,L,O,fe),i("ready")}async function dt(y){const R=await Wr();v(R),await Ro(R.visitorId,L,O,fe),i("ready")}async function fe(y){const M=await Al(y??E);I(M)}function Ke(y){re({documentId:y.documentId,content:y.content,displayName:y.displayName}),we(R=>R+1),Ge(!1)}function Et(y,R){re({documentId:y,content:R.content,displayName:R.displayName}),we(M=>M+1),Ge(!0)}async function ln(y,R){await Ao(y);const M=await Xt(y);if((A==null?void 0:A.documentId)===y&&w.current===y){ie(fn(M)),Ge(!1);const W=K.current,ee=R!==void 0&&M.content===R,le=(W==null?void 0:W.documentId)===y&&W.content===M.content;ee||le?(W==null?void 0:W.documentId)===y&&W.displayName!==M.displayName&&re({...W,displayName:M.displayName}):Ke(M)}return M}function Rt(y,R,M="folder"){console.log("[openGraph]",M,y,R),ie(null),re(null),ce({kind:"graph",scope:M,resourceId:y,name:R})}function qt(){ce(null)}x.useEffect(()=>{function y(R){J.current&&!J.current.contains(R.target)&&V(!1)}if($)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[$]);async function cn(y){w.current=y,ot("docs"),ce({kind:"document",documentId:y});try{const R=await Re(y);if(w.current!==y)return;const M=await Xt(y);if(w.current!==y||(M.domainId!==E&&(localStorage.setItem("mdocs.currentDomainId",M.domainId),O(M.domainId),fe(M.domainId)),Me($n(M.relativePath)),M.headCommitId&&R&&!R.published&&(R.publishError===nn.SYNC_HEAD_MISSING&&await Mo(y),R.localBaseCommitId||await $t({...R,localBaseCommitId:M.headCommitId})),ie(fn(M)),w.current!==y))return;R&&!R.published?Et(y,R):Ke(M)}catch(R){if(w.current!==y)return;be(Je(e,R))}}x.useEffect(()=>{r==="ready"&&(ne?cn(ne):(ce(null),ie(null),re(null),tt(null)))},[r,ne]);const{createModal:Kt,setCreateModal:ao,createModalError:yr,createModalBusy:Yt,createModalInputRef:Ga,openNewDocumentModal:dn,openNewFolderModal:vr,submitCreateModal:Wa}=Gf({tree:T,currentDomainId:E,selectedCreateParentPath:an,t:e,onDocCreated:y=>{ie(fn(y)),Ke(y),Me($n(y.relativePath)),B(`/doc/${y.documentId}`)},refreshTree:fe}),[qa,Mn]=x.useState(!1),[Ka,so]=x.useState(!1);x.useEffect(()=>{const y=R=>{!(R.metaKey||R.ctrlKey)||R.key.toLowerCase()!=="k"||(R.preventDefault(),so(!0))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[]);const[Ya,un]=x.useState(!1),[Ot,br]=x.useState([]),[lo,xr]=x.useState(""),[jn,wr]=x.useState(""),[Ja,_r]=x.useState(new Set);async function Xa(){try{const y=await Ll();br(y)}catch(y){be(Je(e,y))}}const co=x.useMemo(()=>{const y={};for(const R of N)y[R.domainId]=R.domainName;return y},[N]),Ir=x.useMemo(()=>{let y=Ot;const R=lo.trim().toLowerCase();return R&&(y=y.filter(M=>{var W;return(W=M.displayName)==null?void 0:W.toLowerCase().includes(R)})),jn&&(y=y.filter(M=>M.domainId===jn)),y},[Ot,lo,jn]),Za=x.useMemo(()=>{const y=new Set,R=[];for(const M of Ot){const W=M.domainId;W&&!y.has(W)&&(y.add(W),R.push({id:W,name:co[W]??W}))}return R},[Ot,co]);async function Qa(y,R,M,W,ee){let le=await Re(y);!le&&(A==null?void 0:A.documentId)===y&&(le={documentId:y,content:R,displayName:M,updatedAt:Date.now(),published:!1,localBaseCommitId:W,permission:A.permission,ownerVisitorId:A.ownerVisitorId,domainId:A.domainId},await $t(le)),le&&await jo(y,{localBaseCommitId:W,conflictStatus:"publish_conflict",conflict:{localBaseCommitId:W,remoteCommitId:ee.headCommitId,localSnapshotContent:R}}),vt(!0)}async function es(){if(!A||rn||(b==null?void 0:b.visitorId)!==A.ownerVisitorId||!window.confirm(e("conflictForceConfirm")))return;const R=A.documentId;Vt(!0);try{await po(R).execute(async()=>{var fo,Dr,Nr,Pr,Tr;const M=await Re(R),W=((fo=M==null?void 0:M.conflict)==null?void 0:fo.localBaseCommitId)??(M==null?void 0:M.localBaseCommitId)??se??A.headCommitId,ee=((Dr=M==null?void 0:M.conflict)==null?void 0:Dr.remoteCommitId)??($e==null?void 0:$e.remoteCommitId),le=((Nr=M==null?void 0:M.conflict)==null?void 0:Nr.localSnapshotContent)??(M==null?void 0:M.content)??((Pr=K.current)==null?void 0:Pr.content),Ie=(M==null?void 0:M.displayName)??((Tr=K.current)==null?void 0:Tr.displayName)??A.displayName;if(!W||!ee||le==null)throw be(e("syncHeadMissing")),new Error("missing force overwrite payload");await yo(R,{content:le,displayName:Ie,version:{localBaseCommitId:W,merge:{remoteCommitId:ee,localSnapshotContent:le,forceLocal:!0}}});const Ft=await Xt(R);await kr(Ft)})}catch(M){M instanceof Error&&M.message==="missing force overwrite payload"||be(Je(e,M))}finally{Vt(!1)}}async function uo(y,R,M,W){return po(M).execute(async()=>{const ee=await Re(M),le=(ee==null?void 0:ee.localBaseCommitId)??(A==null?void 0:A.headCommitId);if(!le)throw be(e("syncHeadMissing")),new Error("missing localBaseCommitId");try{await yo(M,{content:y,displayName:R,permission:W,version:{localBaseCommitId:le}}),await Eo(M),await ln(M,y),await fe(),vt(!1),me(e("published")),window.setTimeout(()=>me(null),1200)}catch(Ie){throw Ie instanceof et&&Ie.status===409&&Ie.code==="VERSION_CONFLICT"&&Ie.details&&typeof Ie.details=="object"&&await Qa(M,y,R,le,Ie.details),Ie}})}async function ts(){if(!A)return;const y=await Xt(A.documentId);y.domainId!==E&&(localStorage.setItem("mdocs.currentDomainId",y.domainId),O(y.domainId),fe(y.domainId)),Me($n(y.relativePath)),ie(fn(y)),Ke(y),me(e("syncPullDone")),window.setTimeout(()=>me(null),1200)}async function En(){if(!A)return;const y=await Re(A.documentId),R=!!(y&&!y.published);if((y==null?void 0:y.conflictStatus)==="publish_conflict"||(y==null?void 0:y.conflictStatus)==="diverged"||!!(y!=null&&y.conflict)){nt(!0);return}if(R&&y){if(We&&Mt){const W=y.localBaseCommitId??se;if(W){const ee={localBaseCommitId:W,remoteCommitId:Mt,localSnapshotContent:y.content};await jo(A.documentId,{localBaseCommitId:W,conflictStatus:"diverged",conflict:ee}),Gt(ee)}nt(!0);return}me(e("pullBlockedDraft")),window.setTimeout(()=>me(null),3e3);return}await ts()}async function kr(y){await Eo(y.documentId),await Ao(y.documentId),Ge(!1),nt(!1),vt(!1),await cn(y.documentId),fe(y.domainId),me(e("published")),window.setTimeout(()=>me(null),1200)}async function ns(y,R,M){try{await rm(y,R,M)}catch(W){if(!(W instanceof Cn))throw W;const ee=M??await Re(y);throw me(om(e,ee,W.code,W.cause??R)),window.setTimeout(()=>me(null),4e3),W}}async function Sr(y){let R;try{await po(y).execute(async()=>{const M=await Re(y);if(!M)return;R=M;let W=M.localBaseCommitId;if(W||(W=(await Xt(y)).headCommitId??void 0,W&&(await $t({...M,localBaseCommitId:W}),M.publishError===nn.SYNC_HEAD_MISSING&&await Mo(y))),!W)throw new Cn(nn.SYNC_HEAD_MISSING);const ee=await Re(y);ee&&(await yo(y,{content:ee.content,displayName:ee.displayName,version:{localBaseCommitId:W}}),await Eo(y),await Mo(y),(A==null?void 0:A.documentId)===y?await ln(y,ee.content):await Ao(y),await fe(),me(e("published")),window.setTimeout(()=>me(null),1200))})}catch(M){await ns(y,M,R)}}function Rn(y,R){jt({type:"document",id:y,name:R})}function Cr(y,R){jt({type:"folder",id:y,name:R})}async function os(y,R){try{const M=await El(y,R);await fe(M.domainId),(A==null?void 0:A.documentId)===y&&(ie(fn(M)),Me($n(M.relativePath)))}catch(M){M instanceof et?M.status===409&&be(M.message):be(Je(e,M))}}async function rs(){if(xe)try{xe.type==="document"?(await jl(xe.id),(A==null?void 0:A.documentId)===xe.id&&(ie(null),re(null),Me(""),B("/"))):xe.type==="folder"&&(await Ol(xe.id),A&&(ie(null),re(null),Me(""),B("/"))),await fe(),me(xe.type==="folder"?`已删除「${xe.name}」及其下所有内容`:`已删除「${xe.name}」`),window.setTimeout(()=>me(null),2e3)}catch(y){be(Je(e,y))}finally{jt(null)}}return r==="loading"?c.jsx("div",{className:"mdocs-loading muted",children:e("loading")}):r==="needsRegister"?c.jsx(Kl,{onSubmit:_t,onRecover:dt,error:Ee}):c.jsxs("div",{className:"mdocs-app-root",children:[Gi(),c.jsx("div",{className:"mdocs-shell",children:sn==="settings"?c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"mdocs-main muted",style:{padding:24},children:"加载设置…"}),children:c.jsx(ym,{onBack:()=>ot("docs"),onPublishDraft:Sr,onOpenDocument:cn,onRecoverDraft:()=>void fe()})}):c.jsxs("div",{className:"mdocs-layout"+(l?" mdocs-layout--reader":""),children:[l&&u?c.jsx("button",{type:"button",className:"mdocs-mobile-nav-scrim","aria-label":e("collapseSidebar"),onClick:()=>d(!1)}):null,c.jsxs("aside",{className:"mdocs-sidebar"+(l?u?" mdocs-sidebar--drawer-open":" mdocs-sidebar--drawer":a?" mdocs-sidebar-collapsed":""),children:[c.jsxs("header",{className:"mdocs-sidebar-header",children:[c.jsxs("div",{className:"mdocs-brand",children:[c.jsx("img",{src:mm,alt:e("brand"),className:"mdocs-brand-logo"}),c.jsx("span",{children:e("brand")})]}),c.jsx("button",{type:"button",className:"mdocs-sidebar-toggle",onClick:h,"aria-label":e(l?u?"collapseSidebar":"expandSidebar":a?"expandSidebar":"collapseSidebar"),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:y=>{y.currentTarget.style.background="var(--mdocs-hover-bg, #f0f0f0)"},onMouseLeave:y=>{y.currentTarget.style.background="none"},children:l?c.jsx(Rr,{size:18}):a?c.jsx(Or,{size:18}):c.jsx(Rr,{size:18})})]}),c.jsxs("div",{className:"mdocs-sidebar-actions",ref:J,children:[c.jsxs("button",{type:"button",className:"mdocs-sidebar-create-btn",onClick:()=>V(y=>!y),children:[c.jsx(Er,{size:15,strokeWidth:1.75}),e("newArticle")]}),$&&c.jsxs("div",{className:"mdocs-create-dropdown",children:[c.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{V(!1),dn()},children:[c.jsx(Er,{size:14,strokeWidth:1.5}),"Markdown"]}),c.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{V(!1),dn(void 0,"html")},children:[c.jsx(Ls,{size:14,strokeWidth:1.5}),"HTML"]}),c.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{V(!1),dn(void 0,"sheet")},children:[c.jsx(dl,{size:14,strokeWidth:1.5}),e("sheetDocument")]})]}),c.jsxs("button",{type:"button",className:"mdocs-sidebar-create-btn",onClick:()=>{V(!1),vr()},children:[c.jsx(qs,{size:15,strokeWidth:1.75}),e("newDirectory")]}),c.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":e("docSearch"),onClick:()=>so(!0),children:c.jsx(Ui,{size:18,strokeWidth:1.75})}),c.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":"知识图谱",onClick:()=>Rt(E,"知识图谱","domain"),children:c.jsx(er,{size:18,strokeWidth:1.75})})]}),c.jsx(Jl,{nodes:T,activeDocumentId:ue,graphFocusAnchorId:(G==null?void 0:G.kind)==="graph"?G.resourceId:null,selectedParentPath:an,onOpen:y=>{l&&d(!1),Q(()=>B(`/doc/${y.documentId}`))},onOpenFolder:(y,R)=>{Q(()=>{Me(y),R&&(qt(),l&&d(!1),B(`/doc/${R}`))})},onContextMenu:ct,onMoveDocument:os,onDeselect:()=>{qt(),Q(()=>{Me(""),B("/")})},onOpenGraph:(y,R)=>{if(y.type==="folder")Rt(y.documentId,y.name);else if(R){const M=T.find(W=>W.documentId===R);Rt(R,(M==null?void 0:M.name)??"图谱")}},onGenerateGraph:async(y,R)=>{var ee;const M=y.type==="folder"?y.documentId:R;if(!M)return;const W=y.type==="folder"?y.name:((ee=T.find(le=>le.documentId===R))==null?void 0:ee.name)??"图谱";Rt(M,W)}}),c.jsxs("footer",{className:"mdocs-sidebar-footer",children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,cursor:"pointer"},onClick:()=>Q(()=>ot("settings")),children:[c.jsx("span",{className:"mdocs-visitor-avatar",children:b?b.visitorName.charAt(0).toUpperCase():"?"}),c.jsx("span",{className:"mdocs-visitor-footer-name",children:b?b.visitorName:""})]}),c.jsx("button",{type:"button",className:"mdocs-sidebar-bookmark mdocs-tooltip","data-tooltip":e("bookmark"),onClick:()=>{un(!0),xr(""),wr(""),Xa()},style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4},children:c.jsx(ll,{size:16,strokeWidth:1.5})}),c.jsx("button",{type:"button",className:"mdocs-sidebar-logout mdocs-tooltip","data-tooltip":e("logout"),onClick:()=>Mn(!0),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4},children:c.jsx(Zs,{size:16,strokeWidth:1.5})})]})]}),c.jsxs("main",{className:"mdocs-main",children:[(G==null?void 0:G.kind)==="graph"?c.jsx(xf,{scope:G.scope,resourceId:G.resourceId,name:G.name,onClose:qt,onOpenDocument:y=>{Q(()=>B(`/doc/${y}`))}},`${G.scope}-${G.resourceId}`):A&&oe&&oe.documentId===A.documentId?A.fileType==="html"||A.fileType==="sheet"?c.jsxs("div",{className:"mdocs-editor-with-comments",children:[c.jsx("div",{className:"mdocs-editor-container",children:c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:A.fileType==="sheet"?c.jsx(gm,{meta:A,initialContent:oe.content,initialDisplayName:oe.displayName,contentRevision:Z,canEdit:!!(b&&(A.ownerVisitorId===b.visitorId||go(A.permission)||A.invitedEdit===!0)),domains:N,currentDomainId:E,onDomainChange:y=>{Q(()=>{localStorage.setItem("mdocs.currentDomainId",y),O(y),ie(null),re(null),Me(""),B("/"),fe(y)})},onDomainsChange:L,onContentChange:y=>{re(R=>R&&{...R,content:y})},onDraftExistsChange:Ge,hasLocalDraft:_e,onPublish:uo,syncBehind:We,onSyncClick:()=>void En(),onDelete:async()=>{Rn(A.documentId,A.relativePath)},canManageInvites:!!(b&&b.visitorId===A.ownerVisitorId),onToggleComments:()=>f(!m),commentPanelOpen:m,commentCount:p,onShowToast:me,readerChrome:l,onOpenMobileNav:()=>d(!0)},A.documentId):c.jsx(pm,{meta:A,initialContent:oe.content,initialDisplayName:oe.displayName,contentRevision:Z,canEdit:!!(b&&(A.ownerVisitorId===b.visitorId||go(A.permission)||A.invitedEdit===!0)),domains:N,currentDomainId:E,onDomainChange:y=>{Q(()=>{localStorage.setItem("mdocs.currentDomainId",y),O(y),ie(null),re(null),Me(""),B("/"),fe(y)})},onDomainsChange:L,onContentChange:y=>{re(R=>R&&{...R,content:y})},onDraftExistsChange:Ge,hasLocalDraft:_e,onPublish:uo,syncBehind:We,onSyncClick:()=>void En(),canManageInvites:!!(b&&b.visitorId===A.ownerVisitorId),onDelete:async()=>{Rn(A.documentId,A.relativePath)},onToggleComments:()=>f(!m),commentPanelOpen:m,commentCount:p,onAiWrite:l?void 0:()=>void De(),onShowToast:me,readerChrome:l,onOpenMobileNav:()=>d(!0)},A.documentId)})}),m&&c.jsx(Oi,{documentId:A.documentId,visitorId:b==null?void 0:b.visitorId,visitorName:b==null?void 0:b.visitorName,documentOwnerId:A.ownerVisitorId,onClose:()=>f(!1)})]}):c.jsxs("div",{className:"mdocs-editor-with-comments",children:[c.jsx("div",{className:"mdocs-editor-container",children:c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:c.jsx(hm,{meta:A,initialContent:oe.content,initialDisplayName:oe.displayName,contentRevision:Z,canEdit:!!(b&&(A.ownerVisitorId===b.visitorId||go(A.permission)||A.invitedEdit===!0)),domains:N,currentDomainId:E,onDomainChange:y=>{Q(()=>{localStorage.setItem("mdocs.currentDomainId",y),O(y),ie(null),re(null),Me(""),B("/"),fe(y)})},onDomainsChange:L,onPublish:uo,syncBehind:We,onSyncClick:()=>void En(),onDraftExistsChange:Ge,hasLocalDraft:_e,onConflictModalRequest:()=>vt(!0),onMergeRequest:()=>nt(!0),canManageInvites:!!(b&&b.visitorId===A.ownerVisitorId),onDelete:async()=>{if(A.relativePath.endsWith("/___desc___.md")){const y=A.relativePath.replace(/\/___desc___\.md$/,"");Cr(A.documentId,y)}else Rn(A.documentId,A.relativePath)},saveBeforeNavRef:X,exportMarkdownRef:te,onShowToast:me,onShowError:be,onToggleComments:()=>f(!m),commentPanelOpen:m,commentCount:p,onAiWrite:l?void 0:()=>void De(),readerChrome:l,onOpenMobileNav:()=>d(!0)},A.documentId)})}),m&&c.jsx(Oi,{documentId:A.documentId,visitorId:b==null?void 0:b.visitorId,visitorName:b==null?void 0:b.visitorName,documentOwnerId:A.ownerVisitorId,onClose:()=>f(!1)})]}):c.jsxs("div",{className:"mdocs-welcome",children:[l?c.jsxs("button",{type:"button",className:"mdocs-reader-float-pill",onClick:()=>d(!0),"aria-label":e("expandSidebar"),children:[c.jsx(Or,{size:18,strokeWidth:1.75}),c.jsx("span",{children:e("brand")})]}):null,c.jsx("div",{className:"mdocs-welcome-icon",children:c.jsx(Os,{size:64,strokeWidth:1,opacity:.15})}),c.jsx("h1",{children:e("brand")}),c.jsx("p",{className:"mdocs-welcome-lead",children:e("createDocToStart")}),c.jsxs("div",{className:"mdocs-welcome-actions",children:[c.jsxs("button",{type:"button",className:"primary",onClick:()=>dn(),style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx(Gs,{size:16,strokeWidth:1.5}),e("startWriting")]}),l?null:c.jsxs("button",{type:"button",className:"secondary",onClick:()=>je(),style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx("img",{src:Aa,alt:"",width:16,height:16,style:{display:"block"}}),"AI 帮写"]})]}),c.jsxs("div",{className:"mdocs-welcome-domain",children:[c.jsx("label",{className:"muted mdocs-welcome-domain-label",children:e("domainLabel")}),c.jsx(_f,{domains:N.length?N:[{domainId:"default",domainName:e("defaultDomain"),permission:"",creatorVisitorId:"",docCount:0}],value:E,onChange:y=>{Q(()=>{localStorage.setItem("mdocs.currentDomainId",y),O(y),ie(null),re(null),Me(""),B("/"),fe(y)})},onDomainsChange:L,ariaLabel:e("domainLabel"),localizeName:y=>kn(y,n,e)})]})]}),c.jsx(Jf,{open:Tt,onClose:()=>vt(!1),onResolve:()=>{vt(!1),nt(!0)},onForceOverwrite:b&&A&&b.visitorId===A.ownerVisitorId?()=>void es():void 0,forceBusy:rn}),At&&A&&$e&&c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"merge-view-loading",children:e("mergeLoadingRemote")}),children:c.jsx(xm,{documentId:A.documentId,displayName:A.displayName,conflict:$e,fileType:A.fileType,onClose:()=>nt(!1),onSuccess:kr,onError:y=>be(y)})}),Ee&&c.jsx("div",{className:"mdocs-toast",role:"status",children:Ee}),Ce&&c.jsx(Pf,{title:e("error"),message:Ce,onClose:()=>be(null)})]}),qa&&c.jsx("div",{className:"mdocs-dialog-backdrop",onClick:y=>{y.target===y.currentTarget&&Mn(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:440},children:[c.jsx("h1",{style:{fontSize:"1.125rem",marginBottom:8},children:"退出当前登录身份?"}),c.jsx("p",{style:{lineHeight:1.6,color:"var(--mdocs-text-secondary, #666)",marginBottom:20},children:"这将会导致您无法修改以前的文章。如果想找回账号,需要恢复码或联系管理员执行合并用户脚本。"}),c.jsxs("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end"},children:[c.jsx("button",{type:"button",onClick:()=>Mn(!1),children:"取消"}),c.jsx("button",{type:"button",className:"primary",style:{background:"#d32f2f"},onClick:()=>{Cl(),ie(null),re(null),v(null),I([]),Mn(!1),i("needsRegister")},children:"确认退出"})]})]})}),Ya&&c.jsx("div",{className:"mdocs-dialog-backdrop",onClick:y=>{y.target===y.currentTarget&&un(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:640,width:"min(640px, 100%)",maxHeight:"70vh",display:"flex",flexDirection:"column"},children:[c.jsxs("h1",{style:{fontSize:"1.125rem",marginBottom:16},children:[e("bookmarkTitle"),"(",Ot.length,")"]}),Ot.length>0&&c.jsxs("div",{className:"mdocs-bookmark-filterbar",children:[c.jsx("input",{type:"text",placeholder:e("bookmarkSearch"),value:lo,onChange:y=>xr(y.target.value)}),c.jsxs("select",{value:jn,onChange:y=>wr(y.target.value),children:[c.jsx("option",{value:"",children:e("bookmarkFilterAll")}),Za.map(y=>c.jsx("option",{value:y.id,children:y.name},y.id))]})]}),Ot.length===0?c.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkEmpty")}):Ir.length===0?c.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkNoMatch")}):c.jsx("div",{style:{overflowY:"auto",flex:1,margin:"0 -1rem",padding:"0 1rem"},children:c.jsxs("table",{className:"mdocs-bookmark-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:e("bookmarkColTitle")}),c.jsx("th",{children:e("bookmarkColDomain")}),c.jsx("th",{children:e("bookmarkColAuthor")}),c.jsx("th",{children:e("bookmarkColTime")}),c.jsx("th",{className:"mdocs-bookmark-col-action"})]})}),c.jsx("tbody",{children:Ir.map(y=>{const R=Ja.has(y.documentId);return c.jsxs("tr",{className:`${R?"mdocs-bookmark-removing":""}`,style:{opacity:y.isDeleted?.6:1},children:[c.jsx("td",{className:"mdocs-bookmark-col-title",children:c.jsxs("div",{style:{cursor:y.isDeleted?"default":"pointer",display:"flex",alignItems:"center",gap:6,overflow:"hidden"},onClick:()=>{y.isDeleted||Q(()=>{un(!1),B(`/doc/${y.documentId}`)})},children:[c.jsx("span",{ref:M=>{if(M){const W=M.scrollWidth>M.clientWidth;M.title=W?y.displayName??"":""}},style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:y.displayName??"(无标题)"}),y.isDeleted&&c.jsx("span",{style:{fontSize:"0.7rem",color:"#d32f2f",background:"#ffebee",padding:"1px 6px",borderRadius:4,flexShrink:0},children:"已删除"})]})}),c.jsx("td",{children:y.isDeleted?"":co[y.domainId??""]??y.domainId??""}),c.jsx("td",{children:y.isDeleted?"":y.ownerVisitorName??"-"}),c.jsx("td",{children:y.isDeleted?"":wm(y.bookmarkedAt,n)}),c.jsx("td",{className:"mdocs-bookmark-col-action",children:c.jsxs("div",{style:{display:"flex",gap:2,alignItems:"center",justifyContent:"flex-end"},children:[c.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkOpen"),onClick:()=>{y.isDeleted||Q(()=>{un(!1),B(`/doc/${y.documentId}`)})},style:{background:"none",border:"none",cursor:y.isDeleted?"default":"pointer",padding:"4px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4,display:"inline-flex",alignItems:"center"},children:c.jsx(js,{size:14,strokeWidth:1.5})}),c.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkRemove"),onClick:async()=>{try{await zl(y.documentId),_r(M=>new Set(M).add(y.documentId)),setTimeout(()=>{br(M=>M.filter(W=>W.documentId!==y.documentId)),_r(M=>{const W=new Set(M);return W.delete(y.documentId),W})},300)}catch(M){be(Je(e,M))}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4,display:"inline-flex",alignItems:"center"},onMouseEnter:M=>{M.currentTarget.style.color="#d32f2f"},onMouseLeave:M=>{M.currentTarget.style.color="var(--mdocs-text-muted, #999)"},children:"✕"})]})})]},y.documentId)})})]})}),c.jsx("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end",marginTop:16,paddingTop:16,borderTop:"1px solid var(--mdocs-border, #eee)"},children:c.jsx("button",{type:"button",onClick:()=>un(!1),children:e("close")})})]})}),bt&&c.jsx(wf,{x:bt.x,y:bt.y,node:bt.node,parentPath:bt.parentPath,onClose:()=>ct(null),onCreateChild:y=>dn(y),onCreateFolder:y=>vr(y),onDeleteDocument:y=>Rn(y.documentId,y.path),onDeleteFolder:y=>Cr(y.documentId,y.folderDisplayName||y.name)}),xe&&c.jsx(Ma,{title:xe.type==="folder"?"删除文件夹":"删除文档",message:xe.type==="folder"?`确定要删除「${xe.name}」及其下的所有文档和子文件夹吗?此操作不可撤销。`:`确定要删除「${xe.name}」吗?`,confirmLabel:"删除",cancelLabel:"取消",onConfirm:rs,onCancel:()=>jt(null),danger:!0}),Kt&&c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&!Yt&&ao(null)},children:c.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[c.jsx("h1",{children:Kt.kind==="document"?e("newDocumentTitle"):e("newFolderTitle")}),c.jsx("p",{className:"muted",children:Kt.kind==="document"?e("fileNameHint"):e("folderNameHint")}),c.jsxs("form",{onSubmit:Wa,className:"mdocs-dialog-form",children:[c.jsxs("label",{className:"mdocs-dialog-label",children:[Kt.kind==="document"?e("fileNameLabel"):e("folderNameLabel"),c.jsx("input",{ref:Ga,value:Kt.draft,onChange:y=>ao(R=>R&&{...R,draft:y.target.value}),placeholder:Kt.kind==="document"?e("untitledPlaceholder"):e("folderExamplePlaceholder"),maxLength:200,disabled:Yt})]}),yr&&c.jsx("div",{className:"mdocs-dialog-error",children:yr}),c.jsxs("div",{className:"mdocs-dialog-actions",children:[c.jsx("button",{type:"button",onClick:()=>!Yt&&ao(null),disabled:Yt,children:e("cancel")}),c.jsx("button",{type:"submit",className:"primary",disabled:Yt,children:e(Yt?"creating":"create")})]})]})]})})]})}),S&&b&&c.jsx(Yl,{visitorId:S,onDismiss:()=>D(null)}),P&&c.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:y=>{y.target===y.currentTarget&&_(null)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480,textAlign:"center"},children:[c.jsx("h1",{style:{fontSize:"1.25rem",marginBottom:8},children:"🔑 保存你的恢复码"}),c.jsxs("p",{className:"muted",style:{marginBottom:16,lineHeight:1.5},children:["恢复码是你的唯一凭证,当 Token 丢失时可用它找回身份。",c.jsx("br",{}),c.jsx("strong",{children:"请立即复制保存,此弹窗关闭后不可再查看。"})]}),c.jsx("div",{style:{background:"#f5f5f5",borderRadius:8,padding:"12px 16px",fontFamily:"monospace",fontSize:"1.25rem",letterSpacing:"0.1em",marginBottom:20,userSelect:"all"},children:P}),c.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[c.jsx("button",{type:"button",className:"primary",onClick:()=>{navigator.clipboard.writeText(P)},children:"复制恢复码"}),c.jsx("button",{type:"button",onClick:()=>_(null),children:"已保存,关闭"})]})]})}),c.jsxs(c.Fragment,{children:[c.jsx(Df,{open:Fe,onToggle:()=>{var y;Fe?(y=k.current)==null||y.requestClose():qe(!0)},position:Wt,onPositionChange:An}),Fe?c.jsx(x.Suspense,{fallback:null,children:c.jsx(vm,{ref:k,open:Fe,onClose:()=>{qe(!1),xt(!1)},visitorName:b==null?void 0:b.visitorName,fullscreen:l||Tn,onToggleFullscreen:l?void 0:()=>xt(y=>!y),domainId:E||null,domains:N,localizeDomainName:y=>kn(y,n,e),documentId:(A==null?void 0:A.documentId)??null,documentTitle:(A==null?void 0:A.displayName)??null,documentPath:(A==null?void 0:A.relativePath)??null,graphFileId:(G==null?void 0:G.kind)==="graph"?`${G.resourceId}.graph-file`:null,graphLabel:(G==null?void 0:G.kind)==="graph"?G.name:null,anchorStyle:l||Tn?void 0:Cf(Wt),onOpenDocument:y=>{ot("docs"),Q(()=>B(`/doc/${y}`)),qe(!1),xt(!1)},onTreeChanged:()=>void fe(),onDocumentOverwritten:y=>void ke(y),onOpenCoding:l?void 0:y=>void Ne(y)})}):null]}),F?c.jsx(x.Suspense,{fallback:null,children:c.jsx(bm,{open:j,initialMarkdown:F.markdown,documentId:F.documentId,displayName:F.displayName,onClose:()=>{z(!1),q(null)},onComplete:Pe})}):null,c.jsx(jf,{open:Ka,domains:N,onDomainsChange:L,onClose:()=>so(!1),onOpenDocument:y=>{l&&d(!1),ot("docs"),Q(()=>B(`/doc/${y}`))}})]})}const _m=x.lazy(()=>Pt(()=>import("./PlaygroundPage-Bo9rM8MY.js"),__vite__mapDeps([24,1,4,5,2,3,6,7,8,9,10,11])).then(e=>({default:e.PlaygroundPage})));function Im(){return c.jsxs(ds,{children:[c.jsx(mo,{path:"/",element:c.jsx(Li,{})}),c.jsx(mo,{path:"/doc/:documentId",element:c.jsx(Li,{})}),c.jsx(mo,{path:"/playground",element:c.jsx(x.Suspense,{fallback:c.jsx("div",{style:{padding:24},children:"Loading playground…"}),children:c.jsx(_m,{})})})]})}function km(){const{pathname:e,hash:n,search:o,origin:r}=window.location,i="/",a=i.endsWith("/")?i.slice(0,-1):i;let s=e;a&&s.startsWith(a)&&(s=s.slice(a.length)||"/");const l=s.match(/^\/doc\/([^/]+)\/?$/);if(!l)return;const u=n.match(/^#\/doc\/([^/?#]+)/),d=(u==null?void 0:u[1])??l[1];if(!d)return;const h=i.endsWith("/")?i:`${i}/`;window.location.replace(`${r}${h}${o}#/doc/${d}`)}km();const Va=document.getElementById("root");if(!Va)throw new Error("root element missing");us.createRoot(Va).render(c.jsx(zi.StrictMode,{children:c.jsx(ms,{motion:Cs,children:c.jsx(hs,{children:c.jsx(yl,{children:c.jsx(fs,{children:c.jsx(Im,{})})})})})}));export{el as $,Xh as A,Qh as B,Os as C,rt as D,Hh as E,Bh as F,Vh as G,Yh as H,Zh as I,$h as J,Lh as K,zh as L,Ma as M,er as N,Uh as O,Uf as P,Jh as Q,Gh as R,ll as S,Wh as T,Wl as U,Or as V,_f as W,zt as X,Fr as Y,$s as Z,Aa as _,Re as a,jh as a$,nr as a0,Al as a1,Jl as a2,$o as a3,Je as a4,em as a5,om as a6,Mo as a7,Cn as a8,jm as a9,rh as aA,ih as aB,Wf as aC,Yf as aD,ho as aE,Er as aF,oh as aG,Ll as aH,lh as aI,mm as aJ,Rr as aK,Ui as aL,Gi as aM,zm as aN,Lm as aO,nh as aP,kh as aQ,Ph as aR,Th as aS,Nh as aT,Pi as aU,gh as aV,vh as aW,Mh as aX,Gn as aY,Fo as aZ,hf as a_,Tl as aa,Eh as ab,Vm as ac,Hm as ad,Bm as ae,Um as af,qm as ag,Em as ah,Om as ai,Rm as aj,Fm as ak,Wm as al,Gm as am,Km as an,Ym as ao,Jm as ap,ch as aq,Wr as ar,dh as as,qr as at,uh as au,fh as av,mh as aw,hh as ax,ph as ay,Fl as az,tp as b,yh as b0,bh as b1,xh as b2,Ah as b3,Dh as b4,Ih as b5,_h as b6,wh as b7,Ch as b8,Sh as b9,Xt as ba,Xm as bb,vo as bc,yo as bd,On as be,Ve as c,Ao as d,ah as e,$m as f,po as g,Tm as h,sh as i,Zm as j,eh as k,kn as l,Qm as m,th as n,ve as o,Fh as p,pr as q,zl as r,ep as s,Rh as t,Qf as u,zf as v,Oh as w,Kh as x,qh as y,io as z};
|