semaphor 0.0.69 → 0.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/dashboard-plus-XDOAKV4t.js +240 -0
- package/dist/chunks/{dashboard-plus-FX4aBajk.js → dashboard-plus-rK324Am7.js} +2146 -2007
- package/dist/chunks/{index-wsauSY2B.js → index-KelU2yat.js} +14635 -14308
- package/dist/chunks/index-sYvkC1Tf.js +448 -0
- package/dist/chunks/lucide-react-JbmNElkb.js +7381 -0
- package/dist/chunks/lucide-react-j1irXyJ8.js +27835 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +99 -98
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +16 -1
- package/dist/types/main.d.ts +54 -7
- package/dist/types/surfboard.d.ts +16 -1
- package/dist/types/types.d.ts +16 -1
- package/package.json +4 -1
- package/dist/chunks/dashboard-plus-5at88oIA.js +0 -245
- package/dist/chunks/index-RiPhpkfr.js +0 -448
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";const e=require("./index-sYvkC1Tf.js"),S=require("react");require("react-dom");function qs(s){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>s[t]})}}return r.default=s,Object.freeze(r)}const Be=qs(S);/**
|
|
2
|
+
* @license lucide-react v0.453.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 Qe=e.createLucideIcon("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
|
|
7
|
+
* @license lucide-react v0.453.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 Ue=e.createLucideIcon("ChartArea",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);/**
|
|
12
|
+
* @license lucide-react v0.453.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 be=e.createLucideIcon("ChartColumnIncreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
|
|
17
|
+
* @license lucide-react v0.453.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 ye=e.createLucideIcon("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/**
|
|
22
|
+
* @license lucide-react v0.453.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 De=e.createLucideIcon("ChartNoAxesGantt",[["path",{d:"M8 6h10",key:"9lnwnk"}],["path",{d:"M6 12h9",key:"1g9pqf"}],["path",{d:"M11 18h7",key:"c8dzvl"}]]);/**
|
|
27
|
+
* @license lucide-react v0.453.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 Le=e.createLucideIcon("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/**
|
|
32
|
+
* @license lucide-react v0.453.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 Te=e.createLucideIcon("ChartScatter",[["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 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/**
|
|
37
|
+
* @license lucide-react v0.453.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 Ke=e.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"}]]);/**
|
|
42
|
+
* @license lucide-react v0.453.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 We=e.createLucideIcon("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
47
|
+
* @license lucide-react v0.453.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 Je=e.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"}]]);/**
|
|
52
|
+
* @license lucide-react v0.453.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 Ae=e.createLucideIcon("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
|
|
57
|
+
* @license lucide-react v0.453.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 Ye=e.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"}]]);/**
|
|
62
|
+
* @license lucide-react v0.453.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 Xe=e.createLucideIcon("EyeClosed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);/**
|
|
67
|
+
* @license lucide-react v0.453.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 Ze=e.createLucideIcon("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
72
|
+
* @license lucide-react v0.453.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 es=e.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"}]]);/**
|
|
77
|
+
* @license lucide-react v0.453.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 ss=e.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"}]]);/**
|
|
82
|
+
* @license lucide-react v0.453.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 ts=e.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"}]]);/**
|
|
87
|
+
* @license lucide-react v0.453.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 ns=e.createLucideIcon("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
|
|
92
|
+
* @license lucide-react v0.453.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 ze=e.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"}]]);/**
|
|
97
|
+
* @license lucide-react v0.453.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 rs=e.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"}]]);/**
|
|
102
|
+
* @license lucide-react v0.453.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 os=e.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"}]]);/**
|
|
107
|
+
* @license lucide-react v0.453.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 is=e.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"}]]);/**
|
|
112
|
+
* @license lucide-react v0.453.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 le=e.createLucideIcon("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
117
|
+
* @license lucide-react v0.453.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 as=e.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"}]]);/**
|
|
122
|
+
* @license lucide-react v0.453.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 ls=e.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"}]]);/**
|
|
127
|
+
* @license lucide-react v0.453.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 Fe=e.createLucideIcon("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
132
|
+
* @license lucide-react v0.453.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 cs=e.createLucideIcon("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
137
|
+
* @license lucide-react v0.453.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 xs=e.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 0Z",key:"wtfw2c"}]]);/**
|
|
142
|
+
* @license lucide-react v0.453.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 us=e.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"}]]);/**
|
|
147
|
+
* @license lucide-react v0.453.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 Me=e.createLucideIcon("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/**
|
|
152
|
+
* @license lucide-react v0.453.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 ds=e.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"}]]);/**
|
|
157
|
+
* @license lucide-react v0.453.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 ms=e.createLucideIcon("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/**
|
|
162
|
+
* @license lucide-react v0.453.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const ps=e.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 17h.01",key:"1euzgo"}],["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"}]]);/**
|
|
167
|
+
* @license lucide-react v0.453.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const js=e.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"}]]);/**
|
|
172
|
+
* @license lucide-react v0.453.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const hs=e.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"}]]);/**
|
|
177
|
+
* @license lucide-react v0.453.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const Se=e.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"}]]);/**
|
|
182
|
+
* @license lucide-react v0.453.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const Es=e.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 Oe(s){var r;return{...s,sheets:(r=s==null?void 0:s.sheets)==null?void 0:r.map(t=>{var n;return{...t,frames:(n=t.frames)==null?void 0:n.map(o=>{var a;return{...o,cards:(a=o.cards)==null?void 0:a.map(i=>fs(i))}})}})}}function fs(s){var r,t,n,o;return{...s,cfg:{...s.cfg,data:{...(r=s.cfg)==null?void 0:r.data,labels:[],datasets:(o=(n=(t=s.cfg)==null?void 0:t.data)==null?void 0:n.datasets)==null?void 0:o.map(a=>({...a,data:[]}))}},customCfg:_s(s.customCfg),data:[]}}function _s(s){var r,t;return s?{...s,data:{...s==null?void 0:s.data,labels:[],datasets:(t=(r=s==null?void 0:s.data)==null?void 0:r.datasets)==null?void 0:t.map(n=>({...n,data:[]}))}}:null}async function Bs(s,r,t,n){if(!n)return null;const o=JSON.stringify(r),a="https://semaphor.cloud/api/v1/lens";return await e.postRequest(a,n,{name:s,template:o,filterValues:t,operation:"create"})}async function Ie(s,r){if(!r)return null;const{id:t,template:n,filterValues:o,isDefault:a,shared:i}=s,c="https://semaphor.cloud/api/v1/lens";return await e.postRequest(c,r,{lensId:t,template:n,filterValues:o,isDefault:a,shared:i,operation:"update"})}async function Hs(s,r){if(!r)return null;const t="https://semaphor.cloud/api/v1/lens";return await e.postRequest(t,r,{operation:"delete",lensId:s})}function Ps(){const[s,r]=S.useState(""),[t,n]=S.useState(!1),o=e.useDashboardStore(p=>p.lenses),{setLenses:a,setSelectedLensId:i}=e.useDashboardActions(),[c,l]=S.useState(!1),[m,u]=S.useState(!1),R=e.useDashboardStore(p=>p.dashboard),h=e.useDashboardStore(p=>p.filterValues),{authToken:x}=e.useSemaphorContext();async function d(){l(!0);const p=Oe(R),N=await Bs(s,p,h,x==null?void 0:x.accessToken);N&&(a([...o||[],N]),i(N.id),u(!1)),l(!1)}return e.jsxRuntimeExports.jsxs(e.Dialog,{open:m,onOpenChange:u,children:[e.jsxRuntimeExports.jsx(e.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(e.Button,{variant:"secondary",className:"h-7 p-2",size:"sm",children:[e.jsxRuntimeExports.jsx(e.Plus,{className:"mr-2 h-4 w-4",strokeWidth:1.5}),"Lens"]})}),e.jsxRuntimeExports.jsxs(e.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxRuntimeExports.jsxs(e.DialogHeader,{children:[e.jsxRuntimeExports.jsx(e.DialogTitle,{children:"Create Lens"}),e.jsxRuntimeExports.jsx(e.DialogDescription,{children:"Lenses are private by default and are only visible to you."})]}),e.jsxRuntimeExports.jsx("div",{className:"grid gap-4 py-4",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"text-right",children:"Name"}),e.jsxRuntimeExports.jsx(e.Input,{value:s,onChange:p=>{r(p.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),t&&e.jsxRuntimeExports.jsx("p",{className:"text-sm",children:"The lens name already exists. Use a differnet name."}),e.jsxRuntimeExports.jsx(e.DialogFooter,{children:e.jsxRuntimeExports.jsx(e.Button,{size:"sm",variant:"outline",type:"submit",onClick:d,disabled:c,children:c?"Creating...":"Add"})})]})]})}function $s(){const[s,r]=S.useState(!1),t=e.useDashboardStore(u=>u.lenses),n=e.useDashboardStore(u=>u.selectedLensId),{setLenses:o,setSelectedLensId:a}=e.useDashboardActions(),{authToken:i}=e.useSemaphorContext();async function c(u){a(u)}async function l(u){if(await Hs(u,i==null?void 0:i.accessToken)){const h=t==null?void 0:t.filter(x=>x.id!==u);o(h||[]),a("original")}}async function m(u){const R=t==null?void 0:t.map(d=>d.id===u.id?{...d,isDefault:!u.isDefault}:{...d,isDefault:!1});o(R||[]);const h={...u,isDefault:!u.isDefault};await Ie(h,i==null?void 0:i.accessToken);const x=t==null?void 0:t.find(d=>d.isDefault);if(x&&x.id!==u.id){const d={...x,isDefault:!1};await Ie(d,i==null?void 0:i.accessToken)}}return e.jsxRuntimeExports.jsxs(e.DropdownMenu,{open:s,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(e.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{variant:"ghost",className:"h-7 p-2",children:e.jsxRuntimeExports.jsx(es,{className:"h-4 w-4",strokeWidth:1.5})})}),e.jsxRuntimeExports.jsxs(e.DropdownMenuContent,{align:"end",className:"w-60",children:[e.jsxRuntimeExports.jsx(e.DropdownMenuLabel,{className:"px-3",children:"Lenses"}),e.jsxRuntimeExports.jsx(e.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsxs(e.DropdownMenuRadioGroup,{value:n,onValueChange:c,children:[e.jsxRuntimeExports.jsx(e.DropdownMenuRadioItem,{value:"original",children:"Original"}),t==null?void 0:t.map(u=>e.jsxRuntimeExports.jsxs(e.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:u.id,children:[e.jsxRuntimeExports.jsx("p",{children:u.name}),e.jsxRuntimeExports.jsxs("span",{className:"flex items-center gap-3",children:[e.jsxRuntimeExports.jsx(ns,{onClick:R=>{R.preventDefault(),m(u)},className:e.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!u.isDefault,"text-green-500":u.isDefault}),strokeWidth:1.5}),e.jsxRuntimeExports.jsx(e.Cross2Icon,{onClick:R=>{R.preventDefault(),l(u.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},u.id))]})]})]})}function Gs(){const{authToken:s}=e.useSemaphorContext(),r=e.useDashboardStore(g=>g.lenses),t=e.useDashboardStore(g=>g.selectedLensId),n=r==null?void 0:r.find(g=>g.id===t),o=e.useDashboardStore(g=>g.dashboard);e.useDashboardStore(g=>g.selectedSheetId);const a=e.useDashboardStore(g=>g.isDashboardEditing),[i,c]=S.useState(!1),l=e.useDashboardStore(g=>g.filterValues),m=e.useDashboardStore(g=>g.isVisualEditing),u=e.useDashboardStore(g=>g.showFilters);e.useDashboardStore(g=>g.showDashboardJSON);const R=e.useDashboardStore(g=>g.onSaveFunction),h=e.useDashboardStore(g=>g.actions.setShowFilters),{addFrame:x,setSelectedFrameId:d}=e.useDashboardStore(g=>g.actions),{getSelectedSheet:p,setIsDashboardEditing:N,setShowDashboardJSON:I}=e.useDashboardStore(g=>g.actions),L=p(),{tenantId:E,endUserId:D}=S.useMemo(()=>e.getTenantAndEndUserId(s==null?void 0:s.accessToken),[s==null?void 0:s.accessToken]),T=S.useMemo(()=>E||D,[E,D]),j=()=>{if(!a||!L)return;const g={id:e.v4(),title:"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}]},type:"bar",sql:"select COUNT(*) from YOUR_TABLE",data:[]},z={id:e.v4(),cards:[g],activeCardId:g.id};x(L.id,z),d(z.id)},v=()=>{N(!0)};async function b(){if(c(!0),!t||!n)return;const g=Oe(o),z=JSON.stringify(g),O={...n,template:z,filterValues:l};await Ie(O,s==null?void 0:s.accessToken),e.Jt.success("Lens saved"),R==null||R(g),c(!1)}return m?null:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-2 border-b bg-muted/50 py-2 pl-3 pr-2",role:"dashboard-controls",children:[!m&&e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-3",children:e.jsxRuntimeExports.jsx(e.Label,{children:n==null?void 0:n.name})}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[a&&!m&&T&&e.jsxRuntimeExports.jsx(Ps,{}),!m&&T&&e.jsxRuntimeExports.jsx($s,{}),a&&!m&&e.jsxRuntimeExports.jsxs(e.Button,{variant:"secondary",className:"h-7 p-2",size:"sm",disabled:!a,onClick:j,children:[e.jsxRuntimeExports.jsx(e.Plus,{className:"mr-2 h-4 w-4",strokeWidth:1.5}),"Frame"]}),!a&&e.jsxRuntimeExports.jsx(e.Button,{variant:"ghost",className:"h-7 p-2",onClick:v,size:"sm",children:e.jsxRuntimeExports.jsx(Fe,{className:"h-4 w-4",strokeWidth:1.5})}),a&&!m&&e.jsxRuntimeExports.jsx(e.Button,{variant:"ghost",role:"close",className:"h-7 p-2",onClick:()=>{N(!1),I(!1)},size:"sm",children:e.jsxRuntimeExports.jsx(e.Cross2Icon,{className:"h-4 w-4",strokeWidth:1.5})}),a&&!m&&T&&e.jsxRuntimeExports.jsx(e.Button,{className:"h-7 p-2",variant:"ghost",disabled:i,onClick:b,size:"sm",children:e.jsxRuntimeExports.jsx(us,{className:"h-4 w-4",strokeWidth:1.5})}),!u&&!m&&a&&e.jsxRuntimeExports.jsx(e.Button,{className:"h-7 p-2",variant:"ghost",onClick:()=>h(!0),size:"sm",children:e.jsxRuntimeExports.jsx(e.Filter,{className:"h-4 w-4",strokeWidth:1.5})}),!m&&a&&!1,!m&&!1]})]})}function ae({title:s,items:r,value:t,isLoading:n,isError:o,connectionTooltip:a,onChange:i,showNone:c=!1,className:l,showIcon:m=!0,disabled:u=!1}){const R=n?"Loading...":o?"Error":t;function h(){if(s==="Connection")return e.jsxRuntimeExports.jsx(xs,{className:"size-4 rotate-90"});if(s==="Database")return e.jsxRuntimeExports.jsx(Je,{className:"size-4"});if(s==="Schema")return e.jsxRuntimeExports.jsx(ls,{className:"size-4"});if(s==="Table")return e.jsxRuntimeExports.jsx(e.Table,{className:"size-4"});if(s==="Model")return e.jsxRuntimeExports.jsx(Qe,{className:"size-4"})}return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[m&&e.jsxRuntimeExports.jsx("div",{className:"shrink-0",children:a?e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.TooltipTrigger,{children:h()}),e.jsxRuntimeExports.jsx(e.TooltipContent,{className:"text-xs",align:"start",children:a})]}):h()}),e.jsxRuntimeExports.jsxs(e.Select,{disabled:u,value:R,onValueChange:i,children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:e.cn("h-9 w-full focus:ring-1 focus:ring-offset-0",l),children:e.jsxRuntimeExports.jsx(e.SelectValue,{placeholder:n?"Loading...":o?"Error":`Select ${s}`})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[n?e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Loading..."}):e.jsxRuntimeExports.jsx(e.SelectLabel,{children:s}),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[c&&e.jsxRuntimeExports.jsx(e.SelectItem,{value:"none",children:"None"},"none"),r&&r.map((x,d)=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:x.id,children:x.name},d))]}),(n||o)&&e.jsxRuntimeExports.jsx(e.SelectItem,{value:R,children:R})]})})]})]})}function Qs({column:s}){const[r,t]=S.useState(!1),n=e.useEditorStore(x=>x.selectedTableName),o=e.useEditorStore(x=>x.selectedSchemaName),a=e.useEditorStore(x=>x.selectedDatamodelId),i=e.useEditorStore(x=>x.sqlGen),{modelItems:c}=oe(),l=e.useEditorStore(x=>x.actions.setSqlGen),m=e.useEditorStore(x=>x.actions.setCardSql),u=e.useEditorStore(x=>x.actions.setRunSql);function R(x,d){var L;const p=e.createSqlGenConfig(x,i,d),N=(L=c==null?void 0:c.find(E=>E.id===a))==null?void 0:L.name;l(p);const I=e.getSql(p,e.fmt(o||""),e.fmt(n),N);I&&(m(I),u(!0)),t(!1)}function h(){return e.jsxRuntimeExports.jsxs("ul",{className:"text-xs",children:[e.jsxRuntimeExports.jsx("li",{onClick:()=>R(s,"COUNT"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Count"}),e.jsxRuntimeExports.jsx("li",{onClick:()=>R(s,"AVG"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Avg"}),e.jsxRuntimeExports.jsx("li",{onClick:()=>R(s,"SUM"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Sum"}),e.jsxRuntimeExports.jsx("li",{onClick:()=>R(s,"MAX"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Max"}),e.jsxRuntimeExports.jsx("li",{onClick:()=>R(s,"MIN"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Min"})]})}return e.jsxRuntimeExports.jsxs(e.HoverCard,{openDelay:0,open:r,onOpenChange:t,children:[e.jsxRuntimeExports.jsx(e.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(Ae,{className:"invisible size-3.5 cursor-pointer text-foreground/40 group-hover:visible"})}),e.jsxRuntimeExports.jsx(e.HoverCardContent,{align:"center",className:"w-20 rounded-md p-0 shadow-none",children:h()})]})}function gs({column:s}){return e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.$a093c7e1ec25a057$export$8c610744efcf8a1d,{asChild:!0,children:e.TEXT_DATA_TYPES.includes(s.data_type.toLowerCase())?e.jsxRuntimeExports.jsx(Se,{className:"size-3"}):e.NUMBER_DATA_TYPES.includes(s.data_type.toLowerCase())?e.jsxRuntimeExports.jsx(ts,{className:"size-3"}):e.DATE_DATA_TYPES.includes(s.data_type.toLowerCase())?e.jsxRuntimeExports.jsx(e.Calendar,{className:"size-3"}):e.BOOLEAN_DATA_TYPES.includes(s.data_type.toLowerCase())?e.jsxRuntimeExports.jsx(hs,{className:"size-3"}):e.jsxRuntimeExports.jsx(ds,{className:"size-3"})}),e.jsxRuntimeExports.jsx(e.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{className:"font-mono text-xs",children:s.data_type})})]})}function Us({schemaName:s,tableName:r,columns:t,status:n}){const o=e.useEditorStore(b=>b.sqlGen),a=e.useEditorStore(b=>b.selectedConnectionId),i=e.useEditorStore(b=>b.selectedDatabaseName),c=e.useEditorStore(b=>b.selectedSchemaName),l=e.useEditorStore(b=>b.selectedTableName),m=e.useEditorStore(b=>b.selectedDatamodelId),u=e.useDashboardStore(b=>b.dashboard.aiScopeTables),{setAIScopeTables:R}=e.useDashboardStore(b=>b.actions),h=e.useEditorStore(b=>b.actions.setRunSql),x=e.useEditorStore(b=>b.actions.setSqlGen),d=e.useEditorStore(b=>b.actions.setIsShowingVisual),p=e.useEditorStore(b=>b.actions.setCardSql),{connectionType:N,modelItems:I}=oe();function L(b){var F;const g=e.createSqlGenConfig(b,o);x(g);const z=(F=I==null?void 0:I.find(V=>V.id===m))==null?void 0:F.name,O=e.getSql(g,e.fmt(s),e.fmt(r),z);O&&(p(O),h(!0))}function E(){return(u==null?void 0:u.find(b=>b.connectinonId===a&&b.tableName===l))!==void 0}function D(b){if(b===!0&&l&&a){const g={connectinonId:a,connectionType:N,databaseName:i,schemaName:c,tableName:l},O=[...u||[],g].filter((F,V,P)=>P.findIndex(_=>_.connectinonId===F.connectinonId&&_.tableName===F.tableName)===V);R(O),e.Jt.success(`Added '${l}' to AI Scope`,{position:"top-right",duration:2500,richColors:!0})}else{const g=(u||[]).filter(z=>z.connectinonId!==a&&z.tableName!==l);R(g),e.Jt(`Removed '${l}' from AI Scope`,{position:"top-right",duration:2e3,richColors:!0})}}function T(){var F;let b=e.getQualifiedTableName(s,r);const g=(F=I==null?void 0:I.find(V=>V.id===m))==null?void 0:F.name;console.log("modelName",g),m&&m!=="none"&&(b=`${e.DATAMODEL_NAMESPCACE}.${g}`);let z=b;return(V=>/[A-Z]/.test(V))(r)&&(z=z.split(".").map(P=>`"${P}"`).join(".")),z}function j(){const b=T();d(!1);const g=N==="MSSQL"?`SELECT top 10 * FROM ${b}`:`SELECT * FROM ${b} LIMIT 10`;p(g),h(!0)}function v(){const b=T();p(`SELECT COUNT(*) as count FROM ${b}`),h(!0)}return e.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col space-y-4 px-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsxRuntimeExports.jsx(e.Toggle,{title:`${E()?"Remove from":"Add to"} AI Scope`,pressed:E(),onPressedChange:D,variant:"outline",className:"h-9 px-2",children:e.jsxRuntimeExports.jsx(e.Bot,{className:e.cn("size-4",{"text-primary":E(),"text-muted-foreground":!E()})})}),e.jsxRuntimeExports.jsxs(e.Button,{disabled:n!=="Success",onClick:j,size:"sm",variant:"secondary",className:"flex",children:[n!=="Success"?e.jsxRuntimeExports.jsx(le,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):e.jsxRuntimeExports.jsx(ps,{className:"mr-2 size-4"}),"Top 10"]}),e.jsxRuntimeExports.jsxs(e.Button,{disabled:n!=="Success",onClick:v,size:"sm",variant:"secondary",className:"flex",children:[n!=="Success"?e.jsxRuntimeExports.jsx(le,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):e.jsxRuntimeExports.jsx(ms,{className:"mr-2 size-4"}),"Count"]})]}),e.jsxRuntimeExports.jsxs(e.ScrollArea,{className:"flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",children:[t==null?void 0:t.map(b=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>L(b),className:e.cn("group mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",{"bg-muted":e.isColumnInSqlGen(b,o)}),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(gs,{column:b}),e.jsxRuntimeExports.jsx("span",{children:b.column_name})]}),e.jsxRuntimeExports.jsx("div",{onClick:g=>g.stopPropagation(),className:"flex items-center justify-end",children:e.NUMBER_DATA_TYPES.includes(b.data_type)&&e.jsxRuntimeExports.jsx(Qs,{column:b})})]},b.column_name)),e.jsxRuntimeExports.jsx(e.ScrollBar,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(e.ScrollBar,{orientation:"horizontal"})]})]})}function oe(s,r){var pe,ue,je,he,f;let t=S.useMemo(()=>[],[]);const n=e.useSemaphorContext().authToken||s,o=e.useEditorStore(y=>y.selectedConnectionId),a=e.useEditorStore(y=>y.selectedDatamodelId),i=e.useEditorStore(y=>y.selectedDatabaseName),c=e.useEditorStore(y=>y.selectedSchemaName),l=e.useEditorStore(y=>y.selectedTableName),m=e.useEditorStore(y=>y.actions.setCurrentColumns),u=e.useEditorStore(y=>y.actions.setSelectedConnectionId),R=e.useEditorStore(y=>y.actions.setSelectedDatamodelId),h=e.useEditorStore(y=>y.actions.setSelectedDatabaseName),x=e.useEditorStore(y=>y.actions.setSelectedSchemaName),d=e.useEditorStore(y=>y.actions.setSelectedTableName),p=e.useEditorStore(y=>y.actions.setCardSql);function N(y){return o&&i&&c&&i!=="NA"?!0:o&&y==="API"?!1:!!(o&&y==="S3")}function I(y){return!!(o&&i&&i!=="NA"&&c&&l||o&&(y==="S3"||y==="API")||a&&a)}function L(y){return o&&y?!(y==="API"||y==="S3"):!1}const{data:E,isLoading:D,isError:T}=e.useQuery({queryKey:["connections"],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/connections",(n==null?void 0:n.accessToken)||""),enabled:!!(n!=null&&n.accessToken)}),{data:j,isLoading:v,isError:b}=e.useQuery({queryKey:["models",o],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/datamodels",(n==null?void 0:n.accessToken)||"",{connection_id:o}),enabled:!!(n!=null&&n.accessToken)&&!!o}),g=E==null?void 0:E.connections.find(y=>y.id===o),z=g==null?void 0:g.type,O=(g==null?void 0:g.type)==="API"||(g==null?void 0:g.type)==="S3",{data:F,isLoading:V,isFetching:P,isError:_,refetch:K}=e.useQuery({queryKey:["databases",o],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/databases",(n==null?void 0:n.accessToken)||"",{connection_id:o}),enabled:L(z)}),{data:q,isLoading:W,isFetching:C,isError:A,refetch:H}=e.useQuery({queryKey:["schemas",o,i],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/schemas",(n==null?void 0:n.accessToken)||"",{connection_id:o,database_name:i}),enabled:!!o&&!!i&&!O&&i!=="NA"}),{data:k,isLoading:w,isFetching:$,isError:M,refetch:G}=e.useQuery({queryKey:["tables",o,i,c],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/tables",(n==null?void 0:n.accessToken)||"",{connection_id:o,database_name:i,schema_name:c}),enabled:N(z)}),{data:Q,isLoading:te,isFetching:ee,isError:B}=e.useQuery({queryKey:["columns",o,i,a,c,l],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/columns",(n==null?void 0:n.accessToken)||"",{connection_id:o,datamodel_id:a||"",database_name:i,schema_name:c,table_name:l}),enabled:I(z)});S.useEffect(()=>{m(t)},[Q,m,t]),S.useEffect(()=>{},[O,p,d,x,h,g]);const J=(g==null?void 0:g.type)==="API"?(pe=g==null?void 0:g.type)==null?void 0:pe.toLowerCase():l||"",Y=O?"":c||"";function ne(y){x(y),d("")}function X(y){h(y==="none"?"":y),x(""),d(""),y!=="none"&&y!==""&&R("")}function se(y){u(y)}function qe(y){R(y==="none"?"":y),y!=="none"&&y!==""&&h("")}F&&((ue=F==null?void 0:F.databases)==null?void 0:ue.length)>0,q&&((je=q==null?void 0:q.schemas)==null?void 0:je.length)>0,Q&&((he=Q==null?void 0:Q.columns)==null?void 0:he.length)>0&&(t=Q.columns.map(y=>({...y,data_type:y.data_type.toLowerCase()}))),_&&(t=[]),(B||T)&&(t=[]);const ie=E==null?void 0:E.connections.map(y=>({id:y.id,name:y.name,type:y.type})),Ce=(f=j==null?void 0:j.datamodels)==null?void 0:f.map(y=>({id:y.id,name:y.name})),me=F==null?void 0:F.databases.map(y=>({id:y.database_name,name:y.database_name})),Ne=q==null?void 0:q.schemas.map(y=>({id:y.schema_name,name:y.schema_name})),we=k==null?void 0:k.tables.map(y=>({id:y.table_name,name:y.table_name}));return{connectionItems:ie,isConnectionsLoading:D,isConnectionsError:T,modelItems:Ce,isModelsLoading:v,isModelsError:b,databaseItems:me,isDatabasesLoadingOrFetching:V||P,isDatabaseError:_,schemaItems:Ne,isSchemaLoadingOrFetching:W||C,isSchemaError:A,tableItems:we,isTableLoadingOrFetching:w||$,isTableError:M,columns:t,isColumnsLoadingOrFetching:te||ee,isColumnsError:B,isNonDbConnection:O,connectionType:z,tableName:J,schemaName:Y,handleConnectionChange:se,handleDatamodelChange:qe,handleDatabaseChange:X,handleSchemaChange:ne}}function Rs({ColumnsComponent:s}){var $;const r=e.useEditorStore(M=>M.selectedConnectionId),t=e.useEditorStore(M=>M.selectedDatamodelId),n=e.useEditorStore(M=>M.selectedDatabaseName),o=e.useEditorStore(M=>M.selectedSchemaName),a=e.useEditorStore(M=>M.selectedTableName),i=e.useEditorStore(M=>M.actions.setSelectedTableName),{connectionItems:c,modelItems:l,schemaItems:m,databaseItems:u,tableItems:R,columns:h,isConnectionsLoading:x,isModelsLoading:d,isConnectionsError:p,isModelsError:N,isDatabasesLoadingOrFetching:I,isDatabaseError:L,isSchemaLoadingOrFetching:E,isSchemaError:D,isColumnsError:T,isColumnsLoadingOrFetching:j,isTableLoadingOrFetching:v,isTableError:b,connectionType:g,isNonDbConnection:z,handleConnectionChange:O,handleDatabaseChange:F,handleSchemaChange:V,handleDatamodelChange:P,tableName:_,schemaName:K}=oe();function q(){return s?s(K,_,h):e.jsxRuntimeExports.jsx(Us,{schemaName:K,tableName:_,columns:h,status:j?"Loading...":T?"Error":"Success"})}function W(){window.location.href="mailto:support@semaphor.cloud?subject=Help&body=I need help with..."}function C(){if(!r||g==="S3"||g==="API")return null;if(!t||t==="none")return e.jsxRuntimeExports.jsx(ae,{showNone:!0,onChange:F,isError:L,isLoading:I,items:u,value:n||"",title:"Database"})}function A(){if(r&&!z&&(!n||n==="none")&&(!t||t==="none"))return e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3",children:[e.jsxRuntimeExports.jsx("div",{className:"col-span-1 grid place-items-center",children:e.jsxRuntimeExports.jsx(e.Separator,{})}),e.jsxRuntimeExports.jsx("div",{className:"col-span-1 grid place-items-center",children:e.jsxRuntimeExports.jsx(e.Label,{children:"OR"})}),e.jsxRuntimeExports.jsx("div",{className:"col-span-1 grid place-items-center",children:e.jsxRuntimeExports.jsx(e.Separator,{})})]})}function H(){if(!r||g==="S3"||g==="API")return null;if(!n||n==="none")return e.jsxRuntimeExports.jsx(ae,{showNone:!0,onChange:P,isError:N,isLoading:d,items:l,value:t||"",title:"Model"})}function k(){return!r||g==="S3"||g==="API"||!n||n==="none"?null:e.jsxRuntimeExports.jsx(ae,{onChange:V,isError:D,isLoading:E,items:m,value:o||"",title:"Schema"})}function w(){function M(){let G=!1;return g==="API"?(G=!1,G):((g==="S3"||r&&n&&n!=="none"&&o)&&(G=!0),G)}return M()?e.jsxRuntimeExports.jsx(ae,{onChange:i,isError:b,items:R,isLoading:v,value:a||"",title:"Table"}):null}return e.jsxRuntimeExports.jsxs("aside",{className:"xbg-red-100 flex grow flex-col justify-between",children:[e.jsxRuntimeExports.jsxs("section",{className:"space-y-3 px-6 py-4",children:[e.jsxRuntimeExports.jsx(ae,{items:c,title:"Connection",value:r||"",onChange:O,isLoading:x,isError:p,connectionTooltip:(($=c==null?void 0:c.find(M=>M.id===r))==null?void 0:$.type)||""}),H(),A(),C(),k(),w()]}),q(),e.jsxRuntimeExports.jsx("div",{className:"flex items-end justify-center gap-2 px-6 py-4",children:e.jsxRuntimeExports.jsxs(e.Button,{onClick:W,size:"sm",variant:"secondary",className:"w-full",children:[e.jsxRuntimeExports.jsx(as,{className:"mr-2 size-4"}),"Help"]})})]})}function Ks(s){const r=s.toUpperCase().indexOf("WHERE"),t=s.toUpperCase().indexOf("GROUP BY"),n=s.toUpperCase().indexOf("LIMIT"),o=s.toUpperCase().indexOf("ORDER BY");let a=s.length;if(o!==-1&&(a=o),n!==-1&&n<a&&(a=n),r!==-1){const i=s.substring(0,r),c=s.substring(r);return`${i} {{ filters | where }} AND ${c.substring(6)}`}else if(t!==-1){const i=s.substring(0,t),c=s.substring(t);return`${i} {{ filters | where }} ${c}`}else{const i=s.substring(0,a),c=s.substring(a);return`${i} {{ filters | where }} ${c}`}}function Ws({error:s,setShowAIDialog:r,setUserInputforAI:t,setTriggerAIRun:n}){return e.jsxRuntimeExports.jsxs(e.HoverCard,{openDelay:0,children:[e.jsxRuntimeExports.jsx(e.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{variant:"link",className:"h-5 p-0",children:e.jsxRuntimeExports.jsx(Ke,{className:"h-4 w-4 text-red-500"})})}),e.jsxRuntimeExports.jsx(e.HoverCardContent,{align:"start",className:"min-w-fit max-w-[500px]",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col space-y-2",children:[e.jsxRuntimeExports.jsx(e.ScrollArea,{className:"max-h-[250px] min-h-0 overflow-scroll",children:e.jsxRuntimeExports.jsx("p",{className:"overflow-auto rounded-md bg-muted p-2 text-xs leading-relaxed",children:s})}),e.jsxRuntimeExports.jsxs(e.Button,{onClick:()=>{r(!0),t(s),n(!0)},size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(ss,{className:"mr-2 h-4 w-4"}),"Debug with AI"]})]})})})]})}function Js({text:s,onCheckedChange:r,checked:t}){return e.jsxRuntimeExports.jsxs("div",{className:"xbg-red-100 ml-6 flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{checked:t,onCheckedChange:r}),e.jsxRuntimeExports.jsx("label",{className:"text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:s})]})}function Ys(){const{authToken:s}=e.useSemaphorContext(),r=e.useEditorStore(a=>a.selectedConnectionId),{data:t}=e.useQuery({queryKey:["connections"],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/connections",(s==null?void 0:s.accessToken)||""),enabled:!!(s!=null&&s.accessToken)}),n=t==null?void 0:t.connections.find(a=>a.id===r);return n==null?void 0:n.type}function Xs(){const{authToken:s}=e.useSemaphorContext(),r=S.useRef(null),t=e.useEditorStore(l=>l.applyFilters),[n,o]=S.useState(""),a=e.useEditorStore(l=>l.filterValues),i=e.useEditorStore(l=>l.card.sql),c=Ys();return e.jsxRuntimeExports.jsxs(e.HoverCard,{openDelay:0,onOpenChange:async l=>{if(!l)return;console.log("onOpenChange");const m=await e.postRequest("https://semaphor.cloud/api/v1/filter-sql",(s==null?void 0:s.accessToken)||"",{sql:i,active_filters:a,connection_type:c});console.log(m),m.sql?(console.log(m.records),o(m.sql)):o("Error")},children:[e.jsxRuntimeExports.jsx(e.HoverCardTrigger,{asChild:!0,children:t&&e.jsxRuntimeExports.jsx("p",{className:"p-0 text-xs hover:cursor-pointer",children:"| Filter Query"})}),e.jsxRuntimeExports.jsxs(e.HoverCardContent,{align:"end",className:"w-[600px]",children:[e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsx("div",{className:"rounded-sm bg-muted p-2",children:e.jsxRuntimeExports.jsxs("code",{ref:r,className:"font-mono text-sm",children:[n,e.jsxRuntimeExports.jsx(e.ClipboardCopyIcon,{onClick:()=>e.copyToClipboard(r),className:"ml-3 inline-block h-4 w-4 opacity-70 hover:cursor-pointer hover:opacity-100"})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsx(e.InfoCircledIcon,{className:"h-4 w-4 opacity-70"}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-muted-foreground",children:"A preview of the query with filters applied."})]})]})]})}const Zs=`
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
190
|
+
Bar / Line Chart:
|
|
191
|
+
|
|
192
|
+
SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table
|
|
193
|
+
|
|
194
|
+
- X-axis - Category
|
|
195
|
+
- Y-axis - Number
|
|
196
|
+
|
|
197
|
+
Stacked Chart:
|
|
198
|
+
|
|
199
|
+
SELECT x-axis, stack-by, y-axis FROM table
|
|
200
|
+
|
|
201
|
+
- X-axis - Category
|
|
202
|
+
- Stack by - Category
|
|
203
|
+
- Y-axis - Number
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
Scatter Chart:
|
|
207
|
+
|
|
208
|
+
SELECT label, x-axis, y-axis FROM table
|
|
209
|
+
|
|
210
|
+
- Label - Category
|
|
211
|
+
- Group (opt) - Category
|
|
212
|
+
- X-axis - Number
|
|
213
|
+
- Y-axis - Number
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
Bubble Chart:
|
|
217
|
+
|
|
218
|
+
SELECT label, x-axis, y-axis, radius FROM table
|
|
219
|
+
|
|
220
|
+
- Label - Category
|
|
221
|
+
- Bubble Group (opt) - Category
|
|
222
|
+
- X-axis - Number
|
|
223
|
+
- Y-axis - Number
|
|
224
|
+
- Radius - Number
|
|
225
|
+
|
|
226
|
+
Pie / Dougnut Chart:
|
|
227
|
+
|
|
228
|
+
SELECT label, measure FROM table
|
|
229
|
+
|
|
230
|
+
- Label - Category
|
|
231
|
+
- Measure - Number
|
|
232
|
+
`;function et({open:s,setOpen:r,userInput:t,setUserInput:n,triggerAIRun:o,setTriggerAIRun:a}){const i=S.useRef(null),c=S.useRef(null),{authToken:l}=e.useSemaphorContext(),[m,u]=S.useState(!1),R=e.useEditorStore(C=>C.actions.setCardSql),h=e.useDashboardStore(C=>C.dashboard.baseQueries),x=e.useEditorStore(C=>C.actions.setRunSql),d=e.useEditorStore(C=>C.actions.setCardType),[p,N]=S.useState([]),I=e.useEditorStore(C=>C.currentColumns),L=e.useEditorStore(C=>C.card.sql),E=e.useEditorStore(C=>C.selectedTableName),D=`
|
|
233
|
+
${t}
|
|
234
|
+
|
|
235
|
+
Database Query Dialect: ${E==="api"||E==="s3"?"DuckDb":""}
|
|
236
|
+
Table Name: ${E}
|
|
237
|
+
Table Columns: ${I==null?void 0:I.map(C=>`${C.column_name} | ${C.data_type}`).join(", ")}
|
|
238
|
+
User SQL: ${L}
|
|
239
|
+
${h&&`Base Queries: ${JSON.stringify(h)} `}`,T=` 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.
|
|
240
|
+
Visual Query Syntax: ${Zs}`,{data:j,isLoading:v,isFetching:b,isError:g,refetch:z}=e.useQuery({queryKey:["ai-query"],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/ai",(l==null?void 0:l.accessToken)||"",{user_content:`userContent: ${D} ${m?T:""}`}),enabled:!1});function O(C){if(C.toLowerCase().includes("bar"))d("bar");else if(C.toLowerCase().includes("line"))d("line");else if(C.toLowerCase().includes("bubble"))d("bubble");else if(C.toLowerCase().includes("scatter"))d("scatter");else if(C.toLowerCase().includes("stacked"))d("stackedBar");else if(C.toLowerCase().includes("pie"))d("pie");else if(C.toLowerCase().includes("donut")||C.toLowerCase().includes("doughnut"))d("doughnut");else if(C.toLowerCase().includes("radar"))d("radar");else return d("bar"),!1;return!0}S.useEffect(()=>{j&&N(C=>[...C,{role:"ai",content:j.response}])},[j]),S.useEffect(()=>{const C=setTimeout(()=>{var A;c.current&&(c.current.scroll({top:c.current.scrollHeight,behavior:"smooth"}),(A=i.current)==null||A.focus())},100);return()=>clearTimeout(C)},[p]);function F(){t&&(N(C=>[...C,{role:"user",content:t}]),O(t)&&u(!0),n(""),z())}S.useEffect(()=>{o&&(F(),a(!1))},[o,a]);const V={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,width:"100%"},P={fontFamily:"monospace",fontSize:14,lineHeight:1.6},_={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,padding:"2px 0",marginLeft:20,listStyleType:"disc"},K={p:({node:C,...A})=>e.jsxRuntimeExports.jsx("p",{style:V,...A}),code:({node:C,...A})=>e.jsxRuntimeExports.jsx("code",{className:"rounded-sm bg-muted px-2 py-1 text-sm",...A}),pre:({node:C,...A})=>e.jsxRuntimeExports.jsxs("pre",{className:"space-y-2 rounded-sm bg-muted/50 p-3",style:P,children:[e.jsxRuntimeExports.jsx("code",{className:"whitespace-normal text-sm",children:A.children}),e.jsxRuntimeExports.jsxs("div",{className:"flex justify-start gap-2",children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:q,size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(e.ClipboardCopyIcon,{})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:H=>{const k=q(H);k&&(r(!1),R(k),x(!0))},size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(e.PlayIcon,{})})]})]}),li:({node:C,...A})=>e.jsxRuntimeExports.jsx("li",{style:_,...A})};function q(C){const A=C.currentTarget.closest("pre");if(!A)return;const H=A.textContent||A.innerText;return navigator.clipboard.writeText(H).then(()=>console.log("Text copied to clipboard")).catch(k=>console.error("Error in copying text: ",k)),H}function W(){return p==null?void 0:p.map((C,A)=>C.role==="user"?e.jsxRuntimeExports.jsxs("div",{className:"flex items-start rounded-md bg-muted p-3 text-sm",children:[e.jsxRuntimeExports.jsx(Es,{className:"mr-2 h-5 w-5"}),e.jsxRuntimeExports.jsx("div",{children:C.content})]},A):C.role==="ai"?e.jsxRuntimeExports.jsx(e.Markdown,{className:"w-full overflow-auto py-1",components:K,children:j==null?void 0:j.response.replace(/DuckDB/gi,"Semaphor")},A):e.jsxRuntimeExports.jsx("div",{},A))}return e.jsxRuntimeExports.jsxs(e.Dialog,{open:s,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(e.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.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..."})}),e.jsxRuntimeExports.jsxs(e.DialogContent,{className:"flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]",children:[e.jsxRuntimeExports.jsxs(e.DialogHeader,{children:[e.jsxRuntimeExports.jsx(e.DialogTitle,{children:"Assistant"}),e.jsxRuntimeExports.jsx(e.DialogDescription,{children:"What can I help you with?"})]}),e.jsxRuntimeExports.jsx("div",{ref:c,className:"h-[625px] w-full overflow-auto border-t border-t-muted",children:e.jsxRuntimeExports.jsx("div",{className:"space-y-4 py-2 pr-3",role:"messages",children:W()})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center rounded-md border",children:[e.jsxRuntimeExports.jsx(e.Textarea,{autoFocus:!0,ref:i,onKeyDown:C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),n(""),F())},placeholder:"Type your question here...",onFocus:C=>{const A=C.target,H=A.value.length;A.setSelectionRange(H,H)},className:e.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:v||b,value:t,onChange:C=>n(C.target.value)})," ",e.jsxRuntimeExports.jsx(e.Button,{className:"h-8",size:"sm",variant:"ghost",onClick:F,children:!v&&!b?e.jsxRuntimeExports.jsx(e.PaperPlaneIcon,{}):e.jsxRuntimeExports.jsx(le,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"})})]})})]})]})}var bs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},He=S.createContext&&S.createContext(bs),st=["attr","size","title"];function tt(s,r){if(s==null)return{};var t=nt(s,r),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);for(o=0;o<a.length;o++)n=a[o],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(s,n)&&(t[n]=s[n])}return t}function nt(s,r){if(s==null)return{};var t={},n=Object.keys(s),o,a;for(a=0;a<n.length;a++)o=n[a],!(r.indexOf(o)>=0)&&(t[o]=s[o]);return t}function ge(){return ge=Object.assign?Object.assign.bind():function(s){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},ge.apply(this,arguments)}function Pe(s,r){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(s);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable})),t.push.apply(t,n)}return t}function Re(s){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Pe(Object(t),!0).forEach(function(n){rt(s,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):Pe(Object(t)).forEach(function(n){Object.defineProperty(s,n,Object.getOwnPropertyDescriptor(t,n))})}return s}function rt(s,r,t){return r=ot(r),r in s?Object.defineProperty(s,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[r]=t,s}function ot(s){var r=it(s,"string");return typeof r=="symbol"?r:String(r)}function it(s,r){if(typeof s!="object"||s===null)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,r||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(s)}function ys(s){return s&&s.map((r,t)=>S.createElement(r.tag,Re({key:t},r.attr),ys(r.child)))}function Z(s){return r=>S.createElement(at,ge({attr:Re({},s.attr)},r),ys(s.child))}function at(s){var r=t=>{var{attr:n,size:o,title:a}=s,i=tt(s,st),c=o||t.size||"1em",l;return t.className&&(l=t.className),s.className&&(l=(l?l+" ":"")+s.className),S.createElement("svg",ge({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,i,{className:l,style:Re(Re({color:s.color||t.color},t.style),s.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),a&&S.createElement("title",null,a),s.children)};return He!==void 0?S.createElement(He.Consumer,null,t=>r(t)):r(bs)}function lt(s){return Z({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:[]}]})(s)}function ct(){const{theme:s}=e.useTheme(),r=S.useRef(),t=S.useRef(),[n,o]=S.useState(!1),[a,i]=S.useState(!1),[c,l]=S.useState(!1),[m,u]=S.useState(""),[R,h]=S.useState(!1),{authToken:x}=e.useSemaphorContext();e.useDashboardStore(f=>f.selectedSheetId);const d=e.useDashboardStore(f=>f.dashboard.baseQueries),p=e.useEditorStore(f=>f.card),N=e.useDashboardStore(f=>f.theme),I=e.useEditorStore(f=>f.isShowingVisual);e.useDashboardStore(f=>f.onAcceptChanges);const L=e.useEditorStore(f=>f.selectedConnectionId),E=e.useEditorStore(f=>f.selectedDatabaseName),D=e.useEditorStore(f=>f.selectedDatamodelId),T=e.useEditorStore(f=>f.selectedSchemaName);e.useDashboardStore(f=>f.actions.updateFrameCard);const j=e.useEditorStore(f=>f.selectedTableName),v=e.useEditorStore(f=>f.card.sql),b=e.useEditorStore(f=>f.card.python),g=e.resolveBaseQuery(v,d),z=e.useEditorStore(f=>f.selectedConnectionId),O=e.useEditorStore(f=>f.frame),F=e.useDashboardStore(f=>f.filterValues),V=e.useEditorStore(f=>f.applyFilters),{setCardCustomCfg:P,setQueryResultColumns:_,setFilterValues:K,setCardSql:q,setCardPython:W,setQueryError:C,setPythonStdOut:A,setCardPreferences:H}=e.useEditorStore(f=>f.actions),k=e.useEditorStore(f=>f.onSave),w=e.useEditorStore(f=>f.actions.setApplyFilters),$=e.useEditorStore(f=>f.onClose),M=e.useEditorStore(f=>f.actions.setCardData),G=e.useEditorStore(f=>f.actions.setSqlGen),Q=e.useEditorStore(f=>f.runSql),te=e.useEditorStore(f=>f.actions.setRunSql),ee=e.useEditorStore(f=>f.actions.setIsSqlRunning),{data:B,isLoading:J,isFetching:Y,isSuccess:ne,isError:X,error:se,status:qe,refetch:ie}=e.useQuery({queryKey:[g,b],queryFn:()=>e.postRequest("https://semaphor.cloud/api/v1/query",(x==null?void 0:x.accessToken)||"",{connection_id:z,sql:g,python:b===e.PYTHON_DEFAULT_CODE?"":b,active_filters:V?F:[]}),enabled:!1,retry:!1});S.useEffect(()=>{if(B&&(M(B.records),B.rowLimitExceeded&&e.Jt.error("Row limit (10,000) exceeded. Refine your query.",{position:"top-center",richColors:!0}),A((B==null?void 0:B.output)||""),B.records.length>0)){const{dimensionKeys:f}=e.getKeys(B.records);_(f)}},[B,M,_,A]),S.useEffect(()=>{Q&&(ie(),te(!1))},[Q,ie,te]),S.useEffect(()=>{(J||Y)&&ee(!0),(X||ne)&&ee(!1),X?(C(se.message),M([]),_([]),A("")):C("")},[J,Y,B,A,X,ne,ee,M,_,C,se]);function Ce(){q(""),M([]),G({}),P(""),H({})}const me=f=>{t.current=f};function Ne(f,y){if(f.length===0)return"";if(y){const re=f.find(U=>U.id===y);if(re){const U=re.tabTitle;if(U=="All__Header")return f[0].id;if(U&&U.endsWith("__Header")){const Os=U.split("__")[0],_e=f.find(Vs=>Vs.tabTitle===Os);return _e?_e.id:f[0].id}return y}}return f[0].id}function we(){let f=v;v&&!v.includes("{{")&&(f=Ks(v),q(f));const y={...p,lastSelectedSchema:T,lastSelectedDatamodelId:D,lastSelectedDatabase:E,lastSelectedTable:j,connectionId:L,type:I?p.type:"table",sql:f,customCfg:I?p.customCfg:null},re=O.cards.map(ke=>ke.id===p.id?y:ke),U={...O,cards:re,activeCardId:Ne(re,O.activeCardId)};k==null||k(U)}function pe(){$==null||$()}S.useEffect(()=>{const f=r.current,y=t.current;if(f){const re=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",U=N==="system"?re:N;f.editor.defineTheme("default",{base:U==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":U==="light"?"#ffffff":e.getCssVariableValue("--semaphor-background")}}),f.editor.setTheme("default")}return y&&f&&y.addCommand(f.KeyMod.Shift|f.KeyCode.Enter,function(){return console.log("Executing query..."),ie(),!1}),()=>{}},[s,N,r.current]);function ue(f){r.current=f}function je(){return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a&&e.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:e.jsxRuntimeExports.jsxs("div",{className:"w-[99%]",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[e.jsxRuntimeExports.jsx(Js,{checked:V,onCheckedChange:()=>w(!V),text:"Apply Filters"}),e.jsxRuntimeExports.jsx(Xs,{}),F&&a&&e.jsxRuntimeExports.jsx(e.Cross2Icon,{onClick:()=>i(!1),className:"bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"})]}),e.jsxRuntimeExports.jsx(e.Ft,{theme:"default",onChange:f=>{if(f)try{JSON.parse(f),K(JSON.parse(f))}catch{}},defaultLanguage:"json",className:"mt-1 min-h-[220px]",value:JSON.stringify(F,null,2),options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}),F&&!a&&e.jsxRuntimeExports.jsx(e.Filter,{onClick:()=>i(!0),className:e.cn("absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",{"font-bold text-red-800":V})})]})}function he(){return e.jsxRuntimeExports.jsxs(e.ResizablePanelGroup,{className:"flex grow pb-1",direction:"vertical",role:"editor-resizable-group",children:[e.jsxRuntimeExports.jsxs(e.ResizablePanel,{id:"1",order:1,defaultSize:n?20:100,className:"relative flex grow",children:[e.jsxRuntimeExports.jsx("div",{role:"sql-container",className:"relative flex w-[99%]",children:e.jsxRuntimeExports.jsx(e.Ft,{theme:"default",className:"pt-3",onChange:f=>{q(f)},value:v,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"sql",beforeMount:ue,onMount:me})}),n&&e.jsxRuntimeExports.jsx("code",{className:"absolute right-6 top-3 text-sm text-muted-foreground/70",children:"sql"})]}),n&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.ResizableHandle,{withHandle:!0,className:"border"}),e.jsxRuntimeExports.jsxs(e.ResizablePanel,{id:"2",order:2,defaultSize:80,className:"relative flex grow",children:[e.jsxRuntimeExports.jsx("div",{role:"python-container",className:"relative flex w-[99%] pt-0",children:e.jsxRuntimeExports.jsx(e.Ft,{className:"pt-3",theme:"default",onChange:f=>{W(f&&f.trim()||"")},value:b||e.PYTHON_DEFAULT_CODE,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"python",beforeMount:ue,onMount:me})}),e.jsxRuntimeExports.jsx("code",{className:"absolute right-6 top-3 text-sm text-muted-foreground/70",children:"python"})]})]})]})}return e.jsxRuntimeExports.jsxs("section",{role:"editor-section",className:"flex grow flex-col justify-end",children:[e.jsxRuntimeExports.jsxs("div",{role:"sql-editor",className:"relative flex grow justify-between overflow-y-scroll",children:[he(),je()]}),e.jsxRuntimeExports.jsxs("div",{role:"editor-controls",className:"item-center flex flex-wrap justify-between gap-2 px-6 py-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex grow items-center gap-2",children:[e.jsxRuntimeExports.jsxs(e.Button,{title:"Shift + Enter",disabled:J||Y,onClick:()=>{ie()},className:"shrink-0",size:"sm",variant:"outline",children:[J||Y?e.jsxRuntimeExports.jsx(le,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):e.jsxRuntimeExports.jsx(cs,{className:"mr-2 h-4 w-4"}),"Run"]}),X&&e.jsxRuntimeExports.jsx(Ws,{error:se.message,setShowAIDialog:l,setTriggerAIRun:h,setUserInputforAI:u}),e.jsxRuntimeExports.jsxs(e.Button,{onClick:Ce,className:"",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(Ye,{className:"mr-2 size-4"}),"Clear"]}),e.jsxRuntimeExports.jsx(e.Toggle,{pressed:n,onPressedChange:f=>o(f),className:"",size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(lt,{className:"size-4 text-foreground/70"})}),e.jsxRuntimeExports.jsx(et,{open:c,setOpen:l,userInput:m,triggerAIRun:R,setTriggerAIRun:h,setUserInput:f=>u(f)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxRuntimeExports.jsxs(e.Button,{onClick:we,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(e.Check,{className:"mr-2 size-4 font-bold text-green-600"}),"Accept"]}),e.jsxRuntimeExports.jsxs(e.Button,{onClick:pe,className:"w-full",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(e.Cross2Icon,{className:"mr-2 size-4"}),"Close"]})]})]})]})}function xt({data:s}){var i;const[r,t]=S.useState([]),o=Object.keys(s[0]).map(c=>({accessorKey:c,header:({column:l})=>{const m=l.getIsSorted();return e.jsxRuntimeExports.jsx("div",{className:"flex gap-2",children:e.jsxRuntimeExports.jsxs("div",{className:"flex cursor-pointer items-center",onClick:()=>l.toggleSorting(l.getIsSorted()==="asc"),children:[c,m==="asc"?e.jsxRuntimeExports.jsx(e.TriangleUpIcon,{className:"ml-2 h-5 w-5"}):m==="desc"?e.jsxRuntimeExports.jsx(e.TriangleDownIcon,{className:"ml-2 h-5 w-5"}):null]})})}})),a=e.useReactTable({data:s,columns:o,getCoreRowModel:e.getCoreRowModel(),getPaginationRowModel:e.getPaginationRowModel(),onSortingChange:t,getSortedRowModel:e.getSortedRowModel(),manualPagination:!0,state:{sorting:r}});return e.jsxRuntimeExports.jsxs(e.Table$1,{children:[e.jsxRuntimeExports.jsx(e.TableHeader,{children:a.getHeaderGroups().map(c=>e.jsxRuntimeExports.jsx(e.TableRow,{children:c.headers.map(l=>e.jsxRuntimeExports.jsx(e.TableHead,{className:"sticky top-0 bg-muted",children:l.isPlaceholder?null:e.flexRender(l.column.columnDef.header,l.getContext())},l.id))},c.id))}),e.jsxRuntimeExports.jsx(e.TableBody,{children:(i=a.getRowModel().rows)!=null&&i.length?a.getRowModel().rows.map(c=>e.jsxRuntimeExports.jsx(e.TableRow,{className:"whitespace-nowrap py-2","data-state":c.getIsSelected()&&"selected",children:c.getVisibleCells().map(l=>e.jsxRuntimeExports.jsx(e.TableCell,{children:e.flexRender(l.column.columnDef.cell,l.getContext())},l.id))},c.id)):e.jsxRuntimeExports.jsx(e.TableRow,{children:e.jsxRuntimeExports.jsx(e.TableCell,{colSpan:o.length,className:"h-24 text-center",children:"No results."})})})]})}function ut({card:s}){var m,u,R,h,x,d,p,N,I,L;const r=e.useDashboardStore(E=>E.themeStyle),t={colors:((u=(m=r==null?void 0:r.chart)==null?void 0:m.dataset)==null?void 0:u.backgroundColor)||[]};(R=s.customCardPreferences)!=null&&R.inputData;const{getCard:n}=e.useCustomVisual(((h=s.customCardPreferences)==null?void 0:h.url)||""),o=((x=s.customCardPreferences)==null?void 0:x.visualType)||"single",a=e.useEditorStore(E=>E.frame);if(e.useEditorActions(),!((d=s.customCardPreferences)!=null&&d.componentName))return null;const i=n((p=s.customCardPreferences)==null?void 0:p.componentName),c=E=>{console.log("data",E),s.customCardPreferences},l=Object.keys(((N=s.customCardPreferences)==null?void 0:N.dataInputCardIds)||{}).map(E=>{var j,v,b;const D=(v=(j=s.customCardPreferences)==null?void 0:j.dataInputCardIds)==null?void 0:v[E].cardId,T=(b=a==null?void 0:a.cards)==null?void 0:b.find(g=>g.id===D);return T||null});return e.jsxRuntimeExports.jsx("div",{className:"semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsxs(S.Suspense,{fallback:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),children:[i&&o==="single"&&e.jsxRuntimeExports.jsx(i,{theme:t,settings:(I=s.customCardPreferences)==null?void 0:I.settings,onDataChange:c,data:s.data}),i&&o==="multiple"&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2",children:e.jsxRuntimeExports.jsx(i,{theme:t,onDataChange:c,settings:l.map(E=>{var D;return(D=E==null?void 0:E.customCardPreferences)==null?void 0:D.settings}),data:l.map(E=>(E==null?void 0:E.data)||[])})})]},(L=s.customCardPreferences)==null?void 0:L.componentName)})}function Ss({className:s,...r}){var h,x;S.useState(0);const t=e.useDashboardStore(d=>d.themeStyle),n=e.useEditorStore(d=>d.card),o=((h=n.customCardPreferences)==null?void 0:h.showCardHeader)??!0,a=e.useEditorStore(d=>d.frame),i=e.useDashboardStore(d=>d.dashboard.filters);e.useDashboardStore(d=>d.filterValues),e.useEditorStore(d=>d.actions.setRunSql);const{updateFilter:c}=e.useDashboardActions(),l=i==null?void 0:i.find(d=>d.id===a.filterId),m=e.useEditorStore(d=>d.actions.setCard);if(S.useEffect(()=>{},[n.data,n.type,n.cfg,n.customCfg,t,n.preferences]),!n.id)return null;let u;n.data&&n.data.length>0&&(u=e.createChartConfig({data:n.data,cardType:n.type,cfg:n.cfg,customCfg:n.customCfg,preferences:n.preferences}));function R(d){return e.jsxRuntimeExports.jsx(ut,{card:d})}return e.jsxRuntimeExports.jsxs(e.Card,{role:"editor-visual-card",className:e.cn("relative flex h-full flex-col rounded-none",s),...r,children:[o&&e.jsxRuntimeExports.jsxs(e.CardHeader,{className:"flex flex-row items-start justify-between py-4",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Editable,{text:n.title,onSave:d=>m({...n,title:d}),children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-5",children:e.jsxRuntimeExports.jsx(e.CardTitle,{className:"text-base",children:n.title})})},n.title),e.jsxRuntimeExports.jsx(e.Editable,{text:n.description||"",onSave:d=>m({...n,description:d}),children:e.jsxRuntimeExports.jsxs(e.CardDescription,{children:[" ",n.description]})},n.description)]}),l&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxRuntimeExports.jsx(e.Editable,{className:"my-1",text:l.title||l.column,onSave:d=>c({...l,title:d}),children:e.jsxRuntimeExports.jsx(e.Label,{children:l.title})}),e.getFilterComponent(l)]})]}),e.jsxRuntimeExports.jsxs(e.CardContent,{className:"flex grow flex-col",children:[n.type==="custom"&&R(n),!["table","custom"].includes(n.type)&&u&&e.jsxRuntimeExports.jsx(e.ChartJsVisual,{cfg:u},JSON.stringify(u)+JSON.stringify(n.preferences)+((x=n==null?void 0:n.preferences)==null?void 0:x.customVisualCode)),n.type==="table"&&n.data&&n.data.length>0&&e.jsxRuntimeExports.jsx(e.$57acba87d6e25586$export$ccf8d8d7bbf3c2cc,{className:"flex min-h-0 flex-1 grow basis-0",children:e.jsxRuntimeExports.jsx(e.TableVisual,{card:n,data:n==null?void 0:n.data})})]})]})}function dt(){const[s,r]=S.useState(!1),[t,n]=S.useState(""),[o,a]=S.useState(""),[i,c]=S.useState(""),[l,m]=S.useState(""),u=e.useEditorStore(E=>E.card),R=e.useEditorStore(E=>E.card.customCfg),{setCardCustomCfg:h,setCustomVisualCode:x}=e.useEditorActions();function d(E){var j,v;const D={...E,data:{...E==null?void 0:E.data,datasets:(v=(j=E==null?void 0:E.data)==null?void 0:j.datasets)==null?void 0:v.map(b=>({...b,data:[]}))}};return JSON.stringify(D,null,1)}function p(){var D,T;if(!u.data||u.data.length===0)return;const E=e.createChartConfig({data:u.data,cardType:u.type,cfg:u.cfg,preferences:u.preferences});E&&(n(JSON.stringify(E,null,1)),(D=u==null?void 0:u.preferences)!=null&&D.customVisualCode&&c((T=u==null?void 0:u.preferences)==null?void 0:T.customVisualCode),R&&a(JSON.stringify(R,null,1)))}function N(){if(i&&x(i),!!o)try{const E=JSON.parse(o);return E?(h(E),m(""),a(""),E):void 0}catch(E){console.log(E),m("Invalid JSON")}}function I(){a(""),h(null)}function L(){let E;if(R){const D=e._.cloneDeep(u.cfg),T=e._.merge(D,R);return E=d(T),E}return t?(E=d(JSON.parse(t)),E):""}return e.jsxRuntimeExports.jsxs(e.Dialog,{open:s,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(e.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{onClick:p,className:` ${R&&"border-foreground/50 dark:border-foreground/70"}`,size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(e.Settings,{className:"h-4 w-4"})})}),e.jsxRuntimeExports.jsxs(e.DialogContent,{className:"max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]",children:[e.jsxRuntimeExports.jsxs(e.DialogHeader,{className:"",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.DialogTitle,{children:"Customize Card"}),e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(ze,{onClick:()=>{navigator.clipboard.writeText(u.id)},className:"size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsxRuntimeExports.jsx(e.TooltipContent,{side:"right",align:"center",children:e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:"Copy Card ID"})})]})]}),e.jsxRuntimeExports.jsxs(e.DialogDescription,{children:["See the configuration options and documentation",e.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."})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex grow gap-2",children:[e.jsxRuntimeExports.jsx(Ss,{className:"w-1/2 rounded shadow-none"}),e.jsxRuntimeExports.jsxs(e.Tabs,{defaultValue:"custom-config",className:"flex w-1/2 flex-col",children:[e.jsxRuntimeExports.jsxs(e.TabsList,{className:"justify-start rounded-sm rounded-b-none border border-b-0",children:[e.jsxRuntimeExports.jsxs(e.TabsTrigger,{value:"custom-config",children:[R&&e.jsxRuntimeExports.jsx(e.CheckIcon,{className:"mr-1 h-5 w-5 text-green-600"}),R?"Custom Config":"Default Config"]}),e.jsxRuntimeExports.jsx(e.TabsTrigger,{className:"",value:"output",children:"Output"}),e.jsxRuntimeExports.jsx(e.TabsTrigger,{className:"",value:"custom-code",children:"Custom Code"})]}),e.jsxRuntimeExports.jsx(e.TabsContent,{className:"bg-red-x mt-0 grow rounded-b border border-t-0 p-2",value:"output",children:e.jsxRuntimeExports.jsx(e.Textarea,{disabled:!0,value:t,className:"h-full resize-none border-none font-mono focus-visible:ring-0 focus-visible:ring-offset-0"})}),e.jsxRuntimeExports.jsx(e.TabsContent,{className:"mt-0 grow rounded-b border border-t-0",value:"custom-config",children:e.jsxRuntimeExports.jsx(e.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:L(),onChange:E=>a(E)})}),e.jsxRuntimeExports.jsx(e.TabsContent,{className:"mt-0 grow rounded-b border border-t-0",value:"custom-code",children:e.jsxRuntimeExports.jsx(e.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:"javascript",value:i,onChange:E=>c(E||"")})})]})]}),e.jsxRuntimeExports.jsxs(e.DialogFooter,{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"mr-2 text-red-500",children:l}),e.jsxRuntimeExports.jsx(e.Button,{disabled:!R,onClick:I,variant:"outline",children:"Reset"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:N,variant:"outline",children:"Apply"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>r(!1),variant:"outline",children:"Close"})]})]})]})}function vs(s){return Z({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:[]}]})(s)}function Cs(s){return Z({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:[]}]})(s)}function Ns(s){return Z({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:[]}]})(s)}function ws(s){return Z({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:[]}]})(s)}function ks(s){return Z({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m2 19.99 7.5-7.51 4 4 7.09-7.97L22 9.92l-8.5 9.56-4-4-6 6.01-1.5-1.5zm1.5-4.5 6-6.01 4 4L22 3.92l-1.41-1.41-7.09 7.97-4-4L2 13.99l1.5 1.5z"},child:[]}]})(s)}function Is(s){return Z({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:[]}]})(s)}function Ds(s){return Z({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:[]}]})(s)}function Ls(s){return Z({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M217 25v14h78V25h-78zm0 32v46h14V71h50v32h14V57h-78zm32 32v14h14V89h-14zm-64 32v46h30v-46h-30zm48 0v14h46v-14h-46zm64 0v46h30v-46h-30zm-64 32v14h46v-14h-46zm-80 32v46h62v-46h-62zm80 0v14h46v-14h-46zm64 0v46h62v-46h-62zm-64 32v14h46v-14h-46zm-112 32v46h94v-46h-94zm112 0v14h46v-14h-46zm64 0v46h94v-46h-94zm-64 32v14h46v-14h-46zM89 313v46h126v-46H89zm144 0v14h46v-14h-46zm64 0v46h126v-46H297zm-64 32v14h46v-14h-46zM57 377v46h158v-46H57zm176 0v14h46v-14h-46zm64 0v46h158v-46H297zm-64 32v14h46v-14h-46zM25 441v46h190v-46H25zm208 0v14h46v-14h-46zm64 0v46h190v-46H297zm-64 32v14h46v-14h-46z"},child:[]}]})(s)}function Ts(s){const[r,t]=S.useState(null);return S.useEffect(()=>{s&&(async()=>{const a=(await Promise.resolve().then(()=>require("./lucide-react-JbmNElkb.js")))[s];t(a)})()},[s]),r}function As(){const{authToken:s}=e.useSemaphorContext(),{data:r,isLoading:t,isFetching:n,isError:o}=e.useQuery({queryKey:["plugins",s==null?void 0:s.accessToken],queryFn:()=>e.getPlugins(s==null?void 0:s.accessToken)});return{data:r,isLoading:t,isFetching:n,isError:o}}function mt({onChartTypeChange:s}){const[r,t]=S.useState([]),{data:n}=As();return S.useEffect(()=>{(async()=>{var a;if(n){const c=(await Promise.all((a=n==null?void 0:n.plugins)==null?void 0:a.map(async l=>(await e.loadManifest(l.value)).visuals.map(R=>({name:R.name,icon:R.icon,url:l.value}))))).flat();t(c)}})()},[n]),r.length===0?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Separator,{className:"my-2"}),e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 place-items-center",children:r.map((o,a)=>e.jsxRuntimeExports.jsx(pt,{text:o.name,onClick:()=>s("custom",o),icon:o.icon},o.url+o.name+a))})]})}const pt=({text:s,icon:r,onClick:t})=>{const n=Ts(r||""),o=s.charAt(0).toUpperCase();return e.jsxRuntimeExports.jsx(e.Button,{onClick:t,title:s,variant:"ghost",children:n?e.jsxRuntimeExports.jsx(n,{className:"h-4 w-4"}):o})};function jt(){var u,R;const[s,r]=S.useState(!1),t=e.useEditorStore(h=>h.card),n=t.type,{setCardType:o,setCardPreferences:a,setChartOrientation:i}=e.useEditorStore(h=>h.actions),{setCardCustomCfg:c,setCustomCardPreferences:l}=e.useEditorActions();function m(h,x){c(null),a({}),o(h),x&&l({type:"component",visualType:"single",url:x.url,componentName:x.name,icon:x.icon}),r(!1)}return e.jsxRuntimeExports.jsxs(e.Popover,{open:s,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(e.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(ht,{className:"h-4 w-4",chartType:n,customIcon:(u=t.customCardPreferences)==null?void 0:u.icon,componentName:(R=t.customCardPreferences)==null?void 0:R.componentName})})}),e.jsxRuntimeExports.jsxs(e.PopoverContent,{className:"w-50",children:[e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-4 place-items-center",children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("bar"),className:"font-normal",variant:"ghost",children:e.jsxRuntimeExports.jsx(be,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("line"),variant:"ghost",children:e.jsxRuntimeExports.jsx(ye,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("stackedBar"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Is,{className:"size-5",strokeWidth:0})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("stackedLine"),variant:"ghost",children:e.jsxRuntimeExports.jsx(ks,{className:"size-5",strokeWidth:0})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("scatter"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Te,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("bubble"),variant:"ghost",children:e.jsxRuntimeExports.jsx(ws,{className:"size-4"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("pie"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Le,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("doughnut"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Cs,{className:"size-5",strokeWidth:1})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("radar"),variant:"ghost",children:e.jsxRuntimeExports.jsx(vs,{className:"size-5 font-extralight",strokeWidth:.5})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("polarArea"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Ns,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("pyramid"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Ls,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("range"),variant:"ghost",children:e.jsxRuntimeExports.jsx(De,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("table"),variant:"ghost",children:e.jsxRuntimeExports.jsx(e.Table,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("kpi"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Ds,{className:"size-6"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("text"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Se,{className:"size-4"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>m("custom"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Me,{className:"size-4"})})]}),e.jsxRuntimeExports.jsx(mt,{onChartTypeChange:m})]})]})}function ht({chartType:s,className:r,customIcon:t,componentName:n}){const o=Ts(t||"");switch(s){case"bar":return e.jsxRuntimeExports.jsx(be,{className:r});case"line":return e.jsxRuntimeExports.jsx(ye,{className:r});case"pie":return e.jsxRuntimeExports.jsx(Le,{className:r});case"radar":return e.jsxRuntimeExports.jsx(vs,{className:r});case"scatter":return e.jsxRuntimeExports.jsx(Te,{className:r});case"bubble":return e.jsxRuntimeExports.jsx(ws,{className:r});case"doughnut":return e.jsxRuntimeExports.jsx(Cs,{className:r});case"stackedBar":return e.jsxRuntimeExports.jsx(Is,{className:"size-4 text-foreground/70"});case"stackedLine":return e.jsxRuntimeExports.jsx(ks,{className:"size-4 text-foreground/70"});case"polarArea":return e.jsxRuntimeExports.jsx(Ns,{className:r});case"pyramid":return e.jsxRuntimeExports.jsx(Ls,{className:r});case"range":return e.jsxRuntimeExports.jsx(De,{className:r});case"kpi":return e.jsxRuntimeExports.jsx(Ds,{className:r});case"text":return e.jsxRuntimeExports.jsx(Se,{className:r});case"custom":return t&&o?e.jsxRuntimeExports.jsx(o,{className:r}):n?n==null?void 0:n.charAt(0).toUpperCase():e.jsxRuntimeExports.jsx(Me,{className:r});default:return e.jsxRuntimeExports.jsx(e.Table,{className:r})}}function Et(){var o;const s=e.useEditorStore(a=>a.card),r=((o=s.customCardPreferences)==null?void 0:o.showCardHeader)??!0,{setCustomCardPreferences:t}=e.useEditorActions(),n=a=>{s.customCardPreferences&&t({...s.customCardPreferences,showCardHeader:a===!0})};return e.jsxRuntimeExports.jsxs(e.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(e.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(Ae,{className:"size-4 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsxRuntimeExports.jsxs(e.DropdownMenuContent,{align:"start",className:"w-40 text-muted-foreground",children:[e.jsxRuntimeExports.jsx(e.DropdownMenuCheckboxItem,{checked:r,onCheckedChange:n,children:"Card Header"}),e.jsxRuntimeExports.jsxs(e.DropdownMenuItem,{onClick:()=>{navigator.clipboard.writeText(s.id),e.Jt.success("Card ID copied to clipboard")},className:"cursor-pointer space-x-2",children:[e.jsxRuntimeExports.jsx(ze,{className:"size-4"}),e.jsxRuntimeExports.jsx("span",{children:"Copy Card ID"})]})]})]})}function $e(){const s=e.useEditorStore(j=>j.frame),r=e.useEditorStore(j=>j.card),t=e.useEditorStore(j=>j.card.data),n=e.useEditorStore(j=>j.isShowingVisual),o=e.useEditorStore(j=>j.isSqlRunning),a=e.useEditorStore(j=>j.queryError),i=e.useEditorStore(j=>j.pythonStdOut),c=e.useEditorStore(j=>j.actions.setRunSql);e.useEditorStore(j=>j.onSave),e.useEditorStore(j=>j.onClose),e.useEditorStore(j=>j.actions.setCardSql),e.useEditorStore(j=>j.actions.setCardType),e.useEditorStore(j=>j.actions.setSqlGen);const{setFrame:l,setCard:m,updateCardInFrame:u}=e.useEditorActions();if(!r)return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:"No Active Card"});function R(){const j={id:e.v4(),title:"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}]},type:"bar",sql:"",data:[]};h(j)}function h(j){const v={...s,cards:[...s.cards,j],activeCardId:j.id};l(v),m(j)}function x(){const j={...r,id:e.v4(),title:`${r.title} Copy`,tabTitle:`${r.tabTitle} Copy`};h(j)}function d(j){const v=s.cards.filter(z=>z.id!==j),b=v[0],g={...s,cards:v,activeCardId:b.id};l(g),m(b)}function p(j){const v={...s,cards:s.cards.map(g=>g.id===r.id?r:g),activeCardId:j};l(v);const b=v.cards.find(g=>g.id===j);m(b),b.sql&&b.data&&b.data.length===0&&c(!0)}const N=(j,v)=>{console.log("handleDragStart",v),j.dataTransfer.setData("tabIndex",v.toString())},I=j=>{j.preventDefault()},L=(j,v)=>{const b=j.dataTransfer.getData("tabIndex");if(b===v.toString())return;const g=Array.from(s.cards),[z]=g.splice(parseInt(b),1);g.splice(v,0,z),l({...s,cards:g})};function E(j,v){return j.cards.length===1&&(v.displayTab===!0||v.displayTab===void 0)||j.activeCardId!==v.id&&(v.displayTab===!0||v.displayTab===void 0)?null:e.jsxRuntimeExports.jsx("div",{onClick:()=>{const b=v.displayTab===void 0?!1:!v.displayTab;m({...v,displayTab:b}),u({...v,displayTab:b})},children:v.displayTab===!0||v.displayTab===void 0?e.jsxRuntimeExports.jsx(Ze,{className:"mr-2 size-3.5 text-muted-foreground hover:text-foreground"}):e.jsxRuntimeExports.jsx(Xe,{className:"mr-2 size-3.5 text-muted-foreground hover:text-foreground"})})}function D(){return e.jsxRuntimeExports.jsxs(e.Tabs,{onValueChange:p,value:s.activeCardId,className:"flex grow flex-col",children:[s.cards.map(j=>e.jsxRuntimeExports.jsx(e.TabsContent,{className:"mt-0 grow",value:j.id,children:T()},j.id)),e.jsxRuntimeExports.jsx(e.TabsList,{className:"group mx-6 justify-between",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.cards.map((j,v)=>e.jsxRuntimeExports.jsx(e.Editable,{text:j.tabTitle||j.title,onSave:b=>{m({...r,tabTitle:b}),u({...r,tabTitle:b})},children:e.jsxRuntimeExports.jsxs(e.TabsTrigger,{draggable:!0,onDragStart:b=>N(b,v),onDragOver:I,onDrop:b=>L(b,v),className:"",value:j.id,children:[E(s,j),j.tabTitle||j.title,s.activeCardId===j.id&&s.cards.length>1&&e.jsxRuntimeExports.jsx(e.X,{className:"ml-2 size-3.5 text-muted-foreground hover:text-foreground",onClick:()=>d(j.id)})]})},j.id)),e.jsxRuntimeExports.jsx(e.Button,{className:"ml-1 h-8 px-2 hover:bg-muted-foreground/50",variant:"outline",onClick:R,children:e.jsxRuntimeExports.jsx(e.Plus,{className:"h-4 w-4"})}),e.jsxRuntimeExports.jsx(e.Button,{className:"invisible ml-1 h-8 px-2 hover:bg-muted-foreground/50 group-hover:visible",variant:"outline",onClick:x,children:e.jsxRuntimeExports.jsx(We,{className:"h-4 w-4"})})]})})]})}function T(){return r.type==="kpi"?e.jsxRuntimeExports.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxRuntimeExports.jsx("div",{className:"w-1/2 rounded-md border",children:e.jsxRuntimeExports.jsx(e.KPICard,{isLoading:o,card:r})})}):r.type==="text"?e.jsxRuntimeExports.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxRuntimeExports.jsx("div",{className:"w-1/2 rounded-md border",children:e.jsxRuntimeExports.jsx(e.TextCard,{isLoading:o,card:r})})}):e.jsxRuntimeExports.jsx(Ss,{className:"grow border-none shadow-none"})}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col py-3",children:[o&&e.jsxRuntimeExports.jsx(le,{className:"absolute bottom-0 left-0 right-0 top-0 z-10 m-auto h-10 w-10 animate-spin text-foreground/10"}),e.jsxRuntimeExports.jsxs("div",{className:"mb-0 flex min-h-10 items-center justify-end gap-2 px-6",children:[n&&e.jsxRuntimeExports.jsxs("div",{className:"flex grow items-center gap-2",children:[e.jsxRuntimeExports.jsx(jt,{}),!["table","custom"].includes(r.type)&&e.jsxRuntimeExports.jsx(dt,{}),e.jsxRuntimeExports.jsx(Et,{})]}),e.jsxRuntimeExports.jsx(gt,{})]}),n?D():e.jsxRuntimeExports.jsxs("div",{className:"flex min-h-0 w-full flex-1 grow basis-0 px-6",children:[i&&e.jsxRuntimeExports.jsx(ft,{}),r.data&&r.data.length>0&&e.jsxRuntimeExports.jsx(xt,{data:t||[]}),a&&e.jsxRuntimeExports.jsx("span",{className:"font-mono text-sm",children:a})]})]})}function ft(){const s=e.useEditorStore(t=>t.pythonStdOut);if(!s)return null;const r=s.replace(/\n/g,"<br>");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("p",{className:"font-mono text-sm",children:"Output:"}),e.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:r},className:"bg-muted p-2 font-mono text-sm"}),e.jsxRuntimeExports.jsx(e.Separator,{className:"mb-2"})]})}function gt(){const s=e.useEditorStore(t=>t.isShowingVisual),r=e.useEditorStore(t=>t.actions.setIsShowingVisual);return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"visualize",children:"Chart"}),e.jsxRuntimeExports.jsx(e.Switch,{checked:s,onCheckedChange:()=>r(!s),id:"visualize",className:"data-[state=checked]:bg-foreground/50"})]})}function Rt({options:s,value:r,onValueChange:t}){return e.jsxRuntimeExports.jsx(e.RadioGroup,{value:r,onValueChange:t,className:"flex gap-4",defaultValue:s[0].value,children:s.map(n=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:n.value,id:n.value}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:n.value,children:n.label})]},n.value))})}function de({label:s,options:r,value:t,onValueChange:n,className:o}){return e.jsxRuntimeExports.jsxs(e.Select,{value:t,onValueChange:n,children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:e.cn("w-full focus:ring-0 focus:ring-offset-0",o),children:e.jsxRuntimeExports.jsx(e.SelectValue,{placeholder:s})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:s}),r.map(a=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:a.value,children:a.label},a.value))]})})]})}function bt(){var d;const s=e.useEditorStore(p=>p.card.customCardPreferences),{data:r}=As(),t=(r==null?void 0:r.plugins)||[];e.useEditorStore(p=>p.card);const n=e.useEditorStore(p=>p.frame),o=(s==null?void 0:s.visualType)||"single",{setCustomCardPreferences:a}=e.useEditorActions(),{components:i,manifest:c}=e.useCustomVisual((s==null?void 0:s.url)||""),l=(d=c==null?void 0:c.visuals)==null?void 0:d.find(p=>p.name===(s==null?void 0:s.componentName));function m(p,N){if(!s)return;const L={...(s==null?void 0:s.dataInputCardIds)||{},[p]:{cardId:N,hookRef:null}};a({...s,dataInputCardIds:L})}function u(p){var I,L;const N=(I=n==null?void 0:n.cards)==null?void 0:I.filter(E=>{var D;return((D=E==null?void 0:E.customCardPreferences)==null?void 0:D.visualType)!=="multiple"}).map(E=>({value:E.id,label:E.tabTitle||E.title}));return e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:(L=p==null?void 0:p.dataInputs)==null?void 0:L.map((E,D)=>{var T,j;return e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-10 gap-2",children:[e.jsxRuntimeExports.jsx("div",{className:"col-span-4 flex items-center",children:E}),e.jsxRuntimeExports.jsx(de,{className:"col-span-6 h-8 w-full justify-between",label:"",options:N||[],value:((j=(T=s==null?void 0:s.dataInputCardIds)==null?void 0:T[D])==null?void 0:j.cardId)||"",onValueChange:v=>m(D,v)})]},D+Math.random())})})}function R(p,N,I=[]){var L,E;return s?p==="input"?e.jsxRuntimeExports.jsx(e.Input,{className:`h-8 w-full ${e.removeRing}`,value:((L=s==null?void 0:s.settings)==null?void 0:L[N])||"",onChange:D=>{a({...s,settings:{...s==null?void 0:s.settings,[N]:D.target.value}})}},N):p==="select"?e.jsxRuntimeExports.jsx(de,{className:"h-8 w-full",label:"",options:I,value:((E=s==null?void 0:s.settings)==null?void 0:E[N])||"",onValueChange:D=>{a({...s,settings:{...s==null?void 0:s.settings,[N]:D}})}}):null:null}function h(p){const N=Object.entries((p==null?void 0:p.settings)||{});return e.jsxRuntimeExports.jsx("div",{className:"space-y-3",children:N.map(([I,L])=>e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsx(e.Label,{children:L.title}),R(L.ui,I,L.options)]},I))})}function x(p){s&&a({...s,visualType:p,componentName:""})}return e.jsxRuntimeExports.jsxs(e.Accordion,{className:"px-6",type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"plugin-settings",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Plugin"}),e.jsxRuntimeExports.jsx(e.AccordionContent,{children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(de,{className:"h-8 w-full",label:"",options:t,value:(s==null?void 0:s.url)||"",onValueChange:p=>a({...s||{url:"",componentName:""},url:p})})})}),((s==null?void 0:s.type)==="component"||(s==null?void 0:s.type)===void 0)&&e.jsxRuntimeExports.jsx(Rt,{options:[{value:"single",label:"Single Visual"},{value:"multiple",label:"Multi-Visual"}],value:o,onValueChange:x}),((s==null?void 0:s.type)==="component"||(s==null?void 0:s.type)===void 0)&&s&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Component"}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2 px-2",children:i&&e.jsxRuntimeExports.jsx(de,{className:"h-8 w-full",label:"",options:(i==null?void 0:i.filter(p=>p.type===o).map(p=>({value:p.name,label:p.name})))||[],value:s.componentName,onValueChange:p=>{console.log("changing value",p),a({...s,componentName:p})}})})]})})]})})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"component-settings",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Component Settings"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{children:[l&&l.dataInputs&&e.jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Input Mapping"}),e.jsxRuntimeExports.jsx("div",{className:"px-2",children:u(l)})]}),l&&l.settings&&e.jsxRuntimeExports.jsx("div",{className:"space-y-3",children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:h(l)})})]})]})]})}function ce(){const[s,r]=S.useState([]);e.useEditorStore(u=>u.card.cfg);const t=e.useEditorStore(u=>u.card.preferences),{setCardCfg:n,setFilterOnClickColumnIndex:o,setCardPreferences:a}=e.useEditorStore(u=>u.actions),i=e.useEditorStore(u=>u.queryResultColumns);e.useEditorStore(u=>{var R;return(R=u.card.preferences)==null?void 0:R.filterOnClickColumnIndex}),S.useEffect(()=>{i&&r(new Array(i.length).fill(!1))},[i]);function c(u,R){var h,x;R?t!=null&&t.onClickFilter&&((h=t==null?void 0:t.onClickFilter)==null?void 0:h.length)>0?a({...t,onClickFilter:[...t.onClickFilter,{columnIndex:u,expression:""}]}):a({...t,onClickFilter:[{columnIndex:u,expression:""}]}):(a({...t,onClickFilter:(x=t==null?void 0:t.onClickFilter)==null?void 0:x.filter(d=>d.columnIndex!==u)}),r(d=>{const p=[...d];return p[u]=!1,p}))}function l(u,R){var x;const h=(x=t==null?void 0:t.onClickFilter)==null?void 0:x.map(d=>d.columnIndex===u?{...d,expression:R.target.value}:d);a({...t,onClickFilter:h})}function m(u){var R,h,x,d;if(s!=null&&s[u]||(h=(R=t==null?void 0:t.onClickFilter)==null?void 0:R.find(p=>p.columnIndex===u))!=null&&h.expression)return e.jsxRuntimeExports.jsx(e.Input,{value:(d=(x=t==null?void 0:t.onClickFilter)==null?void 0:x.find(p=>p.columnIndex===u))==null?void 0:d.expression,onChange:p=>l(u,p),type:"text",className:"h-9 w-full font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"Expression"})}return e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"On Click"}),i==null?void 0:i.map((u,R)=>{var h,x;return e.jsxRuntimeExports.jsx("div",{className:"xbg-red-100 group flex items-center justify-between space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grow",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 py-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{checked:!!((h=t==null?void 0:t.onClickFilter)!=null&&h.find(d=>d.columnIndex===R)),onCheckedChange:d=>c(R,d)}),e.jsxRuntimeExports.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:u}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:((x=t==null?void 0:t.onClickFilter)==null?void 0:x.find(d=>d.columnIndex===R))&&e.jsxRuntimeExports.jsx(Fe,{onClick:()=>{r(d=>{const p=[...d];return p[R]=!d[R],p})},className:"invisible size-3 cursor-pointer text-gray-400 group-hover:visible"})})]}),m(R)]})},u)})]})}function ve(){var i,c,l;const s=e.useEditorStore(m=>m.card.preferences),r=e.useEditorStore(m=>m.card.cfg),{setCardCfg:t,setCardPreferences:n,setChartOrientation:o}=e.useEditorStore(m=>m.actions);(i=r==null?void 0:r.options)!=null&&i.indexAxis;function a(m){o(m)}return e.jsxRuntimeExports.jsxs(e.RadioGroup,{value:((c=s==null?void 0:s.chartOptions)==null?void 0:c.indexAxis)||((l=r==null?void 0:r.options)==null?void 0:l.indexAxis)||"x",onValueChange:a,className:"flex gap-3",defaultValue:"x",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"x",id:"r1"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Vertical"})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"y",id:"r2"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Horizontal"})]})]})}const Ee="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";function Ge(s,r){var n,o,a;const t=e.getNumberAxis(s,r);return((a=(o=(n=s==null?void 0:s.chartOptions)==null?void 0:n.scales)==null?void 0:o[t])==null?void 0:a.type)||"linear"}function zs(){var K,q,W,C,A,H;const[s,r]=S.useState(!1),t=e.useEditorStore(k=>{var w;return(w=k.card)==null?void 0:w.preferences}),n=e.useEditorStore(k=>{var w;return(w=k.card)==null?void 0:w.cfg}),o=e.getNumberAxis(t,n),[a,i]=S.useState(Ge(t)),[c,l]=S.useState(((W=(q=(K=t==null?void 0:t.chartOptions)==null?void 0:K.scales)==null?void 0:q[o])==null?void 0:W.min)||""),[m,u]=S.useState(((H=(A=(C=t==null?void 0:t.chartOptions)==null?void 0:C.scales)==null?void 0:A[o])==null?void 0:H.max)||""),[R,h]=S.useState(c||m?"custom":"auto"),[x,d]=S.useState(""),[p,N]=S.useState(0),[I,L]=S.useState(""),[E,D]=S.useState(""),[T,j]=S.useState(""),v=e.useEditorStore(k=>k.actions.setCardPreferences),{updateCardInFrame:b}=e.useEditorActions(),g=e.useEditorStore(k=>k.card),z=e.useEditorStore(k=>{var w;return(w=k.card)==null?void 0:w.type}),O=["pie","doughnut","polarArea"].includes(z);S.useEffect(()=>{var k,w,$,M,G,Q,te,ee,B,J,Y,ne,X,se;i(Ge(t)),l((($=(w=(k=t==null?void 0:t.chartOptions)==null?void 0:k.scales)==null?void 0:w[o])==null?void 0:$.min)===0?0:""),u(((Q=(G=(M=t==null?void 0:t.chartOptions)==null?void 0:M.scales)==null?void 0:G[o])==null?void 0:Q.max)||""),d(((J=(B=(ee=(te=t==null?void 0:t.chartOptions)==null?void 0:te.scales)==null?void 0:ee[o])==null?void 0:B.ticks)==null?void 0:J.stepSize)||""),N(((Y=t==null?void 0:t.numberAxisFormat)==null?void 0:Y.decimalPlaces)||0),L(((ne=t==null?void 0:t.numberAxisFormat)==null?void 0:ne.suffix)||""),D(((X=t==null?void 0:t.numberAxisFormat)==null?void 0:X.currency)||""),j(((se=t==null?void 0:t.numberAxisFormat)==null?void 0:se.locale)||"")},[s,t,o]);function F(k,w){return w===""||/^[0-9\b]+$/.test(w)?Number(w):Number(k)}function V(){const k=[...new Set(e.LOCALE_CURRENCY_PAIRS.map(w=>w.currency))];return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-6 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"col-span-2 hover:cursor-pointer hover:underline",htmlFor:"currency",children:e.jsxRuntimeExports.jsx("a",{target:"_blank",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat",children:"Currency"})}),e.jsxRuntimeExports.jsxs(e.Select,{value:E||"none",onValueChange:w=>D(w==="none"?"":w),children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Currency"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"none",children:"None"}),k.map(w=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:w,children:w},w))]})})]}),e.jsxRuntimeExports.jsxs(e.Select,{value:T,onValueChange:w=>j(w),children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Locale"}),e.LOCALE_CURRENCY_PAIRS.map(w=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:w.locale,children:w.locale},w.locale))]})})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-9 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"col-span-3",htmlFor:"format",children:"Decimals"}),e.jsxRuntimeExports.jsx(e.Input,{value:p,onChange:w=>N(Number(w.target.value)),id:"format",className:`col-span-6 h-8 w-full tracking-wide ${Ee}`})]})]})}function P(){return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"range",children:"Range"}),e.jsxRuntimeExports.jsx(e.Input,{id:"min",value:c,onChange:k=>l(w=>F(w,k.target.value)),className:`col-span-1 h-8 w-full ${Ee}`}),e.jsxRuntimeExports.jsx(e.Input,{value:m,onChange:k=>u(w=>F(w,k.target.value)),id:"max",className:`col-span-1 h-8 w-full ${Ee}`})]}),e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"step-size",children:"Step Size"}),e.jsxRuntimeExports.jsx(e.Input,{value:x,onChange:k=>d(w=>F(w,k.target.value)),id:"step-size",className:`col-span-1 h-8 w-full ${Ee}`})]})]})}function _(){var M;let k={};R==="custom"&&(k={min:c,max:m,ticks:{stepSize:x}});const w={...t||{},chartOptions:{...t==null?void 0:t.chartOptions,scales:{...(M=t==null?void 0:t.chartOptions)==null?void 0:M.scales,[o]:{type:a,...a==="linear"?k:{}}}},numberAxisFormat:{decimalPlaces:p,suffix:I,currency:E,locale:T}};console.log(w),v(w);const $={...g,preferences:w};b($)}return e.jsxRuntimeExports.jsxs(e.Popover,{onOpenChange:k=>r(k),children:[e.jsxRuntimeExports.jsx(e.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.SliderIcon,{className:"size-4 cursor-pointer text-muted-foreground hover:text-foreground"})}),e.jsxRuntimeExports.jsx(e.PopoverContent,{align:"center",className:"max-w-65",children:e.jsxRuntimeExports.jsxs("div",{className:"grid gap-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsx("h4",{className:"font-medium leading-none",children:"Scale Options"}),e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the scale for the number axis"})]}),e.jsxRuntimeExports.jsxs("div",{className:"grid gap-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"scale",children:"Type"}),e.jsxRuntimeExports.jsxs(e.Select,{disabled:O,value:a,onValueChange:k=>i(k),children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{id:"type",children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Option"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"linear",children:"Linear"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"logarithmic",children:"Logarithmic"})]})})]})]}),a=="linear"&&e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2 py-1",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"scale-option",children:"Setup"}),e.jsxRuntimeExports.jsxs(e.RadioGroup,{disabled:O,id:"scale-option",value:R,onValueChange:k=>h(k),className:"col-span-2 flex gap-3",defaultValue:"x",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"auto",id:"r1"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Auto"})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"custom",id:"r2"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Custom"})]})]})]}),R==="custom"&&a=="linear"&&P(),V(),e.jsxRuntimeExports.jsx(e.SelectSeparator,{}),e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3",children:e.jsxRuntimeExports.jsx(e.Button,{onClick:_,variant:"secondary",className:"col-span-1 col-start-3 h-8 w-full",children:"Apply"})})]})]})})]})}function yt({idx:s}){var c;const r=e.useEditorStore(l=>{var m;return(m=l.card)==null?void 0:m.preferences}),t=e.useEditorStore(l=>{var m;return(m=l.card.preferences)==null?void 0:m.datasetOptions}),n=e.useEditorStore(l=>l.actions.setCardPreferences),o=(c=r==null?void 0:r.chartOptions)==null?void 0:c.indexAxis,a=t==null?void 0:t.find(l=>l.idx===s);function i(l,m){(l==="end"||l==="start")&&e.getContrastColor(e.getCanvasBackgroundColor());const u={display:l!=="none",align:l,anchor:l,clamp:!0};if(!a)n({...r,datasetOptions:[...t||[],{idx:m,datalabels:u}]});else{const R={...a};R.datalabels=u;const h=t==null?void 0:t.map(x=>x.idx===m?R:x);n({...r,datasetOptions:h})}}return e.jsxRuntimeExports.jsxs(e.Popover,{children:[e.jsxRuntimeExports.jsx(e.PopoverTrigger,{children:e.jsxRuntimeExports.jsx(js,{className:"invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),e.jsxRuntimeExports.jsx(e.PopoverContent,{className:"w-fit p-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex gap-1",children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>i("none",s),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:e.jsxRuntimeExports.jsx(e.X,{className:"size-4"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>i("start",s),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:e.jsxRuntimeExports.jsx(rs,{className:e.cn("h-4 w-4",{"rotate-90":o==="y"})})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>i("center",s),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:e.jsxRuntimeExports.jsx(is,{className:e.cn("h-4 w-4",{"rotate-90":o==="y"})})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>i("end",s),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:e.jsxRuntimeExports.jsx(os,{className:e.cn("h-4 w-4",{"rotate-90":o==="y"})})})]})})]})}function Fs(){const s=e.useEditorStore(l=>l.card),r=e.useEditorStore(l=>{var m,u,R;return(R=(u=(m=l==null?void 0:l.card)==null?void 0:m.preferences)==null?void 0:u.chartOptions)==null?void 0:R.indexAxis}),t=r==="y"?"Y axis":"X axis",n=r==="y"?"X axis":"Y axis",{keys:o,metricKeys:a,dimensionKeys:i}=e.getKeys(s.data||[]);let c=a;if(["stackedBar","stackedLine"].includes(s.type)){const l=e.pivotData({dataArray:s.data||[],groupKey:i[0],pivotKey:i[1],valueKey:c[0]}),{metricKeys:m}=e.getKeys(l);c=m}return o.length===0?null:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsx(e.Label,{children:t}),e.jsxRuntimeExports.jsx("div",{className:"my-1 space-y-1",children:e.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-muted/70 px-2 py-1 hover:bg-muted",children:e.jsxRuntimeExports.jsx("p",{children:i[0]})})})]}),e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-5",children:[e.jsxRuntimeExports.jsx(e.Label,{children:n}),e.jsxRuntimeExports.jsx(zs,{})]}),e.jsxRuntimeExports.jsx("div",{className:"my-1 space-y-1",children:c.map((l,m)=>e.jsxRuntimeExports.jsx(St,{col:l,idx:m},l))})]})]})}function St({col:s,idx:r}){const t=e.useEditorStore(c=>{var l;return(l=c.card)==null?void 0:l.preferences}),n=e.useEditorStore(c=>{var l;return(l=c.card.preferences)==null?void 0:l.datasetOptions}),o=n==null?void 0:n.find(c=>c.idx===r),{setCardPreferences:a}=e.useEditorStore(c=>c.actions);function i(c){if(!o)a({...t,datasetOptions:[...n||[],{idx:r,type:c==="area"?"line":c,fill:c==="area"?"origin":""}]});else{const l={...o};l.type=c==="area"?"line":c,l.fill=c==="area"?"origin":"";const m=n==null?void 0:n.map(u=>u.idx===r?l:u);a({...t,datasetOptions:m})}}return e.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:[e.jsxRuntimeExports.jsx("p",{children:s}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[e.jsxRuntimeExports.jsx(be,{onClick:()=>i("bar"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),e.jsxRuntimeExports.jsx(ye,{onClick:()=>i("line"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),e.jsxRuntimeExports.jsx(Ue,{onClick:()=>i("area"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),e.jsxRuntimeExports.jsx(e.Separator,{orientation:"vertical",className:"invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"}),e.jsxRuntimeExports.jsx(yt,{idx:r})]})]})}function Ms(){const s=e.useEditorStore(h=>h.selectedConnectionId),r=e.useEditorStore(h=>h.selectedDatamodelId),t=e.useEditorStore(h=>h.selectedDatabaseName),n=e.useEditorStore(h=>h.selectedSchemaName),o=e.useEditorStore(h=>h.selectedTableName),a=e.useDashboardStore(h=>h.dashboard.filters)||[],i=e.useDashboardStore(h=>h.actions.addFilter),c=e.useDashboardStore(h=>h.actions.removeFilter),l=e.useDashboardStore(h=>h.actions.removeFilterValue),{modelItems:m,tableName:u}=oe();function R(h,x="dashboard"){var j;const d=e.fmt(h.column_name),p=e.fmt(t||""),N=e.fmt(n||""),I=e.fmt(u);let L=e.getQualifiedTableName(N,I),E=`${L}.${d}`;const D=(j=m==null?void 0:m.find(v=>v.id===r))==null?void 0:j.name;r&&r!=="none"&&(E=`${e.DATAMODEL_NAMESPCACE}.${D}.${d}`,L=`${e.DATAMODEL_NAMESPCACE}.${D}`);const T=a==null?void 0:a.find(v=>v.column===E&&v.table===I&&(v.database===p||v.database===t));if(T)l(T.id),c(T.id);else{const v=e.v4();return u==="api"&&s?(i({location:x,id:v,column:E,title:h.column_name,dataType:h.data_type,table:"api",database:"",connectionId:s,operation:"in",sql:e.getDefaultFilterSql(h.data_type,L,d)}),v):(i({id:v,location:x,column:E,title:h.column_name,dataType:h.data_type,table:o||"",database:t||"",connectionId:s||"",operation:"in",sql:e.getDefaultFilterSql(h.data_type,L,d)}),v)}}return{assignFilter:R}}function xe(){const s=e.useDashboardStore(c=>c.dashboard.filters),r=e.useEditorStore(c=>c.frame),{setFrame:t}=e.useEditorActions(),{columns:n}=oe(),{assignFilter:o}=Ms();function a(c){const l=o(c,"frame");t({...r,filterId:l})}const i=s==null?void 0:s.find(c=>c.id===r.filterId);return e.jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Card Filter"}),e.jsxRuntimeExports.jsx(vt,{onSelect:a,columns:n}),i&&e.jsxRuntimeExports.jsx(e.FilterHeader,{filter:i})]})}function vt({columns:s,onSelect:r}){var i;const[t,n]=Be.useState(!1),[o,a]=Be.useState("");return e.jsxRuntimeExports.jsxs(e.Popover,{open:t,onOpenChange:n,children:[e.jsxRuntimeExports.jsx(e.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(e.Button,{size:"sm",variant:"outline",role:"combobox","aria-expanded":t,className:"w-full justify-between font-normal",children:[o?(i=s.find(c=>c.column_name===o))==null?void 0:i.column_name:"Select Column...",e.jsxRuntimeExports.jsx(e.CaretSortIcon,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsxRuntimeExports.jsx(e.PopoverContent,{className:"w-[200px] p-0",children:e.jsxRuntimeExports.jsxs(e.Command,{children:[e.jsxRuntimeExports.jsx(e.CommandInput,{placeholder:"Search column",className:"h-9"}),e.jsxRuntimeExports.jsxs(e.CommandList,{children:[e.jsxRuntimeExports.jsx(e.CommandEmpty,{children:"No framework found."}),e.jsxRuntimeExports.jsx(e.CommandGroup,{children:s.map(c=>e.jsxRuntimeExports.jsxs(e.CommandItem,{value:c.column_name,onSelect:l=>{const m=l===o?"":l;a(m),n(!1),m&&r(c)},children:[c.column_name,e.jsxRuntimeExports.jsx(e.CheckIcon,{className:e.cn("ml-auto h-4 w-4",o===c.column_name?"opacity-100":"opacity-0")})]},c.column_name))})]})]})})]})}function Ct({cardType:s}){return e.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxRuntimeExports.jsxs(e.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:`${e.titleCase(s)} Chart`}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[e.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"}),e.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),e.jsxRuntimeExports.jsx("li",{children:"y-axis1 - number"}),e.jsxRuntimeExports.jsx("li",{children:"y-axis2 - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:r=>r.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#line-chart",children:"example"})," in the docs."]})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Settings"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(ve,{}),e.jsxRuntimeExports.jsx(Fs,{})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(ce,{}),e.jsxRuntimeExports.jsx(xe,{})]})]})]})})}function Ve(){var o,a,i;const s=e.useEditorStore(c=>c.card.cfg),r=e.useEditorStore(c=>c.actions.setCardCfg),t=e.useEditorStore(c=>c.card.type);function n(c){var u;const l={datalabels:{display:c!=="none",align:c,anchor:c,clamp:!0}},m={...s,options:{...s==null?void 0:s.options,plugins:{...(u=s==null?void 0:s.options)==null?void 0:u.plugins,...l}}};r(m),console.log(c)}return e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxRuntimeExports.jsx("label",{className:"font-medium",children:"Data Labels"}),!["pyramid"].includes(t)&&e.jsxRuntimeExports.jsx(zs,{})]}),e.jsxRuntimeExports.jsxs(e.Select,{value:(i=(a=(o=s==null?void 0:s.options)==null?void 0:o.plugins)==null?void 0:a.datalabels)==null?void 0:i.anchor,onValueChange:n,defaultValue:"none",children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{placeholder:"Select position"})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Data Labels"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"none",children:"None"}),t!=="pyramid"&&e.jsxRuntimeExports.jsx(e.SelectItem,{value:"start",children:"Start"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"center",children:"Center"}),t!=="pyramid"&&e.jsxRuntimeExports.jsx(e.SelectItem,{value:"end",children:"End"})]})})]})]})}function Nt({cardType:s}){function r(t){const n="SELECT label, [group], x-axis, y-axis, radius FROM table",o="SELECT label, [group], x-axis, y-axis FROM table";return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:t==="bubble"?n:o}),e.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"label - category"}),e.jsxRuntimeExports.jsx("li",{children:"group - category"}),e.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),e.jsxRuntimeExports.jsx("li",{children:"y-axis - category"}),t==="bubble"&&e.jsxRuntimeExports.jsx("li",{children:"radius - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:a=>a.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#pie-chart",children:"example"})," in the docs."]})]})}return e.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxRuntimeExports.jsxs(e.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:`${e.titleCase(s)} Chart`}),e.jsxRuntimeExports.jsx(e.AccordionContent,{className:"space-y-4 font-mono text-xs",children:r(s)})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Settings"}),e.jsxRuntimeExports.jsx(e.AccordionContent,{className:"px-2",children:e.jsxRuntimeExports.jsx(Ve,{})})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(ce,{}),e.jsxRuntimeExports.jsx(xe,{})]})]})]})})}const wt={datasets:[{type:"line",label:"Sum_sales",data:[]},{type:"bar",label:"Sum_profit",data:[]}]},kt={datasets:[{fill:"origin",type:"line",label:"Sum_sales",data:[]}]};function It(){const s=e.useEditorStore(r=>r.card.type);return e.jsxRuntimeExports.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxRuntimeExports.jsx(e.Accordion,{className:" ",type:"single",collapsible:!0,children:Dt(s)}),e.jsxRuntimeExports.jsx("section",{className:"",children:["line","bar"].includes(s)&&e.jsxRuntimeExports.jsx(ve,{})}),!["kpi"].includes(s)&&e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsx(Ve,{}),e.jsxRuntimeExports.jsx(ce,{}),e.jsxRuntimeExports.jsx(xe,{})]})]})}function Dt(s){if(["line","bar"].includes(s))return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:e.jsxRuntimeExports.jsx("p",{children:"Chart Query"})}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:" ",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"X-axis - Category (ex. city)"}),e.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:"Mixed Chart"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-2 text-xs",children:[e.jsxRuntimeExports.jsxs("p",{children:["Click ",e.jsxRuntimeExports.jsx("b",{children:"Customize"})," and change the `type` property in the dataset."]}),e.jsxRuntimeExports.jsx("pre",{children:JSON.stringify(wt,null,2)})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:"Area Chart"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-2 text-xs",children:[e.jsxRuntimeExports.jsxs("p",{children:["Click ",e.jsxRuntimeExports.jsx("b",{children:"Customize"})," and add `fill` property to the dataset. See",e.jsxRuntimeExports.jsx("a",{className:"mx-1 text-blue-500 hover:underline",href:"https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",target:"_blank",children:"docs"}),"for more options."]}),e.jsxRuntimeExports.jsx("pre",{children:JSON.stringify(kt,null,2)})]})]})]});if(s==="bubble")return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:e.jsxRuntimeExports.jsxs("p",{children:["How to create a ",e.jsxRuntimeExports.jsx("span",{children:s})," chart query?"]})}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:" ",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, x-axis, y-axis, radius FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),e.jsxRuntimeExports.jsx("li",{children:"Bubble Group (opt) - Category (ex. state)"}),e.jsxRuntimeExports.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),e.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"}),e.jsxRuntimeExports.jsx("li",{children:"Radius - Number (ex. population)"})]})]})]})});if(s==="scatter")return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:e.jsxRuntimeExports.jsxs("p",{children:["How to create a ",e.jsxRuntimeExports.jsx("span",{children:s})," chart query?"]})}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:" ",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, x-axis, y-axis FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),e.jsxRuntimeExports.jsx("li",{children:"Group (opt) - Category (ex. state)"}),e.jsxRuntimeExports.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),e.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"})]})]})]})});if(["pie","doughnut","polarArea"].includes(s))return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:e.jsxRuntimeExports.jsxs("p",{children:[e.jsxRuntimeExports.jsx("span",{children:s==="polarArea"?"Polar":s.charAt(0).toUpperCase()+s.slice(1)})," ","chart query"]})}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:" ",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, measure FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),e.jsxRuntimeExports.jsx("li",{children:"Measure - Number (ex. population)"})]})]})]})})}function Lt(){var l,m,u,R,h;const s=e.useEditorStore(x=>x.card.preferences),r=e.useEditorStore(x=>x.actions.setCardPreferences),t=e.useEditorStore(x=>x.actions.setNumberFormat);e.useEditorStore(x=>{var d,p;return(p=(d=x.card.preferences)==null?void 0:d.formatNumber)==null?void 0:p.decimalPlaces});const n=e.useEditorStore(x=>{var d,p;return(p=(d=x.card.preferences)==null?void 0:d.formatNumber)==null?void 0:p.locale}),o=e.useEditorStore(x=>{var d,p;return(p=(d=x.card.preferences)==null?void 0:d.formatNumber)==null?void 0:p.currency});e.useEditorStore(x=>x.actions.setFilterOnClickField);const a=e.useEditorStore(x=>{var d,p;return(p=(d=x.card.preferences)==null?void 0:d.formatNumber)==null?void 0:p.colorRanges})||[],i=e.useEditorStore(x=>x.actions.setColorRanges),c=[...new Set(e.LOCALE_CURRENCY_PAIRS.map(x=>x.currency))];return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{checked:!!((l=s==null?void 0:s.formatNumber)!=null&&l.enabled),onCheckedChange:x=>{r({...s,formatNumber:{...s==null?void 0:s.formatNumber,enabled:x}})}}),e.jsxRuntimeExports.jsx(e.Label,{children:"Format Number"})]}),((m=s==null?void 0:s.formatNumber)==null?void 0:m.enabled)===!0&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 p-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-full space-y-1",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Locale"}),e.jsxRuntimeExports.jsxs(e.Select,{value:n||"en-US",onValueChange:x=>{var d,p,N;return t(((d=s==null?void 0:s.formatNumber)==null?void 0:d.decimalPlaces)||0,((p=s==null?void 0:s.formatNumber)==null?void 0:p.currency)||"",x||"en-US",((N=s==null?void 0:s.formatNumber)==null?void 0:N.suffix)||"")},children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Format"}),e.LOCALE_CURRENCY_PAIRS.map(x=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:x.locale,children:x.locale},x.locale))]})})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"w-full space-y-1",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Currency"}),e.jsxRuntimeExports.jsxs(e.Select,{value:o||"none",onValueChange:x=>{var d,p,N;return t(((d=s==null?void 0:s.formatNumber)==null?void 0:d.decimalPlaces)||0,x==="none"?"":x,((p=s==null?void 0:s.formatNumber)==null?void 0:p.locale)||"",((N=s==null?void 0:s.formatNumber)==null?void 0:N.suffix)||"")},children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Currency"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"none",children:"None"},"none"),c.map(x=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:x,children:x},x))]})})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-full space-y-1",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Decimals"}),e.jsxRuntimeExports.jsxs(e.Select,{value:((R=(u=s==null?void 0:s.formatNumber)==null?void 0:u.decimalPlaces)==null?void 0:R.toString())||"0",onValueChange:x=>{var d,p,N;return t(Number(x),((d=s==null?void 0:s.formatNumber)==null?void 0:d.currency)||"",((p=s==null?void 0:s.formatNumber)==null?void 0:p.locale)||"",((N=s==null?void 0:s.formatNumber)==null?void 0:N.suffix)||"")},children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:["0","1","2","3","4"].map(x=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:x,children:x},x))})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"w-full space-y-1",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Suffix"}),e.jsxRuntimeExports.jsx(e.Input,{value:((h=s==null?void 0:s.formatNumber)==null?void 0:h.suffix)||"",className:"h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"K, M, B, %",onChange:x=>{var d,p,N;return t(((d=s==null?void 0:s.formatNumber)==null?void 0:d.decimalPlaces)||0,((p=s==null?void 0:s.formatNumber)==null?void 0:p.currency)||"",((N=s==null?void 0:s.formatNumber)==null?void 0:N.locale)||"",x.target.value)}})]})]})]})}),e.jsxRuntimeExports.jsx(e.Separator,{className:"my-3"}),e.jsxRuntimeExports.jsx(e.ColorFormat,{colorRanges:a,setColorRanges:i})]})]})}function Tt(){return e.jsxRuntimeExports.jsxs("div",{className:"space-y-6 px-6 py-2",children:[e.jsxRuntimeExports.jsx(e.Accordion,{type:"single",collapsible:!0,children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"",children:"KPI Query"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"font-mono",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs",children:"SELECT current, previous FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"current - number"}),e.jsxRuntimeExports.jsx("li",{children:"previous - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:s=>s.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#kpi",children:"example"})," in the docs."]})]})]})}),e.jsxRuntimeExports.jsx("section",{className:"",children:e.jsxRuntimeExports.jsx(Lt,{})}),e.jsxRuntimeExports.jsx("div",{}),e.jsxRuntimeExports.jsx("div",{})]})}function At(){var n;const s=e.useEditorStore(o=>o.card.preferences),{setCardPreferences:r}=e.useEditorStore(o=>o.actions);function t(o){r({...s,textVisualOptions:{...s==null?void 0:s.textVisualOptions,isDynamicText:o==="dynamic"}})}return e.jsxRuntimeExports.jsxs(e.RadioGroup,{value:(n=s==null?void 0:s.textVisualOptions)!=null&&n.isDynamicText?"dynamic":"static",onValueChange:t,className:"flex gap-3",defaultValue:"x",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"static",id:"r1"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Static"})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"dynamic",id:"r2"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Dynamic"})]})]})}function fe({cardType:s,docContent:r,suffix:t="Chart"}){return e.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxRuntimeExports.jsxs(e.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:`${e.titleCase(s)} ${t}`}),e.jsxRuntimeExports.jsx(e.AccordionContent,{children:r||e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT label, measure FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"label - category"}),e.jsxRuntimeExports.jsx("li",{children:"measure - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.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."]})]})})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Settings"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[s==="range"&&e.jsxRuntimeExports.jsx(ve,{}),s!=="text"&&e.jsxRuntimeExports.jsx(Ve,{}),s==="text"&&e.jsxRuntimeExports.jsx(At,{})]})]}),!["range","text"].includes(s)&&e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(ce,{}),e.jsxRuntimeExports.jsx(xe,{})]})]})]})})}function zt(){const s=e.useEditorStore(n=>{var o,a;return(a=(o=n==null?void 0:n.card)==null?void 0:o.preferences)==null?void 0:a.sortChart}),{setSortChart:r}=e.useEditorActions();function t(){return e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Sort"}),e.jsxRuntimeExports.jsx(de,{className:"h-8",label:"Sort Chart",options:[{label:"None",value:"none"},{label:"ASC",value:"asc"},{label:"DESC",value:"desc"}],value:s||"none",onValueChange:n=>{r(n)}})]})}return e.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxRuntimeExports.jsxs(e.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Stacked Chart"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT x-axis, stack-by, y-axis FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),e.jsxRuntimeExports.jsx("li",{children:"stack by - category"}),e.jsxRuntimeExports.jsx("li",{children:"y-axis - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:n=>n.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#stacked-chart",children:"example"})," in the docs."]})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Settings"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(ve,{}),t(),e.jsxRuntimeExports.jsx(Fs,{})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(ce,{}),e.jsxRuntimeExports.jsx(xe,{})]})]})]})})}function Ft({}){const s=e.useEditorStore(n=>{var o;return(o=n.card)==null?void 0:o.preferences}),r=e.useEditorStore(n=>n.actions.setCardPreferences),t=n=>{r({...s,allowDownload:n})};return e.jsxRuntimeExports.jsxs("div",{className:"space-y-6 px-6 py-2",children:[e.jsxRuntimeExports.jsx(e.Accordion,{defaultValue:["item-3"],type:"multiple",children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(ce,{}),e.jsxRuntimeExports.jsx(xe,{})]})]})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{onCheckedChange:t,id:"allow-download"}),e.jsxRuntimeExports.jsx("label",{htmlFor:"allow-download",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Allow Download"})]})]})}const Mt=e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT dimension, cohort, metric FROM table"}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:s=>s.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#pyramid-chart",children:"example"})," in the docs."]})]}),Ot=e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT y-axis, label, range-from, range-to, range-value FROM table"}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:s=>s.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#range-charts",children:"example"})," in the docs."]})]}),Vt=e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT text FROM table limit 1"}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:s=>s.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#text-visual",children:"example"})," in the docs."]})]});function qt(){const s=e.useEditorStore(t=>t.card.type);function r(t){switch(t){case"stackedBar":case"stackedLine":return e.jsxRuntimeExports.jsx(zt,{});case"pyramid":return e.jsxRuntimeExports.jsx(fe,{docContent:Mt,cardType:t});case"kpi":return e.jsxRuntimeExports.jsx(Tt,{});case"line":case"bar":return e.jsxRuntimeExports.jsx(Ct,{cardType:t});case"range":return e.jsxRuntimeExports.jsx(fe,{docContent:Ot,cardType:t});case"pie":case"doughnut":case"polarArea":case"radar":return e.jsxRuntimeExports.jsx(fe,{cardType:t});case"bubble":case"scatter":return e.jsxRuntimeExports.jsx(Nt,{cardType:t});case"table":return e.jsxRuntimeExports.jsx(Ft,{cardType:t});case"text":return e.jsxRuntimeExports.jsx(fe,{docContent:Vt,cardType:t,suffix:"Visual"});case"custom":return e.jsxRuntimeExports.jsx(bt,{});default:return e.jsxRuntimeExports.jsx(It,{})}}return e.jsxRuntimeExports.jsx(e.ScrollArea,{className:"h-full w-full text-sm",children:r(s)})}function _t(){const s=e.useEditorStore(r=>r.isShowingVisual);return e.jsxRuntimeExports.jsxs(e.ResizablePanelGroup,{direction:"vertical",className:"min-h-[250px] min-w-full max-w-lg",children:[e.jsxRuntimeExports.jsx(e.ResizablePanel,{role:"query-section",className:"flex",minSize:20,defaultSize:40,children:e.jsxRuntimeExports.jsx(ct,{})}),e.jsxRuntimeExports.jsx(e.ResizableHandle,{withHandle:!0,className:"border"}),e.jsxRuntimeExports.jsx(e.ResizablePanel,{className:"pb-1",role:"visual-section",minSize:0,defaultSize:60,children:s?e.jsxRuntimeExports.jsxs(e.ResizablePanelGroup,{direction:"horizontal",children:[e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(e.ResizablePanel,{className:"flex min-w-[275px]",minSize:20,defaultSize:25,maxSize:30,children:e.jsxRuntimeExports.jsx(qt,{})})}),e.jsxRuntimeExports.jsx(e.ResizableHandle,{className:"border"}),e.jsxRuntimeExports.jsx(e.ResizablePanel,{minSize:40,defaultSize:75,maxSize:100,children:e.jsxRuntimeExports.jsx($e,{})})]}):e.jsxRuntimeExports.jsx($e,{})})]})}function Bt({authToken:s,onSave:r,onClose:t}){e.useDashboardStore(i=>i.themeStyle);const n=e.useEditorStore(i=>i.actions.setOnSave),o=e.useEditorStore(i=>i.actions.setOnClose),a=e.useDashboardStore(i=>i.actions.setAuthToken);return S.useEffect(()=>{r&&n(r),t&&o(t)},[r,n,t,o]),S.useEffect(()=>{s&&s.accessToken&&a(s)},[s,a]),e.jsxRuntimeExports.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:e.jsxRuntimeExports.jsxs(e.EditorPanel,{style:{},className:"rounded-none",role:"editor-panel",children:[e.jsxRuntimeExports.jsx(e.EditorAside,{className:"rounded-none border-r-[1.5px]",children:e.jsxRuntimeExports.jsx(Rs,{})}),e.jsxRuntimeExports.jsx(e.EditorMain,{children:e.jsxRuntimeExports.jsx(_t,{})})]})})}function Ht(){e.useDashboardStore(i=>i.selectedCardId);const s=e.useDashboardStore(i=>i.selectedSheetId),{setIsVisualEditing:r}=e.useDashboardStore(i=>i.actions),t=e.useDashboardStore(i=>i.isVisualEditing),n=e.useDashboardStore(i=>i.actions.updateFrame);function o(i){s&&(n(s,i),r(!1))}function a(){r(!1)}return e.jsxRuntimeExports.jsx("div",{role:"editor-container",className:e.cn("flex grow",{block:t,hidden:!t}),children:e.jsxRuntimeExports.jsx(Bt,{onSave:o,onClose:a})})}function Pt(){e.useEditorStore(i=>i.selectedConnectionId),e.useEditorStore(i=>i.selectedDatamodelId);const s=e.useEditorStore(i=>i.selectedDatabaseName);e.useEditorStore(i=>i.selectedSchemaName);const r=e.useEditorStore(i=>i.selectedTableName),t=e.useDashboardStore(i=>i.dashboard.filters)||[];e.useDashboardStore(i=>i.actions.addFilter),e.useDashboardStore(i=>i.actions.removeFilter),e.useDashboardStore(i=>i.actions.removeFilterValue);const{modelItems:n,columns:o}=oe(),{assignFilter:a}=Ms();return e.jsxRuntimeExports.jsx("div",{className:"xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3",children:o==null?void 0:o.map(i=>{const c=t==null?void 0:t.find(l=>l.column===e.fmt(i.column_name)&&l.table===r&&l.database===s);return e.jsxRuntimeExports.jsx("div",{onClick:()=>a(i),className:e.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":c}),children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(gs,{column:i}),e.jsxRuntimeExports.jsx("span",{children:i.column_name})]})},i.column_name)})})}function $t(){e.useDashboardStore(r=>r.showFilters);const s=e.useDashboardStore(r=>r.actions.setShowFilters);return e.jsxRuntimeExports.jsxs("section",{className:"relative flex grow flex-col border-l px-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"mt-4 flex items-center justify-between gap-2 px-3",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"text-lg",children:"Filters"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>s(!1),className:"h-7 w-7 p-0",variant:"ghost",children:e.jsxRuntimeExports.jsx(e.Cross2Icon,{})})]}),e.jsxRuntimeExports.jsx("div",{className:"flex grow",children:e.jsxRuntimeExports.jsx(Rs,{ColumnsComponent:()=>e.jsxRuntimeExports.jsx(Pt,{})})})]})}function Gt(){const s=e.useDashboardStore(t=>t.showFilters),r=e.useDashboardStore(t=>t.isVisualEditing);return e.jsxRuntimeExports.jsxs("div",{role:"dashboard-plus-main",className:e.cn("grow",{hidden:r,flex:!r}),children:[e.jsxRuntimeExports.jsx(e.DashboardTabs,{}),s&&e.jsxRuntimeExports.jsx("div",{role:"filter-aside-container",className:"flex",children:e.jsxRuntimeExports.jsx($t,{})})]})}function Qt(){const s=e.useDashboardStore(n=>n.dashboard),r=e.useDashboardStore(n=>n.actions.setDashboard),t=e.useDashboardStore(n=>n.showDashboardJSON);return e.useDashboardStore(n=>n.actions.setShowDashboardJSON),e.jsxRuntimeExports.jsx("div",{className:e.cn(" p-2",{hidden:!t}),children:e.jsxRuntimeExports.jsx(e.de,{onChange:n=>{if(n)try{JSON.parse(n),r(JSON.parse(n))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto ",value:JSON.stringify(s,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})})}function Ut({showControls:s=!1,showFooter:r=!0,...t}){return e.jsxRuntimeExports.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:e.jsxRuntimeExports.jsxs(e.SemaphorContextProvider,{dashboardProps:t,children:[e.jsxRuntimeExports.jsx(e.Te,{}),e.jsxRuntimeExports.jsxs(e.UXProvider,{children:[e.jsxRuntimeExports.jsx(Qt,{}),e.jsxRuntimeExports.jsxs(e.DashboardPanel,{...t,children:[s&&e.jsxRuntimeExports.jsx(Gs,{}),e.jsxRuntimeExports.jsx(Ht,{}),e.jsxRuntimeExports.jsx(Gt,{})]})]})]})})}exports.Box=Qe;exports.ChartArea=Ue;exports.ChartColumnIncreasing=be;exports.ChartLine=ye;exports.ChartNoAxesGantt=De;exports.ChartPie=Le;exports.ChartScatter=Te;exports.CircleX=Ke;exports.CopyPlus=We;exports.DashboardPlus=Ut;exports.Database=Je;exports.EllipsisVertical=Ae;exports.Eraser=Ye;exports.Eye=Ze;exports.EyeClosed=Xe;exports.Glasses=es;exports.Hammer=ss;exports.Hash=ts;exports.House=ns;exports.Key=ze;exports.ListEnd=rs;exports.ListStart=os;exports.ListX=is;exports.LoaderCircle=le;exports.MessageSquareMore=as;exports.Network=ls;exports.Pencil=Fe;exports.Play=cs;exports.Plug2=xs;exports.Save=us;exports.SelectComponent=ae;exports.Shapes=Me;exports.ShieldQuestion=ds;exports.Sigma=ms;exports.SwatchBook=ps;exports.Tag=js;exports.ToggleLeft=hs;exports.Type=Se;exports.User=Es;exports.cleanCard=fs;exports.getDashbaordStateWithoutData=Oe;exports.useEditorAside=oe;
|