@web-mods/articles 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,125 +1,161 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("react"),fe=require("./server.cjs"),pe=require("react-router"),nt=require("react-dom"),Se=c.createContext({navigate:()=>{},params:{},locationState:null});function Ce(){return c.useContext(Se)}let ee=[];const ke=new Set;function Pe(){ke.forEach(e=>e([...ee]))}function xe(e,r){const n=Math.random().toString(36).slice(2);ee=[...ee,{id:n,type:e,content:r}],Pe(),setTimeout(()=>{ee=ee.filter(s=>s.id!==n),Pe()},3e3)}const F={success:e=>xe("success",e),error:e=>xe("error",e),warning:e=>xe("warning",e)};function st(e){return ke.add(e),()=>{ke.delete(e)}}function at(){return ee}const it={success:"bg-emerald-500",error:"bg-red-500",warning:"bg-amber-500"},ot={success:"✓",error:"✕",warning:"⚠"};function ct(){const[e,r]=c.useState(at());return c.useEffect(()=>st(r),[]),e.length===0?null:t.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>t.jsxs("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg shadow-lg text-sm text-white font-medium pointer-events-auto ${it[n.type]}`,children:[t.jsx("span",{className:"shrink-0 font-bold",children:ot[n.type]}),n.content]},n.id))})}const We=c.createContext(null);function lt({children:e,basePath:r,service:n=fe.defaultArticleService,previewBaseUrl:s,previewTailwind:o,navigate:u}){const g=t.jsxs(We.Provider,{value:{basePath:r,service:n,previewBaseUrl:s,previewTailwind:o},children:[e,t.jsx(ct,{})]});return u?t.jsx(Se.Provider,{value:{navigate:u,params:{},locationState:null},children:g}):g}function Oe(){const e=c.useContext(We);if(!e)throw new Error("useArticlesConfig must be used within ArticlesProvider");return e}function ut({children:e}){const r=pe.useNavigate(),n=pe.useParams(),s=pe.useLocation();return t.jsx(Se.Provider,{value:{navigate:(o,u)=>r(o,u),params:n,locationState:s.state},children:e})}/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),le=require("./server.cjs"),ae=require("react-router"),Ue=require("react-dom"),Le=o.createContext({navigate:()=>{},params:{},locationState:null});function Te(){return o.useContext(Le)}let ne=[];const Ce=new Set;function De(){Ce.forEach(t=>t([...ne]))}function ve(t,r){const n=Math.random().toString(36).slice(2);ne=[...ne,{id:n,type:t,content:r}],De(),setTimeout(()=>{ne=ne.filter(s=>s.id!==n),De()},3e3)}const G={success:t=>ve("success",t),error:t=>ve("error",t),warning:t=>ve("warning",t)};function ft(t){return Ce.add(t),()=>{Ce.delete(t)}}function xt(){return ne}const pt={success:"bg-emerald-500",error:"bg-red-500",warning:"bg-amber-500"},gt={success:"✓",error:"✕",warning:"⚠"};function bt(){const[t,r]=o.useState(xt());return o.useEffect(()=>ft(r),[]),t.length===0?null:e.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:t.map(n=>e.jsxs("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg shadow-lg text-sm text-white font-medium pointer-events-auto ${pt[n.type]}`,children:[e.jsx("span",{className:"shrink-0 font-bold",children:gt[n.type]}),n.content]},n.id))})}const Ge=o.createContext(null);function yt({children:t,basePath:r,service:n=le.defaultArticleService,previewBaseUrl:s,previewTailwind:i,navigate:l}){const x=e.jsxs(Ge.Provider,{value:{basePath:r,service:n,previewBaseUrl:s,previewTailwind:i},children:[t,e.jsx(bt,{})]});return l?e.jsx(Le.Provider,{value:{navigate:l,params:{},locationState:null},children:x}):x}function pe(){const t=o.useContext(Ge);if(!t)throw new Error("useArticlesConfig must be used within ArticlesProvider");return t}function vt({children:t}){const r=ae.useNavigate(),n=ae.useParams(),s=ae.useLocation(),{basePath:i}=pe(),l=i.replace(/\/+$/,""),x=ae.useMatch(`${l}/:id/edit`),p=ae.useMatch(`${l}/:id/detail`),y=x??p;return e.jsx(Le.Provider,{value:{navigate:(N,f)=>r(N,f),params:{...n,...y==null?void 0:y.params},locationState:s.state},children:t})}/**
2
2
  * @license lucide-react v1.11.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Ve=(...e)=>e.filter((r,n,s)=>!!r&&r.trim()!==""&&s.indexOf(r)===n).join(" ").trim();/**
6
+ */const Ze=(...t)=>t.filter((r,n,s)=>!!r&&r.trim()!==""&&s.indexOf(r)===n).join(" ").trim();/**
7
7
  * @license lucide-react v1.11.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const dt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
11
+ */const wt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
12
12
  * @license lucide-react v1.11.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const ht=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
16
+ */const jt=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
17
17
  * @license lucide-react v1.11.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const De=e=>{const r=ht(e);return r.charAt(0).toUpperCase()+r.slice(1)};/**
21
+ */const ze=t=>{const r=jt(t);return r.charAt(0).toUpperCase()+r.slice(1)};/**
22
22
  * @license lucide-react v1.11.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */var ge={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"};/**
26
+ */var we={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"};/**
27
27
  * @license lucide-react v1.11.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const ft=e=>{for(const r in e)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},mt=c.createContext({}),pt=()=>c.useContext(mt),xt=c.forwardRef(({color:e,size:r,strokeWidth:n,absoluteStrokeWidth:s,className:o="",children:u,iconNode:g,...k},$)=>{const{size:C=24,strokeWidth:m=2,absoluteStrokeWidth:S=!1,color:H="currentColor",className:P=""}=pt()??{},T=s??S?Number(n??m)*24/Number(r??C):n??m;return c.createElement("svg",{ref:$,...ge,width:r??C??ge.width,height:r??C??ge.height,stroke:e??H,strokeWidth:T,className:Ve("lucide",P,o),...!u&&!ft(k)&&{"aria-hidden":"true"},...k},[...g.map(([R,z])=>c.createElement(R,z)),...Array.isArray(u)?u:[u]])});/**
31
+ */const Nt=t=>{for(const r in t)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},kt=o.createContext({}),$t=()=>o.useContext(kt),St=o.forwardRef(({color:t,size:r,strokeWidth:n,absoluteStrokeWidth:s,className:i="",children:l,iconNode:x,...p},y)=>{const{size:N=24,strokeWidth:f=2,absoluteStrokeWidth:v=!1,color:O="currentColor",className:z=""}=$t()??{},A=s??v?Number(n??f)*24/Number(r??N):n??f;return o.createElement("svg",{ref:y,...we,width:r??N??we.width,height:r??N??we.height,stroke:t??O,strokeWidth:A,className:Ze("lucide",z,i),...!l&&!Nt(p)&&{"aria-hidden":"true"},...p},[...x.map(([T,I])=>o.createElement(T,I)),...Array.isArray(l)?l:[l]])});/**
32
32
  * @license lucide-react v1.11.0 - ISC
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const V=(e,r)=>{const n=c.forwardRef(({className:s,...o},u)=>c.createElement(xt,{ref:u,iconNode:r,className:Ve(`lucide-${dt(De(e))}`,`lucide-${e}`,s),...o}));return n.displayName=De(e),n};/**
36
+ */const q=(t,r)=>{const n=o.forwardRef(({className:s,...i},l)=>o.createElement(St,{ref:l,iconNode:r,className:Ze(`lucide-${wt(ze(t))}`,`lucide-${t}`,s),...i}));return n.displayName=ze(t),n};/**
37
37
  * @license lucide-react v1.11.0 - ISC
38
38
  *
39
39
  * This source code is licensed under the ISC license.
40
40
  * See the LICENSE file in the root directory of this source tree.
41
- */const gt=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Ye=V("arrow-left",gt);/**
41
+ */const Mt=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Ke=q("arrow-left",Mt);/**
42
42
  * @license lucide-react v1.11.0 - ISC
43
43
  *
44
44
  * This source code is licensed under the ISC license.
45
45
  * See the LICENSE file in the root directory of this source tree.
46
- */const yt=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],qe=V("code",yt);/**
46
+ */const Ct=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Et=q("check",Ct);/**
47
47
  * @license lucide-react v1.11.0 - ISC
48
48
  *
49
49
  * This source code is licensed under the ISC license.
50
50
  * See the LICENSE file in the root directory of this source tree.
51
- */const bt=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],vt=V("copy",bt);/**
51
+ */const Ot=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Pt=q("chevron-down",Ot);/**
52
52
  * @license lucide-react v1.11.0 - ISC
53
53
  *
54
54
  * This source code is licensed under the ISC license.
55
55
  * See the LICENSE file in the root directory of this source tree.
56
- */const wt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],jt=V("external-link",wt);/**
56
+ */const Lt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ae=q("chevron-right",Lt);/**
57
57
  * @license lucide-react v1.11.0 - ISC
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const Nt=[["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"}]],$e=V("eye",Nt);/**
61
+ */const Tt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],_t=q("circle-alert",Tt);/**
62
62
  * @license lucide-react v1.11.0 - ISC
63
63
  *
64
64
  * This source code is licensed under the ISC license.
65
65
  * See the LICENSE file in the root directory of this source tree.
66
- */const kt=[["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"}]],$t=V("file-text",kt);/**
66
+ */const Dt=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],_e=q("code",Dt);/**
67
67
  * @license lucide-react v1.11.0 - ISC
68
68
  *
69
69
  * This source code is licensed under the ISC license.
70
70
  * See the LICENSE file in the root directory of this source tree.
71
- */const Mt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],St=V("inbox",Mt);/**
71
+ */const zt=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],At=q("copy",zt);/**
72
72
  * @license lucide-react v1.11.0 - ISC
73
73
  *
74
74
  * This source code is licensed under the ISC license.
75
75
  * See the LICENSE file in the root directory of this source tree.
76
- */const Ct=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Ot=V("link",Ct);/**
76
+ */const Rt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],It=q("external-link",Rt);/**
77
77
  * @license lucide-react v1.11.0 - ISC
78
78
  *
79
79
  * This source code is licensed under the ISC license.
80
80
  * See the LICENSE file in the root directory of this source tree.
81
- */const Pt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Dt=V("loader-circle",Pt);/**
81
+ */const Ht=[["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"}]],Ee=q("eye",Ht);/**
82
82
  * @license lucide-react v1.11.0 - ISC
83
83
  *
84
84
  * This source code is licensed under the ISC license.
85
85
  * See the LICENSE file in the root directory of this source tree.
86
- */const Et=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Ue=V("monitor",Et);/**
86
+ */const Wt=[["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"}]],Vt=q("file-text",Wt);/**
87
87
  * @license lucide-react v1.11.0 - ISC
88
88
  *
89
89
  * This source code is licensed under the ISC license.
90
90
  * See the LICENSE file in the root directory of this source tree.
91
- */const Lt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],At=V("pencil",Lt);/**
91
+ */const qt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],Yt=q("inbox",qt);/**
92
92
  * @license lucide-react v1.11.0 - ISC
93
93
  *
94
94
  * This source code is licensed under the ISC license.
95
95
  * See the LICENSE file in the root directory of this source tree.
96
- */const Tt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],_t=V("plus",Tt);/**
96
+ */const Ft=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]],Je=q("layout-panel-top",Ft);/**
97
97
  * @license lucide-react v1.11.0 - ISC
98
98
  *
99
99
  * This source code is licensed under the ISC license.
100
100
  * See the LICENSE file in the root directory of this source tree.
101
- */const zt=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Rt=V("rotate-ccw",zt);/**
101
+ */const Bt=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Ut=q("link",Bt);/**
102
102
  * @license lucide-react v1.11.0 - ISC
103
103
  *
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
- */const Ht=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ye=V("search",Ht);/**
106
+ */const Gt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Qe=q("loader-circle",Gt);/**
107
107
  * @license lucide-react v1.11.0 - ISC
108
108
  *
109
109
  * This source code is licensed under the ISC license.
110
110
  * See the LICENSE file in the root directory of this source tree.
111
- */const It=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ee=V("shield-check",It);/**
111
+ */const Zt=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Xe=q("monitor",Zt);/**
112
112
  * @license lucide-react v1.11.0 - ISC
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
- */const Wt=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Fe=V("smartphone",Wt);/**
116
+ */const Kt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]],et=q("panel-bottom",Kt);/**
117
117
  * @license lucide-react v1.11.0 - ISC
118
118
  *
119
119
  * This source code is licensed under the ISC license.
120
120
  * See the LICENSE file in the root directory of this source tree.
121
- */const Vt=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]],Be=V("tablet",Vt);function Yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ue={exports:{}},qt=ue.exports,Le;function Ut(){return Le||(Le=1,(function(e,r){(function(n,s){e.exports=s()})(qt,(function(){var n=1e3,s=6e4,o=36e5,u="millisecond",g="second",k="minute",$="hour",C="day",m="week",S="month",H="quarter",P="year",T="date",R="Invalid Date",z=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,q=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(b){var a=["th","st","nd","rd"],i=b%100;return"["+b+(a[(i-20)%10]||a[i]||a[0])+"]"}},p=function(b,a,i){var d=String(b);return!d||d.length>=a?b:""+Array(a+1-d.length).join(i)+b},A={s:p,z:function(b){var a=-b.utcOffset(),i=Math.abs(a),d=Math.floor(i/60),l=i%60;return(a<=0?"+":"-")+p(d,2,"0")+":"+p(l,2,"0")},m:function b(a,i){if(a.date()<i.date())return-b(i,a);var d=12*(i.year()-a.year())+(i.month()-a.month()),l=a.clone().add(d,S),v=i-l<0,N=a.clone().add(d+(v?-1:1),S);return+(-(d+(i-l)/(v?l-N:N-l))||0)},a:function(b){return b<0?Math.ceil(b)||0:Math.floor(b)},p:function(b){return{M:S,y:P,w:m,d:C,D:T,h:$,m:k,s:g,ms:u,Q:H}[b]||String(b||"").toLowerCase().replace(/s$/,"")},u:function(b){return b===void 0}},O="en",y={};y[O]=_;var w="$isDayjsObject",I=function(b){return b instanceof Y||!(!b||!b[w])},E=function b(a,i,d){var l;if(!a)return O;if(typeof a=="string"){var v=a.toLowerCase();y[v]&&(l=v),i&&(y[v]=i,l=v);var N=a.split("-");if(!l&&N.length>1)return b(N[0])}else{var f=a.name;y[f]=a,l=f}return!d&&l&&(O=l),l||!d&&O},x=function(b,a){if(I(b))return b.clone();var i=typeof a=="object"?a:{};return i.date=b,i.args=arguments,new Y(i)},M=A;M.l=E,M.i=I,M.w=function(b,a){return x(b,{locale:a.$L,utc:a.$u,x:a.$x,$offset:a.$offset})};var Y=(function(){function b(i){this.$L=E(i.locale,null,!0),this.parse(i),this.$x=this.$x||i.x||{},this[w]=!0}var a=b.prototype;return a.parse=function(i){this.$d=(function(d){var l=d.date,v=d.utc;if(l===null)return new Date(NaN);if(M.u(l))return new Date;if(l instanceof Date)return new Date(l);if(typeof l=="string"&&!/Z$/i.test(l)){var N=l.match(z);if(N){var f=N[2]-1||0,j=(N[7]||"0").substring(0,3);return v?new Date(Date.UTC(N[1],f,N[3]||1,N[4]||0,N[5]||0,N[6]||0,j)):new Date(N[1],f,N[3]||1,N[4]||0,N[5]||0,N[6]||0,j)}}return new Date(l)})(i),this.init()},a.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},a.$utils=function(){return M},a.isValid=function(){return this.$d.toString()!==R},a.isSame=function(i,d){var l=x(i);return this.startOf(d)<=l&&l<=this.endOf(d)},a.isAfter=function(i,d){return x(i)<this.startOf(d)},a.isBefore=function(i,d){return this.endOf(d)<x(i)},a.$g=function(i,d,l){return M.u(i)?this[d]:this.set(l,i)},a.unix=function(){return Math.floor(this.valueOf()/1e3)},a.valueOf=function(){return this.$d.getTime()},a.startOf=function(i,d){var l=this,v=!!M.u(d)||d,N=M.p(i),f=function(G,W){var Q=M.w(l.$u?Date.UTC(l.$y,W,G):new Date(l.$y,W,G),l);return v?Q:Q.endOf(C)},j=function(G,W){return M.w(l.toDate()[G].apply(l.toDate("s"),(v?[0,0,0,0]:[23,59,59,999]).slice(W)),l)},D=this.$W,h=this.$M,L=this.$D,J="set"+(this.$u?"UTC":"");switch(N){case P:return v?f(1,0):f(31,11);case S:return v?f(1,h):f(0,h+1);case m:var U=this.$locale().weekStart||0,K=(D<U?D+7:D)-U;return f(v?L-K:L+(6-K),h);case C:case T:return j(J+"Hours",0);case $:return j(J+"Minutes",1);case k:return j(J+"Seconds",2);case g:return j(J+"Milliseconds",3);default:return this.clone()}},a.endOf=function(i){return this.startOf(i,!1)},a.$set=function(i,d){var l,v=M.p(i),N="set"+(this.$u?"UTC":""),f=(l={},l[C]=N+"Date",l[T]=N+"Date",l[S]=N+"Month",l[P]=N+"FullYear",l[$]=N+"Hours",l[k]=N+"Minutes",l[g]=N+"Seconds",l[u]=N+"Milliseconds",l)[v],j=v===C?this.$D+(d-this.$W):d;if(v===S||v===P){var D=this.clone().set(T,1);D.$d[f](j),D.init(),this.$d=D.set(T,Math.min(this.$D,D.daysInMonth())).$d}else f&&this.$d[f](j);return this.init(),this},a.set=function(i,d){return this.clone().$set(i,d)},a.get=function(i){return this[M.p(i)]()},a.add=function(i,d){var l,v=this;i=Number(i);var N=M.p(d),f=function(h){var L=x(v);return M.w(L.date(L.date()+Math.round(h*i)),v)};if(N===S)return this.set(S,this.$M+i);if(N===P)return this.set(P,this.$y+i);if(N===C)return f(1);if(N===m)return f(7);var j=(l={},l[k]=s,l[$]=o,l[g]=n,l)[N]||1,D=this.$d.getTime()+i*j;return M.w(D,this)},a.subtract=function(i,d){return this.add(-1*i,d)},a.format=function(i){var d=this,l=this.$locale();if(!this.isValid())return l.invalidDate||R;var v=i||"YYYY-MM-DDTHH:mm:ssZ",N=M.z(this),f=this.$H,j=this.$m,D=this.$M,h=l.weekdays,L=l.months,J=l.meridiem,U=function(W,Q,re,oe){return W&&(W[Q]||W(d,v))||re[Q].slice(0,oe)},K=function(W){return M.s(f%12||12,W,"0")},G=J||function(W,Q,re){var oe=W<12?"AM":"PM";return re?oe.toLowerCase():oe};return v.replace(q,(function(W,Q){return Q||(function(re){switch(re){case"YY":return String(d.$y).slice(-2);case"YYYY":return M.s(d.$y,4,"0");case"M":return D+1;case"MM":return M.s(D+1,2,"0");case"MMM":return U(l.monthsShort,D,L,3);case"MMMM":return U(L,D);case"D":return d.$D;case"DD":return M.s(d.$D,2,"0");case"d":return String(d.$W);case"dd":return U(l.weekdaysMin,d.$W,h,2);case"ddd":return U(l.weekdaysShort,d.$W,h,3);case"dddd":return h[d.$W];case"H":return String(f);case"HH":return M.s(f,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return G(f,j,!0);case"A":return G(f,j,!1);case"m":return String(j);case"mm":return M.s(j,2,"0");case"s":return String(d.$s);case"ss":return M.s(d.$s,2,"0");case"SSS":return M.s(d.$ms,3,"0");case"Z":return N}return null})(W)||N.replace(":","")}))},a.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},a.diff=function(i,d,l){var v,N=this,f=M.p(d),j=x(i),D=(j.utcOffset()-this.utcOffset())*s,h=this-j,L=function(){return M.m(N,j)};switch(f){case P:v=L()/12;break;case S:v=L();break;case H:v=L()/3;break;case m:v=(h-D)/6048e5;break;case C:v=(h-D)/864e5;break;case $:v=h/o;break;case k:v=h/s;break;case g:v=h/n;break;default:v=h}return l?v:M.a(v)},a.daysInMonth=function(){return this.endOf(S).$D},a.$locale=function(){return y[this.$L]},a.locale=function(i,d){if(!i)return this.$L;var l=this.clone(),v=E(i,d,!0);return v&&(l.$L=v),l},a.clone=function(){return M.w(this.$d,this)},a.toDate=function(){return new Date(this.valueOf())},a.toJSON=function(){return this.isValid()?this.toISOString():null},a.toISOString=function(){return this.$d.toISOString()},a.toString=function(){return this.$d.toUTCString()},b})(),Z=Y.prototype;return x.prototype=Z,[["$ms",u],["$s",g],["$m",k],["$H",$],["$W",C],["$M",S],["$y",P],["$D",T]].forEach((function(b){Z[b[1]]=function(a){return this.$g(a,b[0],b[1])}})),x.extend=function(b,a){return b.$i||(b(a,Y,x),b.$i=!0),x},x.locale=E,x.isDayjs=I,x.unix=function(b){return x(1e3*b)},x.en=y[O],x.Ls=y,x.p={},x}))})(ue)),ue.exports}var Ft=Ut();const Me=Yt(Ft);function Ze(){const[e,r]=c.useState(!1),[n,s]=c.useState(!1),o=c.useRef({title:""}),u={confirm:S=>{o.current=S,s(!1),r(!0)}},g=async()=>{var S,H;s(!0);try{await((H=(S=o.current).onOk)==null?void 0:H.call(S)),r(!1)}finally{s(!1)}},k=()=>{var S,H;(H=(S=o.current).onCancel)==null||H.call(S),r(!1)},$=o.current,C=$.okType==="danger",m=e?nt.createPortal(t.jsxs("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center",children:[t.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:k}),t.jsxs("div",{className:"relative bg-white rounded-2xl shadow-xl w-full max-w-md mx-4 p-6",children:[t.jsx("div",{className:"text-base font-semibold text-gray-800 mb-2",children:$.title}),$.content&&t.jsx("div",{className:"text-sm text-gray-600 mt-3",children:$.content}),t.jsxs("div",{className:"flex justify-end gap-2 mt-5",children:[t.jsx("button",{className:"px-4 py-1.5 rounded-lg border border-gray-200 text-sm text-gray-600 hover:bg-gray-50 transition-colors cursor-pointer",onClick:k,children:$.cancelText??"取消"}),t.jsx("button",{disabled:n,className:`px-4 py-1.5 rounded-lg text-white text-sm font-medium transition-colors disabled:opacity-50 cursor-pointer ${C?"bg-red-500 hover:bg-red-600":"bg-blue-500 hover:bg-blue-600"}`,onClick:g,children:n?"处理中…":$.okText??"确定"})]})]})]}),document.body):null;return[u,m]}const Bt=()=>{const{navigate:e}=Ce(),{basePath:r,service:n}=Oe(),[s,o]=Ze(),[u,g]=c.useState(""),[k,$]=c.useState(""),[C,m]=c.useState(!1),[S,H]=c.useState([]),[P,T]=c.useState({current:1,size:15,total:0}),R=p=>{const A=p.trim();if(!A)return"";try{return new URL(A.startsWith("http")?A:`https://${A}`).origin}catch{return A}},z=async(p=P.current,A=P.size,O=u,y=k)=>{m(!0);try{const w={page:p,size:A};O&&(w.pathname=O);const I=R(y);I&&(w.host=I);const E=await n.getList(w);H(E.items),T(x=>({...x,current:p,size:A,total:E.total??x.total}))}catch(w){F.error(w.message||"获取数据失败")}finally{m(!1)}};c.useEffect(()=>{z(1)},[]);const q=p=>{s.confirm({title:"确认删除",content:`确认删除 /${p.pathname}?`,okText:"删除",okType:"danger",cancelText:"取消",onOk:async()=>{await n.delete(p.id),F.success("删除成功"),z(1)}})},_=Math.ceil(P.total/P.size)||1;return t.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-5",children:[o,t.jsxs("form",{className:"flex items-center gap-2 mb-5",onSubmit:p=>{p.preventDefault(),z(1)},children:[t.jsxs("div",{className:"relative w-52",children:[t.jsx(ye,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400"}),t.jsx("input",{className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition",placeholder:"搜索 Pathname",value:u,onChange:p=>g(p.target.value)})]}),t.jsxs("div",{className:"relative w-52",children:[t.jsx(ye,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400"}),t.jsx("input",{className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition",placeholder:"搜索 Website URL",value:k,onChange:p=>$(p.target.value)})]}),t.jsxs("button",{type:"submit",className:"flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition cursor-pointer",children:[t.jsx(ye,{className:"w-3.5 h-3.5"}),"搜索"]}),t.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-3 py-1.5 border border-gray-200 hover:bg-gray-50 text-gray-600 text-sm rounded-lg transition cursor-pointer",onClick:()=>{g(""),$(""),z(1,P.size,"","")},children:[t.jsx(Rt,{className:"w-3.5 h-3.5"}),"重置"]}),t.jsx("div",{className:"flex-1"}),t.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition cursor-pointer",onClick:()=>e(`${r}/create`),children:[t.jsx(_t,{className:"w-3.5 h-3.5"}),"新增"]})]}),t.jsx("div",{className:"relative",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-gray-100",children:[t.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-44",children:"Pathname"}),t.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-44",children:"Website URL"}),t.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide",children:"HTML 摘要"}),t.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-44",children:"创建时间"}),t.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-56",children:"操作"})]})}),t.jsx("tbody",{children:C?t.jsx("tr",{children:t.jsx("td",{colSpan:5,className:"py-16 text-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-gray-400",children:[t.jsx(Dt,{className:"w-6 h-6 text-blue-400 animate-spin"}),t.jsx("span",{className:"text-sm",children:"加载中…"})]})})}):S.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:5,className:"py-16 text-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-gray-300",children:[t.jsx(St,{className:"w-10 h-10"}),t.jsx("span",{className:"text-sm",children:"暂无数据"})]})})}):S.map(p=>{const A=(p.content||"").replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80);return t.jsxs("tr",{className:"border-b border-gray-50 hover:bg-gray-50/60 transition-colors",children:[t.jsx("td",{className:"py-3 px-3",children:t.jsxs("span",{className:"font-mono text-xs text-gray-700",children:["/",p.pathname]})}),t.jsx("td",{className:"py-3 px-3",children:p.host?t.jsxs("a",{href:p.host,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 max-w-[160px] text-xs text-blue-600 underline underline-offset-2 hover:text-blue-800 transition-colors",title:p.host,children:[t.jsx("span",{className:"truncate",children:p.host.replace(/^https?:\/\//,"")}),t.jsx(jt,{className:"w-3 h-3 shrink-0"})]}):t.jsx("span",{className:"text-xs text-gray-300",children:"—"})}),t.jsx("td",{className:"py-3 px-3",children:A?t.jsx("span",{className:"text-sm text-gray-500 truncate block max-w-sm",title:A,children:A}):t.jsx("span",{className:"text-xs text-gray-300",children:"暂无内容"})}),t.jsx("td",{className:"py-3 px-3 text-xs text-gray-400",children:p.createdAt?Me(p.createdAt).format("YYYY/MM/DD HH:mm"):"—"}),t.jsx("td",{className:"py-3 px-3",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[p.host&&t.jsx("button",{className:"px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 text-gray-600 transition cursor-pointer",onClick:()=>window.open(`${p.host.replace(/\/$/,"")}/${p.pathname}`,"_blank"),children:"跳转"}),t.jsx("button",{className:"px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 text-gray-600 transition cursor-pointer",onClick:()=>e(`${r}/${p.id}/detail`,{state:{record:p}}),children:"详情"}),t.jsx("button",{className:"px-2.5 py-1 text-xs bg-blue-500 hover:bg-blue-600 text-white rounded-md transition cursor-pointer",onClick:()=>e(`${r}/${p.id}/edit`,{state:{record:p}}),children:"编辑"}),t.jsx("button",{className:"px-2.5 py-1 text-xs bg-red-500 hover:bg-red-600 text-white rounded-md transition cursor-pointer",onClick:()=>q(p),children:"删除"})]})})]},p.id)})})]})}),P.total>0&&t.jsxs("div",{className:"flex items-center justify-between pt-4 mt-2 border-t border-gray-100",children:[t.jsxs("span",{className:"text-xs text-gray-400",children:["共 ",P.total," 条"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{className:"px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed text-gray-600 transition cursor-pointer",disabled:P.current<=1,onClick:()=>z(P.current-1),children:"上一页"}),t.jsxs("span",{className:"px-3 py-1 text-xs text-gray-500",children:[P.current," / ",_]}),t.jsx("button",{className:"px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed text-gray-600 transition cursor-pointer",disabled:P.current>=_,onClick:()=>z(P.current+1),children:"下一页"}),t.jsx("select",{className:"ml-2 text-xs border border-gray-200 rounded-md px-1.5 py-1 text-gray-600 focus:outline-none focus:ring-1 focus:ring-blue-400 cursor-pointer",value:P.size,onChange:p=>z(1,Number(p.target.value)),children:[10,15,20,50].map(p=>t.jsxs("option",{value:p,children:[p," 条/页"]},p))})]})]})]})};async function Ae(e){const r=new AbortController,n=setTimeout(()=>r.abort(),1e4);try{const s=await fetch("https://validator.w3.org/nu/?out=json",{method:"POST",headers:{"Content-Type":"text/html; charset=utf-8","User-Agent":"AiSee-Manage/1.0"},body:e,signal:r.signal});if(!s.ok)throw new Error(`W3C validator responded with ${s.status}`);const g=((await s.json()).messages||[]).filter(k=>k.type==="error");return{isValid:g.length===0,errors:g}}catch(s){return console.error("W3C 校验请求失败:",s),{isValid:!0,errors:[],networkError:!0}}finally{clearTimeout(n)}}function Te(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,s=Array(r);n<r;n++)s[n]=e[n];return s}function Zt(e){if(Array.isArray(e))return e}function Jt(e,r,n){return(r=rr(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Kt(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,o,u,g,k=[],$=!0,C=!1;try{if(u=(n=n.call(e)).next,r!==0)for(;!($=(s=u.call(n)).done)&&(k.push(s.value),k.length!==r);$=!0);}catch(m){C=!0,o=m}finally{try{if(!$&&n.return!=null&&(g=n.return(),Object(g)!==g))return}finally{if(C)throw o}}return k}}function Gt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
122
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _e(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,s)}return n}function ze(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?_e(Object(n),!0).forEach(function(s){Jt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Qt(e,r){if(e==null)return{};var n,s,o=Xt(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s<u.length;s++)n=u[s],r.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Xt(e,r){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(r.indexOf(s)!==-1)continue;n[s]=e[s]}return n}function er(e,r){return Zt(e)||Kt(e,r)||nr(e,r)||Gt()}function tr(e,r){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,r);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function rr(e){var r=tr(e,"string");return typeof r=="symbol"?r:r+""}function nr(e,r){if(e){if(typeof e=="string")return Te(e,r);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Te(e,r):void 0}}function sr(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Re(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,s)}return n}function He(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Re(Object(n),!0).forEach(function(s){sr(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function ar(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return function(s){return r.reduceRight(function(o,u){return u(o)},s)}}function ne(e){return function r(){for(var n=this,s=arguments.length,o=new Array(s),u=0;u<s;u++)o[u]=arguments[u];return o.length>=e.length?e.apply(this,o):function(){for(var g=arguments.length,k=new Array(g),$=0;$<g;$++)k[$]=arguments[$];return r.apply(n,[].concat(o,k))}}}function de(e){return{}.toString.call(e).includes("Object")}function ir(e){return!Object.keys(e).length}function ae(e){return typeof e=="function"}function or(e,r){return Object.prototype.hasOwnProperty.call(e,r)}function cr(e,r){return de(r)||X("changeType"),Object.keys(r).some(function(n){return!or(e,n)})&&X("changeField"),r}function lr(e){ae(e)||X("selectorType")}function ur(e){ae(e)||de(e)||X("handlerType"),de(e)&&Object.values(e).some(function(r){return!ae(r)})&&X("handlersType")}function dr(e){e||X("initialIsRequired"),de(e)||X("initialType"),ir(e)&&X("initialContent")}function hr(e,r){throw new Error(e[r]||e.default)}var fr={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},X=ne(hr)(fr),ce={changes:cr,selector:lr,handler:ur,initial:dr};function mr(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ce.initial(e),ce.handler(r);var n={current:e},s=ne(gr)(n,r),o=ne(xr)(n),u=ne(ce.changes)(e),g=ne(pr)(n);function k(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(m){return m};return ce.selector(C),C(n.current)}function $(C){ar(s,o,u,g)(C)}return[k,$]}function pr(e,r){return ae(r)?r(e.current):r}function xr(e,r){return e.current=He(He({},e.current),r),r}function gr(e,r,n){return ae(r)?r(e.current):Object.keys(n).forEach(function(s){var o;return(o=r[s])===null||o===void 0?void 0:o.call(r,e.current[s])}),n}var yr={create:mr},br={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function vr(e){return function r(){for(var n=this,s=arguments.length,o=new Array(s),u=0;u<s;u++)o[u]=arguments[u];return o.length>=e.length?e.apply(this,o):function(){for(var g=arguments.length,k=new Array(g),$=0;$<g;$++)k[$]=arguments[$];return r.apply(n,[].concat(o,k))}}}function wr(e){return{}.toString.call(e).includes("Object")}function jr(e){return e||Ie("configIsRequired"),wr(e)||Ie("configType"),e.urls?(Nr(),{paths:{vs:e.urls.monacoBase}}):e}function Nr(){console.warn(Je.deprecation)}function kr(e,r){throw new Error(e[r]||e.default)}var Je={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
121
+ */const Jt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Qt=q("pencil",Jt);/**
122
+ * @license lucide-react v1.11.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const Xt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],tt=q("plus",Xt);/**
127
+ * @license lucide-react v1.11.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const er=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],tr=q("rotate-ccw",er);/**
132
+ * @license lucide-react v1.11.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const rr=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],je=q("search",rr);/**
137
+ * @license lucide-react v1.11.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const nr=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Re=q("shield-check",nr);/**
142
+ * @license lucide-react v1.11.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const sr=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],rt=q("smartphone",sr);/**
147
+ * @license lucide-react v1.11.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const ar=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]],nt=q("tablet",ar);/**
152
+ * @license lucide-react v1.11.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const ir=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],or=q("x",ir);function cr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var me={exports:{}},lr=me.exports,Ie;function dr(){return Ie||(Ie=1,(function(t,r){(function(n,s){t.exports=s()})(lr,(function(){var n=1e3,s=6e4,i=36e5,l="millisecond",x="second",p="minute",y="hour",N="day",f="week",v="month",O="quarter",z="year",A="date",T="Invalid Date",I=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,_=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,H={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(d){var a=["th","st","nd","rd"],c=d%100;return"["+d+(a[(c-20)%10]||a[c]||a[0])+"]"}},W=function(d,a,c){var m=String(d);return!m||m.length>=a?d:""+Array(a+1-m.length).join(c)+d},C={s:W,z:function(d){var a=-d.utcOffset(),c=Math.abs(a),m=Math.floor(c/60),u=c%60;return(a<=0?"+":"-")+W(m,2,"0")+":"+W(u,2,"0")},m:function d(a,c){if(a.date()<c.date())return-d(c,a);var m=12*(c.year()-a.year())+(c.month()-a.month()),u=a.clone().add(m,v),S=c-u<0,E=a.clone().add(m+(S?-1:1),v);return+(-(m+(c-u)/(S?u-E:E-u))||0)},a:function(d){return d<0?Math.ceil(d)||0:Math.floor(d)},p:function(d){return{M:v,y:z,w:f,d:N,D:A,h:y,m:p,s:x,ms:l,Q:O}[d]||String(d||"").toLowerCase().replace(/s$/,"")},u:function(d){return d===void 0}},P="en",b={};b[P]=H;var h="$isDayjsObject",D=function(d){return d instanceof L||!(!d||!d[h])},$=function d(a,c,m){var u;if(!a)return P;if(typeof a=="string"){var S=a.toLowerCase();b[S]&&(u=S),c&&(b[S]=c,u=S);var E=a.split("-");if(!u&&E.length>1)return d(E[0])}else{var j=a.name;b[j]=a,u=j}return!m&&u&&(P=u),u||!m&&P},g=function(d,a){if(D(d))return d.clone();var c=typeof a=="object"?a:{};return c.date=d,c.args=arguments,new L(c)},w=C;w.l=$,w.i=D,w.w=function(d,a){return g(d,{locale:a.$L,utc:a.$u,x:a.$x,$offset:a.$offset})};var L=(function(){function d(c){this.$L=$(c.locale,null,!0),this.parse(c),this.$x=this.$x||c.x||{},this[h]=!0}var a=d.prototype;return a.parse=function(c){this.$d=(function(m){var u=m.date,S=m.utc;if(u===null)return new Date(NaN);if(w.u(u))return new Date;if(u instanceof Date)return new Date(u);if(typeof u=="string"&&!/Z$/i.test(u)){var E=u.match(I);if(E){var j=E[2]-1||0,M=(E[7]||"0").substring(0,3);return S?new Date(Date.UTC(E[1],j,E[3]||1,E[4]||0,E[5]||0,E[6]||0,M)):new Date(E[1],j,E[3]||1,E[4]||0,E[5]||0,E[6]||0,M)}}return new Date(u)})(c),this.init()},a.init=function(){var c=this.$d;this.$y=c.getFullYear(),this.$M=c.getMonth(),this.$D=c.getDate(),this.$W=c.getDay(),this.$H=c.getHours(),this.$m=c.getMinutes(),this.$s=c.getSeconds(),this.$ms=c.getMilliseconds()},a.$utils=function(){return w},a.isValid=function(){return this.$d.toString()!==T},a.isSame=function(c,m){var u=g(c);return this.startOf(m)<=u&&u<=this.endOf(m)},a.isAfter=function(c,m){return g(c)<this.startOf(m)},a.isBefore=function(c,m){return this.endOf(m)<g(c)},a.$g=function(c,m,u){return w.u(c)?this[m]:this.set(u,c)},a.unix=function(){return Math.floor(this.valueOf()/1e3)},a.valueOf=function(){return this.$d.getTime()},a.startOf=function(c,m){var u=this,S=!!w.u(m)||m,E=w.p(c),j=function(X,k){var U=w.w(u.$u?Date.UTC(u.$y,k,X):new Date(u.$y,k,X),u);return S?U:U.endOf(N)},M=function(X,k){return w.w(u.toDate()[X].apply(u.toDate("s"),(S?[0,0,0,0]:[23,59,59,999]).slice(k)),u)},R=this.$W,V=this.$M,B=this.$D,J="set"+(this.$u?"UTC":"");switch(E){case z:return S?j(1,0):j(31,11);case v:return S?j(1,V):j(0,V+1);case f:var Q=this.$locale().weekStart||0,te=(R<Q?R+7:R)-Q;return j(S?B-te:B+(6-te),V);case N:case A:return M(J+"Hours",0);case y:return M(J+"Minutes",1);case p:return M(J+"Seconds",2);case x:return M(J+"Milliseconds",3);default:return this.clone()}},a.endOf=function(c){return this.startOf(c,!1)},a.$set=function(c,m){var u,S=w.p(c),E="set"+(this.$u?"UTC":""),j=(u={},u[N]=E+"Date",u[A]=E+"Date",u[v]=E+"Month",u[z]=E+"FullYear",u[y]=E+"Hours",u[p]=E+"Minutes",u[x]=E+"Seconds",u[l]=E+"Milliseconds",u)[S],M=S===N?this.$D+(m-this.$W):m;if(S===v||S===z){var R=this.clone().set(A,1);R.$d[j](M),R.init(),this.$d=R.set(A,Math.min(this.$D,R.daysInMonth())).$d}else j&&this.$d[j](M);return this.init(),this},a.set=function(c,m){return this.clone().$set(c,m)},a.get=function(c){return this[w.p(c)]()},a.add=function(c,m){var u,S=this;c=Number(c);var E=w.p(m),j=function(V){var B=g(S);return w.w(B.date(B.date()+Math.round(V*c)),S)};if(E===v)return this.set(v,this.$M+c);if(E===z)return this.set(z,this.$y+c);if(E===N)return j(1);if(E===f)return j(7);var M=(u={},u[p]=s,u[y]=i,u[x]=n,u)[E]||1,R=this.$d.getTime()+c*M;return w.w(R,this)},a.subtract=function(c,m){return this.add(-1*c,m)},a.format=function(c){var m=this,u=this.$locale();if(!this.isValid())return u.invalidDate||T;var S=c||"YYYY-MM-DDTHH:mm:ssZ",E=w.z(this),j=this.$H,M=this.$m,R=this.$M,V=u.weekdays,B=u.months,J=u.meridiem,Q=function(k,U,F,Z){return k&&(k[U]||k(m,S))||F[U].slice(0,Z)},te=function(k){return w.s(j%12||12,k,"0")},X=J||function(k,U,F){var Z=k<12?"AM":"PM";return F?Z.toLowerCase():Z};return S.replace(_,(function(k,U){return U||(function(F){switch(F){case"YY":return String(m.$y).slice(-2);case"YYYY":return w.s(m.$y,4,"0");case"M":return R+1;case"MM":return w.s(R+1,2,"0");case"MMM":return Q(u.monthsShort,R,B,3);case"MMMM":return Q(B,R);case"D":return m.$D;case"DD":return w.s(m.$D,2,"0");case"d":return String(m.$W);case"dd":return Q(u.weekdaysMin,m.$W,V,2);case"ddd":return Q(u.weekdaysShort,m.$W,V,3);case"dddd":return V[m.$W];case"H":return String(j);case"HH":return w.s(j,2,"0");case"h":return te(1);case"hh":return te(2);case"a":return X(j,M,!0);case"A":return X(j,M,!1);case"m":return String(M);case"mm":return w.s(M,2,"0");case"s":return String(m.$s);case"ss":return w.s(m.$s,2,"0");case"SSS":return w.s(m.$ms,3,"0");case"Z":return E}return null})(k)||E.replace(":","")}))},a.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},a.diff=function(c,m,u){var S,E=this,j=w.p(m),M=g(c),R=(M.utcOffset()-this.utcOffset())*s,V=this-M,B=function(){return w.m(E,M)};switch(j){case z:S=B()/12;break;case v:S=B();break;case O:S=B()/3;break;case f:S=(V-R)/6048e5;break;case N:S=(V-R)/864e5;break;case y:S=V/i;break;case p:S=V/s;break;case x:S=V/n;break;default:S=V}return u?S:w.a(S)},a.daysInMonth=function(){return this.endOf(v).$D},a.$locale=function(){return b[this.$L]},a.locale=function(c,m){if(!c)return this.$L;var u=this.clone(),S=$(c,m,!0);return S&&(u.$L=S),u},a.clone=function(){return w.w(this.$d,this)},a.toDate=function(){return new Date(this.valueOf())},a.toJSON=function(){return this.isValid()?this.toISOString():null},a.toISOString=function(){return this.$d.toISOString()},a.toString=function(){return this.$d.toUTCString()},d})(),Y=L.prototype;return g.prototype=Y,[["$ms",l],["$s",x],["$m",p],["$H",y],["$W",N],["$M",v],["$y",z],["$D",A]].forEach((function(d){Y[d[1]]=function(a){return this.$g(a,d[0],d[1])}})),g.extend=function(d,a){return d.$i||(d(a,L,g),d.$i=!0),g},g.locale=$,g.isDayjs=D,g.unix=function(d){return g(1e3*d)},g.en=b[P],g.Ls=b,g.p={},g}))})(me)),me.exports}var ur=dr();const Oe=cr(ur);function st(){const[t,r]=o.useState(!1),[n,s]=o.useState(!1),i=o.useRef({title:""}),l={confirm:v=>{i.current=v,s(!1),r(!0)}},x=async()=>{var v,O;s(!0);try{await((O=(v=i.current).onOk)==null?void 0:O.call(v)),r(!1)}finally{s(!1)}},p=()=>{var v,O;(O=(v=i.current).onCancel)==null||O.call(v),r(!1)},y=i.current,N=y.okType==="danger",f=t?Ue.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9998] flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:p}),e.jsxs("div",{className:"relative bg-white rounded-2xl shadow-xl w-full max-w-md mx-4 p-6",children:[e.jsx("div",{className:"text-base font-semibold text-gray-800 mb-2",children:y.title}),y.content&&e.jsx("div",{className:"text-sm text-gray-600 mt-3",children:y.content}),e.jsxs("div",{className:"flex justify-end gap-2 mt-5",children:[e.jsx("button",{className:"px-4 py-1.5 rounded-lg border border-gray-200 text-sm text-gray-600 hover:bg-gray-50 transition-colors cursor-pointer",onClick:p,children:y.cancelText??"取消"}),e.jsx("button",{disabled:n,className:`px-4 py-1.5 rounded-lg text-white text-sm font-medium transition-colors disabled:opacity-50 cursor-pointer ${N?"bg-red-500 hover:bg-red-600":"bg-blue-500 hover:bg-blue-600"}`,onClick:x,children:n?"处理中…":y.okText??"确定"})]})]})]}),document.body):null;return[l,f]}const at=(t,r)=>JSON.stringify([t.trim().replace(/\/+$/,""),r]);function hr({article:t,groups:r,canLoadGroups:n,onRetry:s}){var x;const i=t.navPlacements??[],l=(x=t.navname)==null?void 0:x.trim();return!t.navEnabled&&!l&&!i.length?e.jsx("span",{className:"text-xs text-gray-400",children:"未加入网站导航"}):e.jsxs("div",{className:"min-w-0 space-y-2.5 py-0.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 break-words text-sm font-semibold text-gray-800",children:l||"未命名导航"}),e.jsxs("span",{className:`inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${t.navEnabled?"bg-emerald-50 text-emerald-700":"bg-gray-100 text-gray-500"}`,title:t.navEnabled?"已在以下位置展示":"导航已关闭,保留以下位置配置",children:[e.jsx("span",{"aria-hidden":"true",className:`h-1.5 w-1.5 rounded-full ${t.navEnabled?"bg-emerald-500":"bg-gray-400"}`}),t.navEnabled?"展示中":"已关闭"]})]}),e.jsxs("div",{className:`space-y-1.5 ${t.navEnabled?"":"opacity-60"}`,children:[["header","footer"].map(p=>{const y=i.find(_=>_.position===p);if(!y)return null;const N=p==="header",f=N?Je:et,v=N?"页眉":"页尾",O=r[at(t.host??"",p)],z=y.parentNavId?O==null?void 0:O.names[y.parentNavId]:void 0,A=n&&t.host&&(!O||O.status==="loading"),T=z||(A?"加载中…":(O==null?void 0:O.status)==="error"?"加载失败":"父导航名称不可用"),I=[v,...y.parentNavId?[T]:[],l||"未命名导航"].join(" → ");return e.jsxs("div",{className:"flex min-w-0 items-start gap-2","aria-label":I,title:I,children:[e.jsxs("span",{className:`inline-flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium leading-none ${N?"bg-blue-50 text-blue-600":"bg-violet-50 text-violet-600"}`,children:[e.jsx(f,{size:12,"aria-hidden":"true"}),v]}),e.jsx(Ae,{size:12,className:"mt-0.5 shrink-0 text-gray-300","aria-hidden":"true"}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-1 pt-0.5 text-xs leading-4",children:[y.parentNavId&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`break-all ${z?"text-gray-600":"text-gray-400"}`,children:T}),(O==null?void 0:O.status)==="error"&&e.jsx("button",{type:"button",onClick:s,className:"cursor-pointer text-blue-500 hover:text-blue-600",children:"重试"}),e.jsx(Ae,{size:12,className:"shrink-0 text-gray-300","aria-hidden":"true"})]}),e.jsx("span",{className:"break-all text-gray-700",children:l||"未命名导航"})]})]},p)}),!i.length&&e.jsx("p",{className:"text-xs text-gray-400",children:"尚未设置展示位置"})]})]})}const mr=()=>{const{navigate:t}=Te(),{basePath:r,service:n}=pe(),[s,i]=st(),[l,x]=o.useState(""),[p,y]=o.useState(""),[N,f]=o.useState(!1),[v,O]=o.useState([]),[z,A]=o.useState({}),[T,I]=o.useState(0),[_,H]=o.useState({current:1,size:15,total:0}),W=h=>{const D=h.trim();if(!D)return"";try{return new URL(D.startsWith("http")?D:`https://${D}`).origin}catch{return D}},C=async(h=_.current,D=_.size,$=l,g=p)=>{f(!0);try{const w={page:h,size:D};$&&(w.pathname=$);const L=W(g);L&&(w.host=L);const Y=await n.getList(w);O(Y.items),H(d=>({...d,current:h,size:D,total:Y.total??d.total}))}catch(w){G.error(w.message||"获取文章失败")}finally{f(!1)}};o.useEffect(()=>{C(1)},[]),o.useEffect(()=>{if(!n.getNavigationGroups)return;let h=!0;const D=new Map;for(const $ of v)if($.host)for(const g of $.navPlacements??[]){if(!g.parentNavId)continue;const w=$.host.trim().replace(/\/+$/,"");D.set(at(w,g.position),{host:w,position:g.position})}A(Object.fromEntries([...D.keys()].map($=>[$,{status:"loading",names:{}}])));for(const[$,g]of D)(async()=>{try{const w=await n.getNavigationGroups(g);if(!h)return;A(L=>({...L,[$]:{status:"loaded",names:Object.fromEntries(w.map(Y=>[Y.id,Y.name]))}}))}catch{if(!h)return;A(w=>({...w,[$]:{status:"error",names:{}}}))}})();return()=>{h=!1}},[v,n,T]);const P=h=>{s.confirm({title:"删除文章",content:`确认删除 /${h.pathname}?`,okText:"删除",okType:"danger",cancelText:"取消",onOk:async()=>{await n.delete(h.id),G.success("删除成功"),C(1)}})},b=Math.ceil(_.total/_.size)||1;return e.jsxs("div",{className:"min-w-0 bg-white rounded-xl shadow-sm border border-gray-100 p-5",children:[i,e.jsxs("form",{className:"flex flex-wrap items-center gap-2 mb-5",onSubmit:h=>{h.preventDefault(),C(1)},children:[e.jsxs("div",{className:"relative w-full sm:w-52",children:[e.jsx(je,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400"}),e.jsx("input",{className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition","aria-label":"搜索访问路径",placeholder:"搜索访问路径",value:l,onChange:h=>x(h.target.value)})]}),e.jsxs("div",{className:"relative w-full sm:w-52",children:[e.jsx(je,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400"}),e.jsx("input",{className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition","aria-label":"搜索网站地址",placeholder:"搜索网站地址",value:p,onChange:h=>y(h.target.value)})]}),e.jsxs("button",{type:"submit",className:"flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition cursor-pointer",children:[e.jsx(je,{className:"w-3.5 h-3.5"}),"搜索"]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-3 py-1.5 border border-gray-200 hover:bg-gray-50 text-gray-600 text-sm rounded-lg transition cursor-pointer",onClick:()=>{x(""),y(""),C(1,_.size,"","")},children:[e.jsx(tr,{className:"w-3.5 h-3.5"}),"重置"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition cursor-pointer",onClick:()=>t(`${r}/create`),children:[e.jsx(tt,{className:"w-3.5 h-3.5"}),"新增文章"]})]}),e.jsx("div",{className:"relative overflow-x-auto",role:"region","aria-label":"文章列表",tabIndex:0,children:e.jsxs("table",{className:"w-full min-w-[1120px] table-fixed text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100",children:[e.jsx("th",{scope:"col",className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-36",children:"访问路径"}),e.jsx("th",{scope:"col",className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-32",children:"网站地址"}),e.jsx("th",{scope:"col",className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-80",children:"网站导航"}),e.jsx("th",{scope:"col",className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide",children:"HTML 摘要"}),e.jsx("th",{scope:"col",className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-36",children:"创建时间"}),e.jsx("th",{scope:"col",className:"text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-60",children:"操作"})]})}),e.jsx("tbody",{children:N?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-16 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-gray-400",children:[e.jsx(Qe,{className:"w-6 h-6 text-blue-400 animate-spin"}),e.jsx("span",{className:"text-sm",children:"加载中…"})]})})}):v.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-16 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-gray-300",children:[e.jsx(Yt,{className:"w-10 h-10"}),e.jsx("span",{className:"text-sm",children:"暂无文章"})]})})}):v.map(h=>{const D=(h.content||"").replace(/<(style|script)\b[^>]*>[\s\S]*?<\/\1>/gi," ").replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80);return e.jsxs("tr",{className:"border-b border-gray-50 hover:bg-gray-50/60 transition-colors",children:[e.jsx("td",{className:"py-3 px-3",children:e.jsxs("span",{className:"block break-words font-mono text-xs text-gray-700",children:["/",h.pathname]})}),e.jsx("td",{className:"py-3 px-3",children:h.host?e.jsxs("a",{href:h.host,target:"_blank",rel:"noopener noreferrer",className:"inline-flex max-w-full items-center gap-1 text-xs text-blue-600 underline underline-offset-2 hover:text-blue-800 transition-colors",title:h.host,children:[e.jsx("span",{className:"truncate",children:h.host.replace(/^https?:\/\//,"")}),e.jsx(It,{className:"w-3 h-3 shrink-0"})]}):e.jsx("span",{className:"text-xs text-gray-300",children:"—"})}),e.jsx("td",{className:"py-3 px-3",children:e.jsx(hr,{article:h,groups:z,canLoadGroups:!!n.getNavigationGroups,onRetry:()=>I($=>$+1)})}),e.jsx("td",{className:"py-3 px-3",children:D?e.jsx("span",{className:"text-sm text-gray-500 truncate block max-w-sm",title:D,children:D}):e.jsx("span",{className:"text-xs text-gray-300",children:"暂无内容"})}),e.jsx("td",{className:"py-3 px-3 text-xs whitespace-nowrap text-gray-400",children:h.createdAt?Oe(h.createdAt).format("YYYY/MM/DD HH:mm"):"—"}),e.jsx("td",{className:"py-3 px-3",children:e.jsxs("div",{className:"flex items-center gap-1",children:[h.host&&e.jsx("button",{className:"px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 text-gray-600 transition cursor-pointer",onClick:()=>window.open(`${h.host.replace(/\/$/,"")}/${h.pathname}`,"_blank"),children:"跳转"}),e.jsx("button",{className:"px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 text-gray-600 transition cursor-pointer",onClick:()=>t(`${r}/${h.id}/detail`,{state:{record:h}}),children:"详情"}),e.jsx("button",{className:"px-2.5 py-1 text-xs bg-blue-500 hover:bg-blue-600 text-white rounded-md transition cursor-pointer",onClick:()=>t(`${r}/${h.id}/edit`,{state:{record:h}}),children:"编辑"}),e.jsx("button",{className:"px-2.5 py-1 text-xs bg-red-500 hover:bg-red-600 text-white rounded-md transition cursor-pointer",onClick:()=>P(h),children:"删除"})]})})]},h.id)})})]})}),_.total>0&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-4 mt-2 border-t border-gray-100",children:[e.jsxs("span",{className:"text-xs text-gray-400",children:["共 ",_.total," 篇文章"]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[e.jsx("button",{className:"px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed text-gray-600 transition cursor-pointer",disabled:_.current<=1,onClick:()=>C(_.current-1),children:"上一页"}),e.jsxs("span",{className:"px-3 py-1 text-xs text-gray-500",children:[_.current," / ",b]}),e.jsx("button",{className:"px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed text-gray-600 transition cursor-pointer",disabled:_.current>=b,onClick:()=>C(_.current+1),children:"下一页"}),e.jsx("select",{"aria-label":"每页条数",className:"ml-2 text-xs border border-gray-200 rounded-md px-1.5 py-1 text-gray-600 focus:outline-none focus:ring-1 focus:ring-blue-400 cursor-pointer",value:_.size,onChange:h=>C(1,Number(h.target.value)),children:[10,15,20,50].map(h=>e.jsxs("option",{value:h,children:[h," 条/页"]},h))})]})]})]})},fr=[{position:"header",label:"页眉",icon:Je,parentEnabled:!1},{position:"footer",label:"页尾",icon:et,parentEnabled:!0}],Pe="w-full min-w-0 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-700 outline-none transition focus:border-blue-400 focus:ring-2 focus:ring-blue-500/20";function xr({host:t,position:r,label:n,parentEnabled:s,service:i,parentNavId:l,onSelect:x}){const p=o.useId(),[y,N]=o.useState([]),[f,v]=o.useState(!1),[O,z]=o.useState(""),[A,T]=o.useState(!1),[I,_]=o.useState(""),[H,W]=o.useState(""),[C,P]=o.useState(!1),b=o.useRef(0),h=o.useRef(0),D=o.useRef(x);D.current=x;const $=i.getNavigationGroups,g=i.createNavigationGroup,w=o.useCallback(async()=>{if(!t||!$)return;const d=++h.current;v(!0),z("");try{const a=await $({host:t,position:r});return d!==h.current?void 0:(N(a),a)}catch(a){d===h.current&&z(a instanceof Error?a.message:"父导航加载失败")}finally{d===h.current&&v(!1)}},[t,r,$]);o.useEffect(()=>(b.current++,w(),()=>{b.current++,h.current++}),[w]);const L=async()=>{if(C||!g||!s)return;const d=I.trim();if(!d){W("请输入父导航名称");return}const a=y.find(m=>m.name===d);if(a){D.current(a.id),T(!1);return}const c=b.current;P(!0),W("");try{const m=await g({host:t,position:r,name:d});if(c!==b.current)return;N(u=>[...u.filter(S=>S.id!==m.id),m]),D.current(m.id),T(!1),_(""),w()}catch(m){if(c!==b.current)return;if((m==null?void 0:m.status)===409){const u=await w();if(c!==b.current)return;const S=u==null?void 0:u.find(E=>E.name===d);if(S){D.current(S.id),T(!1),_("");return}}W(m instanceof Error?m.message:"新增父导航失败")}finally{c===b.current&&P(!1)}},Y=!!l&&!y.some(d=>d.id===l);return e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{htmlFor:p,className:"mb-1.5 block text-xs text-gray-500",children:["所属父导航 ",e.jsx("span",{className:"text-gray-400",children:"(可选)"})]}),e.jsxs("select",{id:p,"aria-label":`${n}父导航`,disabled:!s||!t||f||C,value:l??"",onChange:d=>x(d.target.value||null),className:`${Pe} disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-400`,children:[e.jsx("option",{value:"",children:"无(顶级导航)"}),y.map(d=>e.jsx("option",{value:d.id,children:d.name},d.id)),Y&&e.jsxs("option",{value:l,children:["已选父导航(",l,")"]})]}),f&&e.jsx("p",{role:"status",className:"mt-2 text-xs text-gray-500",children:"加载父导航中…"}),O&&e.jsxs("p",{role:"alert",className:"mt-2 text-xs text-red-500",children:[O,e.jsx("button",{type:"button",onClick:()=>void w(),className:"ml-2 cursor-pointer text-blue-500",children:"重试"})]}),s?t?A?e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{htmlFor:`${p}-new`,className:"mb-1.5 block text-xs text-gray-500",children:["新增",n,"父导航"]}),e.jsx("input",{id:`${p}-new`,autoFocus:!0,maxLength:100,value:I,disabled:C,placeholder:"输入父导航名称","aria-invalid":!!H,"aria-describedby":H?`${p}-error`:void 0,onChange:d=>{_(d.target.value),W("")},onKeyDown:d=>{d.key==="Enter"&&!d.nativeEvent.isComposing&&(d.preventDefault(),L()),d.key==="Escape"&&!C&&T(!1)},className:Pe}),H&&e.jsx("p",{id:`${p}-error`,role:"alert",className:"mt-1.5 text-xs text-red-500",children:H}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",disabled:C,onClick:()=>void L(),className:"flex cursor-pointer items-center gap-1 rounded-lg bg-blue-500 px-2.5 py-1.5 text-xs text-white hover:bg-blue-600 disabled:opacity-50",children:[C?e.jsx(Qe,{size:12,className:"animate-spin"}):e.jsx(Et,{size:12,"aria-hidden":"true"}),C?"添加中…":"添加并选中"]}),e.jsxs("button",{type:"button",disabled:C,onClick:()=>T(!1),className:"flex cursor-pointer items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs text-gray-500 hover:bg-gray-100 disabled:opacity-50",children:[e.jsx(or,{size:12,"aria-hidden":"true"}),"取消"]})]})]}):g?e.jsxs("button",{type:"button",disabled:f,"aria-label":`新增${n}父导航`,onClick:()=>{T(!0),_(""),W("")},className:"mt-2.5 flex cursor-pointer items-center gap-1 text-xs text-blue-500 enabled:hover:text-blue-600 disabled:opacity-50",children:[e.jsx(tt,{size:13,"aria-hidden":"true"}),"新增父导航"]}):null:e.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"请先填写网站地址"}):e.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"页眉暂不支持设置父导航。"})]})}function pr({host:t,service:r,value:n,onChange:s}){const i=o.useId(),l=t.trim().replace(/\/+$/,""),[x,p]=o.useState(!1),y=!!r.getNavigationGroups,N=v=>s({...n,...v}),f=(v,O)=>{N({navPlacements:O?[...n.navPlacements,{position:v,parentNavId:null}]:n.navPlacements.filter(z=>z.position!==v)})};return e.jsxs("section",{"aria-label":"导航设置",className:"mt-5 border-t border-gray-100 pt-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"导航设置"}),e.jsxs("label",{htmlFor:`${i}-enabled`,className:"flex cursor-pointer items-center gap-2 text-sm text-gray-600",children:[e.jsx("span",{children:"启用导航"}),e.jsxs("span",{className:"relative inline-flex h-5 w-9 shrink-0 items-center",children:[e.jsx("input",{id:`${i}-enabled`,type:"checkbox",role:"switch",checked:n.navEnabled,disabled:!y,"aria-controls":`${i}-fields`,onChange:v=>N({navEnabled:v.target.checked}),className:"peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed"}),e.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 rounded-full bg-gray-200 transition peer-checked:bg-blue-500 peer-disabled:opacity-50 peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-blue-500"}),e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none relative ml-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform peer-checked:translate-x-4"})]})]})]}),y?n.navEnabled?e.jsxs("div",{id:`${i}-fields`,className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"max-w-md",children:[e.jsxs("label",{htmlFor:`${i}-name`,className:"mb-1.5 block text-sm font-medium text-gray-700",children:["导航名称 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{id:`${i}-name`,value:n.navname,maxLength:100,placeholder:"输入导航名称",required:!0,"aria-invalid":x&&!n.navname.trim(),"aria-describedby":x&&!n.navname.trim()?`${i}-name-error`:void 0,onChange:v=>N({navname:v.target.value}),onBlur:()=>p(!0),className:Pe}),x&&!n.navname.trim()&&e.jsx("p",{id:`${i}-name-error`,role:"alert",className:"mt-1.5 text-xs text-red-500",children:"开启导航后,请填写导航名称"})]}),e.jsxs("fieldset",{"aria-describedby":`${i}-placements-hint`,children:[e.jsxs("legend",{className:"mb-2 text-sm font-medium text-gray-700",children:["展示位置 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("p",{id:`${i}-placements-hint`,className:"mb-3 text-xs text-gray-500",children:"可同时选择页眉和页尾,页尾可设置父导航。"}),e.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:fr.map(({position:v,label:O,icon:z,parentEnabled:A})=>{const T=n.navPlacements.find(I=>I.position===v);return e.jsxs("div",{className:`min-w-0 rounded-xl border p-3.5 transition-colors ${T?"border-blue-200 bg-blue-50/30":"border-gray-200 bg-gray-50/50"}`,children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 text-sm text-gray-700",children:[e.jsx("input",{type:"checkbox",checked:!!T,onChange:I=>f(v,I.target.checked),className:"h-4 w-4 shrink-0 accent-blue-500"}),e.jsx(z,{size:15,className:"shrink-0 text-gray-400","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:O})]}),T&&e.jsx(xr,{host:l,position:v,label:O,parentEnabled:A,service:r,parentNavId:T.parentNavId,onSelect:I=>N({navPlacements:n.navPlacements.map(_=>_.position===v?{..._,parentNavId:I}:_)})},`${l}:${v}`)]},v)})}),n.navPlacements.length===0&&e.jsx("p",{role:"alert",className:"mt-2 text-xs text-red-500",children:"请至少选择一个展示位置"})]})]}):e.jsx("p",{className:"mt-1.5 text-xs text-gray-500",children:"开启后可将文章加入页眉、页尾或同时加入两处。"}):e.jsx("p",{className:"mt-1.5 text-xs text-gray-500",children:"当前服务尚未接入导航配置"})]})}function gr(t){return t.split(/(“[^”]+”|"[^"]+")/g).map((r,n)=>/^(“.*”|".*")$/.test(r)?e.jsx("code",{className:"rounded bg-gray-100 px-1 py-0.5 font-mono text-[11px] text-gray-800",children:r.slice(1,-1)},n):r)}function br({errors:t,source:r}){const[n,s]=o.useState(null),i=r.split(`
157
+ `);return e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-3 border-b border-gray-100 bg-white px-4 py-3.5",children:[e.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-red-50 text-red-500",children:e.jsx(_t,{size:18,strokeWidth:1.75})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-900",children:"HTML 校验"}),e.jsx("div",{className:"mt-0.5 text-xs text-gray-500",children:"点击问题查看详情"})]}),e.jsxs("span",{className:"shrink-0 rounded-full bg-red-50 px-2.5 py-1 text-xs font-medium text-red-600",children:[t.length," 个问题"]})]}),e.jsx("ol",{className:"m-0 list-none divide-y divide-gray-100 p-0",children:t.map((l,x)=>{var N,f;const p=(l.lastLine?(N=i[l.lastLine-1])==null?void 0:N.trim():"")||((f=l.extract)==null?void 0:f.trim()),y=n===x;return e.jsxs("li",{children:[e.jsxs("button",{type:"button","aria-expanded":y,onClick:()=>s(y?null:x),className:`flex w-full cursor-pointer items-center gap-2.5 px-4 py-3 text-left transition-colors hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400 ${y?"bg-gray-50":""}`,children:[e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-red-400"}),e.jsx("span",{className:"w-16 shrink-0 font-mono text-[11px] text-gray-500",children:l.lastLine!=null?`第 ${l.lastLine} 行`:`问题 ${x+1}`}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs leading-5 text-gray-700",children:l.message.replace(/[“”"]/g,"")}),e.jsx(Pt,{size:14,className:`shrink-0 text-gray-400 transition-transform ${y?"rotate-180":""}`})]}),y&&e.jsxs("div",{className:"border-t border-gray-100 px-4 pb-4 pt-3",children:[l.lastColumn!=null&&e.jsxs("div",{className:"mb-2 font-mono text-[11px] text-gray-400",children:["第 ",l.lastColumn," 列"]}),e.jsx("p",{className:"m-0 text-[13px] leading-6 text-gray-600",children:gr(l.message)}),p&&e.jsxs("div",{className:"mt-3 overflow-hidden rounded-lg border border-gray-100 bg-gray-50",children:[e.jsxs("div",{className:"flex items-center gap-1.5 border-b border-gray-100 px-3 py-1.5 text-[10px] font-medium uppercase tracking-wider text-gray-400",children:[e.jsx(_e,{size:11})," 源代码"]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-words px-3 py-2.5 font-mono text-[11px] leading-5 text-gray-600",children:p})]})]})]},x)})})]})}async function He(t){const r=new AbortController,n=setTimeout(()=>r.abort(),1e4);try{const s=await fetch("https://validator.w3.org/nu/?out=json",{method:"POST",headers:{"Content-Type":"text/html; charset=utf-8","User-Agent":"AiSee-Manage/1.0"},body:t,signal:r.signal});if(!s.ok)throw new Error(`W3C validator responded with ${s.status}`);const x=((await s.json()).messages||[]).filter(p=>p.type==="error");return{isValid:x.length===0,errors:x}}catch(s){return console.error("W3C 校验请求失败:",s),{isValid:!0,errors:[],networkError:!0}}finally{clearTimeout(n)}}function We(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,s=Array(r);n<r;n++)s[n]=t[n];return s}function yr(t){if(Array.isArray(t))return t}function vr(t,r,n){return(r=Mr(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function wr(t,r){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var s,i,l,x,p=[],y=!0,N=!1;try{if(l=(n=n.call(t)).next,r!==0)for(;!(y=(s=l.call(n)).done)&&(p.push(s.value),p.length!==r);y=!0);}catch(f){N=!0,i=f}finally{try{if(!y&&n.return!=null&&(x=n.return(),Object(x)!==x))return}finally{if(N)throw i}}return p}}function jr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
158
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ve(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);r&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function qe(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Ve(Object(n),!0).forEach(function(s){vr(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function Nr(t,r){if(t==null)return{};var n,s,i=kr(t,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(s=0;s<l.length;s++)n=l[s],r.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function kr(t,r){if(t==null)return{};var n={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(r.indexOf(s)!==-1)continue;n[s]=t[s]}return n}function $r(t,r){return yr(t)||wr(t,r)||Cr(t,r)||jr()}function Sr(t,r){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,r);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Mr(t){var r=Sr(t,"string");return typeof r=="symbol"?r:r+""}function Cr(t,r){if(t){if(typeof t=="string")return We(t,r);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?We(t,r):void 0}}function Er(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function Ye(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);r&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Fe(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Ye(Object(n),!0).forEach(function(s){Er(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ye(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function Or(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(s){return r.reduceRight(function(i,l){return l(i)},s)}}function ie(t){return function r(){for(var n=this,s=arguments.length,i=new Array(s),l=0;l<s;l++)i[l]=arguments[l];return i.length>=t.length?t.apply(this,i):function(){for(var x=arguments.length,p=new Array(x),y=0;y<x;y++)p[y]=arguments[y];return r.apply(n,[].concat(i,p))}}}function fe(t){return{}.toString.call(t).includes("Object")}function Pr(t){return!Object.keys(t).length}function ce(t){return typeof t=="function"}function Lr(t,r){return Object.prototype.hasOwnProperty.call(t,r)}function Tr(t,r){return fe(r)||ee("changeType"),Object.keys(r).some(function(n){return!Lr(t,n)})&&ee("changeField"),r}function _r(t){ce(t)||ee("selectorType")}function Dr(t){ce(t)||fe(t)||ee("handlerType"),fe(t)&&Object.values(t).some(function(r){return!ce(r)})&&ee("handlersType")}function zr(t){t||ee("initialIsRequired"),fe(t)||ee("initialType"),Pr(t)&&ee("initialContent")}function Ar(t,r){throw new Error(t[r]||t.default)}var Rr={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},ee=ie(Ar)(Rr),ue={changes:Tr,selector:_r,handler:Dr,initial:zr};function Ir(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ue.initial(t),ue.handler(r);var n={current:t},s=ie(Vr)(n,r),i=ie(Wr)(n),l=ie(ue.changes)(t),x=ie(Hr)(n);function p(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(f){return f};return ue.selector(N),N(n.current)}function y(N){Or(s,i,l,x)(N)}return[p,y]}function Hr(t,r){return ce(r)?r(t.current):r}function Wr(t,r){return t.current=Fe(Fe({},t.current),r),r}function Vr(t,r,n){return ce(r)?r(t.current):Object.keys(n).forEach(function(s){var i;return(i=r[s])===null||i===void 0?void 0:i.call(r,t.current[s])}),n}var qr={create:Ir},Yr={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Fr(t){return function r(){for(var n=this,s=arguments.length,i=new Array(s),l=0;l<s;l++)i[l]=arguments[l];return i.length>=t.length?t.apply(this,i):function(){for(var x=arguments.length,p=new Array(x),y=0;y<x;y++)p[y]=arguments[y];return r.apply(n,[].concat(i,p))}}}function Br(t){return{}.toString.call(t).includes("Object")}function Ur(t){return t||Be("configIsRequired"),Br(t)||Be("configType"),t.urls?(Gr(),{paths:{vs:t.urls.monacoBase}}):t}function Gr(){console.warn(it.deprecation)}function Zr(t,r){throw new Error(t[r]||t.default)}var it={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
123
159
  You are using deprecated way of configuration.
124
160
 
125
161
  Instead of using
@@ -128,8 +164,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
128
164
  monaco.config({ paths: { vs: '...' } })
129
165
 
130
166
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
131
- `},Ie=vr(kr)(Je),$r={config:jr},Mr=function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return function(o){return n.reduceRight(function(u,g){return g(u)},o)}};function Ke(e,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&e[n]&&Object.assign(r[n],Ke(e[n],r[n]))}),ze(ze({},e),r)}var Sr={type:"cancelation",msg:"operation is manually canceled"};function be(e){var r=!1,n=new Promise(function(s,o){e.then(function(u){return r?o(Sr):s(u)}),e.catch(o)});return n.cancel=function(){return r=!0},n}var Cr=["monaco"],Or=yr.create({config:br,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ge=er(Or,2),ie=Ge[0],me=Ge[1];function Pr(e){var r=$r.config(e),n=r.monaco,s=Qt(r,Cr);me(function(o){return{config:Ke(o.config,s),monaco:n}})}function Dr(){var e=ie(function(r){var n=r.monaco,s=r.isInitialized,o=r.resolve;return{monaco:n,isInitialized:s,resolve:o}});if(!e.isInitialized){if(me({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),be(ve);if(window.monaco&&window.monaco.editor)return Qe(window.monaco),e.resolve(window.monaco),be(ve);Mr(Er,Ar)(Tr)}return be(ve)}function Er(e){return document.body.appendChild(e)}function Lr(e){var r=document.createElement("script");return e&&(r.src=e),r}function Ar(e){var r=ie(function(s){var o=s.config,u=s.reject;return{config:o,reject:u}}),n=Lr("".concat(r.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=r.reject,n}function Tr(){var e=ie(function(n){var s=n.config,o=n.resolve,u=n.reject;return{config:s,resolve:o,reject:u}}),r=window.require;r.config(e.config),r(["vs/editor/editor.main"],function(n){var s=n.m||n;Qe(s),e.resolve(s)},function(n){e.reject(n)})}function Qe(e){ie().monaco||me({monaco:e})}function _r(){return ie(function(e){var r=e.monaco;return r})}var ve=new Promise(function(e,r){return me({resolve:e,reject:r})}),Xe={config:Pr,init:Dr,__getMonacoInstance:_r},zr={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},we=zr,Rr={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Hr=Rr;function Ir({children:e}){return c.createElement("div",{style:Hr.container},e)}var Wr=Ir,Vr=Wr;function Yr({width:e,height:r,isEditorReady:n,loading:s,_ref:o,className:u,wrapperProps:g}){return c.createElement("section",{style:{...we.wrapper,width:e,height:r},...g},!n&&c.createElement(Vr,null,s),c.createElement("div",{ref:o,style:{...we.fullWidth,...!n&&we.hide},className:u}))}var qr=Yr,et=c.memo(qr);function Ur(e){c.useEffect(e,[])}var tt=Ur;function Fr(e,r,n=!0){let s=c.useRef(!0);c.useEffect(s.current||!n?()=>{s.current=!1}:e,r)}var B=Fr;function se(){}function te(e,r,n,s){return Br(e,s)||Zr(e,r,n,s)}function Br(e,r){return e.editor.getModel(rt(e,r))}function Zr(e,r,n,s){return e.editor.createModel(r,n,s?rt(e,s):void 0)}function rt(e,r){return e.Uri.parse(r)}function Jr({original:e,modified:r,language:n,originalLanguage:s,modifiedLanguage:o,originalModelPath:u,modifiedModelPath:g,keepCurrentOriginalModel:k=!1,keepCurrentModifiedModel:$=!1,theme:C="light",loading:m="Loading...",options:S={},height:H="100%",width:P="100%",className:T,wrapperProps:R={},beforeMount:z=se,onMount:q=se}){let[_,p]=c.useState(!1),[A,O]=c.useState(!0),y=c.useRef(null),w=c.useRef(null),I=c.useRef(null),E=c.useRef(q),x=c.useRef(z),M=c.useRef(!1);tt(()=>{let a=Xe.init();return a.then(i=>(w.current=i)&&O(!1)).catch(i=>(i==null?void 0:i.type)!=="cancelation"&&console.error("Monaco initialization: error:",i)),()=>y.current?b():a.cancel()}),B(()=>{if(y.current&&w.current){let a=y.current.getOriginalEditor(),i=te(w.current,e||"",s||n||"text",u||"");i!==a.getModel()&&a.setModel(i)}},[u],_),B(()=>{if(y.current&&w.current){let a=y.current.getModifiedEditor(),i=te(w.current,r||"",o||n||"text",g||"");i!==a.getModel()&&a.setModel(i)}},[g],_),B(()=>{let a=y.current.getModifiedEditor();a.getOption(w.current.editor.EditorOption.readOnly)?a.setValue(r||""):r!==a.getValue()&&(a.executeEdits("",[{range:a.getModel().getFullModelRange(),text:r||"",forceMoveMarkers:!0}]),a.pushUndoStop())},[r],_),B(()=>{var a,i;(i=(a=y.current)==null?void 0:a.getModel())==null||i.original.setValue(e||"")},[e],_),B(()=>{let{original:a,modified:i}=y.current.getModel();w.current.editor.setModelLanguage(a,s||n||"text"),w.current.editor.setModelLanguage(i,o||n||"text")},[n,s,o],_),B(()=>{var a;(a=w.current)==null||a.editor.setTheme(C)},[C],_),B(()=>{var a;(a=y.current)==null||a.updateOptions(S)},[S],_);let Y=c.useCallback(()=>{var d;if(!w.current)return;x.current(w.current);let a=te(w.current,e||"",s||n||"text",u||""),i=te(w.current,r||"",o||n||"text",g||"");(d=y.current)==null||d.setModel({original:a,modified:i})},[n,r,o,e,s,u,g]),Z=c.useCallback(()=>{var a;!M.current&&I.current&&(y.current=w.current.editor.createDiffEditor(I.current,{automaticLayout:!0,...S}),Y(),(a=w.current)==null||a.editor.setTheme(C),p(!0),M.current=!0)},[S,C,Y]);c.useEffect(()=>{_&&E.current(y.current,w.current)},[_]),c.useEffect(()=>{!A&&!_&&Z()},[A,_,Z]);function b(){var i,d,l,v;let a=(i=y.current)==null?void 0:i.getModel();k||((d=a==null?void 0:a.original)==null||d.dispose()),$||((l=a==null?void 0:a.modified)==null||l.dispose()),(v=y.current)==null||v.dispose()}return c.createElement(et,{width:P,height:H,isEditorReady:_,loading:m,_ref:I,className:T,wrapperProps:R})}var Kr=Jr;c.memo(Kr);function Gr(e){let r=c.useRef();return c.useEffect(()=>{r.current=e},[e]),r.current}var Qr=Gr,le=new Map;function Xr({defaultValue:e,defaultLanguage:r,defaultPath:n,value:s,language:o,path:u,theme:g="light",line:k,loading:$="Loading...",options:C={},overrideServices:m={},saveViewState:S=!0,keepCurrentModel:H=!1,width:P="100%",height:T="100%",className:R,wrapperProps:z={},beforeMount:q=se,onMount:_=se,onChange:p,onValidate:A=se}){let[O,y]=c.useState(!1),[w,I]=c.useState(!0),E=c.useRef(null),x=c.useRef(null),M=c.useRef(null),Y=c.useRef(_),Z=c.useRef(q),b=c.useRef(),a=c.useRef(s),i=Qr(u),d=c.useRef(!1),l=c.useRef(!1);tt(()=>{let f=Xe.init();return f.then(j=>(E.current=j)&&I(!1)).catch(j=>(j==null?void 0:j.type)!=="cancelation"&&console.error("Monaco initialization: error:",j)),()=>x.current?N():f.cancel()}),B(()=>{var j,D,h,L;let f=te(E.current,e||s||"",r||o||"",u||n||"");f!==((j=x.current)==null?void 0:j.getModel())&&(S&&le.set(i,(D=x.current)==null?void 0:D.saveViewState()),(h=x.current)==null||h.setModel(f),S&&((L=x.current)==null||L.restoreViewState(le.get(u))))},[u],O),B(()=>{var f;(f=x.current)==null||f.updateOptions(C)},[C],O),B(()=>{!x.current||s===void 0||(x.current.getOption(E.current.editor.EditorOption.readOnly)?x.current.setValue(s):s!==x.current.getValue()&&(l.current=!0,x.current.executeEdits("",[{range:x.current.getModel().getFullModelRange(),text:s,forceMoveMarkers:!0}]),x.current.pushUndoStop(),l.current=!1))},[s],O),B(()=>{var j,D;let f=(j=x.current)==null?void 0:j.getModel();f&&o&&((D=E.current)==null||D.editor.setModelLanguage(f,o))},[o],O),B(()=>{var f;k!==void 0&&((f=x.current)==null||f.revealLine(k))},[k],O),B(()=>{var f;(f=E.current)==null||f.editor.setTheme(g)},[g],O);let v=c.useCallback(()=>{var f;if(!(!M.current||!E.current)&&!d.current){Z.current(E.current);let j=u||n,D=te(E.current,s||e||"",r||o||"",j||"");x.current=(f=E.current)==null?void 0:f.editor.create(M.current,{model:D,automaticLayout:!0,...C},m),S&&x.current.restoreViewState(le.get(j)),E.current.editor.setTheme(g),k!==void 0&&x.current.revealLine(k),y(!0),d.current=!0}},[e,r,n,s,o,u,C,m,S,g,k]);c.useEffect(()=>{O&&Y.current(x.current,E.current)},[O]),c.useEffect(()=>{!w&&!O&&v()},[w,O,v]),a.current=s,c.useEffect(()=>{var f,j;O&&p&&((f=b.current)==null||f.dispose(),b.current=(j=x.current)==null?void 0:j.onDidChangeModelContent(D=>{l.current||p(x.current.getValue(),D)}))},[O,p]),c.useEffect(()=>{if(O){let f=E.current.editor.onDidChangeMarkers(j=>{var h;let D=(h=x.current.getModel())==null?void 0:h.uri;if(D&&j.find(L=>L.path===D.path)){let L=E.current.editor.getModelMarkers({resource:D});A==null||A(L)}});return()=>{f==null||f.dispose()}}return()=>{}},[O,A]);function N(){var f,j;(f=b.current)==null||f.dispose(),H?S&&le.set(u,x.current.saveViewState()):(j=x.current.getModel())==null||j.dispose(),x.current.dispose()}return c.createElement(et,{width:P,height:T,isEditorReady:O,loading:$,_ref:M,className:R,wrapperProps:z})}var en=Xr,tn=c.memo(en),rn=tn;function he({title:e,children:r,placement:n="top"}){const[s,o]=c.useState(!1);return e?t.jsxs("div",{className:"relative inline-flex",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[r,s&&t.jsx("div",{className:`absolute left-1/2 -translate-x-1/2 z-50 px-2 py-1 bg-gray-800/90 text-white text-xs rounded-md whitespace-nowrap pointer-events-none ${n==="top"?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:e})]}):t.jsx(t.Fragment,{children:r})}const je=[{key:"desktop",icon:t.jsx(Ue,{size:13}),label:"Desktop",width:null},{key:"tablet",icon:t.jsx(Be,{size:13}),label:"Tablet",width:768},{key:"mobile",icon:t.jsx(Fe,{size:13}),label:"Mobile",width:390}],nn=({id:e,record:r})=>{const{navigate:n,params:s,locationState:o}=Ce(),u=e??s.id,{basePath:g,service:k,previewBaseUrl:$,previewTailwind:C}=Oe(),m=!!u,[S,H]=Ze(),[P,T]=c.useState(!1),[R,z]=c.useState(r??(o==null?void 0:o.record)??null),[q,_]=c.useState(""),[p,A]=c.useState(m?"":"https://aisee.live"),[O,y]=c.useState(""),[w,I]=c.useState(""),[E,x]=c.useState("code"),[M,Y]=c.useState(!1),[Z,b]=c.useState("desktop"),[a,i]=c.useState(!1),[d,l]=c.useState(null),v=(h,L)=>{const J=$?`<base href="${$}">`:"",U=L?`<meta name="viewport" content="width=${L}, initial-scale=1">`:"",K=L?"<style>*,*::before,*::after{box-sizing:border-box}img,video,svg,canvas,audio{max-width:100%;height:auto}pre{white-space:pre-wrap;word-break:break-word;overflow-x:auto}table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}</style>":"",G=C&&!h.includes("cdn.tailwindcss.com")?'<script src="https://cdn.tailwindcss.com"><\/script>':"",W=J+U+K+G;return W?h.includes("</head>")?h.replace("</head>",`${W}
132
- </head>`):W+h:h},N=async()=>{if(!w.trim()){F.warning("请先输入 HTML 代码");return}i(!0),l(null);try{const h=await Ae(w);l(h),h.networkError?F.warning("W3C 校验服务不可用"):h.isValid&&F.success("W3C 校验通过")}finally{i(!1)}};c.useEffect(()=>{m&&(R?(_(R.pathname||""),A(R.host||""),I(R.content||"")):k.getById(u).then(h=>{z(h),_(h.pathname||""),A(h.host||""),I(h.content||"")}).catch(h=>{F.error(h.message||"获取数据失败"),n(g)}))},[u]);const f=()=>n(g),j=!q.trim(),D=async()=>{if(!q.trim()){y("请输入 pathname");return}if(!w.trim()){Y(!0),F.error("请输入 HTML 代码");return}T(!0);const h=await Ae(w);if(T(!1),h.networkError)F.warning("W3C 校验服务不可用,已跳过校验");else if(!h.isValid&&!await new Promise(J=>{S.confirm({title:"W3C 校验发现问题",content:t.jsxs("div",{className:"mt-1",children:[t.jsx("p",{className:"text-gray-600 mb-2",children:"检测到以下 W3C 标准问题,仍要保存吗?"}),t.jsxs("ul",{className:"space-y-1",children:[h.errors.slice(0,5).map((U,K)=>t.jsxs("li",{className:"flex items-start gap-1.5 text-red-500 text-sm",children:[t.jsx("span",{className:"shrink-0",children:"✕"}),t.jsxs("span",{children:[U.lastLine?`第 ${U.lastLine} 行:`:"",U.message]})]},K)),h.errors.length>5&&t.jsxs("li",{className:"text-gray-400 text-xs mt-1",children:["还有 ",h.errors.length-5," 个问题…"]})]})]}),okText:"仍然保存",cancelText:"返回修改",onOk:()=>J(!0),onCancel:()=>J(!1)})}))return;T(!0);try{const L={pathname:q.trim(),content:w,host:(p==null?void 0:p.trim())||void 0};m&&R?(await k.update(R.id,L),F.success("编辑成功")):(await k.create(L),F.success("添加成功")),n(g)}catch(L){F.error(L.message||"保存失败")}finally{T(!1)}};return t.jsxs(t.Fragment,{children:[H,t.jsxs("div",{className:"w-full bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden flex flex-col",style:{height:"calc(100vh - 90px)"},children:[t.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-gray-50/60",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{className:"flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-200 transition -ml-1 cursor-pointer",onClick:f,children:t.jsx(Ye,{size:15})}),t.jsxs("div",{children:[t.jsx("div",{className:"text-base font-semibold text-gray-800 leading-tight",children:m?"编辑 Article":"新增 Article"}),m&&R&&t.jsxs("div",{className:"text-xs text-gray-400 mt-0.5 font-mono",children:["/",R.pathname]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{className:"px-4 py-1.5 border border-gray-200 rounded-lg text-sm text-gray-600 hover:bg-gray-50 transition cursor-pointer",onClick:f,children:"取消"}),t.jsx("button",{disabled:j||P,className:"px-4 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",onClick:D,children:P?"保存中…":"保存"})]})]}),t.jsx("div",{className:"shrink-0 px-6 pt-5 pb-4 border-b border-gray-100",children:t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:["Pathname",t.jsx("span",{className:"text-xs text-gray-400 font-normal ml-1.5",children:"前台网站路径"})]}),t.jsxs("div",{className:`flex items-center border rounded-lg transition focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-400 ${O?"border-red-400 ring-2 ring-red-500/20":"border-gray-200"}`,children:[t.jsx("span",{className:"pl-3 text-gray-400 select-none text-sm shrink-0",children:"/"}),t.jsx("input",{className:"flex-1 pr-3 py-1.5 text-sm bg-transparent focus:outline-none",placeholder:"例如 about-us",value:q,onChange:h=>{_(h.target.value),O&&y("")}})]}),t.jsx("p",{className:"text-xs text-gray-500 mt-1.5",children:"建议使用小写字母,不能包含空格,例如 about-us。"}),O&&t.jsx("p",{className:"text-red-500 text-xs mt-1",children:O})]}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:["Website URL",t.jsx("span",{className:"text-xs text-gray-400 font-normal ml-1.5",children:"可跳转的网站地址"})]}),t.jsx("input",{className:"w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition",placeholder:"例如 https://aisee.live",value:p,onChange:h=>A(h.target.value)})]})]})}),t.jsx("div",{className:"shrink-0 border-b border-gray-100 bg-gray-50/40",children:t.jsxs("div",{className:"flex items-center justify-between px-6 py-2",children:[t.jsx("div",{className:"flex items-center gap-3",children:t.jsxs("div",{className:"flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60",children:[t.jsxs("button",{className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none cursor-pointer ${E==="code"?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50":"text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,onClick:()=>x("code"),children:[t.jsx(qe,{size:11})," Code"]}),t.jsxs("button",{className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none ${E==="preview"?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50 cursor-pointer":w?"text-gray-400 hover:text-gray-600 hover:bg-white/50 cursor-pointer":"text-gray-300 cursor-not-allowed"}`,onClick:()=>x("preview"),disabled:!w,children:[t.jsx($e,{size:11})," 预览"]})]})}),E==="preview"&&w&&t.jsx("div",{className:"flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60",children:je.map(h=>t.jsx(he,{title:h.label,children:t.jsx("button",{className:`flex items-center justify-center w-7 h-6 rounded-md text-xs transition-all duration-150 select-none cursor-pointer ${Z===h.key?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50":"text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,onClick:()=>b(h.key),children:h.icon})},h.key))}),E==="code"&&t.jsxs("div",{className:"flex items-center gap-2",children:[w&&t.jsxs("span",{className:"text-xs text-gray-400",children:[w.split(`
133
- `).length," 行 ·"," ",w.length," 字符"]}),d&&!d.networkError&&(d.isValid?t.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-50 border border-green-200 text-green-600 text-xs",children:[t.jsx(Ee,{size:11})," 校验通过"]}):t.jsx(he,{title:t.jsxs("ul",{className:"m-0 pl-0 list-none space-y-1 max-w-xs",children:[d.errors.slice(0,5).map((h,L)=>t.jsxs("li",{className:"text-xs",children:[h.lastLine?`第 ${h.lastLine} 行:`:"",h.message]},L)),d.errors.length>5&&t.jsxs("li",{className:"text-gray-400 text-xs",children:["还有"," ",d.errors.length-5," ","个问题…"]})]}),children:t.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-50 border border-red-200 text-red-500 text-xs cursor-default",children:["✕"," ",d.errors.length," ","个问题"]})})),t.jsxs("button",{disabled:!w||a,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs border border-gray-200 rounded-lg hover:bg-gray-50 text-gray-600 transition disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",onClick:N,children:[t.jsx(Ee,{size:12}),a?"校验中…":"W3C 校验"]})]})]})}),t.jsxs("div",{className:"flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute inset-0",style:{display:E==="code"?"block":"none",outline:M?"2px solid #ff4d4f":"none"},children:t.jsx(rn,{height:"100%",language:"html",theme:"vs-dark",value:w,onChange:h=>{I(h??""),M&&Y(!1),d&&l(null)},options:{fontSize:13,minimap:{enabled:!1},wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,formatOnPaste:!0,lineNumbers:"on",renderWhitespace:"none",smoothScrolling:!0,cursorBlinking:"smooth",padding:{top:12,bottom:12}}})}),E==="preview"&&(w?t.jsx("div",{className:"absolute inset-0 overflow-auto bg-gray-100/60 flex justify-center",children:Z!=="desktop"?t.jsx("div",{className:"flex flex-col items-center py-6 h-full",children:t.jsx("iframe",{srcDoc:v(w,je.find(h=>h.key===Z).width),sandbox:"allow-same-origin allow-scripts",title:"HTML 预览",style:{width:`${je.find(h=>h.key===Z).width}px`,height:"100%",minHeight:0,border:"1px solid #e5e7eb",borderRadius:10,background:"#fff",boxShadow:"0 4px 24px 0 rgba(0,0,0,0.10)",flexShrink:0}})}):t.jsx("iframe",{srcDoc:v(w),sandbox:"allow-same-origin allow-scripts",title:"HTML 预览",style:{width:"100%",height:"100%",border:"none",background:"#fff",display:"block"}})}):t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-300 gap-3 select-none",children:[t.jsx($e,{size:36}),t.jsx("span",{className:"text-sm",children:"请先输入 HTML 代码"})]}))]})]})]})},Ne=[{key:"desktop",icon:t.jsx(Ue,{size:13}),label:"Desktop",width:null},{key:"tablet",icon:t.jsx(Be,{size:13}),label:"Tablet",width:768},{key:"mobile",icon:t.jsx(Fe,{size:13}),label:"Mobile",width:390}],sn=({id:e,record:r})=>{const{navigate:n,params:s,locationState:o}=Ce(),u=e??s.id,{basePath:g,service:k,previewBaseUrl:$,previewTailwind:C}=Oe(),[m,S]=c.useState(r??(o==null?void 0:o.record)??null),[H,P]=c.useState(!1),[T,R]=c.useState("preview"),[z,q]=c.useState("desktop");c.useEffect(()=>{!m&&u&&(P(!0),k.getById(u).then(S).catch(y=>{F.error(y.message||"获取数据失败"),n(g)}).finally(()=>P(!1)))},[u]);const _=()=>n(g),p=()=>n(`${g}/${u}/edit`,{state:{record:m}}),A=()=>{m!=null&&m.content&&(navigator.clipboard.writeText(m.content),F.success("已复制到剪贴板"))},O=(y,w)=>{const I=$?`<base href="${$}">`:"",E=w?`<meta name="viewport" content="width=${w}, initial-scale=1">`:"",x=w?"<style>*,*::before,*::after{box-sizing:border-box}img,video,svg,canvas,audio{max-width:100%;height:auto}pre{white-space:pre-wrap;word-break:break-word;overflow-x:auto}table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}</style>":"",M=C&&!y.includes("cdn.tailwindcss.com")?'<script src="https://cdn.tailwindcss.com"><\/script>':"",Y=I+E+x+M;return Y?y.includes("</head>")?y.replace("</head>",`${Y}
134
- </head>`):Y+y:y};return H?t.jsx("div",{className:"flex items-center justify-center h-64 text-gray-400 text-sm",children:"加载中…"}):t.jsxs("div",{className:"w-full bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden flex flex-col",style:{height:"calc(100vh - 90px)"},children:[t.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-gray-100 bg-white shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("button",{className:"flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition -ml-1 shrink-0 cursor-pointer",onClick:_,children:t.jsx(Ye,{size:15})}),t.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg shrink-0",style:{background:"linear-gradient(135deg, #60a5fa, #818cf8)"},children:t.jsx($t,{size:13,className:"text-white"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-semibold text-gray-800 text-sm leading-tight",children:"Article 详情"}),t.jsx("div",{className:"flex items-center gap-1 mt-0.5",children:t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0 rounded bg-blue-50 border border-blue-100 text-blue-600 font-mono text-xs leading-5 truncate max-w-[300px]",children:[t.jsx(Ot,{size:9}),"/",m==null?void 0:m.pathname]})})]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[T==="preview"&&t.jsx("div",{className:"flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60",children:Ne.map(y=>t.jsx(he,{title:y.label,children:t.jsx("button",{className:`flex items-center justify-center w-7 h-6 rounded-md text-xs transition-all duration-150 select-none cursor-pointer ${z===y.key?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50":"text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,onClick:()=>q(y.key),children:y.icon})},y.key))}),t.jsx("div",{className:"flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60",children:["preview","code"].map(y=>t.jsx("button",{className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none cursor-pointer ${T===y?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50":"text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,onClick:()=>R(y),children:y==="preview"?t.jsxs(t.Fragment,{children:[t.jsx($e,{size:11})," 预览"]}):t.jsxs(t.Fragment,{children:[t.jsx(qe,{size:11})," Code"]})},y))}),T==="code"&&t.jsx(he,{title:"复制代码",children:t.jsx("button",{className:"flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-blue-500 hover:bg-blue-50 transition cursor-pointer",onClick:A,children:t.jsx(vt,{size:14})})})]})]}),t.jsx("div",{className:`flex-1 min-h-0 ${T==="preview"?"bg-gray-100/70":""}`,children:T==="preview"?t.jsx("div",{className:"w-full h-full flex justify-center overflow-auto py-0",children:z!=="desktop"?t.jsx("div",{className:"flex flex-col items-center py-6 h-full",children:t.jsx("iframe",{srcDoc:O((m==null?void 0:m.content)||"",Ne.find(y=>y.key===z).width),sandbox:"allow-same-origin allow-scripts",title:"HTML 预览",style:{width:`${Ne.find(y=>y.key===z).width}px`,height:"100%",minHeight:0,border:"1px solid #e5e7eb",borderRadius:10,background:"#fff",boxShadow:"0 4px 24px 0 rgba(0,0,0,0.10)",flexShrink:0}})}):t.jsx("iframe",{srcDoc:O((m==null?void 0:m.content)||""),sandbox:"allow-same-origin allow-scripts",title:"HTML 预览",style:{width:"100%",height:"100%",border:"none",background:"#fff",display:"block"}})}):t.jsxs("div",{className:"h-full flex flex-col",style:{background:"#1e1e2e"},children:[t.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 border-b",style:{borderColor:"#2d2d3e",background:"#252536"},children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex gap-1.5",children:[t.jsx("span",{className:"w-3 h-3 rounded-full bg-red-400/80 inline-block"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-yellow-400/80 inline-block"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-green-400/80 inline-block"})]}),t.jsx("span",{className:"text-xs font-mono ml-2",style:{color:"#6c7086"},children:"index.html"})]}),t.jsx("span",{className:"text-xs font-mono",style:{color:"#6c7086"},children:m!=null&&m.content?`${m.content.split(`
135
- `).length} 行 · ${m.content.length} 字符`:"空"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx("pre",{className:"m-0 p-5 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",style:{color:"#cdd6f4"},children:(m==null?void 0:m.content)||t.jsx("span",{style:{color:"#585b70"},children:"// 暂无内容"})})})]})}),t.jsxs("div",{className:"shrink-0 flex items-center justify-between px-5 py-2.5 border-t border-gray-100 bg-gray-50/60",children:[t.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-400",children:[(m==null?void 0:m.createdAt)&&t.jsxs("span",{children:["创建于"," ",Me(m.createdAt).format("YYYY/MM/DD HH:mm")]}),(m==null?void 0:m.updatedAt)&&t.jsxs("span",{children:["更新于"," ",Me(m.updatedAt).format("YYYY/MM/DD HH:mm")]})]}),t.jsxs("button",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs border border-gray-200 rounded-lg hover:bg-gray-50 text-gray-600 transition cursor-pointer",onClick:p,children:[t.jsx(At,{size:12}),"编辑"]})]})]})};exports.createArticleService=fe.createArticleService;exports.defaultArticleService=fe.defaultArticleService;exports.renderArticleByPathname=fe.renderArticleByPathname;exports.ArticleDetail=sn;exports.ArticleEdit=nn;exports.ArticleList=Bt;exports.ArticlesProvider=lt;exports.ReactRouterAdapter=ut;
167
+ `},Be=Fr(Zr)(it),Kr={config:Ur},Jr=function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return function(i){return n.reduceRight(function(l,x){return x(l)},i)}};function ot(t,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&t[n]&&Object.assign(r[n],ot(t[n],r[n]))}),qe(qe({},t),r)}var Qr={type:"cancelation",msg:"operation is manually canceled"};function Ne(t){var r=!1,n=new Promise(function(s,i){t.then(function(l){return r?i(Qr):s(l)}),t.catch(i)});return n.cancel=function(){return r=!0},n}var Xr=["monaco"],en=qr.create({config:Yr,isInitialized:!1,resolve:null,reject:null,monaco:null}),ct=$r(en,2),de=ct[0],ge=ct[1];function tn(t){var r=Kr.config(t),n=r.monaco,s=Nr(r,Xr);ge(function(i){return{config:ot(i.config,s),monaco:n}})}function rn(){var t=de(function(r){var n=r.monaco,s=r.isInitialized,i=r.resolve;return{monaco:n,isInitialized:s,resolve:i}});if(!t.isInitialized){if(ge({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),Ne(ke);if(window.monaco&&window.monaco.editor)return lt(window.monaco),t.resolve(window.monaco),Ne(ke);Jr(nn,an)(on)}return Ne(ke)}function nn(t){return document.body.appendChild(t)}function sn(t){var r=document.createElement("script");return t&&(r.src=t),r}function an(t){var r=de(function(s){var i=s.config,l=s.reject;return{config:i,reject:l}}),n=sn("".concat(r.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=r.reject,n}function on(){var t=de(function(n){var s=n.config,i=n.resolve,l=n.reject;return{config:s,resolve:i,reject:l}}),r=window.require;r.config(t.config),r(["vs/editor/editor.main"],function(n){var s=n.m||n;lt(s),t.resolve(s)},function(n){t.reject(n)})}function lt(t){de().monaco||ge({monaco:t})}function cn(){return de(function(t){var r=t.monaco;return r})}var ke=new Promise(function(t,r){return ge({resolve:t,reject:r})}),dt={config:tn,init:rn,__getMonacoInstance:cn},ln={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},$e=ln,dn={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},un=dn;function hn({children:t}){return o.createElement("div",{style:un.container},t)}var mn=hn,fn=mn;function xn({width:t,height:r,isEditorReady:n,loading:s,_ref:i,className:l,wrapperProps:x}){return o.createElement("section",{style:{...$e.wrapper,width:t,height:r},...x},!n&&o.createElement(fn,null,s),o.createElement("div",{ref:i,style:{...$e.fullWidth,...!n&&$e.hide},className:l}))}var pn=xn,ut=o.memo(pn);function gn(t){o.useEffect(t,[])}var ht=gn;function bn(t,r,n=!0){let s=o.useRef(!0);o.useEffect(s.current||!n?()=>{s.current=!1}:t,r)}var K=bn;function oe(){}function se(t,r,n,s){return yn(t,s)||vn(t,r,n,s)}function yn(t,r){return t.editor.getModel(mt(t,r))}function vn(t,r,n,s){return t.editor.createModel(r,n,s?mt(t,s):void 0)}function mt(t,r){return t.Uri.parse(r)}function wn({original:t,modified:r,language:n,originalLanguage:s,modifiedLanguage:i,originalModelPath:l,modifiedModelPath:x,keepCurrentOriginalModel:p=!1,keepCurrentModifiedModel:y=!1,theme:N="light",loading:f="Loading...",options:v={},height:O="100%",width:z="100%",className:A,wrapperProps:T={},beforeMount:I=oe,onMount:_=oe}){let[H,W]=o.useState(!1),[C,P]=o.useState(!0),b=o.useRef(null),h=o.useRef(null),D=o.useRef(null),$=o.useRef(_),g=o.useRef(I),w=o.useRef(!1);ht(()=>{let a=dt.init();return a.then(c=>(h.current=c)&&P(!1)).catch(c=>(c==null?void 0:c.type)!=="cancelation"&&console.error("Monaco initialization: error:",c)),()=>b.current?d():a.cancel()}),K(()=>{if(b.current&&h.current){let a=b.current.getOriginalEditor(),c=se(h.current,t||"",s||n||"text",l||"");c!==a.getModel()&&a.setModel(c)}},[l],H),K(()=>{if(b.current&&h.current){let a=b.current.getModifiedEditor(),c=se(h.current,r||"",i||n||"text",x||"");c!==a.getModel()&&a.setModel(c)}},[x],H),K(()=>{let a=b.current.getModifiedEditor();a.getOption(h.current.editor.EditorOption.readOnly)?a.setValue(r||""):r!==a.getValue()&&(a.executeEdits("",[{range:a.getModel().getFullModelRange(),text:r||"",forceMoveMarkers:!0}]),a.pushUndoStop())},[r],H),K(()=>{var a,c;(c=(a=b.current)==null?void 0:a.getModel())==null||c.original.setValue(t||"")},[t],H),K(()=>{let{original:a,modified:c}=b.current.getModel();h.current.editor.setModelLanguage(a,s||n||"text"),h.current.editor.setModelLanguage(c,i||n||"text")},[n,s,i],H),K(()=>{var a;(a=h.current)==null||a.editor.setTheme(N)},[N],H),K(()=>{var a;(a=b.current)==null||a.updateOptions(v)},[v],H);let L=o.useCallback(()=>{var m;if(!h.current)return;g.current(h.current);let a=se(h.current,t||"",s||n||"text",l||""),c=se(h.current,r||"",i||n||"text",x||"");(m=b.current)==null||m.setModel({original:a,modified:c})},[n,r,i,t,s,l,x]),Y=o.useCallback(()=>{var a;!w.current&&D.current&&(b.current=h.current.editor.createDiffEditor(D.current,{automaticLayout:!0,...v}),L(),(a=h.current)==null||a.editor.setTheme(N),W(!0),w.current=!0)},[v,N,L]);o.useEffect(()=>{H&&$.current(b.current,h.current)},[H]),o.useEffect(()=>{!C&&!H&&Y()},[C,H,Y]);function d(){var c,m,u,S;let a=(c=b.current)==null?void 0:c.getModel();p||((m=a==null?void 0:a.original)==null||m.dispose()),y||((u=a==null?void 0:a.modified)==null||u.dispose()),(S=b.current)==null||S.dispose()}return o.createElement(ut,{width:z,height:O,isEditorReady:H,loading:f,_ref:D,className:A,wrapperProps:T})}var jn=wn;o.memo(jn);function Nn(t){let r=o.useRef();return o.useEffect(()=>{r.current=t},[t]),r.current}var kn=Nn,he=new Map;function $n({defaultValue:t,defaultLanguage:r,defaultPath:n,value:s,language:i,path:l,theme:x="light",line:p,loading:y="Loading...",options:N={},overrideServices:f={},saveViewState:v=!0,keepCurrentModel:O=!1,width:z="100%",height:A="100%",className:T,wrapperProps:I={},beforeMount:_=oe,onMount:H=oe,onChange:W,onValidate:C=oe}){let[P,b]=o.useState(!1),[h,D]=o.useState(!0),$=o.useRef(null),g=o.useRef(null),w=o.useRef(null),L=o.useRef(H),Y=o.useRef(_),d=o.useRef(),a=o.useRef(s),c=kn(l),m=o.useRef(!1),u=o.useRef(!1);ht(()=>{let j=dt.init();return j.then(M=>($.current=M)&&D(!1)).catch(M=>(M==null?void 0:M.type)!=="cancelation"&&console.error("Monaco initialization: error:",M)),()=>g.current?E():j.cancel()}),K(()=>{var M,R,V,B;let j=se($.current,t||s||"",r||i||"",l||n||"");j!==((M=g.current)==null?void 0:M.getModel())&&(v&&he.set(c,(R=g.current)==null?void 0:R.saveViewState()),(V=g.current)==null||V.setModel(j),v&&((B=g.current)==null||B.restoreViewState(he.get(l))))},[l],P),K(()=>{var j;(j=g.current)==null||j.updateOptions(N)},[N],P),K(()=>{!g.current||s===void 0||(g.current.getOption($.current.editor.EditorOption.readOnly)?g.current.setValue(s):s!==g.current.getValue()&&(u.current=!0,g.current.executeEdits("",[{range:g.current.getModel().getFullModelRange(),text:s,forceMoveMarkers:!0}]),g.current.pushUndoStop(),u.current=!1))},[s],P),K(()=>{var M,R;let j=(M=g.current)==null?void 0:M.getModel();j&&i&&((R=$.current)==null||R.editor.setModelLanguage(j,i))},[i],P),K(()=>{var j;p!==void 0&&((j=g.current)==null||j.revealLine(p))},[p],P),K(()=>{var j;(j=$.current)==null||j.editor.setTheme(x)},[x],P);let S=o.useCallback(()=>{var j;if(!(!w.current||!$.current)&&!m.current){Y.current($.current);let M=l||n,R=se($.current,s||t||"",r||i||"",M||"");g.current=(j=$.current)==null?void 0:j.editor.create(w.current,{model:R,automaticLayout:!0,...N},f),v&&g.current.restoreViewState(he.get(M)),$.current.editor.setTheme(x),p!==void 0&&g.current.revealLine(p),b(!0),m.current=!0}},[t,r,n,s,i,l,N,f,v,x,p]);o.useEffect(()=>{P&&L.current(g.current,$.current)},[P]),o.useEffect(()=>{!h&&!P&&S()},[h,P,S]),a.current=s,o.useEffect(()=>{var j,M;P&&W&&((j=d.current)==null||j.dispose(),d.current=(M=g.current)==null?void 0:M.onDidChangeModelContent(R=>{u.current||W(g.current.getValue(),R)}))},[P,W]),o.useEffect(()=>{if(P){let j=$.current.editor.onDidChangeMarkers(M=>{var V;let R=(V=g.current.getModel())==null?void 0:V.uri;if(R&&M.find(B=>B.path===R.path)){let B=$.current.editor.getModelMarkers({resource:R});C==null||C(B)}});return()=>{j==null||j.dispose()}}return()=>{}},[P,C]);function E(){var j,M;(j=d.current)==null||j.dispose(),O?v&&he.set(l,g.current.saveViewState()):(M=g.current.getModel())==null||M.dispose(),g.current.dispose()}return o.createElement(ut,{width:z,height:A,isEditorReady:P,loading:y,_ref:w,className:T,wrapperProps:I})}var Sn=$n,Mn=o.memo(Sn),Cn=Mn;function xe({title:t,children:r,placement:n="top",align:s="center",variant:i="default"}){const[l,x]=o.useState(!1),[p,y]=o.useState(null),N=o.useRef(null),f=o.useRef(null),v=o.useRef(void 0),O=o.useRef(!1),z=o.useRef(null),A=o.useId(),T=()=>{clearTimeout(v.current),O.current=!1,z.current=null,x(!1),y(null)},I=()=>{clearTimeout(v.current),x(!0)},_=()=>{clearTimeout(v.current),!O.current&&(v.current=setTimeout(()=>{O.current||T()},150))},H=()=>{i==="card"&&(O.current=!0,I())},W=C=>{var P,b;return C instanceof Node&&(((P=N.current)==null?void 0:P.contains(C))||((b=f.current)==null?void 0:b.contains(C)))};return o.useEffect(()=>()=>clearTimeout(v.current),[]),o.useEffect(()=>{if(!l)return;const C=b=>{W(b.target)||T()},P=b=>{b.key==="Escape"&&T()};return document.addEventListener("pointerdown",C),document.addEventListener("keydown",P),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",P)}},[l]),o.useLayoutEffect(()=>{if(!l||!t)return;const C=()=>{const b=N.current,h=f.current;if(!b||!h)return;const D=12,$=6,g=b.getBoundingClientRect(),w=Math.max(0,g.top-D-$),L=Math.max(0,window.innerHeight-g.bottom-D-$),Y=i==="card"?420:320;if(!z.current){const m=i==="card"?Y:Math.min(Y,h.getBoundingClientRect().height),u=n==="top"?w>=m||w>=L:!(L>=m||L>=w);z.current=u?"top":"bottom"}const d=z.current==="top";h.style.maxHeight=`${Math.min(Y,d?w:L)}px`;const{width:a,height:c}=h.getBoundingClientRect();y({left:Math.max(D,Math.min(s==="end"?g.right-a:g.left+(g.width-a)/2,window.innerWidth-a-D)),top:d?g.top-c-$:g.bottom+$})};C();const P=new ResizeObserver(C);return f.current&&P.observe(f.current),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{P.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[l,t,n,s,i]),t?e.jsxs("div",{ref:N,className:"inline-flex","aria-describedby":l&&i==="default"?A:void 0,onMouseEnter:I,onMouseLeave:_,onPointerDown:H,onClick:()=>{i==="default"&&T()},onFocus:I,onBlur:C=>{W(C.relatedTarget)||(C.relatedTarget?T():_())},children:[r,l&&Ue.createPortal(e.jsx("div",{ref:f,id:A,role:i==="card"?"dialog":"tooltip","aria-label":i==="card"?"校验问题":void 0,className:`aisee-articles-tooltip aisee-articles-tooltip--${i}`,style:{width:i==="card"?480:"max-content",maxWidth:"min(480px, calc(100vw - 24px))",overflowWrap:"anywhere",scrollbarWidth:"thin",left:(p==null?void 0:p.left)??0,top:(p==null?void 0:p.top)??0,visibility:p?"visible":"hidden"},onMouseEnter:I,onMouseLeave:_,onPointerDown:H,onFocus:I,children:t}),document.body)]}):e.jsx(e.Fragment,{children:r})}const Se=[{key:"desktop",icon:e.jsx(Xe,{size:13}),label:"桌面",width:null},{key:"tablet",icon:e.jsx(nt,{size:13}),label:"平板",width:768},{key:"mobile",icon:e.jsx(rt,{size:13}),label:"手机",width:390}],En=({id:t,record:r})=>{const{navigate:n,params:s,locationState:i}=Te(),l=t??s.id,{basePath:x,service:p,previewBaseUrl:y,previewTailwind:N}=pe(),f=!!l,[v,O]=st(),[z,A]=o.useState(!1),[T,I]=o.useState(r??(i==null?void 0:i.record)??null),[_,H]=o.useState(""),[W,C]=o.useState(f?"":"https://aisee.live"),[P,b]=o.useState(""),[h,D]=o.useState(""),[$,g]=o.useState({navEnabled:!1,navname:"",navPlacements:[]}),w=k=>g({navEnabled:k.navEnabled??!1,navname:k.navname??"",navPlacements:k.navPlacements??[]}),[L,Y]=o.useState(""),[d,a]=o.useState("code"),[c,m]=o.useState(!1),[u,S]=o.useState("desktop"),[E,j]=o.useState(!1),[M,R]=o.useState(null),V=(k,U)=>{const F=y?`<base href="${y}">`:"",Z=U?`<meta name="viewport" content="width=${U}, initial-scale=1">`:"",re=U?"<style>*,*::before,*::after{box-sizing:border-box}img,video,svg,canvas,audio{max-width:100%;height:auto}pre{white-space:pre-wrap;word-break:break-word;overflow-x:auto}table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}</style>":"",be=N&&!k.includes("cdn.tailwindcss.com")?'<script src="https://cdn.tailwindcss.com"><\/script>':"",ye=F+Z+re+be;return ye?k.includes("</head>")?k.replace("</head>",`${ye}
168
+ </head>`):ye+k:k},B=async()=>{if(!L.trim()){G.warning("请先输入 HTML 代码");return}j(!0),R(null);try{const k=await He(L);R(k),k.networkError?G.warning("W3C 校验服务不可用"):k.isValid&&G.success("HTML 校验通过")}finally{j(!1)}};o.useEffect(()=>{f&&(T?(H(T.pathname||""),C(T.host||""),Y(T.content||""),w(T)):p.getById(l).then(k=>{I(k),H(k.pathname||""),C(k.host||""),Y(k.content||""),w(k)}).catch(k=>{G.error(k.message||"获取文章失败"),n(x)}))},[l]);const J=()=>n(x),Q=!_.trim(),te=L.split(`
169
+ `).length,X=async()=>{if(z)return;if(!_.trim()){D("请输入访问路径");return}if(!L.trim()){m(!0),G.error("请先输入 HTML 代码");return}const k=W.trim().replace(/\/+$/,"");try{const F=new URL(k);if(!["http:","https:"].includes(F.protocol)||F.search||F.hash||F.username||F.password)throw new Error}catch{b("请输入有效的网站地址,需以 http:// 或 https:// 开头");return}if(p.getNavigationGroups&&$.navEnabled){if(!$.navname.trim()){G.error("开启导航后,请填写导航名称");return}if(!$.navPlacements.length){G.error("请至少选择一个展示位置");return}}A(!0);const U=await He(L);if(A(!1),U.networkError)G.warning("W3C 校验服务不可用,已跳过校验");else if(!U.isValid&&!await new Promise(Z=>{v.confirm({title:"HTML 校验发现问题",content:e.jsxs("div",{className:"mt-1",children:[e.jsx("p",{className:"text-gray-600 mb-2",children:"检测到以下 W3C 标准问题,仍要保存吗?"}),e.jsxs("ul",{className:"space-y-1",children:[U.errors.slice(0,5).map((re,be)=>e.jsxs("li",{className:"flex items-start gap-1.5 text-red-500 text-sm",children:[e.jsx("span",{className:"shrink-0",children:"✕"}),e.jsxs("span",{children:[re.lastLine?`第 ${re.lastLine} 行:`:"",re.message]})]},be)),U.errors.length>5&&e.jsxs("li",{className:"text-gray-400 text-xs mt-1",children:["另有 ",U.errors.length-5," 个问题"]})]})]}),okText:"仍然保存",cancelText:"返回修改",onOk:()=>Z(!0),onCancel:()=>Z(!1)})}))return;A(!0);try{const F={pathname:_.trim(),content:L,host:k,...p.getNavigationGroups?{navEnabled:$.navEnabled,navname:$.navname.trim()||null,navPlacements:$.navPlacements.map(({position:Z,parentNavId:re})=>({position:Z,parentNavId:re||null}))}:{}};f&&T?(await p.update(T.id,F),G.success("编辑成功")):(await p.create(F),G.success("新增成功")),n(x)}catch(F){G.error(F.message||"保存失败")}finally{A(!1)}};return e.jsxs(e.Fragment,{children:[O,e.jsxs("div",{className:"w-full bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden flex flex-col",style:{height:"calc(100vh - 90px)"},children:[e.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-gray-50/60",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{"aria-label":"返回文章列表",className:"flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-200 transition -ml-1 cursor-pointer",onClick:J,children:e.jsx(Ke,{size:15})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-semibold text-gray-800 leading-tight",children:f?"编辑文章":"新增文章"}),f&&T&&e.jsxs("div",{className:"text-xs text-gray-400 mt-0.5 font-mono",children:["/",T.pathname]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{className:"px-4 py-1.5 border border-gray-200 rounded-lg text-sm text-gray-600 hover:bg-gray-50 transition cursor-pointer",onClick:J,children:"取消"}),e.jsx("button",{disabled:Q||z,className:"px-4 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",onClick:X,children:z?"保存中…":"保存"})]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[e.jsxs("div",{className:"shrink-0 px-6 pt-5 pb-4 border-b border-gray-100",children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:["访问路径",e.jsx("span",{className:"text-xs text-gray-400 font-normal ml-1.5",children:"前台页面路径"})]}),e.jsxs("div",{className:`flex items-center border rounded-lg transition focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-400 ${h?"border-red-400 ring-2 ring-red-500/20":"border-gray-200"}`,children:[e.jsx("span",{className:"pl-3 text-gray-400 select-none text-sm shrink-0",children:"/"}),e.jsx("input",{className:"flex-1 pr-3 py-1.5 text-sm bg-transparent focus:outline-none",placeholder:"例如 about-us",value:_,onChange:k=>{H(k.target.value),h&&D("")}})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1.5",children:"建议使用小写字母,不能包含空格,例如 about-us。"}),h&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:h})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:["网站地址",e.jsx("span",{className:"text-red-500 ml-1",children:"*"}),e.jsx("span",{className:"text-xs text-gray-400 font-normal ml-1.5",children:"网站基础地址"})]}),e.jsx("input",{className:"w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition",placeholder:"例如 https://aisee.live",value:W,"aria-label":"网站地址","aria-invalid":!!P,onChange:k=>{const U=k.target.value;U.trim().replace(/\/+$/,"")!==W.trim().replace(/\/+$/,"")&&g(F=>({...F,navPlacements:F.navPlacements.map(Z=>({...Z,parentNavId:null}))})),C(U),b("")}}),P&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-red-500",children:P})]})]}),e.jsx(pr,{host:W,service:p,value:$,onChange:g})]}),e.jsx("div",{className:"shrink-0 border-b border-gray-100 bg-gray-50/40",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-6 py-2",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60",children:[e.jsxs("button",{className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none cursor-pointer ${d==="code"?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50":"text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,onClick:()=>a("code"),children:[e.jsx(_e,{size:11})," 代码"]}),e.jsxs("button",{className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none ${d==="preview"?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50 cursor-pointer":L?"text-gray-400 hover:text-gray-600 hover:bg-white/50 cursor-pointer":"text-gray-300 cursor-not-allowed"}`,onClick:()=>a("preview"),disabled:!L,children:[e.jsx(Ee,{size:11})," 预览"]})]})}),d==="preview"&&L&&e.jsx("div",{className:"flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60",children:Se.map(k=>e.jsx(xe,{title:k.label,children:e.jsx("button",{className:`flex items-center justify-center w-7 h-6 rounded-md text-xs transition-all duration-150 select-none cursor-pointer ${u===k.key?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50":"text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,onClick:()=>S(k.key),children:k.icon})},k.key))}),d==="code"&&e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[L&&e.jsxs("span",{className:"text-xs text-gray-400",children:[te," 行 · ",L.length," 字符"]}),M&&!M.networkError&&(M.isValid?e.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-50 border border-green-200 text-green-600 text-xs",children:[e.jsx(Re,{size:11})," 校验通过"]}):e.jsx(xe,{variant:"card",align:"end",title:e.jsx(br,{errors:M.errors,source:L}),children:e.jsxs("span",{tabIndex:0,className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-50 border border-red-200 text-red-500 text-xs cursor-default",children:["✕"," ",M.errors.length," 个问题"]})})),e.jsxs("button",{disabled:!L||E,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs border border-gray-200 rounded-lg hover:bg-gray-50 text-gray-600 transition disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",onClick:B,children:[e.jsx(Re,{size:12}),E?"校验中…":"W3C 校验"]})]})]})}),e.jsxs("div",{className:"relative min-h-[320px] flex-1 shrink-0",children:[e.jsx("div",{className:"absolute inset-0",style:{display:d==="code"?"block":"none",outline:c?"2px solid #ff4d4f":"none"},children:e.jsx(Cn,{height:"100%",language:"html",theme:"vs-dark",value:L,onChange:k=>{Y(k??""),c&&m(!1),M&&R(null)},options:{fontSize:13,minimap:{enabled:!1},wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,formatOnPaste:!0,lineNumbers:"on",renderWhitespace:"none",smoothScrolling:!0,cursorBlinking:"smooth",padding:{top:12,bottom:12}}})}),d==="preview"&&(L?e.jsx("div",{className:"absolute inset-0 overflow-auto bg-gray-100/60 flex justify-center",children:u!=="desktop"?e.jsx("div",{className:"flex flex-col items-center py-6 h-full",children:e.jsx("iframe",{srcDoc:V(L,Se.find(k=>k.key===u).width),sandbox:"allow-same-origin allow-scripts",title:"HTML 预览",style:{width:`${Se.find(k=>k.key===u).width}px`,height:"100%",minHeight:0,border:"1px solid #e5e7eb",borderRadius:10,background:"#fff",boxShadow:"0 4px 24px 0 rgba(0,0,0,0.10)",flexShrink:0}})}):e.jsx("iframe",{srcDoc:V(L),sandbox:"allow-same-origin allow-scripts",title:"HTML 预览",style:{width:"100%",height:"100%",border:"none",background:"#fff",display:"block"}})}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-300 gap-3 select-none",children:[e.jsx(Ee,{size:36}),e.jsx("span",{className:"text-sm",children:"请先输入 HTML 代码以预览"})]}))]})]})]})]})},Me=[{key:"desktop",icon:e.jsx(Xe,{size:13}),label:"Desktop",width:null},{key:"tablet",icon:e.jsx(nt,{size:13}),label:"Tablet",width:768},{key:"mobile",icon:e.jsx(rt,{size:13}),label:"Mobile",width:390}],On=({id:t,record:r})=>{const{navigate:n,params:s,locationState:i}=Te(),l=t??s.id,{basePath:x,service:p,previewBaseUrl:y,previewTailwind:N}=pe(),[f,v]=o.useState(r??(i==null?void 0:i.record)??null),[O,z]=o.useState(!1),[A,T]=o.useState("preview"),[I,_]=o.useState("desktop");o.useEffect(()=>{!f&&l&&(z(!0),p.getById(l).then(v).catch(b=>{G.error(b.message||"获取数据失败"),n(x)}).finally(()=>z(!1)))},[l]);const H=()=>n(x),W=()=>n(`${x}/${l}/edit`,{state:{record:f}}),C=()=>{f!=null&&f.content&&(navigator.clipboard.writeText(f.content),G.success("已复制到剪贴板"))},P=(b,h)=>{const D=y?`<base href="${y}">`:"",$=h?`<meta name="viewport" content="width=${h}, initial-scale=1">`:"",g=h?"<style>*,*::before,*::after{box-sizing:border-box}img,video,svg,canvas,audio{max-width:100%;height:auto}pre{white-space:pre-wrap;word-break:break-word;overflow-x:auto}table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}</style>":"",w=N&&!b.includes("cdn.tailwindcss.com")?'<script src="https://cdn.tailwindcss.com"><\/script>':"",L=D+$+g+w;return L?b.includes("</head>")?b.replace("</head>",`${L}
170
+ </head>`):L+b:b};return O?e.jsx("div",{className:"flex items-center justify-center h-64 text-gray-400 text-sm",children:"加载中…"}):e.jsxs("div",{className:"w-full bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden flex flex-col",style:{height:"calc(100vh - 90px)"},children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-gray-100 bg-white shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{className:"flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition -ml-1 shrink-0 cursor-pointer",onClick:H,children:e.jsx(Ke,{size:15})}),e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg shrink-0",style:{background:"linear-gradient(135deg, #60a5fa, #818cf8)"},children:e.jsx(Vt,{size:13,className:"text-white"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-semibold text-gray-800 text-sm leading-tight",children:"Article 详情"}),e.jsx("div",{className:"flex items-center gap-1 mt-0.5",children:e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0 rounded bg-blue-50 border border-blue-100 text-blue-600 font-mono text-xs leading-5 truncate max-w-[300px]",children:[e.jsx(Ut,{size:9}),"/",f==null?void 0:f.pathname]})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[A==="preview"&&e.jsx("div",{className:"flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60",children:Me.map(b=>e.jsx(xe,{title:b.label,children:e.jsx("button",{className:`flex items-center justify-center w-7 h-6 rounded-md text-xs transition-all duration-150 select-none cursor-pointer ${I===b.key?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50":"text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,onClick:()=>_(b.key),children:b.icon})},b.key))}),e.jsx("div",{className:"flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60",children:["preview","code"].map(b=>e.jsx("button",{className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none cursor-pointer ${A===b?"bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50":"text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,onClick:()=>T(b),children:b==="preview"?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:11})," 预览"]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{size:11})," Code"]})},b))}),A==="code"&&e.jsx(xe,{title:"复制代码",children:e.jsx("button",{type:"button","aria-label":"复制代码",className:"flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-blue-500 hover:bg-blue-50 transition cursor-pointer",onClick:C,children:e.jsx(At,{size:14})})})]})]}),e.jsx("div",{className:`flex-1 min-h-0 ${A==="preview"?"bg-gray-100/70":""}`,children:A==="preview"?e.jsx("div",{className:"w-full h-full flex justify-center overflow-auto py-0",children:I!=="desktop"?e.jsx("div",{className:"flex flex-col items-center py-6 h-full",children:e.jsx("iframe",{srcDoc:P((f==null?void 0:f.content)||"",Me.find(b=>b.key===I).width),sandbox:"allow-same-origin allow-scripts",title:"HTML 预览",style:{width:`${Me.find(b=>b.key===I).width}px`,height:"100%",minHeight:0,border:"1px solid #e5e7eb",borderRadius:10,background:"#fff",boxShadow:"0 4px 24px 0 rgba(0,0,0,0.10)",flexShrink:0}})}):e.jsx("iframe",{srcDoc:P((f==null?void 0:f.content)||""),sandbox:"allow-same-origin allow-scripts",title:"HTML 预览",style:{width:"100%",height:"100%",border:"none",background:"#fff",display:"block"}})}):e.jsxs("div",{className:"h-full flex flex-col",style:{background:"#1e1e2e"},children:[e.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 border-b",style:{borderColor:"#2d2d3e",background:"#252536"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded-full bg-red-400/80 inline-block"}),e.jsx("span",{className:"w-3 h-3 rounded-full bg-yellow-400/80 inline-block"}),e.jsx("span",{className:"w-3 h-3 rounded-full bg-green-400/80 inline-block"})]}),e.jsx("span",{className:"text-xs font-mono ml-2",style:{color:"#6c7086"},children:"index.html"})]}),e.jsx("span",{className:"text-xs font-mono",style:{color:"#6c7086"},children:f!=null&&f.content?`${f.content.split(`
171
+ `).length} 行 · ${f.content.length} 字符`:"空"})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("pre",{className:"m-0 p-5 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",style:{color:"#cdd6f4"},children:(f==null?void 0:f.content)||e.jsx("span",{style:{color:"#585b70"},children:"// 暂无内容"})})})]})}),e.jsxs("div",{className:"shrink-0 flex items-center justify-between px-5 py-2.5 border-t border-gray-100 bg-gray-50/60",children:[e.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-400",children:[(f==null?void 0:f.createdAt)&&e.jsxs("span",{children:["创建于"," ",Oe(f.createdAt).format("YYYY/MM/DD HH:mm")]}),(f==null?void 0:f.updatedAt)&&e.jsxs("span",{children:["更新于"," ",Oe(f.updatedAt).format("YYYY/MM/DD HH:mm")]})]}),e.jsxs("button",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs border border-gray-200 rounded-lg hover:bg-gray-50 text-gray-600 transition cursor-pointer",onClick:W,children:[e.jsx(Qt,{size:12}),"编辑"]})]})]})};exports.ArticleServiceError=le.ArticleServiceError;exports.createArticleService=le.createArticleService;exports.defaultArticleService=le.defaultArticleService;exports.renderArticleByPathname=le.renderArticleByPathname;exports.ArticleDetail=On;exports.ArticleEdit=En;exports.ArticleList=mr;exports.ArticlesProvider=yt;exports.ReactRouterAdapter=vt;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ export { ReactRouterAdapter } from './router/ReactRouterAdapter';
4
4
  export { default as ArticleList } from './pages/ArticleList';
5
5
  export { default as ArticleEdit } from './pages/ArticleEdit';
6
6
  export { default as ArticleDetail } from './pages/ArticleDetail';
7
- export type { Article, ArticleService, ArticlesConfig } from './types';
8
- export { createArticleService, defaultArticleService } from './service';
7
+ export type { Article, ArticleService, ArticlesConfig, ArticleNavigation, NavPosition, NavPlacement, NavigationGroup, NavigationGroupParams, CreateNavigationGroupInput } from './types';
8
+ export { createArticleService, defaultArticleService, ArticleServiceError } from './service';
9
+ export type { ArticleServiceOptions } from './service';
9
10
  export { renderArticleByPathname } from './renderArticle';
10
11
  export type { RenderArticleOptions } from './renderArticle';