semaphor 0.0.44 → 0.0.45

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.
@@ -0,0 +1,228 @@
1
+ "use strict";const t=require("./index-lMbivOVQ.js"),T=require("react");/**
2
+ * @license lucide-react v0.379.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ui=t.createLucideIcon("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
7
+ * @license lucide-react v0.379.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ci=t.createLucideIcon("AreaChart",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M7 12v5h12V8l-5 5-4-4Z",key:"zxz28u"}]]);/**
12
+ * @license lucide-react v0.379.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Ut=t.createLucideIcon("BarChart4",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
17
+ * @license lucide-react v0.379.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const pi=t.createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
22
+ * @license lucide-react v0.379.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const xi=t.createLucideIcon("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
27
+ * @license lucide-react v0.379.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const di=t.createLucideIcon("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
32
+ * @license lucide-react v0.379.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const ir=t.createLucideIcon("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
37
+ * @license lucide-react v0.379.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const mi=t.createLucideIcon("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
42
+ * @license lucide-react v0.379.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const hi=t.createLucideIcon("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
47
+ * @license lucide-react v0.379.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const fi=t.createLucideIcon("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
52
+ * @license lucide-react v0.379.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const gi=t.createLucideIcon("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
57
+ * @license lucide-react v0.379.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const ji=t.createLucideIcon("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
62
+ * @license lucide-react v0.379.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const $t=t.createLucideIcon("LineChart",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/**
67
+ * @license lucide-react v0.379.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const yi=t.createLucideIcon("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/**
72
+ * @license lucide-react v0.379.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const Ei=t.createLucideIcon("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/**
77
+ * @license lucide-react v0.379.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const bi=t.createLucideIcon("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);/**
82
+ * @license lucide-react v0.379.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const Si=t.createLucideIcon("MessageSquareMore",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/**
87
+ * @license lucide-react v0.379.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const ki=t.createLucideIcon("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
92
+ * @license lucide-react v0.379.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const sr=t.createLucideIcon("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
97
+ * @license lucide-react v0.379.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const or=t.createLucideIcon("PieChart",[["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}],["path",{d:"M22 12A10 10 0 0 0 12 2v10z",key:"1rfc4y"}]]);/**
102
+ * @license lucide-react v0.379.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const Ri=t.createLucideIcon("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
107
+ * @license lucide-react v0.379.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const Ci=t.createLucideIcon("Plug2",[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0v0Z",key:"nd4hoy"}]]);/**
112
+ * @license lucide-react v0.379.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const lr=t.createLucideIcon("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
117
+ * @license lucide-react v0.379.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const wi=t.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
122
+ * @license lucide-react v0.379.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 ar=t.createLucideIcon("ScatterChart",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v18h18",key:"1s2lah"}]]);/**
127
+ * @license lucide-react v0.379.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 vi=t.createLucideIcon("ShieldQuestion",[["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.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
132
+ * @license lucide-react v0.379.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 Ni=t.createLucideIcon("SwatchBook",[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h0.01",key:"10821z"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]]);/**
137
+ * @license lucide-react v0.379.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 Kt=t.createLucideIcon("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
142
+ * @license lucide-react v0.379.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 Ii=t.createLucideIcon("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
147
+ * @license lucide-react v0.379.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 Ai=t.createLucideIcon("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
152
+ * @license lucide-react v0.379.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 Ti=t.createLucideIcon("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
157
+ * @license lucide-react v0.379.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const Li=t.createLucideIcon("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);function zi(){const[e,n]=T.useState(""),[r,i]=T.useState(!1),[s,o]=T.useState(!1),l=t.useDashboardStore(u=>u.dashboard);function a(){const u=t.getDashbaordStateWithoutData(l),c=t.getBookmarkKey(l.id),x=JSON.parse(localStorage.getItem(c)||"[]");if(x.some(m=>m.name===e)){i(!0);return}x.push({name:e,template:u}),localStorage.setItem(c,JSON.stringify(x)),o(!1)}return t.jsxRuntimeExports.jsxs(t.Dialog,{open:s,onOpenChange:o,children:[t.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsxs(t.Button,{variant:"outline",className:"h-7 p-2",size:"sm",children:[t.jsxRuntimeExports.jsx(lr,{className:" mr-2 h-4 w-4",strokeWidth:1.5}),"Add Lens"]})}),t.jsxRuntimeExports.jsxs(t.DialogContent,{className:"sm:max-w-[425px]",children:[t.jsxRuntimeExports.jsxs(t.DialogHeader,{children:[t.jsxRuntimeExports.jsx(t.DialogTitle,{children:"Add a Lens"}),t.jsxRuntimeExports.jsx(t.DialogDescription,{children:"Lenses are private by default and are only visible to you."})]}),t.jsxRuntimeExports.jsx("div",{className:"grid gap-4 py-4",children:t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-right",children:"Name"}),t.jsxRuntimeExports.jsx(t.Input,{value:e,onChange:u=>{r&&i(!1),n(u.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),r&&t.jsxRuntimeExports.jsx("p",{className:"text-sm",children:"The bookmark name already exists. Use a differnet name."}),t.jsxRuntimeExports.jsx(t.DialogFooter,{children:t.jsxRuntimeExports.jsx(t.Button,{variant:"outline",type:"submit",disabled:!e,onClick:a,children:"Save"})})]})]})}function Oi(){const[e,n]=T.useState(!1),[r,i]=T.useState(""),s=t.useDashboardStore(d=>d.dashboard),o=t.useDashboardStore(d=>d.bookmarkKey),[l,a]=T.useState([]),u=t.useDashboardStore(d=>d.actions.setDashboard),c=t.useDashboardStore(d=>d.actions.setFilterValues),x=t.useDashboardStore(d=>d.actions.setBookmarkKey);T.useEffect(()=>{const d=t.getBookmarkKey(s.id),j=JSON.parse(localStorage.getItem(d)||"[]");a(j);const E=j.find(S=>S.default);E&&E.name===o&&i(E.name)},[e,s,o]);function p(d){if(d===r)return;const j=l.find(S=>S.name===d),E=j==null?void 0:j.template;E&&(u(E),c(j.filterValues||[]),x(d==="Original"?"":d)),i(d)}function m(d){const j=t.getBookmarkKey(s.id),S=JSON.parse(localStorage.getItem(j)||"[]").filter(y=>y.name!==d);localStorage.setItem(j,JSON.stringify(S)),a(S)}return t.jsxRuntimeExports.jsxs(t.DropdownMenu,{open:e,onOpenChange:n,children:[t.jsxRuntimeExports.jsx(t.DropdownMenuTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{variant:"outline",className:"h-7 p-2",children:t.jsxRuntimeExports.jsx(mi,{className:"h-4 w-4",strokeWidth:1.5})})}),t.jsxRuntimeExports.jsxs(t.DropdownMenuContent,{className:"w-56",children:[t.jsxRuntimeExports.jsx(t.DropdownMenuLabel,{children:"Lenses"}),t.jsxRuntimeExports.jsx(t.DropdownMenuSeparator,{}),t.jsxRuntimeExports.jsxs(t.DropdownMenuRadioGroup,{value:r,onValueChange:p,children:[t.jsxRuntimeExports.jsx(t.DropdownMenuRadioItem,{value:"Original",children:"Original"}),l.filter(d=>d.name!="Original").map((d,j)=>t.jsxRuntimeExports.jsxs(t.DropdownMenuRadioItem,{className:"xbg-red-100 flex justify-between",value:d.name,defaultChecked:d.name===o,children:[t.jsxRuntimeExports.jsx("p",{children:d.name}),t.jsxRuntimeExports.jsx(t.Cross2Icon,{onClick:E=>{E.preventDefault(),m(d.name)},className:"h-3 w-3 hover:cursor-pointer",strokeWidth:1.5})]},j))]})]})]})}function Di(){const[e,n]=T.useState(!1),r=t.useDashboardStore(o=>o.dashboard),i=t.useDashboardStore(o=>o.bookmarkKey);T.useEffect(()=>{if(!i){n(!1);return}const o=t.getBookmarkKey(r.id),a=JSON.parse(localStorage.getItem(o)||"[]").find(u=>u.name===i);n(a?a.default:!1)},[i,r.id]);function s(o){if(n(o),!i)return;const l=t.getBookmarkKey(r.id),u=JSON.parse(localStorage.getItem(l)||"[]").map(c=>(c.name===i?c.default=o:c.default=!1,c));console.log(u),localStorage.setItem(l,JSON.stringify(u))}return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.Checkbox,{checked:e,onCheckedChange:s,id:"terms"}),t.jsxRuntimeExports.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Set as default"})]})}function Fi(){const e=t.useDashboardStore(y=>y.bookmarkKey),n=t.useDashboardStore(y=>y.dashboard);t.useDashboardStore(y=>y.selectedSheetId);const r=t.useDashboardStore(y=>y.isDashboardEditing),i=t.useDashboardStore(y=>y.filterValues),s=t.useDashboardStore(y=>y.isVisualEditing),o=t.useDashboardStore(y=>y.showFilters);t.useDashboardStore(y=>y.showDashboardJSON);const l=t.useDashboardStore(y=>y.onSaveFunction),a=t.useDashboardStore(y=>y.actions.setShowFilters),{addFrame:u,setSelectedFrameId:c}=t.useDashboardStore(y=>y.actions),{getSelectedSheet:x,setIsDashboardEditing:p,setShowDashboardJSON:m}=t.useDashboardStore(y=>y.actions),d=x(),j=()=>{if(!r||!d)return;const y={id:t.v4(),title:"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}]},type:"bar",sql:"select COUNT(*) from YOUR_TABLE",data:[]},w={id:t.v4(),cards:[y],activeCardId:y.id};u(d.id,w),c(w.id)},E=()=>{p(!0)};function S(){if(!e||e==="")return;const y=t.getDashbaordStateWithoutData(n),w=t.getBookmarkKey(n.id),k=JSON.parse(localStorage.getItem(w)||"[]"),L=k.findIndex(D=>D.name===e);L!==-1?k[L]={name:e,template:y,default:k[L].default,filterValues:i}:k.push({name:e,template:y,filterValues:i}),localStorage.setItem(w,JSON.stringify(k)),l==null||l(y)}return s?null:t.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pt-2",role:"dashboard-controls",children:[!s&&t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxRuntimeExports.jsx(t.Label,{children:e}),!!e&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"|"}),t.jsxRuntimeExports.jsx(Di,{})]})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[r&&!s&&t.jsxRuntimeExports.jsx(zi,{}),!s&&t.jsxRuntimeExports.jsx(Oi,{}),r&&!s&&t.jsxRuntimeExports.jsxs(t.Button,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!r,onClick:j,children:[t.jsxRuntimeExports.jsx(lr,{className:"mr-2 h-4 w-4",strokeWidth:1.5}),"Add Frame"]}),!r&&t.jsxRuntimeExports.jsx(t.Button,{variant:"outline",className:"h-7 p-2",onClick:E,size:"sm",children:t.jsxRuntimeExports.jsx(sr,{className:"h-4 w-4",strokeWidth:1.5})}),r&&!s&&t.jsxRuntimeExports.jsx(t.Button,{variant:"outline",role:"close",className:"h-7 p-2",onClick:()=>{p(!1),m(!1)},size:"sm",children:t.jsxRuntimeExports.jsx(t.Cross2Icon,{className:"h-4 w-4",strokeWidth:1.5})}),r&&!s&&t.jsxRuntimeExports.jsx(t.Button,{className:"h-7 p-2",variant:"outline",onClick:S,size:"sm",children:t.jsxRuntimeExports.jsx(wi,{className:"h-4 w-4",strokeWidth:1.5})}),!o&&!s&&r&&t.jsxRuntimeExports.jsx(t.Button,{className:"h-7 p-2",variant:"outline",onClick:()=>a(!0),size:"sm",children:t.jsxRuntimeExports.jsx(ir,{className:"h-4 w-4",strokeWidth:1.5})}),!s&&r&&!1,!s&&!1]})]})}function Ke({title:e,items:n,value:r,isLoading:i,isError:s,connectionTooltip:o,onChange:l,className:a,showIcon:u=!0}){const c=i?"Loading...":s?"Error":r;function x(){if(e==="Connection")return t.jsxRuntimeExports.jsx(Ci,{className:"size-4 rotate-90"});if(e==="Database")return t.jsxRuntimeExports.jsx(xi,{className:"size-4"});if(e==="Schema")return t.jsxRuntimeExports.jsx(ki,{className:"size-4"});if(e==="Table")return t.jsxRuntimeExports.jsx(Kt,{className:"size-4"})}return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[u&&t.jsxRuntimeExports.jsx("div",{className:"shrink-0",children:o?t.jsxRuntimeExports.jsxs(t.Tooltip,{children:[t.jsxRuntimeExports.jsx(t.TooltipTrigger,{children:x()}),t.jsxRuntimeExports.jsx(t.TooltipContent,{className:"text-xs",align:"start",children:o})]}):x()}),t.jsxRuntimeExports.jsxs(t.Select,{value:c,onValueChange:l,children:[t.jsxRuntimeExports.jsx(t.SelectTrigger,{className:t.cn("h-9 w-[190px] focus:ring-1 focus:ring-offset-0",a),children:t.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:i?"Loading...":s?"Error":`Select ${e}`})}),t.jsxRuntimeExports.jsx(t.SelectContent,{children:t.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[i?t.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Loading..."}):t.jsxRuntimeExports.jsx(t.SelectLabel,{children:e}),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:n&&n.map((p,m)=>t.jsxRuntimeExports.jsx(t.SelectItem,{value:p.id,children:p.name},m))}),(i||s)&&t.jsxRuntimeExports.jsx(t.SelectItem,{value:c,children:c})]})})]})]})}function Mi({column:e}){const[n,r]=T.useState(!1),i=t.useEditorStore(x=>x.selectedTableName),s=t.useEditorStore(x=>x.selectedSchemaName),o=t.useEditorStore(x=>x.sqlGen),l=t.useEditorStore(x=>x.actions.setSqlGen),a=t.useEditorStore(x=>x.actions.setCardSql),u=t.useEditorStore(x=>x.actions.setRunSql);function c(x,p){const m=t.createSqlGenConfig(x,o,p);l(m);const d=t.getSql(m,t.fmt(s||""),t.fmt(i));d&&(a(d),u(!0)),r(!1)}return t.jsxRuntimeExports.jsxs(t.Popover,{open:n,onOpenChange:r,children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.ChevronDown,{className:"h-4 w-4 cursor-pointer text-foreground/40"})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{align:"center",className:"w-18 rounded-md p-0 shadow-none",children:t.jsxRuntimeExports.jsxs("ul",{className:"text-xs",children:[t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"COUNT"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Count"}),t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"AVG"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Avg"}),t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"SUM"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Sum"}),t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"MAX"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Max"}),t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"MIN"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Min"})]})})]})}function ur({column:e}){return t.jsxRuntimeExports.jsxs(t.Tooltip,{children:[t.jsxRuntimeExports.jsx(t.$a093c7e1ec25a057$export$8c610744efcf8a1d,{asChild:!0,children:t.TEXT_DATA_TYPES.includes(e.data_type.toLowerCase())?t.jsxRuntimeExports.jsx(Ti,{className:"size-3"}):t.NUMBER_DATA_TYPES.includes(e.data_type.toLowerCase())?t.jsxRuntimeExports.jsx(gi,{className:"size-3"}):t.DATE_DATA_TYPES.includes(e.data_type.toLowerCase())?t.jsxRuntimeExports.jsx(t.Calendar,{className:"size-3"}):t.BOOLEAN_DATA_TYPES.includes(e.data_type.toLowerCase())?t.jsxRuntimeExports.jsx(Ai,{className:"size-3"}):t.jsxRuntimeExports.jsx(vi,{className:"size-3"})}),t.jsxRuntimeExports.jsx(t.TooltipContent,{children:t.jsxRuntimeExports.jsx("p",{className:"font-mono text-xs",children:e.data_type})})]})}function Pi({schemaName:e,tableName:n,columns:r,status:i}){const s=t.useEditorStore(p=>p.sqlGen),o=t.useEditorStore(p=>p.actions.setRunSql),l=t.useEditorStore(p=>p.actions.setSqlGen),a=t.useEditorStore(p=>p.actions.setIsShowingVisual),u=t.useEditorStore(p=>p.actions.setCardSql);function c(p){const m=t.createSqlGenConfig(p,s);l(m);const d=t.getSql(m,t.fmt(e),t.fmt(n));d&&(u(d),o(!0))}function x(){let m=t.getQualifiedTableName(e,n);(j=>j.charAt(0)===j.charAt(0).toUpperCase())(n)&&(m=`"${n}"`),a(!1),u(`SELECT * FROM ${m} LIMIT 10`),o(!0)}return t.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col space-y-4 px-6",children:[t.jsxRuntimeExports.jsx("div",{className:"font-medium",children:t.jsxRuntimeExports.jsxs(t.Button,{disabled:i!=="Success",onClick:x,size:"sm",variant:"secondary",className:"flex w-full",children:[i!=="Success"?t.jsxRuntimeExports.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):t.jsxRuntimeExports.jsx(Ni,{className:"mr-2 size-4"}),"Show top 10 rows"]})}),t.jsxRuntimeExports.jsxs(t.ScrollArea,{className:"flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",children:[r==null?void 0:r.map(p=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>c(p),className:t.cn("mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",{"bg-muted":t.isColumnInSqlGen(p,s)}),children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(ur,{column:p}),t.jsxRuntimeExports.jsx("span",{children:p.column_name})]}),t.NUMBER_DATA_TYPES.includes(p.data_type)&&t.jsxRuntimeExports.jsx("div",{onClick:m=>m.stopPropagation(),className:"flex items-center justify-end",children:t.jsxRuntimeExports.jsx(Mi,{column:p})})]},p.column_name)),t.jsxRuntimeExports.jsx(t.ScrollBar,{orientation:"vertical"}),t.jsxRuntimeExports.jsx(t.ScrollBar,{orientation:"horizontal"})]})]})}function cr(e,n){var Ce,Ae,Me,Ee;let r=T.useMemo(()=>[],[]);const i=t.useSemaphorContext().authToken||e,s=t.useEditorStore(O=>O.selectedConnectionId),o=t.useEditorStore(O=>O.selectedDatabaseName),l=t.useEditorStore(O=>O.selectedSchemaName),a=t.useEditorStore(O=>O.selectedTableName),u=t.useEditorStore(O=>O.actions.setCurrentColumns),c=t.useEditorStore(O=>O.actions.setSelectedConnectionId),x=t.useEditorStore(O=>O.actions.setSelectedDatabaseName),p=t.useEditorStore(O=>O.actions.setSelectedSchemaName),m=t.useEditorStore(O=>O.actions.setSelectedTableName),d=t.useEditorStore(O=>O.actions.setCardSql),{data:j,isLoading:E,isError:S}=t.useQuery({queryKey:["connections"],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/connections",(i==null?void 0:i.accessToken)||""),enabled:!!(i!=null&&i.accessToken)}),y=j==null?void 0:j.connections.find(O=>O.id===s),w=y==null?void 0:y.type,k=(y==null?void 0:y.type)==="API"||(y==null?void 0:y.type)==="S3",{data:L,isLoading:D,isFetching:b,isError:M,refetch:z}=t.useQuery({queryKey:["databases",s],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/databases",(i==null?void 0:i.accessToken)||"",{connection_id:s}),enabled:!!s&&!k}),{data:A,isLoading:H,isFetching:I,isError:N,refetch:K}=t.useQuery({queryKey:["schemas",s,o],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/schemas",(i==null?void 0:i.accessToken)||"",{connection_id:s,database_name:o}),enabled:!!s&&!!o&&!k}),{data:$,isLoading:B,isFetching:U,isError:W,refetch:ie}=t.useQuery({queryKey:["tables",s,o,l],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/tables",(i==null?void 0:i.accessToken)||"",{connection_id:s,database_name:o,schema_name:l}),enabled:!!s&&!!o&&!!l&&w!=="API"}),{data:v,isLoading:h,isFetching:X,isError:Z}=t.useQuery({queryKey:["columns",s,o,l,a],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/columns",(i==null?void 0:i.accessToken)||"",{connection_id:s,database_name:o,schema_name:l,table_name:a}),enabled:!!s&&!!o&&!!l&&!!a||k});T.useEffect(()=>{u(r)},[v,u,r]),T.useEffect(()=>{var O;w==="API"&&(x("NA"),p("NA"),m((O=y==null?void 0:y.type)==null?void 0:O.toLowerCase()))},[k,d,m,p,x,y]);const f=(y==null?void 0:y.type)==="API"?(Ce=y==null?void 0:y.type)==null?void 0:Ce.toLowerCase():a||"",oe=k?"":l||"";function he(O){p(O),m("")}function Y(O){x(O),p(""),m("")}function je(O){c(O)}L&&((Ae=L==null?void 0:L.databases)==null?void 0:Ae.length)>0,A&&((Me=A==null?void 0:A.schemas)==null?void 0:Me.length)>0,v&&((Ee=v==null?void 0:v.columns)==null?void 0:Ee.length)>0&&(r=v.columns.map(O=>({...O,data_type:O.data_type.toLowerCase()}))),M&&(r=[]),(Z||S)&&(r=[]);const ee=j==null?void 0:j.connections.map(O=>({id:O.id,name:O.name,type:O.type})),pe=L==null?void 0:L.databases.map(O=>({id:O.database_name,name:O.database_name})),le=A==null?void 0:A.schemas.map(O=>({id:O.schema_name,name:O.schema_name})),Ie=$==null?void 0:$.tables.map(O=>({id:O.table_name,name:O.table_name}));return{connectionItems:ee,isConnectionsLoading:E,isConnectionsError:S,databaseItems:pe,isDatabasesLoadingOrFetching:D||b,isDatabaseError:M,schemaItems:le,isSchemaLoadingOrFetching:H||I,isSchemaError:N,tableItems:Ie,isTableLoadingOrFetching:B||U,isTableError:W,columns:r,isColumnsLoadingOrFetching:h||X,isColumnsError:Z,isNonDbConnection:k,connectionType:w,tableName:f,schemaName:oe,handleConnectionChange:je,handleDatabaseChange:Y,handleSchemaChange:he}}function pr({ColumnsComponent:e}){var B;const n=t.useEditorStore(U=>U.selectedConnectionId),r=t.useEditorStore(U=>U.selectedDatabaseName),i=t.useEditorStore(U=>U.selectedSchemaName),s=t.useEditorStore(U=>U.selectedTableName),o=t.useEditorStore(U=>U.actions.setSelectedTableName),{connectionItems:l,schemaItems:a,databaseItems:u,tableItems:c,columns:x,isConnectionsLoading:p,isConnectionsError:m,isDatabasesLoadingOrFetching:d,isDatabaseError:j,isSchemaLoadingOrFetching:E,isSchemaError:S,isColumnsError:y,isColumnsLoadingOrFetching:w,connectionType:k,isNonDbConnection:L,handleConnectionChange:D,handleDatabaseChange:b,handleSchemaChange:M,tableName:z,schemaName:A}=cr();function H(){return e?e(A,z,x):t.jsxRuntimeExports.jsx(Pi,{schemaName:A,tableName:z,columns:x,status:w?"Loading...":y?"Error":"Success"})}function I(){window.location.href="mailto:support@semaphor.cloud?subject=Help&body=I need help with..."}function N(){return k==="S3"||k==="API"?null:t.jsxRuntimeExports.jsx(Ke,{onChange:b,isError:j,isLoading:d,items:u,value:r||"",title:"Database"})}function K(){return k==="S3"||k==="API"?null:t.jsxRuntimeExports.jsx(Ke,{onChange:M,isError:S,isLoading:E,items:a,value:i||"",title:"Schema"})}function $(){return k==="API"?null:t.jsxRuntimeExports.jsx(Ke,{onChange:o,isError:j,items:c,isLoading:d,value:s||"",title:"Table"})}return t.jsxRuntimeExports.jsxs("aside",{className:"xbg-red-100 flex grow flex-col justify-between",children:[t.jsxRuntimeExports.jsxs("section",{className:"space-y-3 px-6 py-4",children:[t.jsxRuntimeExports.jsx(Ke,{items:l,title:"Connection",value:n||"",onChange:D,isLoading:p,isError:m,connectionTooltip:((B=l==null?void 0:l.find(U=>U.id===n))==null?void 0:B.type)||""}),N(),K(),$()]}),H(),t.jsxRuntimeExports.jsx("div",{className:"flex items-end justify-center px-6 py-4",children:t.jsxRuntimeExports.jsxs(t.Button,{onClick:I,size:"sm",variant:"secondary",className:"w-full",children:[t.jsxRuntimeExports.jsx(Si,{className:"mr-2 size-4"}),"Help"]})})]})}const zt=({className:e,...n})=>t.jsxRuntimeExports.jsx(t.PanelGroup,{className:t.cn("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),Be=t.Panel,Ot=({withHandle:e,className:n,...r})=>t.jsxRuntimeExports.jsx(t.PanelResizeHandle,{className:t.cn("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",n),...r,children:e&&t.jsxRuntimeExports.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsxRuntimeExports.jsx(hi,{className:"h-2.5 w-2.5"})})});function Bi(e){const n=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),i=e.toUpperCase().indexOf("LIMIT"),s=e.toUpperCase().indexOf("ORDER BY");let o=e.length;if(s!==-1&&(o=s),i!==-1&&i<o&&(o=i),n!==-1){const l=e.substring(0,n),a=e.substring(n);return`${l} {{ filters | where }} AND ${a.substring(6)}`}else if(r!==-1){const l=e.substring(0,r),a=e.substring(r);return`${l} {{ filters | where }} ${a}`}else{const l=e.substring(0,o),a=e.substring(o);return`${l} {{ filters | where }} ${a}`}}function _i({error:e,setShowAIDialog:n,setUserInputforAI:r,setTriggerAIRun:i}){return t.jsxRuntimeExports.jsxs(t.HoverCard,{openDelay:0,children:[t.jsxRuntimeExports.jsx(t.HoverCardTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{variant:"link",className:" p-0 h-5",children:t.jsxRuntimeExports.jsx(pi,{className:"h-4 w-4 text-red-500"})})}),t.jsxRuntimeExports.jsx(t.HoverCardContent,{align:"start",className:" min-w-fit max-w-[500px]",children:t.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:t.jsxRuntimeExports.jsxs("div",{className:"grow space-y-1 flex flex-col ",children:[t.jsxRuntimeExports.jsxs(t.Button,{onClick:()=>{n(!0),r(e),i(!0)},size:"sm",variant:"outline",children:[t.jsxRuntimeExports.jsx(fi,{className:"h-4 w-4 mr-2"}),"Fix It"]}),t.jsxRuntimeExports.jsx(t.ScrollArea,{className:" min-h-0 max-h-[250px] overflow-scroll ",children:t.jsxRuntimeExports.jsx("p",{className:" overflow-auto text-sm leading-relaxed font-mono ",children:e})})]})})})]})}function qi({text:e,onCheckedChange:n,checked:r}){return t.jsxRuntimeExports.jsxs("div",{className:"xbg-red-100 ml-6 flex items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Checkbox,{checked:r,onCheckedChange:n}),t.jsxRuntimeExports.jsx("label",{className:"text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function Vi(){const{authToken:e}=t.useSemaphorContext(),n=T.useRef(null),r=t.useEditorStore(a=>a.applyFilters),[i,s]=T.useState(""),o=t.useEditorStore(a=>a.filterValues),l=t.useEditorStore(a=>a.card.sql);return t.jsxRuntimeExports.jsxs(t.HoverCard,{openDelay:0,onOpenChange:async a=>{if(!a)return;console.log("onOpenChange");const u=await t.postRequest("https://semaphor.cloud/api/v1/filter-sql",(e==null?void 0:e.accessToken)||"",{sql:l,active_filters:o});console.log(u),u.sql?(console.log(u.records),s(u.sql)):s("Error")},children:[t.jsxRuntimeExports.jsx(t.HoverCardTrigger,{asChild:!0,children:r&&t.jsxRuntimeExports.jsx("p",{className:"p-0 text-xs hover:cursor-pointer",children:"|  Filter Query"})}),t.jsxRuntimeExports.jsxs(t.HoverCardContent,{align:"end",className:"w-[600px]",children:[t.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:t.jsxRuntimeExports.jsx("div",{className:"rounded-sm bg-muted p-2",children:t.jsxRuntimeExports.jsxs("code",{ref:n,className:"font-mono text-sm",children:[i,t.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{onClick:()=>t.copyToClipboard(n),className:"ml-3 inline-block h-4 w-4 opacity-70 hover:cursor-pointer hover:opacity-100"})]})})}),t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[t.jsxRuntimeExports.jsx(t.InfoCircledIcon,{className:"h-4 w-4 opacity-70"}),t.jsxRuntimeExports.jsx("span",{className:"text-xs text-muted-foreground",children:"A preview of the query with filters applied."})]})]})]})}function Hi(e,n){const r=n||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Ui=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$i=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ki={};function cn(e,n){return((n||Ki).jsx?$i:Ui).test(e)}const Qi=/[ \t\n\f\r]/g;function Wi(e){return typeof e=="object"?e.type==="text"?pn(e.value):!1:pn(e)}function pn(e){return e.replace(Qi,"")===""}class Je{constructor(n,r,i){this.property=n,this.normal=r,i&&(this.space=i)}}Je.prototype.property={};Je.prototype.normal={};Je.prototype.space=null;function xr(e,n){const r={},i={};let s=-1;for(;++s<e.length;)Object.assign(r,e[s].property),Object.assign(i,e[s].normal);return new Je(r,i,n)}function Dt(e){return e.toLowerCase()}class ge{constructor(n,r){this.property=n,this.attribute=r}}ge.prototype.space=null;ge.prototype.boolean=!1;ge.prototype.booleanish=!1;ge.prototype.overloadedBoolean=!1;ge.prototype.number=!1;ge.prototype.commaSeparated=!1;ge.prototype.spaceSeparated=!1;ge.prototype.commaOrSpaceSeparated=!1;ge.prototype.mustUseProperty=!1;ge.prototype.defined=!1;let Gi=0;const V=De(),ne=De(),dr=De(),R=De(),G=De(),_e=De(),de=De();function De(){return 2**++Gi}const Ft=Object.freeze(Object.defineProperty({__proto__:null,boolean:V,booleanish:ne,commaOrSpaceSeparated:de,commaSeparated:_e,number:R,overloadedBoolean:dr,spaceSeparated:G},Symbol.toStringTag,{value:"Module"})),bt=Object.keys(Ft);class Qt extends ge{constructor(n,r,i,s){let o=-1;if(super(n,r),xn(this,"space",s),typeof i=="number")for(;++o<bt.length;){const l=bt[o];xn(this,bt[o],(i&Ft[l])===Ft[l])}}}Qt.prototype.defined=!0;function xn(e,n,r){r&&(e[n]=r)}const Ji={}.hasOwnProperty;function Ve(e){const n={},r={};let i;for(i in e.properties)if(Ji.call(e.properties,i)){const s=e.properties[i],o=new Qt(i,e.transform(e.attributes||{},i),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),n[i]=o,r[Dt(i)]=i,r[Dt(o.attribute)]=i}return new Je(n,r,e.space)}const mr=Ve({space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),hr=Ve({space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function fr(e,n){return n in e?e[n]:n}function gr(e,n){return fr(e,n.toLowerCase())}const jr=Ve({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:gr,properties:{xmlns:null,xmlnsXLink:null}}),yr=Ve({transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:ne,ariaAutoComplete:null,ariaBusy:ne,ariaChecked:ne,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:G,ariaCurrent:null,ariaDescribedBy:G,ariaDetails:null,ariaDisabled:ne,ariaDropEffect:G,ariaErrorMessage:null,ariaExpanded:ne,ariaFlowTo:G,ariaGrabbed:ne,ariaHasPopup:null,ariaHidden:ne,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:G,ariaLevel:R,ariaLive:null,ariaModal:ne,ariaMultiLine:ne,ariaMultiSelectable:ne,ariaOrientation:null,ariaOwns:G,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:ne,ariaReadOnly:ne,ariaRelevant:null,ariaRequired:ne,ariaRoleDescription:G,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:ne,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null}}),Xi=Ve({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:gr,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_e,acceptCharset:G,accessKey:G,action:null,allow:null,allowFullScreen:V,allowPaymentRequest:V,allowUserMedia:V,alt:null,as:null,async:V,autoCapitalize:null,autoComplete:G,autoFocus:V,autoPlay:V,blocking:G,capture:null,charSet:null,checked:V,cite:null,className:G,cols:R,colSpan:null,content:null,contentEditable:ne,controls:V,controlsList:G,coords:R|_e,crossOrigin:null,data:null,dateTime:null,decoding:null,default:V,defer:V,dir:null,dirName:null,disabled:V,download:dr,draggable:ne,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:V,formTarget:null,headers:G,height:R,hidden:V,high:R,href:null,hrefLang:null,htmlFor:G,httpEquiv:G,id:null,imageSizes:null,imageSrcSet:null,inert:V,inputMode:null,integrity:null,is:null,isMap:V,itemId:null,itemProp:G,itemRef:G,itemScope:V,itemType:G,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:V,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:V,muted:V,name:null,nonce:null,noModule:V,noValidate:V,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:V,optimum:R,pattern:null,ping:G,placeholder:null,playsInline:V,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:V,referrerPolicy:null,rel:G,required:V,reversed:V,rows:R,rowSpan:R,sandbox:G,scope:null,scoped:V,seamless:V,selected:V,shadowRootDelegatesFocus:V,shadowRootMode:null,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:ne,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:V,useMap:null,value:ne,width:R,wrap:null,align:null,aLink:null,archive:G,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:V,declare:V,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:V,noHref:V,noShade:V,noWrap:V,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:ne,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:V,disableRemotePlayback:V,prefix:null,property:null,results:R,security:null,unselectable:null}}),Yi=Ve({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:fr,properties:{about:de,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:G,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:V,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:_e,g2:_e,glyphName:_e,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:de,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:G,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:de,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:de,rev:de,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:de,requiredFeatures:de,requiredFonts:de,requiredFormats:de,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:de,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:de,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:de,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),Zi=/^data[-\w.:]+$/i,dn=/-[a-z]/g,es=/[A-Z]/g;function ts(e,n){const r=Dt(n);let i=n,s=ge;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Zi.test(n)){if(n.charAt(4)==="-"){const o=n.slice(5).replace(dn,rs);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=n.slice(4);if(!dn.test(o)){let l=o.replace(es,ns);l.charAt(0)!=="-"&&(l="-"+l),n="data"+l}}s=Qt}return new s(i,n)}function ns(e){return"-"+e.toLowerCase()}function rs(e){return e.charAt(1).toUpperCase()}const is={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},ss=xr([hr,mr,jr,yr,Xi],"html"),Wt=xr([hr,mr,jr,yr,Yi],"svg");function os(e){return e.join(" ").trim()}var Er={},mn=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ls=/\n/g,as=/^\s*/,us=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,cs=/^:\s*/,ps=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,xs=/^[;\s]*/,ds=/^\s+|\s+$/g,ms=`
162
+ `,hn="/",fn="*",Oe="",hs="comment",fs="declaration",gs=function(e,n){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];n=n||{};var r=1,i=1;function s(j){var E=j.match(ls);E&&(r+=E.length);var S=j.lastIndexOf(ms);i=~S?j.length-S:i+j.length}function o(){var j={line:r,column:i};return function(E){return E.position=new l(j),c(),E}}function l(j){this.start=j,this.end={line:r,column:i},this.source=n.source}l.prototype.content=e;function a(j){var E=new Error(n.source+":"+r+":"+i+": "+j);if(E.reason=j,E.filename=n.source,E.line=r,E.column=i,E.source=e,!n.silent)throw E}function u(j){var E=j.exec(e);if(E){var S=E[0];return s(S),e=e.slice(S.length),E}}function c(){u(as)}function x(j){var E;for(j=j||[];E=p();)E!==!1&&j.push(E);return j}function p(){var j=o();if(!(hn!=e.charAt(0)||fn!=e.charAt(1))){for(var E=2;Oe!=e.charAt(E)&&(fn!=e.charAt(E)||hn!=e.charAt(E+1));)++E;if(E+=2,Oe===e.charAt(E-1))return a("End of comment missing");var S=e.slice(2,E-2);return i+=2,s(S),e=e.slice(E),i+=2,j({type:hs,comment:S})}}function m(){var j=o(),E=u(us);if(E){if(p(),!u(cs))return a("property missing ':'");var S=u(ps),y=j({type:fs,property:gn(E[0].replace(mn,Oe)),value:S?gn(S[0].replace(mn,Oe)):Oe});return u(xs),y}}function d(){var j=[];x(j);for(var E;E=m();)E!==!1&&(j.push(E),x(j));return j}return c(),d()};function gn(e){return e?e.replace(ds,Oe):Oe}var js=t.commonjsGlobal&&t.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Er,"__esModule",{value:!0});var ys=js(gs);function Es(e,n){var r=null;if(!e||typeof e!="string")return r;var i=(0,ys.default)(e),s=typeof n=="function";return i.forEach(function(o){if(o.type==="declaration"){var l=o.property,a=o.value;s?n(l,a,o):a&&(r=r||{},r[l]=a)}}),r}var jn=Er.default=Es;const bs=jn.default||jn,br=Sr("end"),Gt=Sr("start");function Sr(e){return n;function n(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Ss(e){const n=Gt(e),r=br(e);if(n&&r)return{start:n,end:r}}function Qe(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yn(e.position):"start"in e||"end"in e?yn(e):"line"in e||"column"in e?Mt(e):""}function Mt(e){return En(e&&e.line)+":"+En(e&&e.column)}function yn(e){return Mt(e&&e.start)+"-"+Mt(e&&e.end)}function En(e){return e&&typeof e=="number"?e:1}class se extends Error{constructor(n,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let s="",o={},l=!1;if(r&&("line"in r&&"column"in r?o={place:r}:"start"in r&&"end"in r?o={place:r}:"type"in r?o={ancestors:[r],place:r.position}:o={...r}),typeof n=="string"?s=n:!o.cause&&n&&(l=!0,s=n.message,o.cause=n),!o.ruleId&&!o.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?o.ruleId=i:(o.source=i.slice(0,u),o.ruleId=i.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=a?a.line:void 0,this.name=Qe(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}se.prototype.file="";se.prototype.name="";se.prototype.reason="";se.prototype.message="";se.prototype.stack="";se.prototype.column=void 0;se.prototype.line=void 0;se.prototype.ancestors=void 0;se.prototype.cause=void 0;se.prototype.fatal=void 0;se.prototype.place=void 0;se.prototype.ruleId=void 0;se.prototype.source=void 0;const Jt={}.hasOwnProperty,ks=new Map,Rs=/[A-Z]/g,Cs=/-([a-z])/g,ws=new Set(["table","tbody","thead","tfoot","tr"]),vs=new Set(["td","th"]),kr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Ns(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let i;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Fs(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=Ds(r,n.jsx,n.jsxs)}const s={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:i,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Wt:ss,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},o=Rr(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function Rr(e,n,r){if(n.type==="element")return Is(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return As(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Ls(e,n,r);if(n.type==="mdxjsEsm")return Ts(e,n);if(n.type==="root")return zs(e,n,r);if(n.type==="text")return Os(e,n)}function Is(e,n,r){const i=e.schema;let s=i;n.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=Wt,e.schema=s),e.ancestors.push(n);const o=wr(e,n.tagName,!1),l=Ms(e,n);let a=Yt(e,n);return ws.has(n.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!Wi(u):!0})),Cr(e,l,o,n),Xt(l,a),e.ancestors.pop(),e.schema=i,e.create(n,o,l,r)}function As(e,n){if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Ge(e,n.position)}function Ts(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Ge(e,n.position)}function Ls(e,n,r){const i=e.schema;let s=i;n.name==="svg"&&i.space==="html"&&(s=Wt,e.schema=s),e.ancestors.push(n);const o=n.name===null?e.Fragment:wr(e,n.name,!0),l=Ps(e,n),a=Yt(e,n);return Cr(e,l,o,n),Xt(l,a),e.ancestors.pop(),e.schema=i,e.create(n,o,l,r)}function zs(e,n,r){const i={};return Xt(i,Yt(e,n)),e.create(n,e.Fragment,i,r)}function Os(e,n){return n.value}function Cr(e,n,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=i)}function Xt(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function Ds(e,n,r){return i;function i(s,o,l,a){const c=Array.isArray(l.children)?r:n;return a?c(o,l,a):c(o,l)}}function Fs(e,n){return r;function r(i,s,o,l){const a=Array.isArray(o.children),u=Gt(i);return n(s,o,l,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Ms(e,n){const r={};let i,s;for(s in n.properties)if(s!=="children"&&Jt.call(n.properties,s)){const o=Bs(e,s,n.properties[s]);if(o){const[l,a]=o;e.tableCellAlignToStyle&&l==="align"&&typeof a=="string"&&vs.has(n.tagName)?i=a:r[l]=a}}if(i){const o=r.style||(r.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Ps(e,n){const r={};for(const i of n.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const o=i.data.estree.body[0];o.type;const l=o.expression;l.type;const a=l.properties[0];a.type,Object.assign(r,e.evaluater.evaluateExpression(a.argument))}else Ge(e,n.position);else{const s=i.name;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const a=i.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else Ge(e,n.position);else o=i.value===null?!0:i.value;r[s]=o}return r}function Yt(e,n){const r=[];let i=-1;const s=e.passKeys?new Map:ks;for(;++i<n.children.length;){const o=n.children[i];let l;if(e.passKeys){const u=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(u){const c=s.get(u)||0;l=u+"-"+c,s.set(u,c+1)}}const a=Rr(e,o,l);a!==void 0&&r.push(a)}return r}function Bs(e,n,r){const i=ts(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?Hi(r):os(r)),i.property==="style"){let s=typeof r=="object"?r:_s(e,String(r));return e.stylePropertyNameCase==="css"&&(s=qs(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&i.space?is[i.property]||i.property:i.attribute,r]}}function _s(e,n){const r={};try{bs(n,i)}catch(s){if(!e.ignoreInvalidStyle){const o=s,l=new se("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:o,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=kr+"#cannot-parse-style-attribute",l}}return r;function i(s,o){let l=s;l.slice(0,2)!=="--"&&(l.slice(0,4)==="-ms-"&&(l="ms-"+l.slice(4)),l=l.replace(Cs,Hs)),r[l]=o}}function wr(e,n,r){let i;if(!r)i={type:"Literal",value:n};else if(n.includes(".")){const s=n.split(".");let o=-1,l;for(;++o<s.length;){const a=cn(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};l=l?{type:"MemberExpression",object:l,property:a,computed:!!(o&&a.type==="Literal"),optional:!1}:a}i=l}else i=cn(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(i.type==="Literal"){const s=i.value;return Jt.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(i);Ge(e)}function Ge(e,n){const r=new se("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=kr+"#cannot-handle-mdx-estrees-without-createevaluater",r}function qs(e){const n={};let r;for(r in e)Jt.call(e,r)&&(n[Vs(r)]=e[r]);return n}function Vs(e){let n=e.replace(Rs,Us);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Hs(e,n){return n.toUpperCase()}function Us(e){return"-"+e.toLowerCase()}const St={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},$s={};function Ks(e,n){const r=n||$s,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return vr(e,i,s)}function vr(e,n,r){if(Qs(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return bn(e.children,n,r)}return Array.isArray(e)?bn(e,n,r):""}function bn(e,n,r){const i=[];let s=-1;for(;++s<e.length;)i[s]=vr(e[s],n,r);return i.join("")}function Qs(e){return!!(e&&typeof e=="object")}const Sn=document.createElement("i");function Zt(e){const n="&"+e+";";Sn.innerHTML=n;const r=Sn.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Re(e,n,r,i){const s=e.length;let o=0,l;if(n<0?n=-n>s?0:s+n:n=n>s?s:n,r=r>0?r:0,i.length<1e4)l=Array.from(i),l.unshift(n,r),e.splice(...l);else for(r&&e.splice(n,r);o<i.length;)l=i.slice(o,o+1e4),l.unshift(n,0),e.splice(...l),o+=1e4,n+=1e4}function fe(e,n){return e.length>0?(Re(e,e.length,0,n),e):n}const kn={}.hasOwnProperty;function Ws(e){const n={};let r=-1;for(;++r<e.length;)Gs(n,e[r]);return n}function Gs(e,n){let r;for(r in n){const s=(kn.call(e,r)?e[r]:void 0)||(e[r]={}),o=n[r];let l;if(o)for(l in o){kn.call(s,l)||(s[l]=[]);const a=o[l];Js(s[l],Array.isArray(a)?a:a?[a]:[])}}}function Js(e,n){let r=-1;const i=[];for(;++r<n.length;)(n[r].add==="after"?e:i).push(n[r]);Re(e,0,0,i)}function Nr(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function qe(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Xs=ze(new RegExp("\\p{P}","u")),ke=ze(/[A-Za-z]/),me=ze(/[\dA-Za-z]/),Ys=ze(/[#-'*+\--9=?A-Z^-~]/);function Pt(e){return e!==null&&(e<32||e===127)}const Bt=ze(/\d/),Zs=ze(/[\dA-Fa-f]/),Ir=ze(/[!-/:-@[-`{-~]/);function P(e){return e!==null&&e<-2}function ce(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}function eo(e){return Ir(e)||Xs(e)}const to=ze(/\s/);function ze(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function He(e){const n=[];let r=-1,i=0,s=0;for(;++r<e.length;){const o=e.charCodeAt(r);let l="";if(o===37&&me(e.charCodeAt(r+1))&&me(e.charCodeAt(r+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(r+1);o<56320&&a>56319&&a<57344?(l=String.fromCharCode(o,a),s=1):l="�"}else l=String.fromCharCode(o);l&&(n.push(e.slice(i,r),encodeURIComponent(l)),i=r+s+1,l=""),s&&(r+=s,s=0)}return n.join("")+e.slice(i)}function J(e,n,r,i){const s=i?i-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(u){return Q(u)?(e.enter(r),a(u)):n(u)}function a(u){return Q(u)&&o++<s?(e.consume(u),a):(e.exit(r),n(u))}}const no={tokenize:ro};function ro(e){const n=e.attempt(this.parser.constructs.contentInitial,i,s);let r;return n;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),J(e,n,"linePrefix")}function s(a){return e.enter("paragraph"),o(a)}function o(a){const u=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=u),r=u,l(a)}function l(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return P(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),l)}}const io={tokenize:so},Rn={tokenize:oo};function so(e){const n=this,r=[];let i=0,s,o,l;return a;function a(k){if(i<r.length){const L=r[i];return n.containerState=L[1],e.attempt(L[0].continuation,u,c)(k)}return c(k)}function u(k){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,s&&w();const L=n.events.length;let D=L,b;for(;D--;)if(n.events[D][0]==="exit"&&n.events[D][1].type==="chunkFlow"){b=n.events[D][1].end;break}y(i);let M=L;for(;M<n.events.length;)n.events[M][1].end=Object.assign({},b),M++;return Re(n.events,D+1,0,n.events.slice(L)),n.events.length=M,c(k)}return a(k)}function c(k){if(i===r.length){if(!s)return m(k);if(s.currentConstruct&&s.currentConstruct.concrete)return j(k);n.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(Rn,x,p)(k)}function x(k){return s&&w(),y(i),m(k)}function p(k){return n.parser.lazy[n.now().line]=i!==r.length,l=n.now().offset,j(k)}function m(k){return n.containerState={},e.attempt(Rn,d,j)(k)}function d(k){return i++,r.push([n.currentConstruct,n.containerState]),m(k)}function j(k){if(k===null){s&&w(),y(0),e.consume(k);return}return s=s||n.parser.flow(n.now()),e.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:s}),E(k)}function E(k){if(k===null){S(e.exit("chunkFlow"),!0),y(0),e.consume(k);return}return P(k)?(e.consume(k),S(e.exit("chunkFlow")),i=0,n.interrupt=void 0,a):(e.consume(k),E)}function S(k,L){const D=n.sliceStream(k);if(L&&D.push(null),k.previous=o,o&&(o.next=k),o=k,s.defineSkip(k.start),s.write(D),n.parser.lazy[k.start.line]){let b=s.events.length;for(;b--;)if(s.events[b][1].start.offset<l&&(!s.events[b][1].end||s.events[b][1].end.offset>l))return;const M=n.events.length;let z=M,A,H;for(;z--;)if(n.events[z][0]==="exit"&&n.events[z][1].type==="chunkFlow"){if(A){H=n.events[z][1].end;break}A=!0}for(y(i),b=M;b<n.events.length;)n.events[b][1].end=Object.assign({},H),b++;Re(n.events,z+1,0,n.events.slice(M)),n.events.length=b}}function y(k){let L=r.length;for(;L-- >k;){const D=r[L];n.containerState=D[1],D[0].exit.call(n,e)}r.length=k}function w(){s.write([null]),o=void 0,s=void 0,n.containerState._closeFlow=void 0}}function oo(e,n,r){return J(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Cn(e){if(e===null||ce(e)||to(e))return 1;if(eo(e))return 2}function en(e,n,r){const i=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!i.includes(o)&&(n=o(n,r),i.push(o))}return n}const _t={name:"attention",tokenize:ao,resolveAll:lo};function lo(e,n){let r=-1,i,s,o,l,a,u,c,x;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;u=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const p=Object.assign({},e[i][1].end),m=Object.assign({},e[r][1].start);wn(p,-u),wn(m,u),l={type:u>1?"strongSequence":"emphasisSequence",start:p,end:Object.assign({},e[i][1].end)},a={type:u>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[r][1].start),end:m},o={type:u>1?"strongText":"emphasisText",start:Object.assign({},e[i][1].end),end:Object.assign({},e[r][1].start)},s={type:u>1?"strong":"emphasis",start:Object.assign({},l.start),end:Object.assign({},a.end)},e[i][1].end=Object.assign({},l.start),e[r][1].start=Object.assign({},a.end),c=[],e[i][1].end.offset-e[i][1].start.offset&&(c=fe(c,[["enter",e[i][1],n],["exit",e[i][1],n]])),c=fe(c,[["enter",s,n],["enter",l,n],["exit",l,n],["enter",o,n]]),c=fe(c,en(n.parser.constructs.insideSpan.null,e.slice(i+1,r),n)),c=fe(c,[["exit",o,n],["enter",a,n],["exit",a,n],["exit",s,n]]),e[r][1].end.offset-e[r][1].start.offset?(x=2,c=fe(c,[["enter",e[r][1],n],["exit",e[r][1],n]])):x=0,Re(e,i-1,r-i+3,c),r=i+c.length-x-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function ao(e,n){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,s=Cn(i);let o;return l;function l(u){return o=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===o)return e.consume(u),a;const c=e.exit("attentionSequence"),x=Cn(u),p=!x||x===2&&s||r.includes(u),m=!s||s===2&&x||r.includes(i);return c._open=!!(o===42?p:p&&(s||!m)),c._close=!!(o===42?m:m&&(x||!p)),n(u)}}function wn(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const uo={name:"autolink",tokenize:co};function co(e,n,r){let i=0;return s;function s(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(d){return ke(d)?(e.consume(d),l):c(d)}function l(d){return d===43||d===45||d===46||me(d)?(i=1,a(d)):c(d)}function a(d){return d===58?(e.consume(d),i=0,u):(d===43||d===45||d===46||me(d))&&i++<32?(e.consume(d),a):(i=0,c(d))}function u(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),n):d===null||d===32||d===60||Pt(d)?r(d):(e.consume(d),u)}function c(d){return d===64?(e.consume(d),x):Ys(d)?(e.consume(d),c):r(d)}function x(d){return me(d)?p(d):r(d)}function p(d){return d===46?(e.consume(d),i=0,x):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),n):m(d)}function m(d){if((d===45||me(d))&&i++<63){const j=d===45?m:p;return e.consume(d),j}return r(d)}}const xt={tokenize:po,partial:!0};function po(e,n,r){return i;function i(o){return Q(o)?J(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||P(o)?n(o):r(o)}}const Ar={name:"blockQuote",tokenize:xo,continuation:{tokenize:mo},exit:ho};function xo(e,n,r){const i=this;return s;function s(l){if(l===62){const a=i.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return r(l)}function o(l){return Q(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(l))}}function mo(e,n,r){const i=this;return s;function s(l){return Q(l)?J(e,o,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(Ar,n,r)(l)}}function ho(e){e.exit("blockQuote")}const Tr={name:"characterEscape",tokenize:fo};function fo(e,n,r){return i;function i(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return Ir(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(o)}}const Lr={name:"characterReference",tokenize:go};function go(e,n,r){const i=this;let s=0,o,l;return a;function a(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),u}function u(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,l=me,x(p))}function c(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=Zs,x):(e.enter("characterReferenceValue"),o=7,l=Bt,x(p))}function x(p){if(p===59&&s){const m=e.exit("characterReferenceValue");return l===me&&!Zt(i.sliceSerialize(m))?r(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return l(p)&&s++<o?(e.consume(p),x):r(p)}}const vn={tokenize:yo,partial:!0},Nn={name:"codeFenced",tokenize:jo,concrete:!0};function jo(e,n,r){const i=this,s={tokenize:D,partial:!0};let o=0,l=0,a;return u;function u(b){return c(b)}function c(b){const M=i.events[i.events.length-1];return o=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,a=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(b)}function x(b){return b===a?(l++,e.consume(b),x):l<3?r(b):(e.exit("codeFencedFenceSequence"),Q(b)?J(e,p,"whitespace")(b):p(b))}function p(b){return b===null||P(b)?(e.exit("codeFencedFence"),i.interrupt?n(b):e.check(vn,E,L)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||P(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(b)):Q(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),J(e,d,"whitespace")(b)):b===96&&b===a?r(b):(e.consume(b),m)}function d(b){return b===null||P(b)?p(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(b))}function j(b){return b===null||P(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(b)):b===96&&b===a?r(b):(e.consume(b),j)}function E(b){return e.attempt(s,L,S)(b)}function S(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y}function y(b){return o>0&&Q(b)?J(e,w,"linePrefix",o+1)(b):w(b)}function w(b){return b===null||P(b)?e.check(vn,E,L)(b):(e.enter("codeFlowValue"),k(b))}function k(b){return b===null||P(b)?(e.exit("codeFlowValue"),w(b)):(e.consume(b),k)}function L(b){return e.exit("codeFenced"),n(b)}function D(b,M,z){let A=0;return H;function H(B){return b.enter("lineEnding"),b.consume(B),b.exit("lineEnding"),I}function I(B){return b.enter("codeFencedFence"),Q(B)?J(b,N,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):N(B)}function N(B){return B===a?(b.enter("codeFencedFenceSequence"),K(B)):z(B)}function K(B){return B===a?(A++,b.consume(B),K):A>=l?(b.exit("codeFencedFenceSequence"),Q(B)?J(b,$,"whitespace")(B):$(B)):z(B)}function $(B){return B===null||P(B)?(b.exit("codeFencedFence"),M(B)):z(B)}}}function yo(e,n,r){const i=this;return s;function s(l){return l===null?r(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return i.parser.lazy[i.now().line]?r(l):n(l)}}const kt={name:"codeIndented",tokenize:bo},Eo={tokenize:So,partial:!0};function bo(e,n,r){const i=this;return s;function s(c){return e.enter("codeIndented"),J(e,o,"linePrefix",5)(c)}function o(c){const x=i.events[i.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?l(c):r(c)}function l(c){return c===null?u(c):P(c)?e.attempt(Eo,l,u)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||P(c)?(e.exit("codeFlowValue"),l(c)):(e.consume(c),a)}function u(c){return e.exit("codeIndented"),n(c)}}function So(e,n,r){const i=this;return s;function s(l){return i.parser.lazy[i.now().line]?r(l):P(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):J(e,o,"linePrefix",5)(l)}function o(l){const a=i.events[i.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(l):P(l)?s(l):r(l)}}const ko={name:"codeText",tokenize:wo,resolve:Ro,previous:Co};function Ro(e){let n=e.length-4,r=3,i,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=r;++i<n;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(i=r-1,n++;++i<=n;)s===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(s=i):(i===n||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),n-=i-s-2,i=s+2),s=void 0);return e}function Co(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wo(e,n,r){let i=0,s,o;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),a(p)}function a(p){return p===96?(e.consume(p),i++,a):(e.exit("codeTextSequence"),u(p))}function u(p){return p===null?r(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),u):p===96?(o=e.enter("codeTextSequence"),s=0,x(p)):P(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(p))}function c(p){return p===null||p===32||p===96||P(p)?(e.exit("codeTextData"),u(p)):(e.consume(p),c)}function x(p){return p===96?(e.consume(p),s++,x):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(p)):(o.type="codeTextData",c(p))}}function zr(e){const n={};let r=-1,i,s,o,l,a,u,c;for(;++r<e.length;){for(;r in n;)r=n[r];if(i=e[r],r&&i[1].type==="chunkFlow"&&e[r-1][1].type==="listItemPrefix"&&(u=i[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,vo(e,r)),r=n[r],c=!0);else if(i[1]._container){for(o=r,s=void 0;o--&&(l=e[o],l[1].type==="lineEnding"||l[1].type==="lineEndingBlank");)l[0]==="enter"&&(s&&(e[s][1].type="lineEndingBlank"),l[1].type="lineEnding",s=o);s&&(i[1].end=Object.assign({},e[s][1].start),a=e.slice(s,r),a.unshift(i),Re(e,s,r-s+1,a))}}return!c}function vo(e,n){const r=e[n][1],i=e[n][2];let s=n-1;const o=[],l=r._tokenizer||i.parser[r.contentType](r.start),a=l.events,u=[],c={};let x,p,m=-1,d=r,j=0,E=0;const S=[E];for(;d;){for(;e[++s][1]!==d;);o.push(s),d._tokenizer||(x=i.sliceStream(d),d.next||x.push(null),p&&l.defineSkip(d.start),d._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(x),d._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=d,d=d.next}for(d=r;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(E=m+1,S.push(E),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(l.events=[],d?(d._tokenizer=void 0,d.previous=void 0):S.pop(),m=S.length;m--;){const y=a.slice(S[m],S[m+1]),w=o.pop();u.unshift([w,w+y.length-1]),Re(e,w,2,y)}for(m=-1;++m<u.length;)c[j+u[m][0]]=j+u[m][1],j+=u[m][1]-u[m][0]-1;return c}const No={tokenize:To,resolve:Ao},Io={tokenize:Lo,partial:!0};function Ao(e){return zr(e),e}function To(e,n){let r;return i;function i(a){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?o(a):P(a)?e.check(Io,l,o)(a):(e.consume(a),s)}function o(a){return e.exit("chunkContent"),e.exit("content"),n(a)}function l(a){return e.consume(a),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function Lo(e,n,r){const i=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),J(e,o,"linePrefix")}function o(l){if(l===null||P(l))return r(l);const a=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(l):e.interrupt(i.parser.constructs.flow,r,n)(l)}}function Or(e,n,r,i,s,o,l,a,u){const c=u||Number.POSITIVE_INFINITY;let x=0;return p;function p(y){return y===60?(e.enter(i),e.enter(s),e.enter(o),e.consume(y),e.exit(o),m):y===null||y===32||y===41||Pt(y)?r(y):(e.enter(i),e.enter(l),e.enter(a),e.enter("chunkString",{contentType:"string"}),E(y))}function m(y){return y===62?(e.enter(o),e.consume(y),e.exit(o),e.exit(s),e.exit(i),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===62?(e.exit("chunkString"),e.exit(a),m(y)):y===null||y===60||P(y)?r(y):(e.consume(y),y===92?j:d)}function j(y){return y===60||y===62||y===92?(e.consume(y),d):d(y)}function E(y){return!x&&(y===null||y===41||ce(y))?(e.exit("chunkString"),e.exit(a),e.exit(l),e.exit(i),n(y)):x<c&&y===40?(e.consume(y),x++,E):y===41?(e.consume(y),x--,E):y===null||y===32||y===40||Pt(y)?r(y):(e.consume(y),y===92?S:E)}function S(y){return y===40||y===41||y===92?(e.consume(y),E):E(y)}}function Dr(e,n,r,i,s,o){const l=this;let a=0,u;return c;function c(d){return e.enter(i),e.enter(s),e.consume(d),e.exit(s),e.enter(o),x}function x(d){return a>999||d===null||d===91||d===93&&!u||d===94&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?r(d):d===93?(e.exit(o),e.enter(s),e.consume(d),e.exit(s),e.exit(i),n):P(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===null||d===91||d===93||P(d)||a++>999?(e.exit("chunkString"),x(d)):(e.consume(d),u||(u=!Q(d)),d===92?m:p)}function m(d){return d===91||d===92||d===93?(e.consume(d),a++,p):p(d)}}function Fr(e,n,r,i,s,o){let l;return a;function a(m){return m===34||m===39||m===40?(e.enter(i),e.enter(s),e.consume(m),e.exit(s),l=m===40?41:m,u):r(m)}function u(m){return m===l?(e.enter(s),e.consume(m),e.exit(s),e.exit(i),n):(e.enter(o),c(m))}function c(m){return m===l?(e.exit(o),u(l)):m===null?r(m):P(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),J(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(m))}function x(m){return m===l||m===null||P(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?p:x)}function p(m){return m===l||m===92?(e.consume(m),x):x(m)}}function We(e,n){let r;return i;function i(s){return P(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,i):Q(s)?J(e,i,r?"linePrefix":"lineSuffix")(s):n(s)}}const zo={name:"definition",tokenize:Do},Oo={tokenize:Fo,partial:!0};function Do(e,n,r){const i=this;let s;return o;function o(d){return e.enter("definition"),l(d)}function l(d){return Dr.call(i,e,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return s=qe(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),u):r(d)}function u(d){return ce(d)?We(e,c)(d):c(d)}function c(d){return Or(e,x,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function x(d){return e.attempt(Oo,p,p)(d)}function p(d){return Q(d)?J(e,m,"whitespace")(d):m(d)}function m(d){return d===null||P(d)?(e.exit("definition"),i.parser.defined.push(s),n(d)):r(d)}}function Fo(e,n,r){return i;function i(a){return ce(a)?We(e,s)(a):r(a)}function s(a){return Fr(e,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Q(a)?J(e,l,"whitespace")(a):l(a)}function l(a){return a===null||P(a)?n(a):r(a)}}const Mo={name:"hardBreakEscape",tokenize:Po};function Po(e,n,r){return i;function i(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return P(o)?(e.exit("hardBreakEscape"),n(o)):r(o)}}const Bo={name:"headingAtx",tokenize:qo,resolve:_o};function _o(e,n){let r=e.length-2,i=3,s,o;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},o={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},Re(e,i,r-i+1,[["enter",s,n],["enter",o,n],["exit",o,n],["exit",s,n]])),e}function qo(e,n,r){let i=0;return s;function s(x){return e.enter("atxHeading"),o(x)}function o(x){return e.enter("atxHeadingSequence"),l(x)}function l(x){return x===35&&i++<6?(e.consume(x),l):x===null||ce(x)?(e.exit("atxHeadingSequence"),a(x)):r(x)}function a(x){return x===35?(e.enter("atxHeadingSequence"),u(x)):x===null||P(x)?(e.exit("atxHeading"),n(x)):Q(x)?J(e,a,"whitespace")(x):(e.enter("atxHeadingText"),c(x))}function u(x){return x===35?(e.consume(x),u):(e.exit("atxHeadingSequence"),a(x))}function c(x){return x===null||x===35||ce(x)?(e.exit("atxHeadingText"),a(x)):(e.consume(x),c)}}const Vo=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],In=["pre","script","style","textarea"],Ho={name:"htmlFlow",tokenize:Qo,resolveTo:Ko,concrete:!0},Uo={tokenize:Go,partial:!0},$o={tokenize:Wo,partial:!0};function Ko(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Qo(e,n,r){const i=this;let s,o,l,a,u;return c;function c(f){return x(f)}function x(f){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(f),p}function p(f){return f===33?(e.consume(f),m):f===47?(e.consume(f),o=!0,E):f===63?(e.consume(f),s=3,i.interrupt?n:h):ke(f)?(e.consume(f),l=String.fromCharCode(f),S):r(f)}function m(f){return f===45?(e.consume(f),s=2,d):f===91?(e.consume(f),s=5,a=0,j):ke(f)?(e.consume(f),s=4,i.interrupt?n:h):r(f)}function d(f){return f===45?(e.consume(f),i.interrupt?n:h):r(f)}function j(f){const oe="CDATA[";return f===oe.charCodeAt(a++)?(e.consume(f),a===oe.length?i.interrupt?n:N:j):r(f)}function E(f){return ke(f)?(e.consume(f),l=String.fromCharCode(f),S):r(f)}function S(f){if(f===null||f===47||f===62||ce(f)){const oe=f===47,he=l.toLowerCase();return!oe&&!o&&In.includes(he)?(s=1,i.interrupt?n(f):N(f)):Vo.includes(l.toLowerCase())?(s=6,oe?(e.consume(f),y):i.interrupt?n(f):N(f)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(f):o?w(f):k(f))}return f===45||me(f)?(e.consume(f),l+=String.fromCharCode(f),S):r(f)}function y(f){return f===62?(e.consume(f),i.interrupt?n:N):r(f)}function w(f){return Q(f)?(e.consume(f),w):H(f)}function k(f){return f===47?(e.consume(f),H):f===58||f===95||ke(f)?(e.consume(f),L):Q(f)?(e.consume(f),k):H(f)}function L(f){return f===45||f===46||f===58||f===95||me(f)?(e.consume(f),L):D(f)}function D(f){return f===61?(e.consume(f),b):Q(f)?(e.consume(f),D):k(f)}function b(f){return f===null||f===60||f===61||f===62||f===96?r(f):f===34||f===39?(e.consume(f),u=f,M):Q(f)?(e.consume(f),b):z(f)}function M(f){return f===u?(e.consume(f),u=null,A):f===null||P(f)?r(f):(e.consume(f),M)}function z(f){return f===null||f===34||f===39||f===47||f===60||f===61||f===62||f===96||ce(f)?D(f):(e.consume(f),z)}function A(f){return f===47||f===62||Q(f)?k(f):r(f)}function H(f){return f===62?(e.consume(f),I):r(f)}function I(f){return f===null||P(f)?N(f):Q(f)?(e.consume(f),I):r(f)}function N(f){return f===45&&s===2?(e.consume(f),U):f===60&&s===1?(e.consume(f),W):f===62&&s===4?(e.consume(f),X):f===63&&s===3?(e.consume(f),h):f===93&&s===5?(e.consume(f),v):P(f)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(Uo,Z,K)(f)):f===null||P(f)?(e.exit("htmlFlowData"),K(f)):(e.consume(f),N)}function K(f){return e.check($o,$,Z)(f)}function $(f){return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),B}function B(f){return f===null||P(f)?K(f):(e.enter("htmlFlowData"),N(f))}function U(f){return f===45?(e.consume(f),h):N(f)}function W(f){return f===47?(e.consume(f),l="",ie):N(f)}function ie(f){if(f===62){const oe=l.toLowerCase();return In.includes(oe)?(e.consume(f),X):N(f)}return ke(f)&&l.length<8?(e.consume(f),l+=String.fromCharCode(f),ie):N(f)}function v(f){return f===93?(e.consume(f),h):N(f)}function h(f){return f===62?(e.consume(f),X):f===45&&s===2?(e.consume(f),h):N(f)}function X(f){return f===null||P(f)?(e.exit("htmlFlowData"),Z(f)):(e.consume(f),X)}function Z(f){return e.exit("htmlFlow"),n(f)}}function Wo(e,n,r){const i=this;return s;function s(l){return P(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):r(l)}function o(l){return i.parser.lazy[i.now().line]?r(l):n(l)}}function Go(e,n,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(xt,n,r)}}const Jo={name:"htmlText",tokenize:Xo};function Xo(e,n,r){const i=this;let s,o,l;return a;function a(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),u}function u(h){return h===33?(e.consume(h),c):h===47?(e.consume(h),D):h===63?(e.consume(h),k):ke(h)?(e.consume(h),z):r(h)}function c(h){return h===45?(e.consume(h),x):h===91?(e.consume(h),o=0,j):ke(h)?(e.consume(h),w):r(h)}function x(h){return h===45?(e.consume(h),d):r(h)}function p(h){return h===null?r(h):h===45?(e.consume(h),m):P(h)?(l=p,W(h)):(e.consume(h),p)}function m(h){return h===45?(e.consume(h),d):p(h)}function d(h){return h===62?U(h):h===45?m(h):p(h)}function j(h){const X="CDATA[";return h===X.charCodeAt(o++)?(e.consume(h),o===X.length?E:j):r(h)}function E(h){return h===null?r(h):h===93?(e.consume(h),S):P(h)?(l=E,W(h)):(e.consume(h),E)}function S(h){return h===93?(e.consume(h),y):E(h)}function y(h){return h===62?U(h):h===93?(e.consume(h),y):E(h)}function w(h){return h===null||h===62?U(h):P(h)?(l=w,W(h)):(e.consume(h),w)}function k(h){return h===null?r(h):h===63?(e.consume(h),L):P(h)?(l=k,W(h)):(e.consume(h),k)}function L(h){return h===62?U(h):k(h)}function D(h){return ke(h)?(e.consume(h),b):r(h)}function b(h){return h===45||me(h)?(e.consume(h),b):M(h)}function M(h){return P(h)?(l=M,W(h)):Q(h)?(e.consume(h),M):U(h)}function z(h){return h===45||me(h)?(e.consume(h),z):h===47||h===62||ce(h)?A(h):r(h)}function A(h){return h===47?(e.consume(h),U):h===58||h===95||ke(h)?(e.consume(h),H):P(h)?(l=A,W(h)):Q(h)?(e.consume(h),A):U(h)}function H(h){return h===45||h===46||h===58||h===95||me(h)?(e.consume(h),H):I(h)}function I(h){return h===61?(e.consume(h),N):P(h)?(l=I,W(h)):Q(h)?(e.consume(h),I):A(h)}function N(h){return h===null||h===60||h===61||h===62||h===96?r(h):h===34||h===39?(e.consume(h),s=h,K):P(h)?(l=N,W(h)):Q(h)?(e.consume(h),N):(e.consume(h),$)}function K(h){return h===s?(e.consume(h),s=void 0,B):h===null?r(h):P(h)?(l=K,W(h)):(e.consume(h),K)}function $(h){return h===null||h===34||h===39||h===60||h===61||h===96?r(h):h===47||h===62||ce(h)?A(h):(e.consume(h),$)}function B(h){return h===47||h===62||ce(h)?A(h):r(h)}function U(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),n):r(h)}function W(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ie}function ie(h){return Q(h)?J(e,v,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):v(h)}function v(h){return e.enter("htmlTextData"),l(h)}}const tn={name:"labelEnd",tokenize:rl,resolveTo:nl,resolveAll:tl},Yo={tokenize:il},Zo={tokenize:sl},el={tokenize:ol};function tl(e){let n=-1;for(;++n<e.length;){const r=e[n][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(e.splice(n+1,r.type==="labelImage"?4:2),r.type="data",n++)}return e}function nl(e,n){let r=e.length,i=0,s,o,l,a;for(;r--;)if(s=e[r][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(l){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=r,s.type!=="labelLink")){i=2;break}}else s.type==="labelEnd"&&(l=r);const u={type:e[o][1].type==="labelLink"?"link":"image",start:Object.assign({},e[o][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[o][1].start),end:Object.assign({},e[l][1].end)},x={type:"labelText",start:Object.assign({},e[o+i+2][1].end),end:Object.assign({},e[l-2][1].start)};return a=[["enter",u,n],["enter",c,n]],a=fe(a,e.slice(o+1,o+i+3)),a=fe(a,[["enter",x,n]]),a=fe(a,en(n.parser.constructs.insideSpan.null,e.slice(o+i+4,l-3),n)),a=fe(a,[["exit",x,n],e[l-2],e[l-1],["exit",c,n]]),a=fe(a,e.slice(l+1)),a=fe(a,[["exit",u,n]]),Re(e,o,e.length,a),e}function rl(e,n,r){const i=this;let s=i.events.length,o,l;for(;s--;)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){o=i.events[s][1];break}return a;function a(m){return o?o._inactive?p(m):(l=i.parser.defined.includes(qe(i.sliceSerialize({start:o.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),u):r(m)}function u(m){return m===40?e.attempt(Yo,x,l?x:p)(m):m===91?e.attempt(Zo,x,l?c:p)(m):l?x(m):p(m)}function c(m){return e.attempt(el,x,p)(m)}function x(m){return n(m)}function p(m){return o._balanced=!0,r(m)}}function il(e,n,r){return i;function i(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return ce(p)?We(e,o)(p):o(p)}function o(p){return p===41?x(p):Or(e,l,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return ce(p)?We(e,u)(p):x(p)}function a(p){return r(p)}function u(p){return p===34||p===39||p===40?Fr(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):x(p)}function c(p){return ce(p)?We(e,x)(p):x(p)}function x(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),n):r(p)}}function sl(e,n,r){const i=this;return s;function s(a){return Dr.call(i,e,o,l,"reference","referenceMarker","referenceString")(a)}function o(a){return i.parser.defined.includes(qe(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(a):r(a)}function l(a){return r(a)}}function ol(e,n,r){return i;function i(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),n):r(o)}}const ll={name:"labelStartImage",tokenize:al,resolveAll:tn.resolveAll};function al(e,n,r){const i=this;return s;function s(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),l):r(a)}function l(a){return a===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(a):n(a)}}const ul={name:"labelStartLink",tokenize:cl,resolveAll:tn.resolveAll};function cl(e,n,r){const i=this;return s;function s(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(l):n(l)}}const Rt={name:"lineEnding",tokenize:pl};function pl(e,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),J(e,n,"linePrefix")}}const st={name:"thematicBreak",tokenize:xl};function xl(e,n,r){let i=0,s;return o;function o(c){return e.enter("thematicBreak"),l(c)}function l(c){return s=c,a(c)}function a(c){return c===s?(e.enter("thematicBreakSequence"),u(c)):i>=3&&(c===null||P(c))?(e.exit("thematicBreak"),n(c)):r(c)}function u(c){return c===s?(e.consume(c),i++,u):(e.exit("thematicBreakSequence"),Q(c)?J(e,a,"whitespace")(c):a(c))}}const ue={name:"list",tokenize:hl,continuation:{tokenize:fl},exit:jl},dl={tokenize:yl,partial:!0},ml={tokenize:gl,partial:!0};function hl(e,n,r){const i=this,s=i.events[i.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return a;function a(d){const j=i.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!i.containerState.marker||d===i.containerState.marker:Bt(d)){if(i.containerState.type||(i.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(st,r,c)(d):c(d);if(!i.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(d)}return r(d)}function u(d){return Bt(d)&&++l<10?(e.consume(d),u):(!i.interrupt||l<2)&&(i.containerState.marker?d===i.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),c(d)):r(d)}function c(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||d,e.check(xt,i.interrupt?r:x,e.attempt(dl,m,p))}function x(d){return i.containerState.initialBlankLine=!0,o++,m(d)}function p(d){return Q(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),m):r(d)}function m(d){return i.containerState.size=o+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(d)}}function fl(e,n,r){const i=this;return i.containerState._closeFlow=void 0,e.check(xt,s,o);function s(a){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,J(e,n,"listItemIndent",i.containerState.size+1)(a)}function o(a){return i.containerState.furtherBlankLines||!Q(a)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,l(a)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(ml,n,l)(a))}function l(a){return i.containerState._closeFlow=!0,i.interrupt=void 0,J(e,e.attempt(ue,n,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function gl(e,n,r){const i=this;return J(e,s,"listItemIndent",i.containerState.size+1);function s(o){const l=i.events[i.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===i.containerState.size?n(o):r(o)}}function jl(e){e.exit(this.containerState.type)}function yl(e,n,r){const i=this;return J(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const l=i.events[i.events.length-1];return!Q(o)&&l&&l[1].type==="listItemPrefixWhitespace"?n(o):r(o)}}const An={name:"setextUnderline",tokenize:bl,resolveTo:El};function El(e,n){let r=e.length,i,s,o;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!o&&e[r][1].type==="definition"&&(o=r);const l={type:"setextHeading",start:Object.assign({},e[s][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",l,n]),e.splice(o+1,0,["exit",e[i][1],n]),e[i][1].end=Object.assign({},e[o][1].end)):e[i][1]=l,e.push(["exit",l,n]),e}function bl(e,n,r){const i=this;let s;return o;function o(c){let x=i.events.length,p;for(;x--;)if(i.events[x][1].type!=="lineEnding"&&i.events[x][1].type!=="linePrefix"&&i.events[x][1].type!=="content"){p=i.events[x][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||p)?(e.enter("setextHeadingLine"),s=c,l(c)):r(c)}function l(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Q(c)?J(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||P(c)?(e.exit("setextHeadingLine"),n(c)):r(c)}}const Sl={tokenize:kl};function kl(e){const n=this,r=e.attempt(xt,i,e.attempt(this.parser.constructs.flowInitial,s,J(e,e.attempt(this.parser.constructs.flow,s,e.attempt(No,s)),"linePrefix")));return r;function i(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const Rl={resolveAll:Pr()},Cl=Mr("string"),wl=Mr("text");function Mr(e){return{tokenize:n,resolveAll:Pr(e==="text"?vl:void 0)};function n(r){const i=this,s=this.parser.constructs[e],o=r.attempt(s,l,a);return l;function l(x){return c(x)?o(x):a(x)}function a(x){if(x===null){r.consume(x);return}return r.enter("data"),r.consume(x),u}function u(x){return c(x)?(r.exit("data"),o(x)):(r.consume(x),u)}function c(x){if(x===null)return!0;const p=s[x];let m=-1;if(p)for(;++m<p.length;){const d=p[m];if(!d.previous||d.previous.call(i,i.previous))return!0}return!1}}}function Pr(e){return n;function n(r,i){let s=-1,o;for(;++s<=r.length;)o===void 0?r[s]&&r[s][1].type==="data"&&(o=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==o+2&&(r[o][1].end=r[s-1][1].end,r.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(r,i):r}}function vl(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],s=n.sliceStream(i);let o=s.length,l=-1,a=0,u;for(;o--;){const c=s[o];if(typeof c=="string"){for(l=c.length;c.charCodeAt(l-1)===32;)a++,l--;if(l)break;l=-1}else if(c===-2)u=!0,a++;else if(c!==-1){o++;break}}if(a){const c={type:r===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{line:i.end.line,column:i.end.column-a,offset:i.end.offset-a,_index:i.start._index+o,_bufferIndex:o?l:i.start._bufferIndex+l},end:Object.assign({},i.end)};i.end=Object.assign({},c.start),i.start.offset===i.end.offset?Object.assign(i,c):(e.splice(r,0,["enter",c,n],["exit",c,n]),r+=2)}r++}return e}function Nl(e,n,r){let i=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const s={},o=[];let l=[],a=[];const u={consume:w,enter:k,exit:L,attempt:M(D),check:M(b),interrupt:M(b,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:d,sliceSerialize:m,now:j,defineSkip:E,write:p};let x=n.tokenize.call(c,u);return n.resolveAll&&o.push(n),c;function p(I){return l=fe(l,I),S(),l[l.length-1]!==null?[]:(z(n,0),c.events=en(o,c.events,c),c.events)}function m(I,N){return Al(d(I),N)}function d(I){return Il(l,I)}function j(){const{line:I,column:N,offset:K,_index:$,_bufferIndex:B}=i;return{line:I,column:N,offset:K,_index:$,_bufferIndex:B}}function E(I){s[I.line]=I.column,H()}function S(){let I;for(;i._index<l.length;){const N=l[i._index];if(typeof N=="string")for(I=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===I&&i._bufferIndex<N.length;)y(N.charCodeAt(i._bufferIndex));else y(N)}}function y(I){x=x(I)}function w(I){P(I)?(i.line++,i.column=1,i.offset+=I===-3?2:1,H()):I!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===l[i._index].length&&(i._bufferIndex=-1,i._index++)),c.previous=I}function k(I,N){const K=N||{};return K.type=I,K.start=j(),c.events.push(["enter",K,c]),a.push(K),K}function L(I){const N=a.pop();return N.end=j(),c.events.push(["exit",N,c]),N}function D(I,N){z(I,N.from)}function b(I,N){N.restore()}function M(I,N){return K;function K($,B,U){let W,ie,v,h;return Array.isArray($)?Z($):"tokenize"in $?Z([$]):X($);function X(Y){return je;function je(ee){const pe=ee!==null&&Y[ee],le=ee!==null&&Y.null,Ie=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(le)?le:le?[le]:[]];return Z(Ie)(ee)}}function Z(Y){return W=Y,ie=0,Y.length===0?U:f(Y[ie])}function f(Y){return je;function je(ee){return h=A(),v=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?he():Y.tokenize.call(N?Object.assign(Object.create(c),N):c,u,oe,he)(ee)}}function oe(Y){return I(v,h),B}function he(Y){return h.restore(),++ie<W.length?f(W[ie]):U}}}function z(I,N){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&Re(c.events,N,c.events.length-N,I.resolve(c.events.slice(N),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function A(){const I=j(),N=c.previous,K=c.currentConstruct,$=c.events.length,B=Array.from(a);return{restore:U,from:$};function U(){i=I,c.previous=N,c.currentConstruct=K,c.events.length=$,a=B,H()}}function H(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function Il(e,n){const r=n.start._index,i=n.start._bufferIndex,s=n.end._index,o=n.end._bufferIndex;let l;if(r===s)l=[e[r].slice(i,o)];else{if(l=e.slice(r,s),i>-1){const a=l[0];typeof a=="string"?l[0]=a.slice(i):l.shift()}o>0&&l.push(e[s].slice(0,o))}return l}function Al(e,n){let r=-1;const i=[];let s;for(;++r<e.length;){const o=e[r];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
163
+ `;break}case-3:{l=`\r
164
+ `;break}case-2:{l=n?" ":" ";break}case-1:{if(!n&&s)continue;l=" ";break}default:l=String.fromCharCode(o)}s=o===-2,i.push(l)}return i.join("")}const Tl={42:ue,43:ue,45:ue,48:ue,49:ue,50:ue,51:ue,52:ue,53:ue,54:ue,55:ue,56:ue,57:ue,62:Ar},Ll={91:zo},zl={[-2]:kt,[-1]:kt,32:kt},Ol={35:Bo,42:st,45:[An,st],60:Ho,61:An,95:st,96:Nn,126:Nn},Dl={38:Lr,92:Tr},Fl={[-5]:Rt,[-4]:Rt,[-3]:Rt,33:ll,38:Lr,42:_t,60:[uo,Jo],91:ul,92:[Mo,Tr],93:tn,95:_t,96:ko},Ml={null:[_t,Rl]},Pl={null:[42,95]},Bl={null:[]},_l=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Pl,contentInitial:Ll,disable:Bl,document:Tl,flow:Ol,flowInitial:zl,insideSpan:Ml,string:Dl,text:Fl},Symbol.toStringTag,{value:"Module"}));function ql(e){const r=Ws([_l,...(e||{}).extensions||[]]),i={defined:[],lazy:{},constructs:r,content:s(no),document:s(io),flow:s(Sl),string:s(Cl),text:s(wl)};return i;function s(o){return l;function l(a){return Nl(i,o,a)}}}function Vl(e){for(;!zr(e););return e}const Tn=/[\0\t\n\r]/g;function Hl(){let e=1,n="",r=!0,i;return s;function s(o,l,a){const u=[];let c,x,p,m,d;for(o=n+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),p=0,n="",r&&(o.charCodeAt(0)===65279&&p++,r=void 0);p<o.length;){if(Tn.lastIndex=p,c=Tn.exec(o),m=c&&c.index!==void 0?c.index:o.length,d=o.charCodeAt(m),!c){n=o.slice(p);break}if(d===10&&p===m&&i)u.push(-3),i=void 0;else switch(i&&(u.push(-5),i=void 0),p<m&&(u.push(o.slice(p,m)),e+=m-p),d){case 0:{u.push(65533),e++;break}case 9:{for(x=Math.ceil(e/4)*4,u.push(-2);e++<x;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:i=!0,e=1}p=m+1}return a&&(i&&u.push(-5),n&&u.push(n),u.push(null)),u}}const Ul=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $l(e){return e.replace(Ul,Kl)}function Kl(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),o=s===120||s===88;return Nr(r.slice(o?2:1),o?16:10)}return Zt(r)||e}const Br={}.hasOwnProperty;function Ql(e,n,r){return typeof n!="string"&&(r=n,n=void 0),Wl(r)(Vl(ql(r).document().write(Hl()(e,n,!0))))}function Wl(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Ze),autolinkProtocol:A,autolinkEmail:A,atxHeading:o(Me),blockQuote:o(pe),characterEscape:A,characterReference:A,codeFenced:o(le),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(le,l),codeText:o(Ie,l),codeTextData:A,data:A,codeFlowValue:A,definition:o(Ce),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(Ae),hardBreakEscape:o(Ee),hardBreakTrailing:o(Ee),htmlFlow:o(O,l),htmlFlowData:A,htmlText:o(O,l),htmlTextData:A,image:o(Ye),label:l,link:o(Ze),listItem:o(ht),listItemValue:m,listOrdered:o(et,p),listUnordered:o(et),paragraph:o(ft),reference:f,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(Me),strong:o(tt),thematicBreak:o(jt)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:ee,autolinkProtocol:je,blockQuote:u(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:he,characterReferenceMarkerNumeric:he,characterReferenceValue:Y,codeFenced:u(S),codeFencedFence:E,codeFencedFenceInfo:d,codeFencedFenceMeta:j,codeFlowValue:H,codeIndented:u(y),codeText:u(B),codeTextData:H,data:H,definition:u(),definitionDestinationString:L,definitionLabelString:w,definitionTitleString:k,emphasis:u(),hardBreakEscape:u(N),hardBreakTrailing:u(N),htmlFlow:u(K),htmlFlowData:H,htmlText:u($),htmlTextData:H,image:u(W),label:v,labelText:ie,lineEnding:I,link:u(U),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:oe,resourceDestinationString:h,resourceTitleString:X,resource:Z,setextHeading:u(z),setextHeadingLineSequence:M,setextHeadingText:b,strong:u(),thematicBreak:u()}};_r(n,(e||{}).mdastExtensions||[]);const r={};return i;function i(g){let C={type:"root",children:[]};const F={stack:[C],tokenStack:[],config:n,enter:a,exit:c,buffer:l,resume:x,data:r},_=[];let q=-1;for(;++q<g.length;)if(g[q][1].type==="listOrdered"||g[q][1].type==="listUnordered")if(g[q][0]==="enter")_.push(q);else{const xe=_.pop();q=s(g,xe,q)}for(q=-1;++q<g.length;){const xe=n[g[q][0]];Br.call(xe,g[q][1].type)&&xe[g[q][1].type].call(Object.assign({sliceSerialize:g[q][2].sliceSerialize},F),g[q][1])}if(F.tokenStack.length>0){const xe=F.tokenStack[F.tokenStack.length-1];(xe[1]||Ln).call(F,void 0,xe[0])}for(C.position={start:Le(g.length>0?g[0][1].start:{line:1,column:1,offset:0}),end:Le(g.length>0?g[g.length-2][1].end:{line:1,column:1,offset:0})},q=-1;++q<n.transforms.length;)C=n.transforms[q](C)||C;return C}function s(g,C,F){let _=C-1,q=-1,xe=!1,we,ye,Te,ae;for(;++_<=F;){const te=g[_];switch(te[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{te[0]==="enter"?q++:q--,ae=void 0;break}case"lineEndingBlank":{te[0]==="enter"&&(we&&!ae&&!q&&!Te&&(Te=_),ae=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ae=void 0}if(!q&&te[0]==="enter"&&te[1].type==="listItemPrefix"||q===-1&&te[0]==="exit"&&(te[1].type==="listUnordered"||te[1].type==="listOrdered")){if(we){let be=_;for(ye=void 0;be--;){const re=g[be];if(re[1].type==="lineEnding"||re[1].type==="lineEndingBlank"){if(re[0]==="exit")continue;ye&&(g[ye][1].type="lineEndingBlank",xe=!0),re[1].type="lineEnding",ye=be}else if(!(re[1].type==="linePrefix"||re[1].type==="blockQuotePrefix"||re[1].type==="blockQuotePrefixWhitespace"||re[1].type==="blockQuoteMarker"||re[1].type==="listItemIndent"))break}Te&&(!ye||Te<ye)&&(we._spread=!0),we.end=Object.assign({},ye?g[ye][1].start:te[1].end),g.splice(ye||_,0,["exit",we,te[2]]),_++,F++}if(te[1].type==="listItemPrefix"){const be={type:"listItem",_spread:!1,start:Object.assign({},te[1].start),end:void 0};we=be,g.splice(_,0,["enter",be,te[2]]),_++,F++,Te=void 0,ae=!0}}}return g[C][1]._spread=xe,F}function o(g,C){return F;function F(_){a.call(this,g(_),_),C&&C.call(this,_)}}function l(){this.stack.push({type:"fragment",children:[]})}function a(g,C,F){this.stack[this.stack.length-1].children.push(g),this.stack.push(g),this.tokenStack.push([C,F]),g.position={start:Le(C.start),end:void 0}}function u(g){return C;function C(F){g&&g.call(this,F),c.call(this,F)}}function c(g,C){const F=this.stack.pop(),_=this.tokenStack.pop();if(_)_[0].type!==g.type&&(C?C.call(this,g,_[0]):(_[1]||Ln).call(this,g,_[0]));else throw new Error("Cannot close `"+g.type+"` ("+Qe({start:g.start,end:g.end})+"): it’s not open");F.position.end=Le(g.end)}function x(){return Ks(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(g){if(this.data.expectingFirstListItemValue){const C=this.stack[this.stack.length-2];C.start=Number.parseInt(this.sliceSerialize(g),10),this.data.expectingFirstListItemValue=void 0}}function d(){const g=this.resume(),C=this.stack[this.stack.length-1];C.lang=g}function j(){const g=this.resume(),C=this.stack[this.stack.length-1];C.meta=g}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const g=this.resume(),C=this.stack[this.stack.length-1];C.value=g.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const g=this.resume(),C=this.stack[this.stack.length-1];C.value=g.replace(/(\r?\n|\r)$/g,"")}function w(g){const C=this.resume(),F=this.stack[this.stack.length-1];F.label=C,F.identifier=qe(this.sliceSerialize(g)).toLowerCase()}function k(){const g=this.resume(),C=this.stack[this.stack.length-1];C.title=g}function L(){const g=this.resume(),C=this.stack[this.stack.length-1];C.url=g}function D(g){const C=this.stack[this.stack.length-1];if(!C.depth){const F=this.sliceSerialize(g).length;C.depth=F}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function M(g){const C=this.stack[this.stack.length-1];C.depth=this.sliceSerialize(g).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function A(g){const F=this.stack[this.stack.length-1].children;let _=F[F.length-1];(!_||_.type!=="text")&&(_=gt(),_.position={start:Le(g.start),end:void 0},F.push(_)),this.stack.push(_)}function H(g){const C=this.stack.pop();C.value+=this.sliceSerialize(g),C.position.end=Le(g.end)}function I(g){const C=this.stack[this.stack.length-1];if(this.data.atHardBreak){const F=C.children[C.children.length-1];F.position.end=Le(g.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(C.type)&&(A.call(this,g),H.call(this,g))}function N(){this.data.atHardBreak=!0}function K(){const g=this.resume(),C=this.stack[this.stack.length-1];C.value=g}function $(){const g=this.resume(),C=this.stack[this.stack.length-1];C.value=g}function B(){const g=this.resume(),C=this.stack[this.stack.length-1];C.value=g}function U(){const g=this.stack[this.stack.length-1];if(this.data.inReference){const C=this.data.referenceType||"shortcut";g.type+="Reference",g.referenceType=C,delete g.url,delete g.title}else delete g.identifier,delete g.label;this.data.referenceType=void 0}function W(){const g=this.stack[this.stack.length-1];if(this.data.inReference){const C=this.data.referenceType||"shortcut";g.type+="Reference",g.referenceType=C,delete g.url,delete g.title}else delete g.identifier,delete g.label;this.data.referenceType=void 0}function ie(g){const C=this.sliceSerialize(g),F=this.stack[this.stack.length-2];F.label=$l(C),F.identifier=qe(C).toLowerCase()}function v(){const g=this.stack[this.stack.length-1],C=this.resume(),F=this.stack[this.stack.length-1];if(this.data.inReference=!0,F.type==="link"){const _=g.children;F.children=_}else F.alt=C}function h(){const g=this.resume(),C=this.stack[this.stack.length-1];C.url=g}function X(){const g=this.resume(),C=this.stack[this.stack.length-1];C.title=g}function Z(){this.data.inReference=void 0}function f(){this.data.referenceType="collapsed"}function oe(g){const C=this.resume(),F=this.stack[this.stack.length-1];F.label=C,F.identifier=qe(this.sliceSerialize(g)).toLowerCase(),this.data.referenceType="full"}function he(g){this.data.characterReferenceType=g.type}function Y(g){const C=this.sliceSerialize(g),F=this.data.characterReferenceType;let _;F?(_=Nr(C,F==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):_=Zt(C);const q=this.stack.pop();q.value+=_,q.position.end=Le(g.end)}function je(g){H.call(this,g);const C=this.stack[this.stack.length-1];C.url=this.sliceSerialize(g)}function ee(g){H.call(this,g);const C=this.stack[this.stack.length-1];C.url="mailto:"+this.sliceSerialize(g)}function pe(){return{type:"blockquote",children:[]}}function le(){return{type:"code",lang:null,meta:null,value:""}}function Ie(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ae(){return{type:"emphasis",children:[]}}function Me(){return{type:"heading",depth:0,children:[]}}function Ee(){return{type:"break"}}function O(){return{type:"html",value:""}}function Ye(){return{type:"image",title:null,url:"",alt:null}}function Ze(){return{type:"link",title:null,url:"",children:[]}}function et(g){return{type:"list",ordered:g.type==="listOrdered",start:null,spread:g._spread,children:[]}}function ht(g){return{type:"listItem",spread:g._spread,checked:null,children:[]}}function ft(){return{type:"paragraph",children:[]}}function tt(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function jt(){return{type:"thematicBreak"}}}function Le(e){return{line:e.line,column:e.column,offset:e.offset}}function _r(e,n){let r=-1;for(;++r<n.length;){const i=n[r];Array.isArray(i)?_r(e,i):Gl(e,i)}}function Gl(e,n){let r;for(r in n)if(Br.call(n,r))switch(r){case"canContainEols":{const i=n[r];i&&e[r].push(...i);break}case"transforms":{const i=n[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=n[r];i&&Object.assign(e[r],i);break}}}function Ln(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Qe({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Qe({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Qe({start:n.start,end:n.end})+") is still open")}function Jl(e){const n=this;n.parser=r;function r(i){return Ql(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function Xl(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function Yl(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
165
+ `}]}function Zl(e,n){const r=n.value?n.value+`
166
+ `:"",i={};n.lang&&(i.className=["language-"+n.lang]);let s={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return n.meta&&(s.data={meta:n.meta}),e.patch(n,s),s=e.applyData(n,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(n,s),s}function ea(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ta(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function na(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),s=He(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let l,a=e.footnoteCounts.get(i);a===void 0?(a=0,e.footnoteOrder.push(i),l=e.footnoteOrder.length):l=o+1,a+=1,e.footnoteCounts.set(i,a);const u={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(n,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(n,c),e.applyData(n,c)}function ra(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ia(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function qr(e,n){const r=n.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];const s=e.all(n),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=i:s.push({type:"text",value:i}),s}function sa(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return qr(e,n);const s={src:He(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(s.title=i.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(n,o),e.applyData(n,o)}function oa(e,n){const r={src:He(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,i),e.applyData(n,i)}function la(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,i),e.applyData(n,i)}function aa(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return qr(e,n);const s={href:He(i.url||"")};i.title!==null&&i.title!==void 0&&(s.title=i.title);const o={type:"element",tagName:"a",properties:s,children:e.all(n)};return e.patch(n,o),e.applyData(n,o)}function ua(e,n){const r={href:He(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function ca(e,n,r){const i=e.all(n),s=r?pa(r):Vr(n),o={},l=[];if(typeof n.checked=="boolean"){const x=i[0];let p;x&&x.type==="element"&&x.tagName==="p"?p=x:(p={type:"element",tagName:"p",properties:{},children:[]},i.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<i.length;){const x=i[a];(s||a!==0||x.type!=="element"||x.tagName!=="p")&&l.push({type:"text",value:`
167
+ `}),x.type==="element"&&x.tagName==="p"&&!s?l.push(...x.children):l.push(x)}const u=i[i.length-1];u&&(s||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
168
+ `});const c={type:"element",tagName:"li",properties:o,children:l};return e.patch(n,c),e.applyData(n,c)}function pa(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let i=-1;for(;!n&&++i<r.length;)n=Vr(r[i])}return n}function Vr(e){const n=e.spread;return n??e.children.length>1}function xa(e,n){const r={},i=e.all(n);let s=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++s<i.length;){const l=i[s];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const o={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(n,o),e.applyData(n,o)}function da(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ma(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function ha(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function fa(e,n){const r=e.all(n),i=r.shift(),s=[];if(i){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],l),s.push(l)}if(r.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},a=Gt(n.children[1]),u=br(n.children[n.children.length-1]);a&&u&&(l.position={start:a,end:u}),s.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(n,o),e.applyData(n,o)}function ga(e,n,r){const i=r?r.children:void 0,o=(i?i.indexOf(n):1)===0?"th":"td",l=r&&r.type==="table"?r.align:void 0,a=l?l.length:n.children.length;let u=-1;const c=[];for(;++u<a;){const p=n.children[u],m={},d=l?l[u]:void 0;d&&(m.align=d);let j={type:"element",tagName:o,properties:m,children:[]};p&&(j.children=e.all(p),e.patch(p,j),j=e.applyData(p,j)),c.push(j)}const x={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(n,x),e.applyData(n,x)}function ja(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const zn=9,On=32;function ya(e){const n=String(e),r=/\r?\n|\r/g;let i=r.exec(n),s=0;const o=[];for(;i;)o.push(Dn(n.slice(s,i.index),s>0,!0),i[0]),s=i.index+i[0].length,i=r.exec(n);return o.push(Dn(n.slice(s),s>0,!1)),o.join("")}function Dn(e,n,r){let i=0,s=e.length;if(n){let o=e.codePointAt(i);for(;o===zn||o===On;)i++,o=e.codePointAt(i)}if(r){let o=e.codePointAt(s-1);for(;o===zn||o===On;)s--,o=e.codePointAt(s-1)}return s>i?e.slice(i,s):""}function Ea(e,n){const r={type:"text",value:ya(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function ba(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const Sa={blockquote:Xl,break:Yl,code:Zl,delete:ea,emphasis:ta,footnoteReference:na,heading:ra,html:ia,imageReference:sa,image:oa,inlineCode:la,linkReference:aa,link:ua,listItem:ca,list:xa,paragraph:da,root:ma,strong:ha,table:fa,tableCell:ja,tableRow:ga,text:Ea,thematicBreak:ba,toml:nt,yaml:nt,definition:nt,footnoteDefinition:nt};function nt(){}const Hr=-1,dt=0,lt=1,at=2,nn=3,rn=4,sn=5,on=6,Ur=7,$r=8,Fn=typeof self=="object"?self:globalThis,ka=(e,n)=>{const r=(s,o)=>(e.set(o,s),s),i=s=>{if(e.has(s))return e.get(s);const[o,l]=n[s];switch(o){case dt:case Hr:return r(l,s);case lt:{const a=r([],s);for(const u of l)a.push(i(u));return a}case at:{const a=r({},s);for(const[u,c]of l)a[i(u)]=i(c);return a}case nn:return r(new Date(l),s);case rn:{const{source:a,flags:u}=l;return r(new RegExp(a,u),s)}case sn:{const a=r(new Map,s);for(const[u,c]of l)a.set(i(u),i(c));return a}case on:{const a=r(new Set,s);for(const u of l)a.add(i(u));return a}case Ur:{const{name:a,message:u}=l;return r(new Fn[a](u),s)}case $r:return r(BigInt(l),s);case"BigInt":return r(Object(BigInt(l)),s)}return r(new Fn[o](l),s)};return i},Mn=e=>ka(new Map,e)(0),Pe="",{toString:Ra}={},{keys:Ca}=Object,$e=e=>{const n=typeof e;if(n!=="object"||!e)return[dt,n];const r=Ra.call(e).slice(8,-1);switch(r){case"Array":return[lt,Pe];case"Object":return[at,Pe];case"Date":return[nn,Pe];case"RegExp":return[rn,Pe];case"Map":return[sn,Pe];case"Set":return[on,Pe]}return r.includes("Array")?[lt,r]:r.includes("Error")?[Ur,r]:[at,r]},rt=([e,n])=>e===dt&&(n==="function"||n==="symbol"),wa=(e,n,r,i)=>{const s=(l,a)=>{const u=i.push(l)-1;return r.set(a,u),u},o=l=>{if(r.has(l))return r.get(l);let[a,u]=$e(l);switch(a){case dt:{let x=l;switch(u){case"bigint":a=$r,x=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);x=null;break;case"undefined":return s([Hr],l)}return s([a,x],l)}case lt:{if(u)return s([u,[...l]],l);const x=[],p=s([a,x],l);for(const m of l)x.push(o(m));return p}case at:{if(u)switch(u){case"BigInt":return s([u,l.toString()],l);case"Boolean":case"Number":case"String":return s([u,l.valueOf()],l)}if(n&&"toJSON"in l)return o(l.toJSON());const x=[],p=s([a,x],l);for(const m of Ca(l))(e||!rt($e(l[m])))&&x.push([o(m),o(l[m])]);return p}case nn:return s([a,l.toISOString()],l);case rn:{const{source:x,flags:p}=l;return s([a,{source:x,flags:p}],l)}case sn:{const x=[],p=s([a,x],l);for(const[m,d]of l)(e||!(rt($e(m))||rt($e(d))))&&x.push([o(m),o(d)]);return p}case on:{const x=[],p=s([a,x],l);for(const m of l)(e||!rt($e(m)))&&x.push(o(m));return p}}const{message:c}=l;return s([a,{name:u,message:c}],l)};return o},Pn=(e,{json:n,lossy:r}={})=>{const i=[];return wa(!(n||r),!!n,new Map,i)(e),i},ut=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Mn(Pn(e,n)):structuredClone(e):(e,n)=>Mn(Pn(e,n));function va(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function Na(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function Ia(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||va,i=e.options.footnoteBackLabel||Na,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let u=-1;for(;++u<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[u]);if(!c)continue;const x=e.all(c),p=String(c.identifier).toUpperCase(),m=He(p.toLowerCase());let d=0;const j=[],E=e.footnoteCounts.get(p);for(;E!==void 0&&++d<=E;){j.length>0&&j.push({type:"text",value:" "});let w=typeof r=="string"?r:r(u,d);typeof w=="string"&&(w={type:"text",value:w}),j.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+m+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(u,d),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const S=x[x.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const w=S.children[S.children.length-1];w&&w.type==="text"?w.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...j)}else x.push(...j);const y={type:"element",tagName:"li",properties:{id:n+"fn-"+m},children:e.wrap(x,!0)};e.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ut(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
169
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
170
+ `}]}}const Kr=function(e){if(e==null)return za;if(typeof e=="function")return mt(e);if(typeof e=="object")return Array.isArray(e)?Aa(e):Ta(e);if(typeof e=="string")return La(e);throw new Error("Expected function, string, or object as test")};function Aa(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Kr(e[r]);return mt(i);function i(...s){let o=-1;for(;++o<n.length;)if(n[o].apply(this,s))return!0;return!1}}function Ta(e){const n=e;return mt(r);function r(i){const s=i;let o;for(o in e)if(s[o]!==n[o])return!1;return!0}}function La(e){return mt(n);function n(r){return r&&r.type===e}}function mt(e){return n;function n(r,i,s){return!!(Oa(r)&&e.call(this,r,typeof i=="number"?i:void 0,s||void 0))}}function za(){return!0}function Oa(e){return e!==null&&typeof e=="object"&&"type"in e}const Qr=[],Da=!0,Bn=!1,Fa="skip";function Ma(e,n,r,i){let s;typeof n=="function"&&typeof r!="function"?(i=r,r=n):s=n;const o=Kr(s),l=i?-1:1;a(e,void 0,[])();function a(u,c,x){const p=u&&typeof u=="object"?u:{};if(typeof p.type=="string"){const d=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(u.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=Qr,j,E,S;if((!n||o(u,c,x[x.length-1]||void 0))&&(d=Pa(r(u,x)),d[0]===Bn))return d;if("children"in u&&u.children){const y=u;if(y.children&&d[0]!==Fa)for(E=(i?y.children.length:-1)+l,S=x.concat(y);E>-1&&E<y.children.length;){const w=y.children[E];if(j=a(w,E,S)(),j[0]===Bn)return j;E=typeof j[1]=="number"?j[1]:E+l}}return d}}}function Pa(e){return Array.isArray(e)?e:typeof e=="number"?[Da,e]:e==null?Qr:[e]}function Wr(e,n,r,i){let s,o,l;typeof n=="function"&&typeof r!="function"?(o=void 0,l=n,s=r):(o=n,l=r,s=i),Ma(e,o,a,s);function a(u,c){const x=c[c.length-1],p=x?x.children.indexOf(u):void 0;return l(u,p,x)}}const qt={}.hasOwnProperty,Ba={};function _a(e,n){const r=n||Ba,i=new Map,s=new Map,o=new Map,l={...Sa,...r.handlers},a={all:c,applyData:Va,definitionById:i,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:l,one:u,options:r,patch:qa,wrap:Ua};return Wr(e,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const p=x.type==="definition"?i:s,m=String(x.identifier).toUpperCase();p.has(m)||p.set(m,x)}}),a;function u(x,p){const m=x.type,d=a.handlers[m];if(qt.call(a.handlers,m)&&d)return d(a,x,p);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in x){const{children:E,...S}=x,y=ut(S);return y.children=a.all(x),y}return ut(x)}return(a.options.unknownHandler||Ha)(a,x,p)}function c(x){const p=[];if("children"in x){const m=x.children;let d=-1;for(;++d<m.length;){const j=a.one(m[d],x);if(j){if(d&&m[d-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=_n(j.value)),!Array.isArray(j)&&j.type==="element")){const E=j.children[0];E&&E.type==="text"&&(E.value=_n(E.value))}Array.isArray(j)?p.push(...j):p.push(j)}}}return p}}function qa(e,n){e.position&&(n.position=Ss(e))}function Va(e,n){let r=n;if(e&&e.data){const i=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const l="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:l}}r.type==="element"&&o&&Object.assign(r.properties,ut(o)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function Ha(e,n){const r=n.data||{},i="value"in n&&!(qt.call(r,"hProperties")||qt.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function Ua(e,n){const r=[];let i=-1;for(n&&r.push({type:"text",value:`
171
+ `});++i<e.length;)i&&r.push({type:"text",value:`
172
+ `}),r.push(e[i]);return n&&e.length>0&&r.push({type:"text",value:`
173
+ `}),r}function _n(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function qn(e,n){const r=_a(e,n),i=r.one(e,void 0),s=Ia(r),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
174
+ `},s),o}function $a(e,n){return e&&"run"in e?async function(r,i){const s=qn(r,{file:i,...n});await e.run(s,i)}:function(r,i){return qn(r,{file:i,...n||e})}}function Vn(e){if(e)throw e}var ot=Object.prototype.hasOwnProperty,Gr=Object.prototype.toString,Hn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,$n=function(n){return typeof Array.isArray=="function"?Array.isArray(n):Gr.call(n)==="[object Array]"},Kn=function(n){if(!n||Gr.call(n)!=="[object Object]")return!1;var r=ot.call(n,"constructor"),i=n.constructor&&n.constructor.prototype&&ot.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!r&&!i)return!1;var s;for(s in n);return typeof s>"u"||ot.call(n,s)},Qn=function(n,r){Hn&&r.name==="__proto__"?Hn(n,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):n[r.name]=r.newValue},Wn=function(n,r){if(r==="__proto__")if(ot.call(n,r)){if(Un)return Un(n,r).value}else return;return n[r]},Ka=function e(){var n,r,i,s,o,l,a=arguments[0],u=1,c=arguments.length,x=!1;for(typeof a=="boolean"&&(x=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<c;++u)if(n=arguments[u],n!=null)for(r in n)i=Wn(a,r),s=Wn(n,r),a!==s&&(x&&s&&(Kn(s)||(o=$n(s)))?(o?(o=!1,l=i&&$n(i)?i:[]):l=i&&Kn(i)?i:{},Qn(a,{name:r,newValue:e(x,l,s)})):typeof s<"u"&&Qn(a,{name:r,newValue:s}));return a};const Ct=t.getDefaultExportFromCjs(Ka);function Vt(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Qa(){const e=[],n={run:r,use:i};return n;function r(...s){let o=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);a(null,...s);function a(u,...c){const x=e[++o];let p=-1;if(u){l(u);return}for(;++p<s.length;)(c[p]===null||c[p]===void 0)&&(c[p]=s[p]);s=c,x?Wa(x,a)(...c):l(null,...c)}}function i(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),n}}function Wa(e,n){let r;return i;function i(...l){const a=e.length>l.length;let u;a&&l.push(s);try{u=e.apply(this,l)}catch(c){const x=c;if(a&&r)throw x;return s(x)}a||(u instanceof Promise?u.then(o,s):u instanceof Error?s(u):o(u))}function s(l,...a){r||(r=!0,n(l,...a))}function o(l){s(null,l)}}const Se={basename:Ga,dirname:Ja,extname:Xa,join:Ya,sep:"/"};function Ga(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Xe(e);let r=0,i=-1,s=e.length,o;if(n===void 0||n.length===0||n.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){r=s+1;break}}else i<0&&(o=!0,i=s+1);return i<0?"":e.slice(r,i)}if(n===e)return"";let l=-1,a=n.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){r=s+1;break}}else l<0&&(o=!0,l=s+1),a>-1&&(e.codePointAt(s)===n.codePointAt(a--)?a<0&&(i=s):(a=-1,i=l));return r===i?i=l:i<0&&(i=e.length),e.slice(r,i)}function Ja(e){if(Xe(e),e.length===0)return".";let n=-1,r=e.length,i;for(;--r;)if(e.codePointAt(r)===47){if(i){n=r;break}}else i||(i=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function Xa(e){Xe(e);let n=e.length,r=-1,i=0,s=-1,o=0,l;for(;n--;){const a=e.codePointAt(n);if(a===47){if(l){i=n+1;break}continue}r<0&&(l=!0,r=n+1),a===46?s<0?s=n:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||r<0||o===0||o===1&&s===r-1&&s===i+1?"":e.slice(s,r)}function Ya(...e){let n=-1,r;for(;++n<e.length;)Xe(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":Za(r)}function Za(e){Xe(e);const n=e.codePointAt(0)===47;let r=eu(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function eu(e,n){let r="",i=0,s=-1,o=0,l=-1,a,u;for(;++l<=e.length;){if(l<e.length)a=e.codePointAt(l);else{if(a===47)break;a=47}if(a===47){if(!(s===l-1||o===1))if(s!==l-1&&o===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(u=r.lastIndexOf("/"),u!==r.length-1){u<0?(r="",i=0):(r=r.slice(0,u),i=r.length-1-r.lastIndexOf("/")),s=l,o=0;continue}}else if(r.length>0){r="",i=0,s=l,o=0;continue}}n&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(s+1,l):r=e.slice(s+1,l),i=l-s-1;s=l,o=0}else a===46&&o>-1?o++:o=-1}return r}function Xe(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const tu={cwd:nu};function nu(){return"/"}function Ht(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ru(e){if(typeof e=="string")e=new URL(e);else if(!Ht(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return iu(e)}function iu(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const i=n.codePointAt(r+2);if(i===70||i===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}const wt=["history","path","basename","stem","extname","dirname"];class Jr{constructor(n){let r;n?Ht(n)?r={path:n}:typeof n=="string"||su(n)?r={value:n}:r=n:r={},this.cwd=tu.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<wt.length;){const o=wt[i];o in r&&r[o]!==void 0&&r[o]!==null&&(this[o]=o==="history"?[...r[o]]:r[o])}let s;for(s in r)wt.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Se.basename(this.path):void 0}set basename(n){Nt(n,"basename"),vt(n,"basename"),this.path=Se.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Se.dirname(this.path):void 0}set dirname(n){Gn(this.basename,"dirname"),this.path=Se.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Se.extname(this.path):void 0}set extname(n){if(vt(n,"extname"),Gn(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Se.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Ht(n)&&(n=ru(n)),Nt(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Se.basename(this.path,this.extname):void 0}set stem(n){Nt(n,"stem"),vt(n,"stem"),this.path=Se.join(this.dirname||"",n+(this.extname||""))}fail(n,r,i){const s=this.message(n,r,i);throw s.fatal=!0,s}info(n,r,i){const s=this.message(n,r,i);return s.fatal=void 0,s}message(n,r,i){const s=new se(n,r,i);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function vt(e,n){if(e&&e.includes(Se.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Se.sep+"`")}function Nt(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Gn(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function su(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ou=function(e){const i=this.constructor.prototype,s=i[e],o=function(){return s.apply(o,arguments)};Object.setPrototypeOf(o,i);const l=Object.getOwnPropertyNames(s);for(const a of l){const u=Object.getOwnPropertyDescriptor(s,a);u&&Object.defineProperty(o,a,u)}return o},lu={}.hasOwnProperty;class ln extends ou{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Qa()}copy(){const n=new ln;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];n.use(...i)}return n.data(Ct(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Tt("data",this.frozen),this.namespace[n]=r,this):lu.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Tt("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const s=r.call(n,...i);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=it(n),i=this.parser||this.Parser;return It("parse",i),i(String(r),r)}process(n,r){const i=this;return this.freeze(),It("process",this.parser||this.Parser),At("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(o,l){const a=it(n),u=i.parse(a);i.run(u,a,function(x,p,m){if(x||!p||!m)return c(x);const d=p,j=i.stringify(d,m);cu(j)?m.value=j:m.result=j,c(x,m)});function c(x,p){x||!p?l(x):o?o(p):r(void 0,p)}}}processSync(n){let r=!1,i;return this.freeze(),It("processSync",this.parser||this.Parser),At("processSync",this.compiler||this.Compiler),this.process(n,s),Xn("processSync","process",r),i;function s(o,l){r=!0,Vn(o),i=l}}run(n,r,i){Jn(n),this.freeze();const s=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?o(void 0,i):new Promise(o);function o(l,a){const u=it(r);s.run(n,u,c);function c(x,p,m){const d=p||n;x?a(x):l?l(d):i(void 0,d,m)}}}runSync(n,r){let i=!1,s;return this.run(n,r,o),Xn("runSync","run",i),s;function o(l,a){Vn(l),s=a,i=!0}}stringify(n,r){this.freeze();const i=it(r),s=this.compiler||this.Compiler;return At("stringify",s),Jn(n),s(n,i)}use(n,...r){const i=this.attachers,s=this.namespace;if(Tt("use",this.frozen),n!=null)if(typeof n=="function")u(n,r);else if(typeof n=="object")Array.isArray(n)?a(n):l(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function o(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[x,...p]=c;u(x,p)}else l(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function l(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(s.settings=Ct(!0,s.settings,c.settings))}function a(c){let x=-1;if(c!=null)if(Array.isArray(c))for(;++x<c.length;){const p=c[x];o(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,x){let p=-1,m=-1;for(;++p<i.length;)if(i[p][0]===c){m=p;break}if(m===-1)i.push([c,...x]);else if(x.length>0){let[d,...j]=x;const E=i[m][1];Vt(E)&&Vt(d)&&(d=Ct(!0,E,d)),i[m]=[c,d,...j]}}}}const au=new ln().freeze();function It(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function At(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Tt(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Jn(e){if(!Vt(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Xn(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function it(e){return uu(e)?e:new Jr(e)}function uu(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function cu(e){return typeof e=="string"||pu(e)}function pu(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xu="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Yn=[],Zn={allowDangerousHtml:!0},du=/^(https?|ircs?|mailto|xmpp)$/i,mu=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function hu(e){const n=e.allowedElements,r=e.allowElement,i=e.children||"",s=e.className,o=e.components,l=e.disallowedElements,a=e.rehypePlugins||Yn,u=e.remarkPlugins||Yn,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Zn}:Zn,x=e.skipHtml,p=e.unwrapDisallowed,m=e.urlTransform||fu,d=au().use(Jl).use(u).use($a,c).use(a),j=new Jr;typeof i=="string"&&(j.value=i);for(const w of mu)Object.hasOwn(e,w.from)&&(""+w.from+(w.to?"use `"+w.to+"` instead":"remove it")+xu+w.id,void 0);const E=d.parse(j);let S=d.runSync(E,j);return s&&(S={type:"element",tagName:"div",properties:{className:s},children:S.type==="root"?S.children:[S]}),Wr(S,y),Ns(S,{Fragment:t.jsxRuntimeExports.Fragment,components:o,ignoreInvalidStyle:!0,jsx:t.jsxRuntimeExports.jsx,jsxs:t.jsxRuntimeExports.jsxs,passKeys:!0,passNode:!0});function y(w,k,L){if(w.type==="raw"&&L&&typeof k=="number")return x?L.children.splice(k,1):L.children[k]={type:"text",value:w.value},k;if(w.type==="element"){let D;for(D in St)if(Object.hasOwn(St,D)&&Object.hasOwn(w.properties,D)){const b=w.properties[D],M=St[D];(M===null||M.includes(w.tagName))&&(w.properties[D]=m(String(b||""),D,w))}}if(w.type==="element"){let D=n?!n.includes(w.tagName):l?l.includes(w.tagName):!1;if(!D&&r&&typeof k=="number"&&(D=!r(w,k,L)),D&&L&&typeof k=="number")return p&&w.children?L.children.splice(k,1,...w.children):L.children.splice(k,1),k}}}function fu(e){const n=e.indexOf(":"),r=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return n<0||s>-1&&n>s||r>-1&&n>r||i>-1&&n>i||du.test(e.slice(0,n))?e:""}const gu=`
175
+
176
+ Use the following syntax to create a chart query. Please replace the x-axis, y-axis, stack-by, label, and measure with the actual column names of the table.
177
+
178
+ Bar / Line Chart:
179
+
180
+ SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table
181
+
182
+ - X-axis - Category
183
+ - Y-axis - Number
184
+
185
+ Stacked Chart:
186
+
187
+ SELECT x-axis, stack-by, y-axis FROM table
188
+
189
+ - X-axis - Category
190
+ - Stack by - Category
191
+ - Y-axis - Number
192
+
193
+
194
+ Scatter Chart:
195
+
196
+ SELECT label, x-axis, y-axis FROM table
197
+
198
+ - Label - Category
199
+ - Group (opt) - Category
200
+ - X-axis - Number
201
+ - Y-axis - Number
202
+
203
+
204
+ Bubble Chart:
205
+
206
+ SELECT label, x-axis, y-axis, radius FROM table
207
+
208
+ - Label - Category
209
+ - Bubble Group (opt) - Category
210
+ - X-axis - Number
211
+ - Y-axis - Number
212
+ - Radius - Number
213
+
214
+ Pie / Dougnut Chart:
215
+
216
+ SELECT label, measure FROM table
217
+
218
+ - Label - Category
219
+ - Measure - Number
220
+ `;function ju({open:e,setOpen:n,userInput:r,setUserInput:i,triggerAIRun:s,setTriggerAIRun:o}){const l=T.useRef(null),a=T.useRef(null),{authToken:u}=t.useSemaphorContext(),[c,x]=T.useState(!1),p=t.useEditorStore(v=>v.actions.setCardSql),m=t.useDashboardStore(v=>v.dashboard.baseQueries),d=t.useEditorStore(v=>v.actions.setRunSql),j=t.useEditorStore(v=>v.actions.setCardType),[E,S]=T.useState([]),y=t.useEditorStore(v=>v.currentColumns),w=t.useEditorStore(v=>v.card.sql),k=t.useEditorStore(v=>v.selectedTableName),L=`
221
+ ${r}
222
+
223
+ Database Query Dialect: ${k==="api"||k==="s3"?"DuckDb":""}
224
+ Table Name: ${k}
225
+ Table Columns: ${y==null?void 0:y.map(v=>`${v.column_name} | ${v.data_type}`).join(", ")}
226
+ User SQL: ${w}
227
+ ${m&&`Base Queries: ${JSON.stringify(m)} `}`,D=` When the user asks for a specific chart please use the following query structure to generate the chart query. Do not make up the column names. Use only the table columns provided above for the query. Replace x-axis, y-axis, and lables with the appropriate column names.
228
+ Visual Query Syntax: ${gu}`,{data:b,isLoading:M,isFetching:z,isError:A,refetch:H}=t.useQuery({queryKey:["ai-query"],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/ai",(u==null?void 0:u.accessToken)||"",{user_content:`userContent: ${L} ${c?D:""}`}),enabled:!1});function I(v){if(v.toLowerCase().includes("bar"))j("bar");else if(v.toLowerCase().includes("line"))j("line");else if(v.toLowerCase().includes("bubble"))j("bubble");else if(v.toLowerCase().includes("scatter"))j("scatter");else if(v.toLowerCase().includes("stacked"))j("stackedBar");else if(v.toLowerCase().includes("pie"))j("pie");else if(v.toLowerCase().includes("donut")||v.toLowerCase().includes("doughnut"))j("doughnut");else if(v.toLowerCase().includes("radar"))j("radar");else return j("bar"),!1;return!0}T.useEffect(()=>{b&&S(v=>[...v,{role:"ai",content:b.response}])},[b]),T.useEffect(()=>{const v=setTimeout(()=>{var h;a.current&&(a.current.scroll({top:a.current.scrollHeight,behavior:"smooth"}),(h=l.current)==null||h.focus())},100);return()=>clearTimeout(v)},[E]);function N(){r&&(S(v=>[...v,{role:"user",content:r}]),I(r)&&x(!0),i(""),H())}T.useEffect(()=>{s&&(N(),o(!1))},[s,o]);const K={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,width:"100%"},$={fontFamily:"monospace",fontSize:14,lineHeight:1.6},B={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,padding:"2px 0",marginLeft:20,listStyleType:"disc"},U={p:({node:v,...h})=>t.jsxRuntimeExports.jsx("p",{style:K,...h}),code:({node:v,...h})=>t.jsxRuntimeExports.jsx("code",{className:"rounded-sm bg-muted px-2 py-1 text-sm",...h}),pre:({node:v,...h})=>t.jsxRuntimeExports.jsxs("pre",{className:"space-y-2 rounded-sm bg-muted/50 p-3",style:$,children:[t.jsxRuntimeExports.jsx("code",{className:"whitespace-normal text-sm",children:h.children}),t.jsxRuntimeExports.jsxs("div",{className:"flex justify-start gap-2",children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:W,size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:X=>{const Z=W(X);Z&&(n(!1),p(Z),d(!0))},size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(t.PlayIcon,{})})]})]}),li:({node:v,...h})=>t.jsxRuntimeExports.jsx("li",{style:B,...h})};function W(v){const h=v.currentTarget.closest("pre");if(!h)return;const X=h.textContent||h.innerText;return navigator.clipboard.writeText(X).then(()=>console.log("Text copied to clipboard")).catch(Z=>console.error("Error in copying text: ",Z)),X}function ie(){return E==null?void 0:E.map((v,h)=>v.role==="user"?t.jsxRuntimeExports.jsxs("div",{className:"flex items-start rounded-md bg-muted p-3 text-sm",children:[t.jsxRuntimeExports.jsx(Li,{className:"mr-2 h-5 w-5"}),t.jsxRuntimeExports.jsx("div",{children:v.content})]},h):v.role==="ai"?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(hu,{className:"w-full overflow-auto py-1",components:U,children:b==null?void 0:b.response},h)}):t.jsxRuntimeExports.jsx("div",{},h))}return t.jsxRuntimeExports.jsxs(t.Dialog,{open:e,onOpenChange:n,children:[t.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{size:"sm",className:"w-full justify-start border font-normal text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0",variant:"secondary",children:"Type your question here..."})}),t.jsxRuntimeExports.jsxs(t.DialogContent,{className:"flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]",children:[t.jsxRuntimeExports.jsxs(t.DialogHeader,{children:[t.jsxRuntimeExports.jsx(t.DialogTitle,{children:"Assistant"}),t.jsxRuntimeExports.jsx(t.DialogDescription,{children:"What can I help you with?"})]}),t.jsxRuntimeExports.jsx("div",{ref:a,className:"h-[625px] w-full overflow-auto border-t border-t-muted",children:t.jsxRuntimeExports.jsx("div",{className:"space-y-4 py-2 pr-3",role:"messages",children:ie()})}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center rounded-md border",children:[t.jsxRuntimeExports.jsx(t.Textarea,{autoFocus:!0,ref:l,onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),i(""),N())},placeholder:"Type your question here...",onFocus:v=>{const h=v.target,X=h.value.length;h.setSelectionRange(X,X)},className:t.cn("max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"),disabled:M||z,value:r,onChange:v=>i(v.target.value)})," ",t.jsxRuntimeExports.jsx(t.Button,{className:"h-8",size:"sm",variant:"ghost",onClick:N,children:!M&&!z?t.jsxRuntimeExports.jsx(t.PaperPlaneIcon,{}):t.jsxRuntimeExports.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"})})]})})]})]})}var Xr={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},er=T.createContext&&T.createContext(Xr),yu=["attr","size","title"];function Eu(e,n){if(e==null)return{};var r=bu(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function bu(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}function ct(){return ct=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ct.apply(this,arguments)}function tr(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function pt(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?tr(Object(r),!0).forEach(function(i){Su(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tr(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Su(e,n,r){return n=ku(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ku(e){var n=Ru(e,"string");return typeof n=="symbol"?n:String(n)}function Ru(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Yr(e){return e&&e.map((n,r)=>T.createElement(n.tag,pt({key:r},n.attr),Yr(n.child)))}function Fe(e){return n=>T.createElement(Cu,ct({attr:pt({},e.attr)},n),Yr(e.child))}function Cu(e){var n=r=>{var{attr:i,size:s,title:o}=e,l=Eu(e,yu),a=s||r.size||"1em",u;return r.className&&(u=r.className),e.className&&(u=(u?u+" ":"")+e.className),T.createElement("svg",ct({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,i,l,{className:u,style:pt(pt({color:e.color||r.color},r.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),o&&T.createElement("title",null,o),e.children)};return er!==void 0?T.createElement(er.Consumer,null,r=>n(r)):n(Xr)}function wu(e){return Fe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"},child:[]}]})(e)}function vu(){const{theme:e}=t.useTheme(),n=T.useRef(),r=T.useRef(),[i,s]=T.useState(!1),[o,l]=T.useState(!1),[a,u]=T.useState(!1),[c,x]=T.useState(""),[p,m]=T.useState(!1),{authToken:d}=t.useSemaphorContext();t.useDashboardStore(g=>g.selectedSheetId);const j=t.useDashboardStore(g=>g.dashboard.baseQueries),E=t.useEditorStore(g=>g.card),S=t.useDashboardStore(g=>g.theme),y=t.useEditorStore(g=>g.isShowingVisual),w=t.useEditorStore(g=>g.selectedConnectionId),k=t.useEditorStore(g=>g.selectedDatabaseName),L=t.useEditorStore(g=>g.selectedSchemaName);t.useDashboardStore(g=>g.actions.updateFrameCard);const D=t.useEditorStore(g=>g.selectedTableName),b=t.useEditorStore(g=>g.card.sql),M=t.useEditorStore(g=>g.card.python),z=t.resolveBaseQuery(b,j),A=t.useEditorStore(g=>g.selectedConnectionId),H=t.useEditorStore(g=>g.frame),I=t.useEditorStore(g=>g.filterValues),N=t.useEditorStore(g=>g.applyFilters),{setCardCustomCfg:K,setQueryResultColumns:$,setFilterValues:B,setCardSql:U,setCardPython:W,setQueryError:ie,setPythonStdOut:v}=t.useEditorStore(g=>g.actions),h=t.useEditorStore(g=>g.onSave),X=t.useEditorStore(g=>g.actions.setApplyFilters),Z=t.useEditorStore(g=>g.onClose),f=t.useEditorStore(g=>g.actions.setCardData),oe=t.useEditorStore(g=>g.actions.setSqlGen),he=t.useEditorStore(g=>g.runSql),Y=t.useEditorStore(g=>g.actions.setRunSql),je=t.useEditorStore(g=>g.actions.setIsSqlRunning),{data:ee,isLoading:pe,isFetching:le,isSuccess:Ie,isError:Ce,error:Ae,status:Me,refetch:Ee}=t.useQuery({queryKey:[z,M],queryFn:()=>t.postRequest("https://semaphor.cloud/api/v1/query",(d==null?void 0:d.accessToken)||"",{connection_id:A,sql:z,python:M===t.PYTHON_DEFAULT_CODE?"":M,active_filters:N?I:[]}),enabled:!1,retry:!1});T.useEffect(()=>{if(ee&&(f(ee.records),v((ee==null?void 0:ee.output)||""),ee.records.length>0)){const{dimensionKeys:g}=t.getKeys(ee.records);$(g)}},[ee,f,$,v]),T.useEffect(()=>{he&&(Ee(),Y(!1))},[he,Ee,Y]),T.useEffect(()=>{(pe||le)&&je(!0),(Ce||Ie)&&je(!1),Ce?(ie(Ae.message),f([]),$([]),v("")):ie("")},[pe,le,ee,v,Ce,Ie,je,f,$,ie,Ae]);function O(){U(""),f([]),oe({}),K("")}const Ye=g=>{r.current=g};function Ze(){let g=b;b&&!b.includes("{{")&&(g=Bi(b),U(g));const C={...E,lastSelectedSchema:L,lastSelectedDatabase:k,lastSelectedTable:D,connectionId:w,type:y?E.type:"table",sql:g,customCfg:y?E.customCfg:null},F=H.cards.map(_=>_.id===E.id?C:_);h==null||h({...H,cards:F})}function et(){Z==null||Z()}function ht(g){const C=getComputedStyle(document.documentElement).getPropertyValue(g);return ft(C)}function ft(g){const[C,F,_]=g.split(" "),q=parseFloat(C),xe=parseFloat(F),we=parseFloat(_),ye=xe/100,Te=we/100,ae=(1-Math.abs(2*Te-1))*ye,te=ae*(1-Math.abs(q/60%2-1)),be=Te-ae/2;let re=0,ve=0,Ne=0;0<=q&&q<60?(re=ae,ve=te,Ne=0):60<=q&&q<120?(re=te,ve=ae,Ne=0):120<=q&&q<180?(re=0,ve=ae,Ne=te):180<=q&&q<240?(re=0,ve=te,Ne=ae):240<=q&&q<300?(re=te,ve=0,Ne=ae):300<=q&&q<360&&(re=ae,ve=0,Ne=te),re=Math.round((re+be)*255),ve=Math.round((ve+be)*255),Ne=Math.round((Ne+be)*255);const yt=ai=>{const Et=ai.toString(16);return Et.length==1?"0"+Et:Et};return`#${yt(re)}${yt(ve)}${yt(Ne)}`}T.useEffect(()=>{const g=n.current,C=r.current;if(g){const F=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",_=S==="system"?F:S;g.editor.defineTheme("default",{base:_==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":_==="light"?"#ffffff":ht("--background")}}),g.editor.setTheme("default")}return C&&g&&C.addCommand(g.KeyMod.Shift|g.KeyCode.Enter,function(){return console.log("Executing query..."),Ee(),!1}),()=>{}},[e,S,n.current]);function tt(g){n.current=g}function gt(){return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[o&&t.jsxRuntimeExports.jsx("div",{className:"xbg-yellow-100 relative flex w-1/3 min-w-0 grow overflow-hidden border-l p-1 text-xs",role:"editor-filter-container",children:t.jsxRuntimeExports.jsxs("div",{className:"w-[99%]",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[t.jsxRuntimeExports.jsx(qi,{checked:N,onCheckedChange:()=>X(!N),text:"Apply Filters"}),t.jsxRuntimeExports.jsx(Vi,{}),I&&o&&t.jsxRuntimeExports.jsx(t.Cross2Icon,{onClick:()=>l(!1),className:"bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"})]}),t.jsxRuntimeExports.jsx(t.Ft,{theme:"default",onChange:g=>{if(g)try{JSON.parse(g),B(JSON.parse(g))}catch{}},defaultLanguage:"json",className:"mt-1 min-h-[220px]",value:JSON.stringify(I,null,2),options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}),I&&!o&&t.jsxRuntimeExports.jsx(ir,{onClick:()=>l(!0),className:t.cn("absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",{"font-bold text-red-800":N})})]})}function jt(){return t.jsxRuntimeExports.jsxs(zt,{className:"flex grow pb-1",direction:"vertical",role:"editor-resizable-group",children:[t.jsxRuntimeExports.jsxs(Be,{id:"1",order:1,defaultSize:i?20:100,className:"relative flex grow",children:[t.jsxRuntimeExports.jsx("div",{role:"sql-container",className:"relative flex w-[99%]",children:t.jsxRuntimeExports.jsx(t.Ft,{theme:"default",className:"pt-3",onChange:g=>{U(g)},value:b,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"sql",defaultValue:"SELECT * FROM table",beforeMount:tt,onMount:Ye})}),i&&t.jsxRuntimeExports.jsx("code",{className:"absolute right-6 top-3 text-sm text-muted-foreground/70",children:"sql"})]}),i&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Ot,{withHandle:!0,className:"border"}),t.jsxRuntimeExports.jsxs(Be,{id:"2",order:2,defaultSize:80,className:"relative flex grow",children:[t.jsxRuntimeExports.jsx("div",{role:"python-container",className:"relative flex w-[99%] pt-0",children:t.jsxRuntimeExports.jsx(t.Ft,{className:"pt-3",theme:"default",onChange:g=>{W(g&&g.trim()||"")},value:M||t.PYTHON_DEFAULT_CODE,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"python",beforeMount:tt,onMount:Ye})}),t.jsxRuntimeExports.jsx("code",{className:"absolute right-6 top-3 text-sm text-muted-foreground/70",children:"python"})]})]})]})}return t.jsxRuntimeExports.jsxs("section",{role:"editor-section",className:"flex grow flex-col justify-end",children:[t.jsxRuntimeExports.jsxs("div",{role:"sql-editor",className:"relative flex grow justify-between overflow-y-scroll",children:[jt(),gt()]}),t.jsxRuntimeExports.jsxs("div",{role:"editor-controls",className:"item-center flex flex-wrap justify-between gap-2 px-6 py-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex grow items-center gap-2",children:[t.jsxRuntimeExports.jsxs(t.Button,{disabled:pe||le,onClick:()=>{Ee()},className:"shrink-0",size:"sm",variant:"outline",children:[pe||le?t.jsxRuntimeExports.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):t.jsxRuntimeExports.jsx(Ri,{className:"mr-2 h-4 w-4"}),"Run"]}),Ce&&t.jsxRuntimeExports.jsx(_i,{error:Ae.message,setShowAIDialog:u,setTriggerAIRun:m,setUserInputforAI:x}),t.jsxRuntimeExports.jsxs(t.Button,{onClick:O,className:"",size:"sm",variant:"outline",children:[t.jsxRuntimeExports.jsx(di,{className:"mr-2 size-4"}),"Clear"]}),t.jsxRuntimeExports.jsx(t.Toggle,{pressed:i,onPressedChange:g=>s(g),className:"",size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(wu,{className:"size-4 text-foreground/70"})}),t.jsxRuntimeExports.jsx(ju,{open:a,setOpen:u,userInput:c,triggerAIRun:p,setTriggerAIRun:m,setUserInput:g=>x(g)})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex items-end gap-2",children:[t.jsxRuntimeExports.jsxs(t.Button,{onClick:Ze,size:"sm",variant:"outline",children:[t.jsxRuntimeExports.jsx(t.Check,{className:"mr-2 size-4 font-bold text-green-600"}),"Accept"]}),t.jsxRuntimeExports.jsxs(t.Button,{onClick:et,className:"w-full",size:"sm",variant:"outline",children:[t.jsxRuntimeExports.jsx(t.Cross2Icon,{className:"mr-2 size-4"}),"Close"]})]})]})]})}function Nu({data:e}){var l;const[n,r]=T.useState([]),s=Object.keys(e[0]).map(a=>({accessorKey:a,header:({column:u})=>{const c=u.getIsSorted();return t.jsxRuntimeExports.jsx("div",{className:"flex gap-2",children:t.jsxRuntimeExports.jsxs("div",{className:"flex cursor-pointer items-center",onClick:()=>u.toggleSorting(u.getIsSorted()==="asc"),children:[a,c==="asc"?t.jsxRuntimeExports.jsx(t.TriangleUpIcon,{className:"ml-2 h-5 w-5"}):c==="desc"?t.jsxRuntimeExports.jsx(t.TriangleDownIcon,{className:"ml-2 h-5 w-5"}):null]})})}})),o=t.useReactTable({data:e,columns:s,getCoreRowModel:t.getCoreRowModel(),getPaginationRowModel:t.getPaginationRowModel(),onSortingChange:r,getSortedRowModel:t.getSortedRowModel(),manualPagination:!0,state:{sorting:n}});return t.jsxRuntimeExports.jsxs(t.Table,{children:[t.jsxRuntimeExports.jsx(t.TableHeader,{children:o.getHeaderGroups().map(a=>t.jsxRuntimeExports.jsx(t.TableRow,{children:a.headers.map(u=>t.jsxRuntimeExports.jsx(t.TableHead,{className:"sticky top-0 bg-muted",children:u.isPlaceholder?null:t.flexRender(u.column.columnDef.header,u.getContext())},u.id))},a.id))}),t.jsxRuntimeExports.jsx(t.TableBody,{children:(l=o.getRowModel().rows)!=null&&l.length?o.getRowModel().rows.map(a=>t.jsxRuntimeExports.jsx(t.TableRow,{className:"whitespace-nowrap py-2","data-state":a.getIsSelected()&&"selected",children:a.getVisibleCells().map(u=>t.jsxRuntimeExports.jsx(t.TableCell,{children:t.flexRender(u.column.columnDef.cell,u.getContext())},u.id))},a.id)):t.jsxRuntimeExports.jsx(t.TableRow,{children:t.jsxRuntimeExports.jsx(t.TableCell,{colSpan:s.length,className:"h-24 text-center",children:"No results."})})})]})}function Zr({className:e,...n}){T.useState(0);const r=t.useDashboardStore(l=>l.themeStyle),i=t.useEditorStore(l=>l.card),s=t.useEditorStore(l=>l.actions.setCard);if(T.useEffect(()=>{},[i.data,i.type,i.cfg,i.customCfg,r,i.preferences]),!i.id)return null;let o;return i.data&&i.data.length>0&&(o=t.createChartConfig({data:i.data,cardType:i.type,cfg:i.cfg,customCfg:i.customCfg,preferences:i.preferences})),t.jsxRuntimeExports.jsxs(t.Card,{role:"editor-visual-card",className:t.cn("relative flex h-full flex-col rounded-none",e),...n,children:[t.jsxRuntimeExports.jsxs(t.CardHeader,{className:"py-4",children:[t.jsxRuntimeExports.jsx(t.Editable,{text:i.title,onSave:l=>s({...i,title:l}),children:t.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:t.jsxRuntimeExports.jsx(t.CardTitle,{className:"text-base",children:i.title})})},i.title),t.jsxRuntimeExports.jsx(t.Editable,{text:i.description||"",onSave:l=>s({...i,description:l}),children:t.jsxRuntimeExports.jsxs(t.CardDescription,{children:[" ",i.description]})},i.description)]}),t.jsxRuntimeExports.jsxs(t.CardContent,{className:"flex grow flex-col pb-3",children:[i.type!=="table"&&o&&t.jsxRuntimeExports.jsx(t.ChartJsVisual,{cfg:o},JSON.stringify(o)),i.type==="table"&&i.data&&i.data.length>0&&t.jsxRuntimeExports.jsx(t.$57acba87d6e25586$export$ccf8d8d7bbf3c2cc,{className:"flex min-h-0 flex-1 grow basis-0",children:t.jsxRuntimeExports.jsx(t.TableVisual,{card:i,data:i==null?void 0:i.data})})]})]})}function Iu(){const[e,n]=T.useState(!1),[r,i]=T.useState(""),[s,o]=T.useState(""),[l,a]=T.useState(""),u=t.useEditorStore(S=>S.card),c=t.useEditorStore(S=>S.card.customCfg),x=t.useEditorStore(S=>S.actions.setCardCustomCfg);function p(S){var k,L;const y={...S,data:{...S==null?void 0:S.data,datasets:(L=(k=S==null?void 0:S.data)==null?void 0:k.datasets)==null?void 0:L.map(D=>({...D,data:[]}))}};return JSON.stringify(y,null,1)}function m(){if(!u.data||u.data.length===0)return;const S=t.createChartConfig({data:u.data,cardType:u.type,cfg:u.cfg,preferences:u.preferences});S&&(i(JSON.stringify(S,null,1)),c&&o(JSON.stringify(c,null,1)))}function d(){if(s)try{const S=JSON.parse(s);return S?(x(S),a(""),o(""),S):void 0}catch(S){console.log(S),a("Invalid JSON")}}function j(){o(""),x(null)}function E(){let S;if(c){const y=t._.cloneDeep(u.cfg),w=t._.merge(y,c);return S=p(w),S}return r?(S=p(JSON.parse(r)),S):""}return t.jsxRuntimeExports.jsxs(t.Dialog,{open:e,onOpenChange:n,children:[t.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{onClick:m,className:` ${c&&"border-foreground/50 dark:border-foreground/70"}`,size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(t.Settings,{className:"h-4 w-4"})})}),t.jsxRuntimeExports.jsxs(t.DialogContent,{className:"max-h-[70vh] min-h-[70vh] min-w-[900px] overflow-auto",children:[t.jsxRuntimeExports.jsxs(t.DialogHeader,{className:"",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.DialogTitle,{children:"Customize Card"}),t.jsxRuntimeExports.jsxs(t.Tooltip,{children:[t.jsxRuntimeExports.jsx(t.TooltipTrigger,{children:t.jsxRuntimeExports.jsx(ji,{onClick:()=>{navigator.clipboard.writeText(u.id)},className:"size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),t.jsxRuntimeExports.jsx(t.TooltipContent,{side:"right",align:"center",children:t.jsxRuntimeExports.jsx("p",{className:"text-xs",children:"Copy Card ID"})})]})]}),t.jsxRuntimeExports.jsxs(t.DialogDescription,{children:["See the configuration options and documentation",t.jsxRuntimeExports.jsx("a",{target:"_blank",className:"ml-1 text-blue-500 underline",href:"https://www.chartjs.org/docs/latest/samples/bar/vertical.html",children:"here."})]})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex grow gap-2",children:[t.jsxRuntimeExports.jsx(Zr,{className:"w-1/2 rounded shadow-none"}),t.jsxRuntimeExports.jsxs(t.Tabs,{defaultValue:"custom-config",className:"flex w-1/2 flex-col",children:[t.jsxRuntimeExports.jsxs(t.TabsList,{className:"justify-start rounded-sm rounded-b-none border border-b-0",children:[t.jsxRuntimeExports.jsxs(t.TabsTrigger,{value:"custom-config",children:[c&&t.jsxRuntimeExports.jsx(t.CheckIcon,{className:"mr-1 h-5 w-5 text-green-600"}),c?"Custom Config":"Default Config"]}),t.jsxRuntimeExports.jsx(t.TabsTrigger,{className:"",value:"output",children:"Output"})]}),t.jsxRuntimeExports.jsx(t.TabsContent,{className:"bg-red-x mt-0 grow rounded-b border border-t-0 p-2",value:"output",children:t.jsxRuntimeExports.jsx(t.Textarea,{disabled:!0,value:r,className:"h-full resize-none border-none font-mono focus-visible:ring-0 focus-visible:ring-offset-0"})}),t.jsxRuntimeExports.jsx(t.TabsContent,{className:"mt-0 grow rounded-b border border-t-0",value:"custom-config",children:t.jsxRuntimeExports.jsx(t.Ft,{className:"h-full w-full overflow-hidden",theme:"default",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"json",value:E(),onChange:S=>o(S)})})]})]}),t.jsxRuntimeExports.jsxs(t.DialogFooter,{className:"flex items-center",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"mr-2 text-red-500",children:l}),t.jsxRuntimeExports.jsx(t.Button,{disabled:!c,onClick:j,variant:"outline",children:"Reset"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:d,variant:"outline",children:"Apply"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>n(!1),variant:"outline",children:"Close"})]})]})]})}function ei(e){return Fe({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M926.8 397.1l-396-288a31.81 31.81 0 0 0-37.6 0l-396 288a31.99 31.99 0 0 0-11.6 35.8l151.3 466a32 32 0 0 0 30.4 22.1h489.5c13.9 0 26.1-8.9 30.4-22.1l151.3-466c4.2-13.2-.5-27.6-11.7-35.8zM838.6 417l-98.5 32-200-144.7V199.9L838.6 417zM466 567.2l-89.1 122.3-55.2-169.2L466 567.2zm-116.3-96.8L484 373.3v140.8l-134.3-43.7zM512 599.2l93.9 128.9H418.1L512 599.2zm28.1-225.9l134.2 97.1L540.1 514V373.3zM558 567.2l144.3-46.9-55.2 169.2L558 567.2zm-74-367.3v104.4L283.9 449l-98.5-32L484 199.9zM169.3 470.8l86.5 28.1 80.4 246.4-53.8 73.9-113.1-348.4zM327.1 853l50.3-69h269.3l50.3 69H327.1zm414.5-33.8l-53.8-73.9 80.4-246.4 86.5-28.1-113.1 348.4z"},child:[]}]})(e)}function ti(e){return Fe({tag:"svg",attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M137.39,24.06A16,16,0,0,0,120,40V80.67a15.86,15.86,0,0,0,13.25,15.76A32,32,0,1,1,96,129.68c-.41-8.22,1.27-15,5-20.26h0a15.86,15.86,0,0,0-1.69-20.47L71.69,60.68a16,16,0,0,0-23.63,1.1A103.6,103.6,0,0,0,55,202.05,103.24,103.24,0,0,0,128,232h1.49A104.3,104.3,0,0,0,232,129.48C232.75,75.18,191.19,28.88,137.39,24.06ZM60.32,71.94l27.61,28.19,0,.06A43.29,43.29,0,0,0,80.44,120H40.36A87.13,87.13,0,0,1,60.32,71.94ZM40.37,136h40.3A48,48,0,0,0,120,175.34v40.3A88,88,0,0,1,40.37,136Zm149.77,54.14A87.45,87.45,0,0,1,136,215.61V175.34a47.55,47.55,0,0,0,24.73-12.23A48,48,0,0,0,136,80.66L136,40c45.52,4.08,80.67,43.28,80,89.25A87.45,87.45,0,0,1,190.14,190.14Z"},child:[]}]})(e)}function ni(e){return Fe({tag:"svg",attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm87.63,96H191.48A64.1,64.1,0,0,0,136,64.52V40.37A88.13,88.13,0,0,1,215.63,120ZM120,120H80.68A48.09,48.09,0,0,1,120,80.68Zm0,16v39.32A48.09,48.09,0,0,1,80.68,136Zm16,0h39.32A48.09,48.09,0,0,1,136,175.32Zm0-16V80.68A48.09,48.09,0,0,1,175.32,120ZM120,40.37V64.52A64.1,64.1,0,0,0,64.52,120H40.37A88.13,88.13,0,0,1,120,40.37ZM40.37,136H64.52A64.1,64.1,0,0,0,120,191.48v24.15A88.13,88.13,0,0,1,40.37,136ZM136,215.63V191.48A64.1,64.1,0,0,0,191.48,136h24.15A88.13,88.13,0,0,1,136,215.63Z"},child:[]}]})(e)}function ri(e){return Fe({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},child:[]},{tag:"path",attr:{d:"M6 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"},child:[]},{tag:"path",attr:{d:"M16 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M14.5 7.5m-4.5 0a4.5 4.5 0 1 0 9 0a4.5 4.5 0 1 0 -9 0"},child:[]}]})(e)}function ii(e){return Fe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M4 9h4v11H4zM4 4h4v4H4zM10 7h4v4h-4zM16 10h4v4h-4zM16 15h4v5h-4zM10 12h4v8h-4z"},child:[]}]})(e)}function si(e){return Fe({tag:"svg",attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M4 18c-.552 0-1-.448-1-1v-6.382l-.553.276c-.495.248-1.095.046-1.342-.447-.247-.494-.046-1.094.448-1.342l2-1c.31-.155.678-.139.973.044.294.183.474.504.474.851v8c0 .552-.448 1-1 1zM13 18h-5c-.404 0-.769-.244-.924-.617-.155-.374-.069-.804.217-1.09l4-4c.254-.254.394-.591.394-.95 0-.358-.14-.695-.394-.949-.508-.508-1.39-.508-1.9.001-.253.252-.393.589-.393.948 0 .552-.448 1-1 1s-1-.448-1-1c0-.894.348-1.733.98-2.364 1.265-1.263 3.464-1.263 4.727.001.632.631.979 1.471.979 2.363 0 .893-.348 1.733-.979 2.364l-2.293 2.293h2.586c.552 0 1 .448 1 1s-.448 1-1 1zM20.955 12.377c.338-.457.545-1.016.545-1.627 0-1.517-1.234-2.75-2.75-2.75-1.031 0-1.966.569-2.44 1.484-.254.49-.063 1.094.428 1.348.49.254 1.094.062 1.348-.428.128-.249.383-.404.664-.404.414 0 .75.336.75.75s-.336.75-.75.75c-.552 0-1 .448-1 1s.448 1 1 1c.689 0 1.25.561 1.25 1.25s-.561 1.25-1.25 1.25-1.25-.561-1.25-1.25c0-.552-.448-1-1-1s-1 .448-1 1c0 1.792 1.458 3.25 3.25 3.25s3.25-1.458 3.25-3.25c0-.939-.406-1.779-1.045-2.373z"},child:[]}]})(e)}function Au(){const[e,n]=T.useState(!1),r=t.useEditorStore(l=>l.card.type),i=t.useEditorStore(l=>l.actions.setCardType),s=t.useEditorStore(l=>l.actions.setCardCustomCfg);function o(l){i(l),s(null),n(!1)}return t.jsxRuntimeExports.jsxs(t.Popover,{open:e,onOpenChange:n,children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(Tu,{className:"h-4 w-4",chartType:r})})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{className:"w-50",children:t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 place-items-center ",children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("bar"),className:"font-normal",variant:"ghost",children:t.jsxRuntimeExports.jsx(Ut,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("line"),variant:"ghost",children:t.jsxRuntimeExports.jsx($t,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("stackedBar"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ii,{className:"size-5 ",strokeWidth:0})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("scatter"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ar,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("bubble"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ri,{className:"size-4"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("pie"),variant:"ghost",children:t.jsxRuntimeExports.jsx(or,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("doughnut"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ti,{className:"size-5 ",strokeWidth:1})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("radar"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ei,{className:"size-5 font-extralight",strokeWidth:.5})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("polarArea"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ni,{className:"size-5 "})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("table"),variant:"ghost",children:t.jsxRuntimeExports.jsx(Kt,{className:"size-5 "})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("kpi"),variant:"ghost",children:t.jsxRuntimeExports.jsx(si,{className:"size-6 "})})]})})]})}function Tu({chartType:e,className:n}){switch(e){case"bar":return t.jsxRuntimeExports.jsx(Ut,{className:n});case"line":return t.jsxRuntimeExports.jsx($t,{className:n});case"pie":return t.jsxRuntimeExports.jsx(or,{className:n});case"radar":return t.jsxRuntimeExports.jsx(ei,{className:n});case"scatter":return t.jsxRuntimeExports.jsx(ar,{className:n});case"bubble":return t.jsxRuntimeExports.jsx(ri,{className:n});case"doughnut":return t.jsxRuntimeExports.jsx(ti,{className:n});case"stackedBar":return t.jsxRuntimeExports.jsx(ii,{className:"size-4 text-foreground/70 "});case"polarArea":return t.jsxRuntimeExports.jsx(ni,{className:n});case"kpi":return t.jsxRuntimeExports.jsx(si,{className:n});default:return t.jsxRuntimeExports.jsx(Kt,{className:n})}}function Lu(){const e=t.useEditorStore(r=>r.card.refreshInterval),n=t.useEditorStore(r=>r.actions.setCardRefreshInterval);return t.jsxRuntimeExports.jsxs(t.Popover,{children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(ui,{className:"w-4 h-4"})})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{className:"w-[200px]",children:t.jsxRuntimeExports.jsx("div",{className:"grid gap-4",children:t.jsxRuntimeExports.jsx("div",{className:"grid gap-2",children:t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-5 items-center gap-1",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"col-span-3",htmlFor:"width",children:"Refresh Every"}),t.jsxRuntimeExports.jsx(t.Input,{value:e||"",onChange:r=>n(r.target.value),id:"width",placeholder:"30s",className:"col-span-2 h-7 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0"})]})})})})]})}function nr(){t.useEditorStore(l=>l.frame);const e=t.useEditorStore(l=>l.card),n=t.useEditorStore(l=>l.card.data),r=t.useEditorStore(l=>l.isShowingVisual),i=t.useEditorStore(l=>l.isSqlRunning),s=t.useEditorStore(l=>l.queryError),o=t.useEditorStore(l=>l.pythonStdOut);return t.useEditorStore(l=>l.onSave),t.useEditorStore(l=>l.onClose),t.useEditorStore(l=>l.actions.setCardSql),t.useEditorStore(l=>l.actions.setCardType),t.useEditorStore(l=>l.actions.setSqlGen),e?t.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col py-3",children:[i&&t.jsxRuntimeExports.jsx(t.LoaderCircle,{className:"absolute bottom-0 left-0 right-0 top-0 z-10 m-auto h-10 w-10 animate-spin text-foreground/10"}),t.jsxRuntimeExports.jsxs("div",{className:"mb-0 flex min-h-10 items-center justify-end gap-2 px-6",children:[r&&t.jsxRuntimeExports.jsxs("div",{className:"flex grow items-center gap-2",children:[t.jsxRuntimeExports.jsx(Au,{}),t.jsxRuntimeExports.jsx(Iu,{}),t.jsxRuntimeExports.jsx(Lu,{})]}),t.jsxRuntimeExports.jsx(Ou,{})]}),r?e.type==="kpi"?t.jsxRuntimeExports.jsx("div",{className:"flex grow items-center justify-center",children:t.jsxRuntimeExports.jsx("div",{className:"w-1/2 rounded-md border",children:t.jsxRuntimeExports.jsx(t.KPICard,{isLoading:i,card:e})})}):t.jsxRuntimeExports.jsx(Zr,{className:"grow border-none shadow-none"}):t.jsxRuntimeExports.jsxs("div",{className:"flex min-h-0 w-full flex-1 grow basis-0 px-6",children:[o&&t.jsxRuntimeExports.jsx(zu,{}),e.data&&e.data.length>0&&t.jsxRuntimeExports.jsx(Nu,{data:n||[]}),s&&t.jsxRuntimeExports.jsx("span",{className:"font-mono text-sm",children:s})]})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:"No Active Card"})}function zu(){const e=t.useEditorStore(r=>r.pythonStdOut);if(!e)return null;const n=e.replace(/\n/g,"<br>");return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("p",{className:"font-mono text-sm",children:"Output:"}),t.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:n},className:"bg-muted p-2 font-mono text-sm"}),t.jsxRuntimeExports.jsx(t.Separator,{className:"mb-2"})]})}function Ou(){const e=t.useEditorStore(r=>r.isShowingVisual),n=t.useEditorStore(r=>r.actions.setIsShowingVisual);return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"visualize",children:"Chart"}),t.jsxRuntimeExports.jsx(t.Switch,{checked:e,onCheckedChange:()=>n(!e),id:"visualize",className:"data-[state=checked]:bg-foreground/50"})]})}function Ue(){const[e,n]=T.useState([]);t.useEditorStore(x=>x.card.cfg);const r=t.useEditorStore(x=>x.card.preferences),{setCardCfg:i,setFilterOnClickColumnIndex:s,setCardPreferences:o}=t.useEditorStore(x=>x.actions),l=t.useEditorStore(x=>x.queryResultColumns);t.useEditorStore(x=>{var p;return(p=x.card.preferences)==null?void 0:p.filterOnClickColumnIndex}),T.useEffect(()=>{l&&n(new Array(l.length).fill(!1))},[l]);function a(x,p){var m,d;p?r!=null&&r.onClickFilter&&((m=r==null?void 0:r.onClickFilter)==null?void 0:m.length)>0?o({...r,onClickFilter:[...r.onClickFilter,{columnIndex:x,expression:""}]}):o({...r,onClickFilter:[{columnIndex:x,expression:""}]}):(o({...r,onClickFilter:(d=r==null?void 0:r.onClickFilter)==null?void 0:d.filter(j=>j.columnIndex!==x)}),n(j=>{const E=[...j];return E[x]=!1,E}))}function u(x,p){var d;const m=(d=r==null?void 0:r.onClickFilter)==null?void 0:d.map(j=>j.columnIndex===x?{...j,expression:p.target.value}:j);o({...r,onClickFilter:m})}function c(x){var p,m,d,j;if(e!=null&&e[x]||(m=(p=r==null?void 0:r.onClickFilter)==null?void 0:p.find(E=>E.columnIndex===x))!=null&&m.expression)return t.jsxRuntimeExports.jsx(t.Input,{value:(j=(d=r==null?void 0:r.onClickFilter)==null?void 0:d.find(E=>E.columnIndex===x))==null?void 0:j.expression,onChange:E=>u(x,E),type:"text",className:" h-9 w-full focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 font-mono text-xs",placeholder:"Expression"})}return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:l==null?void 0:l.map((x,p)=>{var m,d;return t.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between space-y-2 xbg-red-100 group",children:t.jsxRuntimeExports.jsxs("div",{className:" grow",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center py-2 space-x-2",children:[t.jsxRuntimeExports.jsx(t.Checkbox,{checked:!!((m=r==null?void 0:r.onClickFilter)!=null&&m.find(j=>j.columnIndex===p)),onCheckedChange:j=>a(p,j)}),t.jsxRuntimeExports.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:x}),t.jsxRuntimeExports.jsx("div",{className:"flex gap-2 items-center ",children:((d=r==null?void 0:r.onClickFilter)==null?void 0:d.find(j=>j.columnIndex===p))&&t.jsxRuntimeExports.jsx(sr,{onClick:()=>{n(j=>{const E=[...j];return E[p]=!j[p],E})},className:" invisible group-hover:visible size-3 text-gray-400 cursor-pointer"})})]}),c(p)]})},x)})})}function an(){var o,l;const e=t.useEditorStore(a=>a.card.preferences),n=t.useEditorStore(a=>a.card.cfg),{setCardCfg:r,setCardPreferences:i}=t.useEditorStore(a=>a.actions);(o=n==null?void 0:n.options)!=null&&o.indexAxis;function s(a){var x,p,m,d,j,E;let u={};(x=e==null?void 0:e.chartOptions)!=null&&x.scales&&(u={x:(m=(p=e==null?void 0:e.chartOptions)==null?void 0:p.scales)==null?void 0:m.y,y:(j=(d=e==null?void 0:e.chartOptions)==null?void 0:d.scales)==null?void 0:j.x});const c={...e,chartOptions:{...e==null?void 0:e.chartOptions,scales:{...(E=e==null?void 0:e.chartOptions)==null?void 0:E.scales,...u},indexAxis:a}};i(c)}return t.jsxRuntimeExports.jsxs(t.RadioGroup,{value:((l=e==null?void 0:e.chartOptions)==null?void 0:l.indexAxis)||"x",onValueChange:s,className:"flex gap-3",defaultValue:"x",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.RadioGroupItem,{value:"x",id:"r1"}),t.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Vertical"})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.RadioGroupItem,{value:"y",id:"r2"}),t.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Horizontal"})]})]})}const Lt="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";function oi(e){var r,i;return(r=e==null?void 0:e.chartOptions)!=null&&r.indexAxis?((i=e==null?void 0:e.chartOptions)==null?void 0:i.indexAxis)==="x"?"y":"x":"y"}function rr(e){var r,i,s;const n=oi(e);return((s=(i=(r=e==null?void 0:e.chartOptions)==null?void 0:r.scales)==null?void 0:i[n])==null?void 0:s.type)||"linear"}function Du(){var w,k,L,D,b,M;const[e,n]=T.useState(!1),r=t.useEditorStore(z=>{var A;return(A=z.card)==null?void 0:A.preferences}),i=oi(r),[s,o]=T.useState(rr(r)),[l,a]=T.useState(((L=(k=(w=r==null?void 0:r.chartOptions)==null?void 0:w.scales)==null?void 0:k[i])==null?void 0:L.min)||""),[u,c]=T.useState(((M=(b=(D=r==null?void 0:r.chartOptions)==null?void 0:D.scales)==null?void 0:b[i])==null?void 0:M.max)||""),[x,p]=T.useState(l||u?"custom":"auto"),[m,d]=T.useState(""),j=t.useEditorStore(z=>z.actions.setCardPreferences);T.useEffect(()=>{var z,A,H,I,N,K,$,B,U,W;o(rr(r)),a(((H=(A=(z=r==null?void 0:r.chartOptions)==null?void 0:z.scales)==null?void 0:A[i])==null?void 0:H.min)===0?0:""),c(((K=(N=(I=r==null?void 0:r.chartOptions)==null?void 0:I.scales)==null?void 0:N[i])==null?void 0:K.max)||""),d(((W=(U=(B=($=r==null?void 0:r.chartOptions)==null?void 0:$.scales)==null?void 0:B[i])==null?void 0:U.ticks)==null?void 0:W.stepSize)||"")},[e,r,i]);function E(z,A){return A===""||/^[0-9\b]+$/.test(A)?Number(A):Number(z)}function S(){return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"range",children:"Range"}),t.jsxRuntimeExports.jsx(t.Input,{id:"min",value:l,onChange:z=>a(A=>E(A,z.target.value)),className:`col-span-1 h-8 w-full ${Lt}`}),t.jsxRuntimeExports.jsx(t.Input,{value:u,onChange:z=>c(A=>E(A,z.target.value)),id:"max",className:`col-span-1 h-8 w-full ${Lt}`})]}),t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"step-size",children:"Step Size"}),t.jsxRuntimeExports.jsx(t.Input,{value:m,onChange:z=>d(A=>E(A,z.target.value)),id:"step-size",className:`col-span-1 h-8 w-full ${Lt}`})]})]})}function y(){var H;let z={};x==="custom"&&(z={min:l,max:u,ticks:{stepSize:m}});const A={...r||{},chartOptions:{...r==null?void 0:r.chartOptions,scales:{...(H=r==null?void 0:r.chartOptions)==null?void 0:H.scales,[i]:{type:s,...s==="linear"?z:{}}}}};j(A)}return t.jsxRuntimeExports.jsxs(t.Popover,{onOpenChange:z=>n(z),children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.SliderIcon,{className:"size-4 cursor-pointer text-muted-foreground hover:text-foreground"})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{align:"center",className:"max-w-65",children:t.jsxRuntimeExports.jsxs("div",{className:"grid gap-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.jsxRuntimeExports.jsx("h4",{className:"font-medium leading-none",children:"Scale Options"}),t.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the scale for the number axis"})]}),t.jsxRuntimeExports.jsxs("div",{className:"grid gap-2",children:[t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"scale",children:"Type"}),t.jsxRuntimeExports.jsxs(t.Select,{value:s,onValueChange:z=>o(z),children:[t.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0",children:t.jsxRuntimeExports.jsx(t.SelectValue,{})}),t.jsxRuntimeExports.jsx(t.SelectContent,{id:"type",children:t.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[t.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Option"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"linear",children:"Linear"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"logarithmic",children:"Logarithmic"})]})})]})]}),s=="linear"&&t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2 py-1",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"scale-option",children:"Setup"}),t.jsxRuntimeExports.jsxs(t.RadioGroup,{id:"scale-option",value:x,onValueChange:z=>p(z),className:"col-span-2 flex gap-3",defaultValue:"x",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.RadioGroupItem,{value:"auto",id:"r1"}),t.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Auto"})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.RadioGroupItem,{value:"custom",id:"r2"}),t.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Custom"})]})]})]}),x==="custom"&&s=="linear"&&S(),t.jsxRuntimeExports.jsx(t.SelectSeparator,{}),t.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3",children:t.jsxRuntimeExports.jsx(t.Button,{onClick:y,variant:"secondary",className:"col-span-1 col-start-3 h-8 w-full",children:"Apply"})})]})]})})]})}function Fu({idx:e}){var a;const n=t.useEditorStore(u=>{var c;return(c=u.card)==null?void 0:c.preferences}),r=t.useEditorStore(u=>{var c;return(c=u.card.preferences)==null?void 0:c.datasetOptions}),i=t.useEditorStore(u=>u.actions.setCardPreferences),s=(a=n==null?void 0:n.chartOptions)==null?void 0:a.indexAxis,o=r==null?void 0:r.find(u=>u.idx===e);function l(u,c){(u==="end"||u==="start")&&t.getContrastColor(t.getCanvasBackgroundColor());const x={display:u!=="none",align:u,anchor:u,clamp:!0};if(!o)i({...n,datasetOptions:[...r||[],{idx:c,datalabels:x}]});else{const p={...o};p.datalabels=x;const m=r==null?void 0:r.map(d=>d.idx===c?p:d);i({...n,datasetOptions:m})}}return t.jsxRuntimeExports.jsxs(t.Popover,{children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{children:t.jsxRuntimeExports.jsx(Ii,{className:"invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),t.jsxRuntimeExports.jsxs(t.PopoverContent,{className:"flex w-fit gap-1 p-1",children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>l("none",e),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:t.jsxRuntimeExports.jsx(t.X,{className:"size-4"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>l("start",e),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:t.jsxRuntimeExports.jsx(yi,{className:t.cn("h-4 w-4",{"rotate-90":s==="y"})})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>l("center",e),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:t.jsxRuntimeExports.jsx(bi,{className:t.cn("h-4 w-4",{"rotate-90":s==="y"})})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>l("end",e),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:t.jsxRuntimeExports.jsx(Ei,{className:t.cn("h-4 w-4",{"rotate-90":s==="y"})})})]})]})}function li(){const e=t.useEditorStore(u=>u.card),n=t.useEditorStore(u=>{var c,x,p;return(p=(x=(c=u==null?void 0:u.card)==null?void 0:c.preferences)==null?void 0:x.chartOptions)==null?void 0:p.indexAxis}),r=n==="y"?"Y axis":"X axis",i=n==="y"?"X axis":"Y axis",{keys:s,metricKeys:o,dimensionKeys:l}=t.getKeys(e.data||[]);let a=o;if(e.type==="stackedBar"){const u=t.pivotData({dataArray:e.data||[],groupKey:l[0],pivotKey:l[1],valueKey:a[0]}),{metricKeys:c}=t.getKeys(u);a=c}return s.length===0?null:t.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.jsxRuntimeExports.jsx(t.Label,{children:r}),t.jsxRuntimeExports.jsx("div",{className:"my-1 space-y-1",children:t.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-muted/70 px-2 py-1 hover:bg-muted",children:t.jsxRuntimeExports.jsx("p",{children:l[0]})})})]}),t.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-5",children:[t.jsxRuntimeExports.jsx(t.Label,{children:i}),t.jsxRuntimeExports.jsx(Du,{})]}),t.jsxRuntimeExports.jsx("div",{className:"my-1 space-y-1",children:a.map((u,c)=>t.jsxRuntimeExports.jsx(Mu,{col:u,idx:c},u))})]})]})}function Mu({col:e,idx:n}){const r=t.useEditorStore(a=>{var u;return(u=a.card)==null?void 0:u.preferences}),i=t.useEditorStore(a=>{var u;return(u=a.card.preferences)==null?void 0:u.datasetOptions}),s=i==null?void 0:i.find(a=>a.idx===n),{setCardPreferences:o}=t.useEditorStore(a=>a.actions);function l(a){if(!s)o({...r,datasetOptions:[...i||[],{idx:n,type:a==="area"?"line":a,fill:a==="area"?"origin":""}]});else{const u={...s};u.type=a==="area"?"line":a,u.fill=a==="area"?"origin":"";const c=i==null?void 0:i.map(x=>x.idx===n?u:x);o({...r,datasetOptions:c})}}return t.jsxRuntimeExports.jsxs("div",{className:"group flex items-center justify-between gap-5 rounded-md bg-muted/70 px-2 py-1 hover:bg-muted",children:[t.jsxRuntimeExports.jsx("p",{children:e}),t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[t.jsxRuntimeExports.jsx(Ut,{onClick:()=>l("bar"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),t.jsxRuntimeExports.jsx($t,{onClick:()=>l("line"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),t.jsxRuntimeExports.jsx(ci,{onClick:()=>l("area"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),t.jsxRuntimeExports.jsx(t.Separator,{orientation:"vertical",className:"invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"}),t.jsxRuntimeExports.jsx(Fu,{idx:n})]})]})}function Pu({cardType:e}){return t.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:t.jsxRuntimeExports.jsxs(t.Accordion,{defaultValue:["item-2"],type:"multiple",children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:`${t.titleCase(e)} Chart`}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[t.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT x-axis, y-axis-1, y-axis-2,... FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[t.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),t.jsxRuntimeExports.jsx("li",{children:"y-axis1 - number"}),t.jsxRuntimeExports.jsx("li",{children:"y-axis2 - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:n=>n.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#line-chart",children:"example"})," in the docs."]})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Settings"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"space-y-4 px-2",children:[t.jsxRuntimeExports.jsx(an,{}),t.jsxRuntimeExports.jsx(li,{})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ue,{})})]})]})})}function un(){var i,s,o;const e=t.useEditorStore(l=>l.card.cfg),n=t.useEditorStore(l=>l.actions.setCardCfg);function r(l){var c;const a={datalabels:{display:l!=="none",align:l,anchor:l,clamp:!0}},u={...e,options:{...e==null?void 0:e.options,plugins:{...(c=e==null?void 0:e.options)==null?void 0:c.plugins,...a}}};n(u),console.log(l)}return t.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.jsxRuntimeExports.jsx("label",{className:"font-medium",children:"Data Labels"}),t.jsxRuntimeExports.jsxs(t.Select,{value:(o=(s=(i=e==null?void 0:e.options)==null?void 0:i.plugins)==null?void 0:s.datalabels)==null?void 0:o.anchor,onValueChange:r,defaultValue:"none",children:[t.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-8 w-[180px] focus:ring-1 focus:ring-offset-0",children:t.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select position"})}),t.jsxRuntimeExports.jsx(t.SelectContent,{children:t.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[t.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Data Labels"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"none",children:"None"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"start",children:"Start"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"center",children:"Center"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"end",children:"End"})]})})]})]})}function Bu({cardType:e}){function n(r){const i="SELECT label, [group], x-axis, y-axis, radius FROM table",s="SELECT label, [group], x-axis, y-axis FROM table";return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded text-xs",children:r==="bubble"?i:s}),t.jsxRuntimeExports.jsxs("ul",{className:" ml-6 list-disc [&>li]:mt-2 text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"label - category"}),t.jsxRuntimeExports.jsx("li",{children:"group - category"}),t.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),t.jsxRuntimeExports.jsx("li",{children:"y-axis - category"}),r==="bubble"&&t.jsxRuntimeExports.jsx("li",{children:"radius - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:o=>o.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#pie-chart",children:"example"})," in the docs."]})]})}return t.jsxRuntimeExports.jsx("div",{className:"px-6 py-2 space-y-6",children:t.jsxRuntimeExports.jsxs(t.Accordion,{defaultValue:["item-2"],type:"multiple",children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:`${t.titleCase(e)} Chart`}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:" space-y-4 font-mono text-xs ",children:n(e)})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Settings"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(un,{})})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ue,{})})]})]})})}const _u={datasets:[{type:"line",label:"Sum_sales",data:[]},{type:"bar",label:"Sum_profit",data:[]}]},qu={datasets:[{fill:"origin",type:"line",label:"Sum_sales",data:[]}]};function Vu(){const e=t.useEditorStore(n=>n.card.type);return t.jsxRuntimeExports.jsxs("div",{className:"p-6 space-y-6",children:[t.jsxRuntimeExports.jsx(t.Accordion,{className:" ",type:"single",collapsible:!0,children:Hu(e)}),t.jsxRuntimeExports.jsx("section",{className:"",children:["line","bar"].includes(e)&&t.jsxRuntimeExports.jsx(an,{})}),t.jsxRuntimeExports.jsx("div",{children:!["kpi"].includes(e)&&t.jsxRuntimeExports.jsx(un,{})}),t.jsxRuntimeExports.jsx("div",{children:!["kpi"].includes(e)&&t.jsxRuntimeExports.jsx(Ue,{})})]})}function Hu(e){if(["line","bar"].includes(e))return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:t.jsxRuntimeExports.jsx("p",{children:"Chart Query"})}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"X-axis - Category (ex. city)"}),t.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:"Mixed Chart"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" text-xs space-y-2",children:[t.jsxRuntimeExports.jsxs("p",{children:["Click ",t.jsxRuntimeExports.jsx("b",{children:"Customize"})," and change the `type` property in the dataset."]}),t.jsxRuntimeExports.jsx("pre",{children:JSON.stringify(_u,null,2)})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:"Area Chart"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" text-xs space-y-2",children:[t.jsxRuntimeExports.jsxs("p",{children:["Click ",t.jsxRuntimeExports.jsx("b",{children:"Customize"})," and add `fill` property to the dataset. See",t.jsxRuntimeExports.jsx("a",{className:"text-blue-500 hover:underline mx-1",href:"https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",target:"_blank",children:"docs"}),"for more options."]}),t.jsxRuntimeExports.jsx("pre",{children:JSON.stringify(qu,null,2)})]})]})]});if(e==="bubble")return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:t.jsxRuntimeExports.jsxs("p",{children:["How to create a ",t.jsxRuntimeExports.jsx("span",{children:e})," chart query?"]})}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, x-axis, y-axis, radius FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),t.jsxRuntimeExports.jsx("li",{children:"Bubble Group (opt) - Category (ex. state)"}),t.jsxRuntimeExports.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),t.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"}),t.jsxRuntimeExports.jsx("li",{children:"Radius - Number (ex. population)"})]})]})]})});if(e==="scatter")return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:t.jsxRuntimeExports.jsxs("p",{children:["How to create a ",t.jsxRuntimeExports.jsx("span",{children:e})," chart query?"]})}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, x-axis, y-axis FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),t.jsxRuntimeExports.jsx("li",{children:"Group (opt) - Category (ex. state)"}),t.jsxRuntimeExports.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),t.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"})]})]})]})});if(["pie","doughnut","polarArea"].includes(e))return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:t.jsxRuntimeExports.jsxs("p",{children:[t.jsxRuntimeExports.jsx("span",{children:e==="polarArea"?"Polar":e.charAt(0).toUpperCase()+e.slice(1)})," ","chart query"]})}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, measure FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),t.jsxRuntimeExports.jsx("li",{children:"Measure - Number (ex. population)"})]})]})]})})}function Uu(){var l,a,u;const e=t.useEditorStore(c=>c.card.preferences),n=t.useEditorStore(c=>c.actions.setCardPreferences),r=t.useEditorStore(c=>c.actions.setNumberFormat),i=t.useEditorStore(c=>{var x,p;return(p=(x=c.card.preferences)==null?void 0:x.formatNumber)==null?void 0:p.format}),s=t.useEditorStore(c=>{var x,p;return(p=(x=c.card.preferences)==null?void 0:x.formatNumber)==null?void 0:p.locale}),o=t.useEditorStore(c=>{var x,p;return(p=(x=c.card.preferences)==null?void 0:x.formatNumber)==null?void 0:p.currency});return t.useEditorStore(c=>c.actions.setFilterOnClickField),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Checkbox,{checked:!!((l=e==null?void 0:e.formatNumber)!=null&&l.enabled),onCheckedChange:c=>{n({...e,formatNumber:{...e==null?void 0:e.formatNumber,enabled:c}})}}),t.jsxRuntimeExports.jsx(t.Label,{children:"Format Number"})]}),((a=e==null?void 0:e.formatNumber)==null?void 0:a.enabled)===!0&&t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-xs",children:"Currency"}),t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1",children:[t.jsxRuntimeExports.jsx(t.Input,{value:o||"",className:"h-7 w-20 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"USD",onChange:c=>{var x,p,m;return r(((x=e==null?void 0:e.formatNumber)==null?void 0:x.format)||"",c.target.value,((p=e==null?void 0:e.formatNumber)==null?void 0:p.locale)||"",((m=e==null?void 0:e.formatNumber)==null?void 0:m.suffix)||"")}}),t.jsxRuntimeExports.jsx(t.Input,{value:s||"",className:"h-7 w-20 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"en-US",onChange:c=>{var x,p,m;return r(((x=e==null?void 0:e.formatNumber)==null?void 0:x.format)||"",((p=e==null?void 0:e.formatNumber)==null?void 0:p.currency)||"",c.target.value,((m=e==null?void 0:e.formatNumber)==null?void 0:m.suffix)||"")}})]})]}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-xs",children:"Format"}),t.jsxRuntimeExports.jsxs(t.Tooltip,{children:[t.jsxRuntimeExports.jsx(t.TooltipTrigger,{children:t.jsxRuntimeExports.jsx(t.InfoCircledIcon,{strokeWidth:1,className:"h-3 w-3 opacity-70"})}),t.jsxRuntimeExports.jsx(t.TooltipContent,{children:t.jsxRuntimeExports.jsxs("div",{className:"max-w-[200px]",children:["Format number",t.jsxRuntimeExports.jsx("div",{className:"mt-1 font-mono text-xs",children:"#.## for 123.43"})]})})]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Input,{value:i||"",className:"h-7 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"###,###.##",onChange:c=>{var x,p,m;return r(c.target.value,((x=e==null?void 0:e.formatNumber)==null?void 0:x.currency)||"",((p=e==null?void 0:e.formatNumber)==null?void 0:p.locale)||"",((m=e==null?void 0:e.formatNumber)==null?void 0:m.suffix)||"")}})})]}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-xs",children:"Suffix"}),t.jsxRuntimeExports.jsx(t.Input,{value:((u=e==null?void 0:e.formatNumber)==null?void 0:u.suffix)||"",className:"h-7 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"K, M, B",onChange:c=>{var x,p,m;return r(((x=e==null?void 0:e.formatNumber)==null?void 0:x.format)||"",((p=e==null?void 0:e.formatNumber)==null?void 0:p.currency)||"",((m=e==null?void 0:e.formatNumber)==null?void 0:m.locale)||"",c.target.value)}})]})]})]})}function $u(){return t.jsxRuntimeExports.jsxs("div",{className:"space-y-6 px-6 py-2",children:[t.jsxRuntimeExports.jsx(t.Accordion,{type:"single",collapsible:!0,children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:"",children:"KPI Query"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"font-mono",children:[t.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs",children:"SELECT current, previous FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs [&>li]:mt-2",children:[t.jsxRuntimeExports.jsx("li",{children:"current - number"}),t.jsxRuntimeExports.jsx("li",{children:"previous - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:e=>e.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#kpi",children:"example"})," in the docs."]})]})]})}),t.jsxRuntimeExports.jsx("section",{className:"",children:t.jsxRuntimeExports.jsx(Uu,{})}),t.jsxRuntimeExports.jsx("div",{}),t.jsxRuntimeExports.jsx("div",{})]})}function Ku({cardType:e}){return t.jsxRuntimeExports.jsx("div",{className:"px-6 py-2 space-y-6",children:t.jsxRuntimeExports.jsxs(t.Accordion,{defaultValue:["item-2"],type:"multiple",children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:`${t.titleCase(e)} Chart`}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" space-y-4 font-mono text-xs ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded text-xs",children:"SELECT label, measure FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:" ml-6 list-disc [&>li]:mt-2 text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"label - category"}),t.jsxRuntimeExports.jsx("li",{children:"measure - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:n=>n.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#pie-chart",children:"example"})," in the docs."]})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Settings"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(un,{})})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ue,{})})]})]})})}function Qu(){return t.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:t.jsxRuntimeExports.jsxs(t.Accordion,{defaultValue:["item-2"],type:"multiple",children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Stacked Chart"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[t.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT x-axis, stack-by, y-axis FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[t.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),t.jsxRuntimeExports.jsx("li",{children:"stack by - category"}),t.jsxRuntimeExports.jsx("li",{children:"y-axis - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:e=>e.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#stacked-chart",children:"example"})," in the docs."]})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Settings"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"space-y-4 px-2",children:[t.jsxRuntimeExports.jsx(an,{}),t.jsxRuntimeExports.jsx(li,{})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ue,{})})]})]})})}function Wu({cardType:e}){return console.log("TableVisualSettings",e),t.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:t.jsxRuntimeExports.jsx(t.Accordion,{defaultValue:["item-3"],type:"multiple",children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ue,{})})]})})})}function Gu(){const e=t.useEditorStore(r=>r.card.type);function n(r){switch(r){case"stackedBar":return t.jsxRuntimeExports.jsx(Qu,{});case"kpi":return t.jsxRuntimeExports.jsx($u,{});case"line":case"bar":return t.jsxRuntimeExports.jsx(Pu,{cardType:r});case"pie":case"doughnut":case"polarArea":case"radar":return t.jsxRuntimeExports.jsx(Ku,{cardType:r});case"bubble":case"scatter":return t.jsxRuntimeExports.jsx(Bu,{cardType:r});case"table":return t.jsxRuntimeExports.jsx(Wu,{cardType:r});default:return t.jsxRuntimeExports.jsx(Vu,{})}}return t.jsxRuntimeExports.jsx(t.ScrollArea,{className:"h-full w-full text-sm",children:n(e)})}function Ju(){const e=t.useEditorStore(n=>n.isShowingVisual);return t.jsxRuntimeExports.jsxs(zt,{direction:"vertical",className:"min-w-full max-w-lg min-h-[250px]",children:[t.jsxRuntimeExports.jsx(Be,{role:"query-section",className:"flex",minSize:20,defaultSize:40,children:t.jsxRuntimeExports.jsx(vu,{})}),t.jsxRuntimeExports.jsx(Ot,{withHandle:!0,className:"border "}),t.jsxRuntimeExports.jsx(Be,{className:"pb-1",role:"visual-section",minSize:0,defaultSize:60,children:e?t.jsxRuntimeExports.jsxs(zt,{direction:"horizontal",children:[t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Be,{className:"flex min-w-[275px]",minSize:20,defaultSize:25,maxSize:30,children:t.jsxRuntimeExports.jsx(Gu,{})})}),t.jsxRuntimeExports.jsx(Ot,{className:"border "}),t.jsxRuntimeExports.jsx(Be,{minSize:40,defaultSize:75,maxSize:100,children:t.jsxRuntimeExports.jsx(nr,{})})]}):t.jsxRuntimeExports.jsx(nr,{})})]})}function Xu({authToken:e,onSave:n,onClose:r}){const i=t.useEditorStore(l=>l.actions.setOnSave),s=t.useEditorStore(l=>l.actions.setOnClose),o=t.useDashboardStore(l=>l.actions.setAuthToken);return T.useEffect(()=>{n&&i(n),r&&s(r)},[n,i,r,s]),T.useEffect(()=>{e&&e.accessToken&&o(e)},[e,o]),t.jsxRuntimeExports.jsxs(t.EditorPanel,{className:"rounded-none",role:"editor-panel",children:[t.jsxRuntimeExports.jsx(t.EditorAside,{className:"rounded-none border-r-[1.5px]",children:t.jsxRuntimeExports.jsx(pr,{})}),t.jsxRuntimeExports.jsx(t.EditorMain,{children:t.jsxRuntimeExports.jsx(Ju,{})})]})}function Yu(){t.useDashboardStore(l=>l.selectedCardId);const e=t.useDashboardStore(l=>l.selectedSheetId),{setIsVisualEditing:n}=t.useDashboardStore(l=>l.actions),r=t.useDashboardStore(l=>l.isVisualEditing),i=t.useDashboardStore(l=>l.actions.updateFrame);function s(l){e&&(i(e,l),n(!1))}function o(){n(!1)}return t.jsxRuntimeExports.jsx("div",{role:"editor-container",className:t.cn("flex grow",{block:r,hidden:!r}),children:t.jsxRuntimeExports.jsx(Xu,{onSave:s,onClose:o})})}function Zu({columns:e,tableName:n}){const r=t.useEditorStore(p=>p.selectedConnectionId),i=t.useEditorStore(p=>p.selectedDatabaseName),s=t.useEditorStore(p=>p.selectedSchemaName),o=t.useEditorStore(p=>p.selectedTableName),l=t.useDashboardStore(p=>p.dashboard.filters)||[],a=t.useDashboardStore(p=>p.actions.addFilter),u=t.useDashboardStore(p=>p.actions.removeFilter),c=t.useDashboardStore(p=>p.actions.removeFilterValue);function x(p){const m=t.fmt(p.column_name),d=t.fmt(i||""),j=t.fmt(s||""),E=t.fmt(n),S=t.getQualifiedTableName(j,E),y=`${S}.${m}`;console.log("find",y,E,d);const w=l==null?void 0:l.find(k=>k.column===y&&k.table===E&&(k.database===d||k.database===i));if(w)c(w.id),u(w.id);else{if(n==="api"&&r){a({id:t.v4(),column:y,title:p.column_name,dataType:p.data_type,table:"api",database:"NA",connectionId:r,operation:"in",sql:t.getDefaultFilterSql(p.data_type,S,m)});return}if(!r||!i||!o)throw new Error("missing connectionId, database, or table");a({id:t.v4(),column:`${S}.${m}`,title:p.column_name,dataType:p.data_type,table:o,database:i,connectionId:r,operation:"in",sql:t.getDefaultFilterSql(p.data_type,S,m)})}}return t.jsxRuntimeExports.jsx("div",{className:"xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3",children:e==null?void 0:e.map(p=>{const m=l==null?void 0:l.find(d=>d.column===t.fmt(p.column_name)&&d.table===o&&d.database===i);return t.jsxRuntimeExports.jsx("div",{onClick:()=>x(p),className:t.cn("group flex cursor-pointer items-center justify-between border border-dashed border-background px-3 py-[6px] text-sm transition-colors hover:bg-muted/50",{"bg-muted":m}),children:t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxRuntimeExports.jsx(ur,{column:p}),t.jsxRuntimeExports.jsx("span",{children:p.column_name})]})},p.column_name)})})}function ec(){t.useDashboardStore(n=>n.showFilters);const e=t.useDashboardStore(n=>n.actions.setShowFilters);return t.jsxRuntimeExports.jsxs("section",{className:"relative flex grow flex-col border-l px-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"mt-4 flex items-center justify-between gap-2 px-3",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-lg",children:"Filters"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>e(!1),className:"h-7 w-7 p-0",variant:"ghost",children:t.jsxRuntimeExports.jsx(t.Cross2Icon,{})})]}),t.jsxRuntimeExports.jsx("div",{className:"flex grow",children:t.jsxRuntimeExports.jsx(pr,{ColumnsComponent:(n,r,i)=>t.jsxRuntimeExports.jsx(Zu,{schemaName:n,tableName:r,columns:i})})})]})}function tc(){t.useDashboardStore(r=>r.dashboard);const e=t.useDashboardStore(r=>r.showFilters),n=t.useDashboardStore(r=>r.isVisualEditing);return t.useDashboardStore(r=>r.bookmarkKey),t.jsxRuntimeExports.jsxs("div",{role:"dashboard-plus-main",className:t.cn("grow",{hidden:n,flex:!n}),children:[t.jsxRuntimeExports.jsx(t.DashboardTabs,{}),e&&t.jsxRuntimeExports.jsx("div",{role:"filter-aside-container",className:"flex",children:t.jsxRuntimeExports.jsx(ec,{})})]})}function nc(){const e=t.useDashboardStore(i=>i.dashboard),n=t.useDashboardStore(i=>i.actions.setDashboard),r=t.useDashboardStore(i=>i.showDashboardJSON);return t.useDashboardStore(i=>i.actions.setShowDashboardJSON),t.jsxRuntimeExports.jsx("div",{className:t.cn(" p-2",{hidden:!r}),children:t.jsxRuntimeExports.jsx(t.de,{onChange:i=>{if(i)try{JSON.parse(i),n(JSON.parse(i))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto ",value:JSON.stringify(e,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})})}function rc({showControls:e=!1,showFooter:n=!0,...r}){return t.jsxRuntimeExports.jsx(t.SemaphorContextProvider,{dashboardProps:r,children:t.jsxRuntimeExports.jsxs(t.UXProvider,{children:[t.jsxRuntimeExports.jsx(nc,{}),t.jsxRuntimeExports.jsxs(t.DashboardPanel,{...r,children:[e&&t.jsxRuntimeExports.jsx(Fi,{}),t.jsxRuntimeExports.jsx(Yu,{}),t.jsxRuntimeExports.jsx(tc,{})]})]})})}exports.DashboardPlus=rc;exports.SelectComponent=Ke;exports.useEditorAside=cr;