@alfadocs/ui-kit-debug 0.50.0 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{bishop-score-2MzAz8NE.js → bishop-score-CMQxsdy4.js} +2 -2
- package/dist/_chunks/{bishop-score-2MzAz8NE.js.map → bishop-score-CMQxsdy4.js.map} +1 -1
- package/dist/_chunks/{bmi-calculator-DdylQzT6.js → bmi-calculator-DuUneHuZ.js} +2 -2
- package/dist/_chunks/{bmi-calculator-DdylQzT6.js.map → bmi-calculator-DuUneHuZ.js.map} +1 -1
- package/dist/_chunks/{cycle-calculator-oOkj5wlB.js → cycle-calculator-vTtZZAmn.js} +2 -2
- package/dist/_chunks/{cycle-calculator-oOkj5wlB.js.map → cycle-calculator-vTtZZAmn.js.map} +1 -1
- package/dist/_chunks/{due-date-calculator-DykajWzh.js → due-date-calculator-CUm5KJbf.js} +2 -2
- package/dist/_chunks/{due-date-calculator-DykajWzh.js.map → due-date-calculator-CUm5KJbf.js.map} +1 -1
- package/dist/_chunks/{fetal-weight-Da-B4P4k.js → fetal-weight-Xf8-ZoDy.js} +2 -2
- package/dist/_chunks/{fetal-weight-Da-B4P4k.js.map → fetal-weight-Xf8-ZoDy.js.map} +1 -1
- package/dist/_chunks/{gestational-age-calculator-Bc55hq6t.js → gestational-age-calculator-830KJql3.js} +2 -2
- package/dist/_chunks/{gestational-age-calculator-Bc55hq6t.js.map → gestational-age-calculator-830KJql3.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-DAnpbale.js → hcg-doubling-kVOpDfny.js} +2 -2
- package/dist/_chunks/{hcg-doubling-DAnpbale.js.map → hcg-doubling-kVOpDfny.js.map} +1 -1
- package/dist/_chunks/insert-result-njqBthzT.js +742 -0
- package/dist/_chunks/insert-result-njqBthzT.js.map +1 -0
- package/dist/_chunks/{pregnancy-dating-48Gfvod1.js → pregnancy-dating-DT_244bG.js} +2 -2
- package/dist/_chunks/{pregnancy-dating-48Gfvod1.js.map → pregnancy-dating-DT_244bG.js.map} +1 -1
- package/dist/_chunks/{pregnancy-weight-gain-CCGrvarh.js → pregnancy-weight-gain-BMRBeA8V.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-CCGrvarh.js.map → pregnancy-weight-gain-BMRBeA8V.js.map} +1 -1
- package/dist/_chunks/{unit-converter-jWp3Z85y.js → unit-converter-BQ6lEYvd.js} +2 -2
- package/dist/_chunks/{unit-converter-jWp3Z85y.js.map → unit-converter-BQ6lEYvd.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/insert-result.d.ts.map +1 -1
- package/dist/components/bishop-score/index.js +1 -1
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/fetal-weight/index.js +1 -1
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/index.js +11 -11
- package/package.json +1 -1
- package/dist/_chunks/insert-result-DNdi_JYW.js +0 -683
- package/dist/_chunks/insert-result-DNdi_JYW.js.map +0 -1
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
import { jsxs as P, jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ht, useRef as St } from "react";
|
|
3
|
+
import { useTranslation as Dt } from "react-i18next";
|
|
4
|
+
import { c as Nt } from "./index-D2ZczOXr.js";
|
|
5
|
+
import { B as Gt } from "./button-DD_0Xdmr.js";
|
|
6
|
+
import { L as Ht } from "./layers-pzGcbLPj.js";
|
|
7
|
+
import { I as Rt } from "./image-C6RM5hfF.js";
|
|
8
|
+
import { c as Pt } from "./createLucideIcon-CrFbzy84.js";
|
|
9
|
+
/**
|
|
10
|
+
* @license lucide-react v1.8.0 - ISC
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the ISC license.
|
|
13
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
const Ft = [
|
|
16
|
+
["path", { d: "M12 4v16", key: "1654pz" }],
|
|
17
|
+
["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
|
|
18
|
+
["path", { d: "M9 20h6", key: "s66wpe" }]
|
|
19
|
+
], Ot = Pt("type", Ft), Ut = 15, at = 40, zt = [18.5, 25, 30];
|
|
20
|
+
function Mn() {
|
|
21
|
+
return {
|
|
22
|
+
bands: [
|
|
23
|
+
{ upTo: 18.5, colorToken: "--info" },
|
|
24
|
+
{ upTo: 25, colorToken: "--success" },
|
|
25
|
+
{ upTo: 30, colorToken: "--warning-readable" },
|
|
26
|
+
{ upTo: at, colorToken: "--destructive" }
|
|
27
|
+
],
|
|
28
|
+
min: Ut,
|
|
29
|
+
max: at,
|
|
30
|
+
ticks: [...zt]
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const V = 14, j = 12, Wt = j / 2, ot = 18, Xt = 12, Vt = 16;
|
|
34
|
+
function N(t, n, i, a, o) {
|
|
35
|
+
if (i <= n) return a;
|
|
36
|
+
const r = (t - n) / (i - n);
|
|
37
|
+
return a + r * (o - a);
|
|
38
|
+
}
|
|
39
|
+
function pt(t, { width: n, height: i }) {
|
|
40
|
+
const a = V, o = n - V, r = ot + Xt, e = ot, c = r + j + Vt;
|
|
41
|
+
let u = t.min;
|
|
42
|
+
const d = t.bands.map((l) => {
|
|
43
|
+
const T = Math.max(t.min, Math.min(u, t.max)), y = Math.max(t.min, Math.min(l.upTo, t.max));
|
|
44
|
+
u = l.upTo;
|
|
45
|
+
const p = N(T, t.min, t.max, a, o), E = N(y, t.min, t.max, a, o);
|
|
46
|
+
return { x: p, w: Math.max(0, E - p), colorToken: l.colorToken };
|
|
47
|
+
}), f = N(t.value, t.min, t.max, a, o), b = t.value < t.min ? "start" : t.value > t.max ? "end" : null, k = Math.min(o, Math.max(a, f)), h = (t.ticks ?? []).filter((l) => l >= t.min && l <= t.max).map((l) => ({
|
|
48
|
+
x: N(l, t.min, t.max, a, o),
|
|
49
|
+
value: l
|
|
50
|
+
})), $ = t.categoryLabel ? t.rangeLabel ? `${t.categoryLabel} (${t.rangeLabel})` : t.categoryLabel : "";
|
|
51
|
+
return {
|
|
52
|
+
width: n,
|
|
53
|
+
height: i,
|
|
54
|
+
barStart: a,
|
|
55
|
+
barEnd: o,
|
|
56
|
+
barY: r,
|
|
57
|
+
barH: j,
|
|
58
|
+
barRadius: Wt,
|
|
59
|
+
bands: d,
|
|
60
|
+
marker: {
|
|
61
|
+
x: k,
|
|
62
|
+
clampedStart: a,
|
|
63
|
+
clampedEnd: o,
|
|
64
|
+
overflow: b
|
|
65
|
+
},
|
|
66
|
+
ticks: h,
|
|
67
|
+
valueLabelY: e,
|
|
68
|
+
tickLabelY: c,
|
|
69
|
+
valueLabel: t.valueLabel,
|
|
70
|
+
summaryLabel: $,
|
|
71
|
+
ariaLabel: t.ariaLabel
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const s = (t) => Math.round(t * 100) / 100, M = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
75
|
+
function bt(t, n, i, a, o, r) {
|
|
76
|
+
const e = t + i, c = n + a, u = r > 0 ? `A${r} ${r} 0 0 1 ${s(e)} ${s(n + r)}` : "", d = r > 0 ? `A${r} ${r} 0 0 1 ${s(e - r)} ${s(c)}` : "", f = o > 0 ? `A${o} ${o} 0 0 1 ${s(t)} ${s(c - o)}` : "", b = o > 0 ? `A${o} ${o} 0 0 1 ${s(t + o)} ${s(n)}` : "";
|
|
77
|
+
return `M${s(t + o)} ${s(n)} H${s(e - r)} ${u} V${s(
|
|
78
|
+
c - r
|
|
79
|
+
)} ${d} H${s(t + o)} ${f} V${s(n + o)} ${b} Z`;
|
|
80
|
+
}
|
|
81
|
+
function jt(t, n) {
|
|
82
|
+
const { resolve: i, font: a, fg: o, muted: r, track: e } = n, c = M(a), u = `<rect x="${s(t.barStart)}" y="${s(
|
|
83
|
+
t.barY
|
|
84
|
+
)}" width="${s(t.barEnd - t.barStart)}" height="${t.barH}" rx="${t.barRadius}" fill="${e}"/>`, d = t.bands.length, f = t.bands.map((m, x) => {
|
|
85
|
+
const C = i(m.colorToken), I = x === 0 ? t.barRadius : 0, U = x === d - 1 ? t.barRadius : 0;
|
|
86
|
+
return `<path d="${bt(
|
|
87
|
+
m.x,
|
|
88
|
+
t.barY,
|
|
89
|
+
m.w,
|
|
90
|
+
t.barH,
|
|
91
|
+
I,
|
|
92
|
+
U
|
|
93
|
+
)}" fill="${C}"/>`;
|
|
94
|
+
}).join(""), b = t.barY + t.barH, k = b + 4, h = t.ticks.map((m) => {
|
|
95
|
+
const x = `<line x1="${s(m.x)}" y1="${s(b)}" x2="${s(
|
|
96
|
+
m.x
|
|
97
|
+
)}" y2="${s(k)}" stroke="${e}" stroke-width="1"/>`, C = `<text x="${s(
|
|
98
|
+
m.x
|
|
99
|
+
)}" y="${s(t.tickLabelY)}" text-anchor="middle" font-family="${c}" font-size="9" fill="${r}">${M(
|
|
100
|
+
String(m.value)
|
|
101
|
+
)}</text>`;
|
|
102
|
+
return x + C;
|
|
103
|
+
}).join(""), $ = s(t.marker.x), l = t.barY - 3, T = t.barY + t.barH + 3, y = `<line x1="${$}" y1="${s(l)}" x2="${$}" y2="${s(
|
|
104
|
+
T
|
|
105
|
+
)}" stroke="${o}" stroke-width="2" stroke-linecap="round"/>`, p = t.barY - 4, E = `<polygon points="${$},${s(t.barY + 1)} ${s(
|
|
106
|
+
t.marker.x - 4
|
|
107
|
+
)},${s(p)} ${s(t.marker.x + 4)},${s(p)}" fill="${o}"/>`;
|
|
108
|
+
let w = "";
|
|
109
|
+
if (t.marker.overflow) {
|
|
110
|
+
const m = t.barY + t.barH / 2;
|
|
111
|
+
if (t.marker.overflow === "start") {
|
|
112
|
+
const x = t.barStart - 2;
|
|
113
|
+
w = `<polyline points="${s(x + 5)},${s(m - 4)} ${s(
|
|
114
|
+
x
|
|
115
|
+
)},${s(m)} ${s(x + 5)},${s(
|
|
116
|
+
m + 4
|
|
117
|
+
)}" fill="none" stroke="${o}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`;
|
|
118
|
+
} else {
|
|
119
|
+
const x = t.barEnd + 2;
|
|
120
|
+
w = `<polyline points="${s(x - 5)},${s(m - 4)} ${s(
|
|
121
|
+
x
|
|
122
|
+
)},${s(m)} ${s(x - 5)},${s(
|
|
123
|
+
m + 4
|
|
124
|
+
)}" fill="none" stroke="${o}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const B = `<text x="${s(
|
|
128
|
+
t.barStart
|
|
129
|
+
)}" y="${s(t.valueLabelY)}" font-family="${c}" font-size="13" font-weight="700" fill="${o}">${M(
|
|
130
|
+
t.valueLabel
|
|
131
|
+
)}</text>`, S = t.summaryLabel ? `<text x="${s(t.barEnd)}" y="${s(
|
|
132
|
+
t.valueLabelY
|
|
133
|
+
)}" text-anchor="end" font-family="${c}" font-size="10" fill="${r}">${M(
|
|
134
|
+
t.summaryLabel
|
|
135
|
+
)}</text>` : "", D = `<title>${M(t.ariaLabel)}</title>`;
|
|
136
|
+
return `<g role="img" aria-label="${M(
|
|
137
|
+
t.ariaLabel
|
|
138
|
+
)}">${D}${u}${f}${h}${y}${E}${w}${B}${S}</g>`;
|
|
139
|
+
}
|
|
140
|
+
const Kt = 260, Q = 64;
|
|
141
|
+
function Zt(t) {
|
|
142
|
+
return `var(${t})`;
|
|
143
|
+
}
|
|
144
|
+
const qt = ht(
|
|
145
|
+
function({ model: n, width: i = Kt, height: a = Q, className: o }, r) {
|
|
146
|
+
const e = pt(n, { width: i, height: a }), c = e.barY + e.barH, u = c + 4, d = e.barY - 3, f = e.barY + e.barH + 3, b = e.barY - 4, k = e.bands.length, h = e.barY + e.barH / 2;
|
|
147
|
+
return /* @__PURE__ */ P(
|
|
148
|
+
"svg",
|
|
149
|
+
{
|
|
150
|
+
ref: r,
|
|
151
|
+
"data-component": "banded-gauge",
|
|
152
|
+
direction: "ltr",
|
|
153
|
+
role: "img",
|
|
154
|
+
"aria-label": e.ariaLabel,
|
|
155
|
+
width: i,
|
|
156
|
+
height: a,
|
|
157
|
+
viewBox: `0 0 ${i} ${a}`,
|
|
158
|
+
className: ["ds:[font-family:var(--font-sans)]", o].filter(Boolean).join(" "),
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ g("title", { children: e.ariaLabel }),
|
|
161
|
+
/* @__PURE__ */ g(
|
|
162
|
+
"rect",
|
|
163
|
+
{
|
|
164
|
+
x: s(e.barStart),
|
|
165
|
+
y: s(e.barY),
|
|
166
|
+
width: s(e.barEnd - e.barStart),
|
|
167
|
+
height: e.barH,
|
|
168
|
+
rx: e.barRadius,
|
|
169
|
+
className: "ds:fill-[color:var(--muted)]"
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
e.bands.map(($, l) => /* @__PURE__ */ g(
|
|
173
|
+
"path",
|
|
174
|
+
{
|
|
175
|
+
d: bt(
|
|
176
|
+
$.x,
|
|
177
|
+
e.barY,
|
|
178
|
+
$.w,
|
|
179
|
+
e.barH,
|
|
180
|
+
l === 0 ? e.barRadius : 0,
|
|
181
|
+
l === k - 1 ? e.barRadius : 0
|
|
182
|
+
),
|
|
183
|
+
fill: Zt($.colorToken)
|
|
184
|
+
},
|
|
185
|
+
`${$.colorToken}-${l}`
|
|
186
|
+
)),
|
|
187
|
+
e.ticks.map(($) => /* @__PURE__ */ P("g", { children: [
|
|
188
|
+
/* @__PURE__ */ g(
|
|
189
|
+
"line",
|
|
190
|
+
{
|
|
191
|
+
x1: s($.x),
|
|
192
|
+
y1: s(c),
|
|
193
|
+
x2: s($.x),
|
|
194
|
+
y2: s(u),
|
|
195
|
+
strokeWidth: 1,
|
|
196
|
+
className: "ds:stroke-[color:var(--border)]"
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ g(
|
|
200
|
+
"text",
|
|
201
|
+
{
|
|
202
|
+
x: s($.x),
|
|
203
|
+
y: s(e.tickLabelY),
|
|
204
|
+
textAnchor: "middle",
|
|
205
|
+
fontSize: 9,
|
|
206
|
+
className: "ds:fill-[color:var(--muted-foreground)]",
|
|
207
|
+
children: $.value
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
] }, $.value)),
|
|
211
|
+
/* @__PURE__ */ g(
|
|
212
|
+
"line",
|
|
213
|
+
{
|
|
214
|
+
x1: s(e.marker.x),
|
|
215
|
+
y1: s(d),
|
|
216
|
+
x2: s(e.marker.x),
|
|
217
|
+
y2: s(f),
|
|
218
|
+
strokeWidth: 2,
|
|
219
|
+
strokeLinecap: "round",
|
|
220
|
+
className: "ds:stroke-[color:var(--foreground)]"
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
/* @__PURE__ */ g(
|
|
224
|
+
"polygon",
|
|
225
|
+
{
|
|
226
|
+
points: `${s(e.marker.x)},${s(e.barY + 1)} ${s(
|
|
227
|
+
e.marker.x - 4
|
|
228
|
+
)},${s(b)} ${s(e.marker.x + 4)},${s(b)}`,
|
|
229
|
+
className: "ds:fill-[color:var(--foreground)]"
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
e.marker.overflow === "start" ? /* @__PURE__ */ g(
|
|
233
|
+
"polyline",
|
|
234
|
+
{
|
|
235
|
+
points: `${s(e.barStart + 3)},${s(h - 4)} ${s(
|
|
236
|
+
e.barStart - 2
|
|
237
|
+
)},${s(h)} ${s(e.barStart + 3)},${s(h + 4)}`,
|
|
238
|
+
fill: "none",
|
|
239
|
+
strokeWidth: 2,
|
|
240
|
+
strokeLinecap: "round",
|
|
241
|
+
strokeLinejoin: "round",
|
|
242
|
+
className: "ds:stroke-[color:var(--foreground)]"
|
|
243
|
+
}
|
|
244
|
+
) : null,
|
|
245
|
+
e.marker.overflow === "end" ? /* @__PURE__ */ g(
|
|
246
|
+
"polyline",
|
|
247
|
+
{
|
|
248
|
+
points: `${s(e.barEnd - 3)},${s(h - 4)} ${s(
|
|
249
|
+
e.barEnd + 2
|
|
250
|
+
)},${s(h)} ${s(e.barEnd - 3)},${s(h + 4)}`,
|
|
251
|
+
fill: "none",
|
|
252
|
+
strokeWidth: 2,
|
|
253
|
+
strokeLinecap: "round",
|
|
254
|
+
strokeLinejoin: "round",
|
|
255
|
+
className: "ds:stroke-[color:var(--foreground)]"
|
|
256
|
+
}
|
|
257
|
+
) : null,
|
|
258
|
+
/* @__PURE__ */ g(
|
|
259
|
+
"text",
|
|
260
|
+
{
|
|
261
|
+
x: s(e.barStart),
|
|
262
|
+
y: s(e.valueLabelY),
|
|
263
|
+
fontSize: 13,
|
|
264
|
+
fontWeight: 700,
|
|
265
|
+
className: "ds:fill-[color:var(--foreground)]",
|
|
266
|
+
children: e.valueLabel
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
e.summaryLabel ? /* @__PURE__ */ g(
|
|
270
|
+
"text",
|
|
271
|
+
{
|
|
272
|
+
x: s(e.barEnd),
|
|
273
|
+
y: s(e.valueLabelY),
|
|
274
|
+
textAnchor: "end",
|
|
275
|
+
fontSize: 10,
|
|
276
|
+
className: "ds:fill-[color:var(--muted-foreground)]",
|
|
277
|
+
children: e.summaryLabel
|
|
278
|
+
}
|
|
279
|
+
) : null
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
qt.displayName = "BandedGauge";
|
|
286
|
+
const Jt = 24, mt = 18, G = 12, gt = {
|
|
287
|
+
activity: '<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>',
|
|
288
|
+
scale: '<path d="M12 3v18"/><path d="m19 8 3 8a5 5 0 0 1-6 0zV7"/><path d="M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1"/><path d="m5 8 3 8a5 5 0 0 1-6 0zV7"/><path d="M7 21h10"/>',
|
|
289
|
+
ruler: '<path d="M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"/><path d="m14.5 12.5 2-2"/><path d="m11.5 9.5 2-2"/><path d="m8.5 6.5 2-2"/><path d="m17.5 15.5 2-2"/>',
|
|
290
|
+
calendar: '<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',
|
|
291
|
+
"calendar-heart": '<path d="M12.127 22H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.125"/><path d="M14.62 18.8A2.25 2.25 0 1 1 18 15.836a2.25 2.25 0 1 1 3.38 2.966l-2.626 2.856a.998.998 0 0 1-1.507 0z"/><path d="M16 2v4"/><path d="M3 10h18"/><path d="M8 2v4"/>',
|
|
292
|
+
baby: '<path d="M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5"/><path d="M15 12h.01"/><path d="M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1"/><path d="M9 12h.01"/>',
|
|
293
|
+
heart: '<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',
|
|
294
|
+
droplets: '<path d="M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z"/><path d="M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97"/>',
|
|
295
|
+
clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
|
|
296
|
+
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"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>',
|
|
297
|
+
"trending-up": '<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',
|
|
298
|
+
percent: '<line x1="19" x2="5" y1="5" y2="19"/><circle cx="6.5" cy="6.5" r="2.5"/><circle cx="17.5" cy="17.5" r="2.5"/>'
|
|
299
|
+
};
|
|
300
|
+
function xt(t) {
|
|
301
|
+
return Object.prototype.hasOwnProperty.call(gt, t);
|
|
302
|
+
}
|
|
303
|
+
function rt(t, n, i, a, o) {
|
|
304
|
+
if (!xt(t)) return "";
|
|
305
|
+
const r = o / Jt;
|
|
306
|
+
return `<g transform="translate(${i} ${a}) scale(${r})" fill="none" color="${n}" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${gt[t]}</g>`;
|
|
307
|
+
}
|
|
308
|
+
function Y(t) {
|
|
309
|
+
return t.variant === "banded";
|
|
310
|
+
}
|
|
311
|
+
const Qt = ["fg", "muted", "accent", "border", "bg"], tt = "--primary", F = 380, vt = (t) => t.trim().replace(/^--/, "");
|
|
312
|
+
function tn(t) {
|
|
313
|
+
return `ds:text-[color:var(${t})]`;
|
|
314
|
+
}
|
|
315
|
+
function kt(t) {
|
|
316
|
+
return t.highlightToken ?? tt;
|
|
317
|
+
}
|
|
318
|
+
function W(t) {
|
|
319
|
+
const n = /* @__PURE__ */ new Set();
|
|
320
|
+
if (t.highlight) {
|
|
321
|
+
const a = t.highlightToken ?? tt;
|
|
322
|
+
n.add(a), n.add(`${a}-foreground`);
|
|
323
|
+
}
|
|
324
|
+
const i = kt(t);
|
|
325
|
+
if (n.add(i), t.gauge)
|
|
326
|
+
if (Y(t.gauge))
|
|
327
|
+
for (const a of t.gauge.bands) n.add(a.colorToken);
|
|
328
|
+
else
|
|
329
|
+
n.add(t.gauge.colorToken);
|
|
330
|
+
return [...n];
|
|
331
|
+
}
|
|
332
|
+
function K(t, n = []) {
|
|
333
|
+
const i = {
|
|
334
|
+
fg: "currentColor",
|
|
335
|
+
muted: "currentColor",
|
|
336
|
+
accent: "currentColor",
|
|
337
|
+
border: "currentColor",
|
|
338
|
+
bg: "transparent",
|
|
339
|
+
font: "sans-serif",
|
|
340
|
+
tokens: {}
|
|
341
|
+
};
|
|
342
|
+
if (!t) return i;
|
|
343
|
+
const a = (r) => {
|
|
344
|
+
const e = t.querySelector(`[data-k="${r}"]`);
|
|
345
|
+
return e && getComputedStyle(e).color || "currentColor";
|
|
346
|
+
}, o = {};
|
|
347
|
+
for (const r of n) {
|
|
348
|
+
const e = t.querySelector(
|
|
349
|
+
`[data-token="${vt(r)}"]`
|
|
350
|
+
);
|
|
351
|
+
if (e) {
|
|
352
|
+
const c = getComputedStyle(e).color;
|
|
353
|
+
c && (o[r] = c);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
fg: a("fg"),
|
|
358
|
+
muted: a("muted"),
|
|
359
|
+
accent: a("accent"),
|
|
360
|
+
border: a("border"),
|
|
361
|
+
bg: a("bg"),
|
|
362
|
+
font: getComputedStyle(t).fontFamily || "sans-serif",
|
|
363
|
+
tokens: o
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function O(t, n, i) {
|
|
367
|
+
var a;
|
|
368
|
+
return n ? ((a = t.tokens) == null ? void 0 : a[n]) ?? i : i;
|
|
369
|
+
}
|
|
370
|
+
const v = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
371
|
+
function yt(t) {
|
|
372
|
+
const n = [t.title];
|
|
373
|
+
t.highlight && n.push(t.highlight);
|
|
374
|
+
for (const i of t.fields) n.push(`• ${i.label}: ${i.value}`);
|
|
375
|
+
return n.join(`
|
|
376
|
+
`);
|
|
377
|
+
}
|
|
378
|
+
function Lt(t) {
|
|
379
|
+
const n = t.fields.map((a) => `<li>${v(a.label)}: ${v(a.value)}</li>`).join(""), i = t.highlight ? `<p><strong>${v(t.highlight)}</strong></p>` : "";
|
|
380
|
+
return `<p><strong>${v(t.title)}</strong></p>${i}<ul>${n}</ul>`;
|
|
381
|
+
}
|
|
382
|
+
const L = 20, _ = L + 18, H = 22, nn = 10, wt = 22, st = 16, it = 12, en = 12, Tt = 34, Z = 9, q = (Tt + Z) * 2, an = 16, lt = mt, on = 6, R = L + G + on, X = F - L - R, ct = 13, Et = 14, It = 13, J = 16;
|
|
383
|
+
function rn(t) {
|
|
384
|
+
return t >= 4352 && t <= 4447 || // Hangul Jamo
|
|
385
|
+
t >= 11904 && t <= 42191 || // CJK radicals … Yi
|
|
386
|
+
t >= 44032 && t <= 55203 || // Hangul syllables
|
|
387
|
+
t >= 63744 && t <= 64255 || // CJK compatibility ideographs
|
|
388
|
+
t >= 65072 && t <= 65103 || // CJK compatibility forms
|
|
389
|
+
t >= 65280 && t <= 65376 || // full-width forms
|
|
390
|
+
t >= 65504 && t <= 65510;
|
|
391
|
+
}
|
|
392
|
+
function A(t, n) {
|
|
393
|
+
let i = 0;
|
|
394
|
+
for (const a of t)
|
|
395
|
+
i += rn(a.codePointAt(0) ?? 0) ? 1 : 0.62;
|
|
396
|
+
return i * n;
|
|
397
|
+
}
|
|
398
|
+
function sn(t, n, i) {
|
|
399
|
+
const a = [];
|
|
400
|
+
let o = "";
|
|
401
|
+
for (const r of t)
|
|
402
|
+
o && A(o + r, n) > i ? (a.push(o), o = r) : o += r;
|
|
403
|
+
return o && a.push(o), a.length ? a : [""];
|
|
404
|
+
}
|
|
405
|
+
function ut(t, n, i) {
|
|
406
|
+
const a = [];
|
|
407
|
+
let o = "";
|
|
408
|
+
const r = (e) => {
|
|
409
|
+
const c = sn(e, n, i);
|
|
410
|
+
for (let u = 0; u < c.length - 1; u += 1) a.push(c[u]);
|
|
411
|
+
o = c[c.length - 1];
|
|
412
|
+
};
|
|
413
|
+
for (const e of t.split(" ")) {
|
|
414
|
+
const c = o ? `${o} ${e}` : e;
|
|
415
|
+
o ? A(c, n) <= i ? o = c : (a.push(o), o = "", A(e, n) > i ? r(e) : o = e) : A(e, n) > i ? r(e) : o = e;
|
|
416
|
+
}
|
|
417
|
+
return o && a.push(o), a.length ? a : [""];
|
|
418
|
+
}
|
|
419
|
+
function Mt(t) {
|
|
420
|
+
const n = [];
|
|
421
|
+
let i = 0;
|
|
422
|
+
t.fields.forEach((r, e) => {
|
|
423
|
+
const c = e === 0 ? Et : It, d = A(`${r.label}: `, ct) + A(r.value, c) <= X ? [{ kind: "inline", text: "" }] : [
|
|
424
|
+
...ut(
|
|
425
|
+
`${r.label}:`,
|
|
426
|
+
ct,
|
|
427
|
+
X
|
|
428
|
+
).map((f) => ({ kind: "label", text: f })),
|
|
429
|
+
...ut(r.value, c, X).map(
|
|
430
|
+
(f) => ({ kind: "value", text: f })
|
|
431
|
+
)
|
|
432
|
+
];
|
|
433
|
+
n.push({ field: r, index: e, firstLineDy: i, lines: d }), i += wt + (d.length - 1) * J;
|
|
434
|
+
});
|
|
435
|
+
const a = n[n.length - 1], o = a ? a.firstLineDy + (a.lines.length - 1) * J : 0;
|
|
436
|
+
return { placements: n, endDy: o };
|
|
437
|
+
}
|
|
438
|
+
function nt(t, n) {
|
|
439
|
+
const i = n !== void 0 ? n : t.brand;
|
|
440
|
+
return typeof i == "string" ? i : !1;
|
|
441
|
+
}
|
|
442
|
+
function ln(t) {
|
|
443
|
+
if (typeof t.fraction == "number")
|
|
444
|
+
return Math.min(1, Math.max(0, t.fraction));
|
|
445
|
+
const n = parseFloat(t.value);
|
|
446
|
+
return Number.isFinite(n) && typeof t.max == "number" && t.max > 0 ? Math.min(1, Math.max(0, n / t.max)) : 1;
|
|
447
|
+
}
|
|
448
|
+
function _t(t, n) {
|
|
449
|
+
const i = !!t.highlight, a = _ + nn, o = (i ? a + H + st : _ + st) + wt - 6, r = o + Mt(t).endDy, e = t.gauge && Y(t.gauge), d = t.gauge && !Y(t.gauge) ? (i ? a : _) + q : 0, f = e ? r + an : null, b = f !== null ? f + Q : 0, k = Math.max(r, d, b), h = n ? k + it + en - 4 : k, $ = Math.round(h + (n ? it : L));
|
|
450
|
+
return {
|
|
451
|
+
hasChip: i,
|
|
452
|
+
chipY: a,
|
|
453
|
+
firstFieldY: o,
|
|
454
|
+
fieldsEndY: r,
|
|
455
|
+
bandedGaugeY: f,
|
|
456
|
+
footerY: h,
|
|
457
|
+
height: $
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
function At(t, n) {
|
|
461
|
+
return _t(t, n !== !1).height;
|
|
462
|
+
}
|
|
463
|
+
function cn(t, n, i, a, o) {
|
|
464
|
+
const r = Tt, e = 2 * Math.PI * r, c = ln(t), u = O(n, t.colorToken, n.accent), d = typeof t.segments == "number" && t.segments > 1 ? t.segments : 0, f = d ? 3 : 0, b = d ? e / d - f : e, k = d ? `${b} ${f}` : "", h = `${e * c} ${e}`, $ = `transform="rotate(-90 ${a} ${o})"`, l = v(
|
|
465
|
+
t.label ? `${t.value} — ${t.label}` : t.value
|
|
466
|
+
), T = `<circle cx="${a}" cy="${o}" r="${r}" fill="none" stroke="${n.border}" stroke-width="${Z}"${k ? ` stroke-dasharray="${k}"` : ""} ${$}/>`, y = `<circle cx="${a}" cy="${o}" r="${r}" fill="none" stroke="${u}" stroke-width="${Z}" stroke-linecap="round" stroke-dasharray="${h}" ${$}/>`, p = `<text x="${a}" y="${o + 1}" text-anchor="middle" dominant-baseline="middle" font-family="${i}" font-size="16" font-weight="700" fill="${n.fg}">${v(
|
|
467
|
+
t.value
|
|
468
|
+
)}</text>`, E = t.label ? `<text x="${a}" y="${o + 15}" text-anchor="middle" dominant-baseline="middle" font-family="${i}" font-size="9" fill="${n.muted}">${v(
|
|
469
|
+
t.label
|
|
470
|
+
)}</text>` : "";
|
|
471
|
+
return `<g role="img" aria-label="${l}"><title>${l}</title>${T}${y}${p}${E}</g>`;
|
|
472
|
+
}
|
|
473
|
+
function un(t, n, i, a) {
|
|
474
|
+
const o = L - V, r = i - 2 * o, e = pt(
|
|
475
|
+
{
|
|
476
|
+
value: t.value,
|
|
477
|
+
bands: t.bands,
|
|
478
|
+
min: t.min,
|
|
479
|
+
max: t.max,
|
|
480
|
+
valueLabel: t.valueLabel,
|
|
481
|
+
categoryLabel: t.categoryLabel,
|
|
482
|
+
rangeLabel: t.rangeLabel,
|
|
483
|
+
ariaLabel: t.ariaLabel,
|
|
484
|
+
ticks: t.ticks
|
|
485
|
+
},
|
|
486
|
+
{ width: r, height: Q }
|
|
487
|
+
), c = jt(e, {
|
|
488
|
+
resolve: (u) => O(n, u, n.accent),
|
|
489
|
+
// Raw theme font — buildBandedGaugeSvgString escapes it once. Passing the
|
|
490
|
+
// card's already-escaped `font` here would double-escape and break it.
|
|
491
|
+
font: n.font,
|
|
492
|
+
fg: n.fg,
|
|
493
|
+
muted: n.muted,
|
|
494
|
+
track: n.border
|
|
495
|
+
});
|
|
496
|
+
return `<g transform="translate(${o} ${a})">${c}</g>`;
|
|
497
|
+
}
|
|
498
|
+
function dt(t) {
|
|
499
|
+
const n = t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
|
|
500
|
+
return n ? [Number(n[1]), Number(n[2]), Number(n[3])] : null;
|
|
501
|
+
}
|
|
502
|
+
function ft([t, n, i]) {
|
|
503
|
+
const a = (o) => {
|
|
504
|
+
const r = o / 255;
|
|
505
|
+
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
506
|
+
};
|
|
507
|
+
return 0.2126 * a(t) + 0.7152 * a(n) + 0.0722 * a(i);
|
|
508
|
+
}
|
|
509
|
+
function dn(t, n) {
|
|
510
|
+
const i = dt(t), a = dt(n);
|
|
511
|
+
if (!i || !a) return 0;
|
|
512
|
+
const o = ft(i), r = ft(a);
|
|
513
|
+
return (Math.max(o, r) + 0.05) / (Math.min(o, r) + 0.05);
|
|
514
|
+
}
|
|
515
|
+
function fn(t, n, i, a) {
|
|
516
|
+
const o = t.highlight, r = t.highlightToken ?? tt, e = O(n, r, n.accent), c = dn(n.bg, e) >= 3 ? n.bg : n.fg, u = Math.round(o.length * 7.2 + 28), d = L + u / 2, f = a + H / 2 + 1;
|
|
517
|
+
return `<rect x="${L}" y="${a}" width="${u}" height="${H}" rx="${H / 2}" fill="${e}"/><text x="${d}" y="${f}" text-anchor="middle" dominant-baseline="middle" font-family="${i}" font-size="12" font-weight="600" fill="${c}">${v(
|
|
518
|
+
o
|
|
519
|
+
)}</text>`;
|
|
520
|
+
}
|
|
521
|
+
function et(t, n, i = !1) {
|
|
522
|
+
const a = F, o = _t(t, i !== !1), r = o.height, e = v(n.font), c = kt(t), u = O(n, c, n.accent), d = t.icon ? rt(
|
|
523
|
+
t.icon,
|
|
524
|
+
u,
|
|
525
|
+
a - L - lt,
|
|
526
|
+
_ - lt + 2,
|
|
527
|
+
mt
|
|
528
|
+
) : "", { placements: f } = Mt(t), b = f.map((p) => {
|
|
529
|
+
const E = o.firstFieldY + p.firstLineDy, w = p.index === 0, B = w ? Et : It, S = w ? 700 : 500, D = w ? u : n.fg, m = E - 4;
|
|
530
|
+
let x;
|
|
531
|
+
p.field.icon && xt(p.field.icon) ? x = rt(
|
|
532
|
+
p.field.icon,
|
|
533
|
+
u,
|
|
534
|
+
L,
|
|
535
|
+
m - G / 2,
|
|
536
|
+
G
|
|
537
|
+
) : x = `<circle cx="${L + G / 2}" cy="${m}" r="2" fill="${n.muted}"/>`;
|
|
538
|
+
const C = p.lines.map((I, U) => {
|
|
539
|
+
const z = E + U * J;
|
|
540
|
+
return I.kind === "inline" ? `<text x="${R}" y="${z}" font-family="${e}" font-size="13"><tspan fill="${n.muted}">${v(
|
|
541
|
+
p.field.label
|
|
542
|
+
)}: </tspan><tspan font-size="${B}" font-weight="${S}" fill="${D}">${v(
|
|
543
|
+
p.field.value
|
|
544
|
+
)}</tspan></text>` : I.kind === "label" ? `<text x="${R}" y="${z}" font-family="${e}" font-size="13" fill="${n.muted}">${v(
|
|
545
|
+
I.text
|
|
546
|
+
)}</text>` : `<text x="${R}" y="${z}" font-family="${e}" font-size="${B}" font-weight="${S}" fill="${D}">${v(
|
|
547
|
+
I.text
|
|
548
|
+
)}</text>`;
|
|
549
|
+
}).join("");
|
|
550
|
+
return `${x}${C}`;
|
|
551
|
+
}).join(""), k = o.hasChip ? fn(t, n, e, o.chipY) : "";
|
|
552
|
+
let h = "";
|
|
553
|
+
t.gauge && (Y(t.gauge) && o.bandedGaugeY !== null ? h = un(t.gauge, n, a, o.bandedGaugeY) : Y(t.gauge) || (h = cn(
|
|
554
|
+
t.gauge,
|
|
555
|
+
n,
|
|
556
|
+
e,
|
|
557
|
+
a - L - q / 2,
|
|
558
|
+
(o.hasChip ? o.chipY : _) + q / 2
|
|
559
|
+
)));
|
|
560
|
+
const $ = i !== !1 ? `<text x="${L}" y="${o.footerY}" font-family="${e}" font-size="10" font-weight="500" fill="${n.muted}">${v(
|
|
561
|
+
i
|
|
562
|
+
)}</text>` : "", l = `<text x="${L}" y="${_}" font-family="${e}" font-size="16" font-weight="700" fill="${n.fg}">${v(
|
|
563
|
+
t.title
|
|
564
|
+
)}</text>`, T = `<rect x="0.5" y="0.5" width="${a - 1}" height="${r - 1}" rx="12" fill="${n.bg}"/>`, y = `<rect x="0.5" y="0.5" width="${a - 1}" height="${r - 1}" rx="12" fill="none" stroke="${n.border}"/>`;
|
|
565
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${r}" viewBox="0 0 ${a} ${r}" role="img" aria-label="${v(
|
|
566
|
+
t.title
|
|
567
|
+
)}">${T}${l}${d}${k}${h}${b}${$}${y}</svg>`;
|
|
568
|
+
}
|
|
569
|
+
function $n() {
|
|
570
|
+
var t;
|
|
571
|
+
return typeof navigator < "u" && typeof ((t = navigator.clipboard) == null ? void 0 : t.write) == "function" && typeof ClipboardItem < "u";
|
|
572
|
+
}
|
|
573
|
+
function Bt(t, n, i) {
|
|
574
|
+
return new Promise((a, o) => {
|
|
575
|
+
const r = new Image();
|
|
576
|
+
r.decoding = "async", r.onload = () => {
|
|
577
|
+
const e = document.createElement("canvas");
|
|
578
|
+
e.width = n, e.height = i;
|
|
579
|
+
const c = e.getContext("2d");
|
|
580
|
+
if (!c) {
|
|
581
|
+
o(new Error("2D canvas context unavailable"));
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
c.drawImage(r, 0, 0, n, i), e.toBlob((u) => {
|
|
585
|
+
u ? a(u) : o(new Error("canvas.toBlob produced no PNG"));
|
|
586
|
+
}, "image/png");
|
|
587
|
+
}, r.onerror = () => o(new Error("SVG failed to decode as an image")), r.src = t;
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
function Ct() {
|
|
591
|
+
const t = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : 1;
|
|
592
|
+
return Math.max(2, t);
|
|
593
|
+
}
|
|
594
|
+
async function _n(t, n = {}) {
|
|
595
|
+
return (await Yt(t, n)).dataUri;
|
|
596
|
+
}
|
|
597
|
+
async function Yt(t, n = {}) {
|
|
598
|
+
const { colours: i, scale: a = Ct() } = n, o = i ?? K(null), r = nt(t, n.brand), e = et(t, o, r), c = `data:image/svg+xml,${encodeURIComponent(e)}`, u = F, d = At(t, r), f = await Bt(
|
|
599
|
+
c,
|
|
600
|
+
Math.round(u * a),
|
|
601
|
+
Math.round(d * a)
|
|
602
|
+
);
|
|
603
|
+
return { dataUri: await hn(f), width: u, height: d };
|
|
604
|
+
}
|
|
605
|
+
function hn(t) {
|
|
606
|
+
return new Promise((n, i) => {
|
|
607
|
+
const a = new FileReader();
|
|
608
|
+
a.onload = () => n(String(a.result)), a.onerror = () => i(a.error ?? new Error("FileReader error")), a.readAsDataURL(t);
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
async function pn(t, n, i) {
|
|
612
|
+
const a = yt(n), o = new Blob([a], { type: "text/plain" });
|
|
613
|
+
if (t === "text")
|
|
614
|
+
return new ClipboardItem({ "text/plain": o });
|
|
615
|
+
const r = nt(n, void 0), e = et(n, i, r), c = `data:image/svg+xml,${encodeURIComponent(e)}`, u = Ct(), d = await Bt(
|
|
616
|
+
c,
|
|
617
|
+
Math.round(F * u),
|
|
618
|
+
Math.round(At(n, r) * u)
|
|
619
|
+
);
|
|
620
|
+
if (t === "image")
|
|
621
|
+
return new ClipboardItem({ "image/png": d, "text/plain": o });
|
|
622
|
+
const f = new Blob([Lt(n)], { type: "text/html" });
|
|
623
|
+
return new ClipboardItem({
|
|
624
|
+
"text/html": f,
|
|
625
|
+
"image/png": d,
|
|
626
|
+
"text/plain": o
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
const bn = Nt(
|
|
630
|
+
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
631
|
+
{
|
|
632
|
+
variants: {
|
|
633
|
+
variant: {
|
|
634
|
+
insert: "",
|
|
635
|
+
copy: ""
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
defaultVariants: { variant: "insert" }
|
|
639
|
+
}
|
|
640
|
+
), mn = ["text", "image", "text-image"], gn = {
|
|
641
|
+
text: /* @__PURE__ */ g(Ot, { "aria-hidden": !0 }),
|
|
642
|
+
image: /* @__PURE__ */ g(Rt, { "aria-hidden": !0 }),
|
|
643
|
+
"text-image": /* @__PURE__ */ g(Ht, { "aria-hidden": !0 })
|
|
644
|
+
}, $t = {
|
|
645
|
+
insert: {
|
|
646
|
+
text: "insert.text",
|
|
647
|
+
image: "insert.image",
|
|
648
|
+
"text-image": "insert.textImage"
|
|
649
|
+
},
|
|
650
|
+
copy: {
|
|
651
|
+
text: "insert.copyText",
|
|
652
|
+
image: "insert.copyImage",
|
|
653
|
+
"text-image": "insert.copyTextImage"
|
|
654
|
+
}
|
|
655
|
+
}, xn = ht(
|
|
656
|
+
function({
|
|
657
|
+
card: n,
|
|
658
|
+
variant: i = "insert",
|
|
659
|
+
onInsert: a,
|
|
660
|
+
onCopy: o,
|
|
661
|
+
onError: r,
|
|
662
|
+
size: e = "sm",
|
|
663
|
+
intent: c = "primary"
|
|
664
|
+
}, u) {
|
|
665
|
+
const { t: d } = Dt(), f = St(null), b = (l) => {
|
|
666
|
+
const T = yt(n), y = Lt(n);
|
|
667
|
+
let p = "", E = "";
|
|
668
|
+
const w = l === "text" ? null : K(f.current, W(n));
|
|
669
|
+
return w && (p = et(n, w, nt(n, void 0)), E = `data:image/svg+xml,${encodeURIComponent(p)}`), { mode: l, text: T, html: y, svg: p, imageDataUri: E, pngDataUri: () => w ? Yt(n, { colours: w }) : Promise.resolve({ dataUri: "", width: 0, height: 0 }) };
|
|
670
|
+
}, $ = i === "copy" ? (l) => {
|
|
671
|
+
if (!$n()) {
|
|
672
|
+
r == null || r(new Error("Clipboard write unavailable in this context"));
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const T = K(
|
|
676
|
+
f.current,
|
|
677
|
+
W(n)
|
|
678
|
+
);
|
|
679
|
+
(async () => {
|
|
680
|
+
try {
|
|
681
|
+
const y = await pn(l, n, T);
|
|
682
|
+
await navigator.clipboard.write([y]), o == null || o(l);
|
|
683
|
+
} catch (y) {
|
|
684
|
+
r == null || r(y);
|
|
685
|
+
}
|
|
686
|
+
})();
|
|
687
|
+
} : (l) => {
|
|
688
|
+
a == null || a(b(l));
|
|
689
|
+
};
|
|
690
|
+
return /* @__PURE__ */ P(
|
|
691
|
+
"div",
|
|
692
|
+
{
|
|
693
|
+
ref: u,
|
|
694
|
+
"data-component": "insert-result",
|
|
695
|
+
"data-variant": i,
|
|
696
|
+
className: bn({ variant: i }),
|
|
697
|
+
children: [
|
|
698
|
+
/* @__PURE__ */ P("span", { ref: f, "aria-hidden": !0, className: "ds:sr-only", children: [
|
|
699
|
+
Qt.map((l) => /* @__PURE__ */ g(
|
|
700
|
+
"span",
|
|
701
|
+
{
|
|
702
|
+
"data-k": l,
|
|
703
|
+
className: l === "fg" ? "ds:text-foreground" : l === "muted" ? "ds:text-muted-foreground" : l === "accent" ? "ds:text-[color:var(--primary)]" : l === "border" ? "ds:text-[color:var(--border)]" : "ds:text-[color:var(--card)]"
|
|
704
|
+
},
|
|
705
|
+
l
|
|
706
|
+
)),
|
|
707
|
+
W(n).map((l) => /* @__PURE__ */ g(
|
|
708
|
+
"span",
|
|
709
|
+
{
|
|
710
|
+
"data-token": vt(l),
|
|
711
|
+
className: tn(l)
|
|
712
|
+
},
|
|
713
|
+
l
|
|
714
|
+
))
|
|
715
|
+
] }),
|
|
716
|
+
mn.map((l) => /* @__PURE__ */ g(
|
|
717
|
+
Gt,
|
|
718
|
+
{
|
|
719
|
+
type: "button",
|
|
720
|
+
intent: c,
|
|
721
|
+
size: e,
|
|
722
|
+
startIcon: gn[l],
|
|
723
|
+
"aria-label": d($t[i][l]),
|
|
724
|
+
onClick: () => $(l),
|
|
725
|
+
children: d($t[i][l])
|
|
726
|
+
},
|
|
727
|
+
l
|
|
728
|
+
))
|
|
729
|
+
]
|
|
730
|
+
}
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
xn.displayName = "InsertButton";
|
|
735
|
+
export {
|
|
736
|
+
qt as B,
|
|
737
|
+
xn as I,
|
|
738
|
+
_n as a,
|
|
739
|
+
Mn as b,
|
|
740
|
+
Yt as s
|
|
741
|
+
};
|
|
742
|
+
//# sourceMappingURL=insert-result-njqBthzT.js.map
|