@alfadocs/ui-kit 0.44.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{alia-sidebar-BpX4z_af.js → alia-sidebar-Be8FhKYd.js} +332 -237
- package/dist/_chunks/{autocomplete-DIgdhCGJ.js → autocomplete-CDqxB68B.js} +2 -2
- package/dist/_chunks/bmi-calculator-CQqXTVNL.js +258 -0
- package/dist/_chunks/{booking-CtLwaxkK.js → booking-DlDVuWMd.js} +2 -2
- package/dist/_chunks/{cycle-calculator-ChHBcjet.js → cycle-calculator-KxA8dqDf.js} +31 -20
- package/dist/_chunks/{due-date-calculator-CYXKLoof.js → due-date-calculator-mFxpHLml.js} +51 -39
- package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js → editable-currency-cell-renderer-BEBUQl9P.js} +2 -2
- package/dist/_chunks/{freemium-paywall-BLXESpH4.js → freemium-paywall-DzpD63WY.js} +2 -2
- package/dist/_chunks/{gestational-age-calculator-sRmoqgVr.js → gestational-age-calculator-gWI_uRA1.js} +52 -39
- package/dist/_chunks/insert-result-C5ABnzDl.js +711 -0
- package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js → marketplace-app-shell-Gfsf78ge.js} +2 -2
- package/dist/_chunks/{patient-search-DPe2ZYEL.js → patient-search-CocVcGJ3.js} +2 -2
- package/dist/_chunks/payment-form-BNTx4876.js +671 -0
- package/dist/_chunks/{pdf-viewer-B6MC6VTx.js → pdf-viewer-CWEXTlwq.js} +2 -2
- package/dist/_chunks/{practice-results-CrLpEiiW.js → practice-results-DDi-kvaD.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-C5YhfYnL.js → pregnancy-weight-gain-BtEHaSqy.js} +26 -13
- package/dist/_chunks/{search-bar-CP6wUJFY.js → search-bar-CvN_S0jW.js} +2 -2
- package/dist/_chunks/{search-input-C1C3jQpD.js → search-input-D3aMvi4l.js} +2 -2
- package/dist/_chunks/{sign-document-B-3k_0LO.js → sign-document-BCyLpFHJ.js} +2 -2
- package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js → sign-in-with-alfadocs-button-CuYn_kKP.js} +2 -2
- package/dist/_chunks/{social-sign-in-button-X54ySJr1.js → social-sign-in-button-uJYLM366.js} +2 -2
- package/dist/_chunks/{spinner-CCByyvcb.js → spinner-OjQNn8oN.js} +7 -3
- package/dist/_chunks/{transcript-panel-CR7VY1uw.js → transcript-panel-B4HiC7ed.js} +2 -2
- package/dist/_chunks/{unit-converter-Ds9jalbN.js → unit-converter-u3CwNDpP.js} +63 -52
- package/dist/_chunks/{wallet-pay-button-DK4ESYge.js → wallet-pay-button-DuDPBlCO.js} +2 -2
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/banded-gauge.d.ts +193 -0
- package/dist/components/_shared/insert-result.d.ts +81 -8
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/bmi-calculator/bmi-calculator.d.ts +2 -2
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/cycle-calculator/cycle-calculator.d.ts +2 -2
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/due-date-calculator/due-date-calculator.d.ts +2 -2
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +2 -2
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/payment-form/payment-form.d.ts +30 -2
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +2 -2
- package/dist/components/search-bar/index.js +1 -1
- package/dist/components/search-input/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
- package/dist/components/social-sign-in-button/index.js +1 -1
- package/dist/components/spinner/index.js +1 -1
- package/dist/components/spinner/spinner.d.ts +2 -2
- package/dist/components/transcript-panel/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/unit-converter/unit-converter.d.ts +2 -2
- package/dist/components/wallet-pay-button/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/de.d.ts +1 -1
- package/dist/i18n/locales/de.js +1 -1
- package/dist/i18n/locales/el.d.ts +1 -1
- package/dist/i18n/locales/el.js +1 -1
- package/dist/i18n/locales/en.d.ts +1 -1
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/es.d.ts +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -1
- package/dist/i18n/locales/fr.js +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -1
- package/dist/i18n/locales/hi.js +1 -1
- package/dist/i18n/locales/it.d.ts +1 -1
- package/dist/i18n/locales/it.js +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -1
- package/dist/i18n/locales/ja.js +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -1
- package/dist/i18n/locales/nl.js +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -1
- package/dist/i18n/locales/pl.js +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -1
- package/dist/i18n/locales/pt.js +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -1
- package/dist/i18n/locales/ro.js +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -1
- package/dist/i18n/locales/ru.js +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -1
- package/dist/i18n/locales/sq.js +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -1
- package/dist/i18n/locales/sv.js +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -1
- package/dist/i18n/locales/tr.js +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -1
- package/dist/i18n/locales/zh.js +1 -1
- package/dist/index.js +25 -25
- package/dist/locales/ar.json +1 -1
- package/dist/locales/de.json +1 -1
- package/dist/locales/el.json +1 -1
- package/dist/locales/en.json +1 -1
- package/dist/locales/es.json +1 -1
- package/dist/locales/fr.json +1 -1
- package/dist/locales/hi.json +1 -1
- package/dist/locales/it.json +1 -1
- package/dist/locales/ja.json +1 -1
- package/dist/locales/nl.json +1 -1
- package/dist/locales/pl.json +1 -1
- package/dist/locales/pt.json +1 -1
- package/dist/locales/ro.json +1 -1
- package/dist/locales/ru.json +1 -1
- package/dist/locales/sq.json +1 -1
- package/dist/locales/sv.json +1 -1
- package/dist/locales/tr.json +1 -1
- package/dist/locales/zh.json +1 -1
- package/dist/patterns/alia-assistant/alia-types.d.ts +20 -0
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/bmi-calculator-DFPWL2OJ.js +0 -273
- package/dist/_chunks/insert-result-CoC1oo6R.js +0 -334
- package/dist/_chunks/payment-form-BzVsG6Ks.js +0 -590
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
import { jsxs as G, jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as it, useRef as Tt } from "react";
|
|
3
|
+
import { useTranslation as Mt } from "react-i18next";
|
|
4
|
+
import { c as It } from "./index-D2ZczOXr.js";
|
|
5
|
+
import { B as At } from "./button-DD_0Xdmr.js";
|
|
6
|
+
import { c as lt } from "./createLucideIcon-CrFbzy84.js";
|
|
7
|
+
import { I as Ct } from "./image-C6RM5hfF.js";
|
|
8
|
+
/**
|
|
9
|
+
* @license lucide-react v1.8.0 - ISC
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the ISC license.
|
|
12
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
const Bt = [
|
|
15
|
+
[
|
|
16
|
+
"path",
|
|
17
|
+
{
|
|
18
|
+
d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
|
|
19
|
+
key: "zw3jo"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"path",
|
|
24
|
+
{
|
|
25
|
+
d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
|
|
26
|
+
key: "1wduqc"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"path",
|
|
31
|
+
{
|
|
32
|
+
d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
|
|
33
|
+
key: "kqbvx6"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
], Et = lt("layers", Bt);
|
|
37
|
+
/**
|
|
38
|
+
* @license lucide-react v1.8.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/
|
|
43
|
+
const _t = [
|
|
44
|
+
["path", { d: "M12 4v16", key: "1654pz" }],
|
|
45
|
+
["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
|
|
46
|
+
["path", { d: "M9 20h6", key: "s66wpe" }]
|
|
47
|
+
], St = lt("type", _t), Yt = 15, J = 40, Nt = [18.5, 25, 30];
|
|
48
|
+
function bn() {
|
|
49
|
+
return {
|
|
50
|
+
bands: [
|
|
51
|
+
{ upTo: 18.5, colorToken: "--info" },
|
|
52
|
+
{ upTo: 25, colorToken: "--success" },
|
|
53
|
+
{ upTo: 30, colorToken: "--warning-readable" },
|
|
54
|
+
{ upTo: J, colorToken: "--destructive" }
|
|
55
|
+
],
|
|
56
|
+
min: Yt,
|
|
57
|
+
max: J,
|
|
58
|
+
ticks: [...Nt]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const P = 14, U = 12, Gt = U / 2, Q = 18, Ht = 12, Rt = 16;
|
|
62
|
+
function S(t, n, i, a, r) {
|
|
63
|
+
if (i <= n) return a;
|
|
64
|
+
const s = (t - n) / (i - n);
|
|
65
|
+
return a + s * (r - a);
|
|
66
|
+
}
|
|
67
|
+
function ct(t, { width: n, height: i }) {
|
|
68
|
+
const a = P, r = n - P, s = Q + Ht, e = Q, c = s + U + Rt;
|
|
69
|
+
let u = t.min;
|
|
70
|
+
const d = t.bands.map((l) => {
|
|
71
|
+
const L = Math.max(t.min, Math.min(u, t.max)), y = Math.max(t.min, Math.min(l.upTo, t.max));
|
|
72
|
+
u = l.upTo;
|
|
73
|
+
const b = S(L, t.min, t.max, a, r), T = S(y, t.min, t.max, a, r);
|
|
74
|
+
return { x: b, w: Math.max(0, T - b), colorToken: l.colorToken };
|
|
75
|
+
}), f = S(t.value, t.min, t.max, a, r), p = t.value < t.min ? "start" : t.value > t.max ? "end" : null, v = Math.min(r, Math.max(a, f)), h = (t.ticks ?? []).filter((l) => l >= t.min && l <= t.max).map((l) => ({
|
|
76
|
+
x: S(l, t.min, t.max, a, r),
|
|
77
|
+
value: l
|
|
78
|
+
})), $ = t.categoryLabel ? t.rangeLabel ? `${t.categoryLabel} (${t.rangeLabel})` : t.categoryLabel : "";
|
|
79
|
+
return {
|
|
80
|
+
width: n,
|
|
81
|
+
height: i,
|
|
82
|
+
barStart: a,
|
|
83
|
+
barEnd: r,
|
|
84
|
+
barY: s,
|
|
85
|
+
barH: U,
|
|
86
|
+
barRadius: Gt,
|
|
87
|
+
bands: d,
|
|
88
|
+
marker: {
|
|
89
|
+
x: v,
|
|
90
|
+
clampedStart: a,
|
|
91
|
+
clampedEnd: r,
|
|
92
|
+
overflow: p
|
|
93
|
+
},
|
|
94
|
+
ticks: h,
|
|
95
|
+
valueLabelY: e,
|
|
96
|
+
tickLabelY: c,
|
|
97
|
+
valueLabel: t.valueLabel,
|
|
98
|
+
summaryLabel: $,
|
|
99
|
+
ariaLabel: t.ariaLabel
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const o = (t) => Math.round(t * 100) / 100, C = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
103
|
+
function ut(t, n, i, a, r, s) {
|
|
104
|
+
const e = t + i, c = n + a, u = s > 0 ? `A${s} ${s} 0 0 1 ${o(e)} ${o(n + s)}` : "", d = s > 0 ? `A${s} ${s} 0 0 1 ${o(e - s)} ${o(c)}` : "", f = r > 0 ? `A${r} ${r} 0 0 1 ${o(t)} ${o(c - r)}` : "", p = r > 0 ? `A${r} ${r} 0 0 1 ${o(t + r)} ${o(n)}` : "";
|
|
105
|
+
return `M${o(t + r)} ${o(n)} H${o(e - s)} ${u} V${o(
|
|
106
|
+
c - s
|
|
107
|
+
)} ${d} H${o(t + r)} ${f} V${o(n + r)} ${p} Z`;
|
|
108
|
+
}
|
|
109
|
+
function Dt(t, n) {
|
|
110
|
+
const { resolve: i, font: a, fg: r, muted: s, track: e } = n, c = C(a), u = `<rect x="${o(t.barStart)}" y="${o(
|
|
111
|
+
t.barY
|
|
112
|
+
)}" width="${o(t.barEnd - t.barStart)}" height="${t.barH}" rx="${t.barRadius}" fill="${e}"/>`, d = t.bands.length, f = t.bands.map((m, g) => {
|
|
113
|
+
const I = i(m.colorToken), _ = g === 0 ? t.barRadius : 0, Lt = g === d - 1 ? t.barRadius : 0;
|
|
114
|
+
return `<path d="${ut(
|
|
115
|
+
m.x,
|
|
116
|
+
t.barY,
|
|
117
|
+
m.w,
|
|
118
|
+
t.barH,
|
|
119
|
+
_,
|
|
120
|
+
Lt
|
|
121
|
+
)}" fill="${I}"/>`;
|
|
122
|
+
}).join(""), p = t.barY + t.barH, v = p + 4, h = t.ticks.map((m) => {
|
|
123
|
+
const g = `<line x1="${o(m.x)}" y1="${o(p)}" x2="${o(
|
|
124
|
+
m.x
|
|
125
|
+
)}" y2="${o(v)}" stroke="${e}" stroke-width="1"/>`, I = `<text x="${o(
|
|
126
|
+
m.x
|
|
127
|
+
)}" y="${o(t.tickLabelY)}" text-anchor="middle" font-family="${c}" font-size="9" fill="${s}">${C(
|
|
128
|
+
String(m.value)
|
|
129
|
+
)}</text>`;
|
|
130
|
+
return g + I;
|
|
131
|
+
}).join(""), $ = o(t.marker.x), l = t.barY - 3, L = t.barY + t.barH + 3, y = `<line x1="${$}" y1="${o(l)}" x2="${$}" y2="${o(
|
|
132
|
+
L
|
|
133
|
+
)}" stroke="${r}" stroke-width="2" stroke-linecap="round"/>`, b = t.barY - 4, T = `<polygon points="${$},${o(t.barY + 1)} ${o(
|
|
134
|
+
t.marker.x - 4
|
|
135
|
+
)},${o(b)} ${o(t.marker.x + 4)},${o(b)}" fill="${r}"/>`;
|
|
136
|
+
let M = "";
|
|
137
|
+
if (t.marker.overflow) {
|
|
138
|
+
const m = t.barY + t.barH / 2;
|
|
139
|
+
if (t.marker.overflow === "start") {
|
|
140
|
+
const g = t.barStart - 2;
|
|
141
|
+
M = `<polyline points="${o(g + 5)},${o(m - 4)} ${o(
|
|
142
|
+
g
|
|
143
|
+
)},${o(m)} ${o(g + 5)},${o(
|
|
144
|
+
m + 4
|
|
145
|
+
)}" fill="none" stroke="${r}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`;
|
|
146
|
+
} else {
|
|
147
|
+
const g = t.barEnd + 2;
|
|
148
|
+
M = `<polyline points="${o(g - 5)},${o(m - 4)} ${o(
|
|
149
|
+
g
|
|
150
|
+
)},${o(m)} ${o(g - 5)},${o(
|
|
151
|
+
m + 4
|
|
152
|
+
)}" fill="none" stroke="${r}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const A = `<text x="${o(
|
|
156
|
+
t.barStart
|
|
157
|
+
)}" y="${o(t.valueLabelY)}" font-family="${c}" font-size="13" font-weight="700" fill="${r}">${C(
|
|
158
|
+
t.valueLabel
|
|
159
|
+
)}</text>`, R = t.summaryLabel ? `<text x="${o(t.barEnd)}" y="${o(
|
|
160
|
+
t.valueLabelY
|
|
161
|
+
)}" text-anchor="end" font-family="${c}" font-size="10" fill="${s}">${C(
|
|
162
|
+
t.summaryLabel
|
|
163
|
+
)}</text>` : "", D = `<title>${C(t.ariaLabel)}</title>`;
|
|
164
|
+
return `<g role="img" aria-label="${C(
|
|
165
|
+
t.ariaLabel
|
|
166
|
+
)}">${D}${u}${f}${h}${y}${T}${M}${A}${R}</g>`;
|
|
167
|
+
}
|
|
168
|
+
const Ot = 260, V = 64;
|
|
169
|
+
function Pt(t) {
|
|
170
|
+
return `var(${t})`;
|
|
171
|
+
}
|
|
172
|
+
const Ut = it(
|
|
173
|
+
function({ model: n, width: i = Ot, height: a = V, className: r }, s) {
|
|
174
|
+
const e = ct(n, { width: i, height: a }), c = e.barY + e.barH, u = c + 4, d = e.barY - 3, f = e.barY + e.barH + 3, p = e.barY - 4, v = e.bands.length, h = e.barY + e.barH / 2;
|
|
175
|
+
return /* @__PURE__ */ G(
|
|
176
|
+
"svg",
|
|
177
|
+
{
|
|
178
|
+
ref: s,
|
|
179
|
+
"data-component": "banded-gauge",
|
|
180
|
+
direction: "ltr",
|
|
181
|
+
role: "img",
|
|
182
|
+
"aria-label": e.ariaLabel,
|
|
183
|
+
width: i,
|
|
184
|
+
height: a,
|
|
185
|
+
viewBox: `0 0 ${i} ${a}`,
|
|
186
|
+
className: ["ds:[font-family:var(--font-sans)]", r].filter(Boolean).join(" "),
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ x("title", { children: e.ariaLabel }),
|
|
189
|
+
/* @__PURE__ */ x(
|
|
190
|
+
"rect",
|
|
191
|
+
{
|
|
192
|
+
x: o(e.barStart),
|
|
193
|
+
y: o(e.barY),
|
|
194
|
+
width: o(e.barEnd - e.barStart),
|
|
195
|
+
height: e.barH,
|
|
196
|
+
rx: e.barRadius,
|
|
197
|
+
className: "ds:fill-[color:var(--muted)]"
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
e.bands.map(($, l) => /* @__PURE__ */ x(
|
|
201
|
+
"path",
|
|
202
|
+
{
|
|
203
|
+
d: ut(
|
|
204
|
+
$.x,
|
|
205
|
+
e.barY,
|
|
206
|
+
$.w,
|
|
207
|
+
e.barH,
|
|
208
|
+
l === 0 ? e.barRadius : 0,
|
|
209
|
+
l === v - 1 ? e.barRadius : 0
|
|
210
|
+
),
|
|
211
|
+
fill: Pt($.colorToken)
|
|
212
|
+
},
|
|
213
|
+
`${$.colorToken}-${l}`
|
|
214
|
+
)),
|
|
215
|
+
e.ticks.map(($) => /* @__PURE__ */ G("g", { children: [
|
|
216
|
+
/* @__PURE__ */ x(
|
|
217
|
+
"line",
|
|
218
|
+
{
|
|
219
|
+
x1: o($.x),
|
|
220
|
+
y1: o(c),
|
|
221
|
+
x2: o($.x),
|
|
222
|
+
y2: o(u),
|
|
223
|
+
strokeWidth: 1,
|
|
224
|
+
className: "ds:stroke-[color:var(--border)]"
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
/* @__PURE__ */ x(
|
|
228
|
+
"text",
|
|
229
|
+
{
|
|
230
|
+
x: o($.x),
|
|
231
|
+
y: o(e.tickLabelY),
|
|
232
|
+
textAnchor: "middle",
|
|
233
|
+
fontSize: 9,
|
|
234
|
+
className: "ds:fill-[color:var(--muted-foreground)]",
|
|
235
|
+
children: $.value
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
] }, $.value)),
|
|
239
|
+
/* @__PURE__ */ x(
|
|
240
|
+
"line",
|
|
241
|
+
{
|
|
242
|
+
x1: o(e.marker.x),
|
|
243
|
+
y1: o(d),
|
|
244
|
+
x2: o(e.marker.x),
|
|
245
|
+
y2: o(f),
|
|
246
|
+
strokeWidth: 2,
|
|
247
|
+
strokeLinecap: "round",
|
|
248
|
+
className: "ds:stroke-[color:var(--foreground)]"
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
/* @__PURE__ */ x(
|
|
252
|
+
"polygon",
|
|
253
|
+
{
|
|
254
|
+
points: `${o(e.marker.x)},${o(e.barY + 1)} ${o(
|
|
255
|
+
e.marker.x - 4
|
|
256
|
+
)},${o(p)} ${o(e.marker.x + 4)},${o(p)}`,
|
|
257
|
+
className: "ds:fill-[color:var(--foreground)]"
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
e.marker.overflow === "start" ? /* @__PURE__ */ x(
|
|
261
|
+
"polyline",
|
|
262
|
+
{
|
|
263
|
+
points: `${o(e.barStart + 3)},${o(h - 4)} ${o(
|
|
264
|
+
e.barStart - 2
|
|
265
|
+
)},${o(h)} ${o(e.barStart + 3)},${o(h + 4)}`,
|
|
266
|
+
fill: "none",
|
|
267
|
+
strokeWidth: 2,
|
|
268
|
+
strokeLinecap: "round",
|
|
269
|
+
strokeLinejoin: "round",
|
|
270
|
+
className: "ds:stroke-[color:var(--foreground)]"
|
|
271
|
+
}
|
|
272
|
+
) : null,
|
|
273
|
+
e.marker.overflow === "end" ? /* @__PURE__ */ x(
|
|
274
|
+
"polyline",
|
|
275
|
+
{
|
|
276
|
+
points: `${o(e.barEnd - 3)},${o(h - 4)} ${o(
|
|
277
|
+
e.barEnd + 2
|
|
278
|
+
)},${o(h)} ${o(e.barEnd - 3)},${o(h + 4)}`,
|
|
279
|
+
fill: "none",
|
|
280
|
+
strokeWidth: 2,
|
|
281
|
+
strokeLinecap: "round",
|
|
282
|
+
strokeLinejoin: "round",
|
|
283
|
+
className: "ds:stroke-[color:var(--foreground)]"
|
|
284
|
+
}
|
|
285
|
+
) : null,
|
|
286
|
+
/* @__PURE__ */ x(
|
|
287
|
+
"text",
|
|
288
|
+
{
|
|
289
|
+
x: o(e.barStart),
|
|
290
|
+
y: o(e.valueLabelY),
|
|
291
|
+
fontSize: 13,
|
|
292
|
+
fontWeight: 700,
|
|
293
|
+
className: "ds:fill-[color:var(--foreground)]",
|
|
294
|
+
children: e.valueLabel
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
e.summaryLabel ? /* @__PURE__ */ x(
|
|
298
|
+
"text",
|
|
299
|
+
{
|
|
300
|
+
x: o(e.barEnd),
|
|
301
|
+
y: o(e.valueLabelY),
|
|
302
|
+
textAnchor: "end",
|
|
303
|
+
fontSize: 10,
|
|
304
|
+
className: "ds:fill-[color:var(--muted-foreground)]",
|
|
305
|
+
children: e.summaryLabel
|
|
306
|
+
}
|
|
307
|
+
) : null
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
Ut.displayName = "BandedGauge";
|
|
314
|
+
const zt = 24, dt = 18, Y = 12, ft = {
|
|
315
|
+
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"/>',
|
|
316
|
+
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"/>',
|
|
317
|
+
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"/>',
|
|
318
|
+
calendar: '<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',
|
|
319
|
+
"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"/>',
|
|
320
|
+
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"/>',
|
|
321
|
+
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"/>',
|
|
322
|
+
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"/>',
|
|
323
|
+
clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
|
|
324
|
+
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"/>',
|
|
325
|
+
"trending-up": '<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',
|
|
326
|
+
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"/>'
|
|
327
|
+
};
|
|
328
|
+
function $t(t) {
|
|
329
|
+
return Object.prototype.hasOwnProperty.call(ft, t);
|
|
330
|
+
}
|
|
331
|
+
function tt(t, n, i, a, r) {
|
|
332
|
+
if (!$t(t)) return "";
|
|
333
|
+
const s = r / zt;
|
|
334
|
+
return `<g transform="translate(${i} ${a}) scale(${s})" fill="none" color="${n}" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${ft[t]}</g>`;
|
|
335
|
+
}
|
|
336
|
+
function E(t) {
|
|
337
|
+
return t.variant === "banded";
|
|
338
|
+
}
|
|
339
|
+
const Ft = ["fg", "muted", "accent", "border", "bg"], j = "--primary", q = 380, ht = (t) => t.trim().replace(/^--/, "");
|
|
340
|
+
function Wt(t) {
|
|
341
|
+
return `ds:text-[color:var(${t})]`;
|
|
342
|
+
}
|
|
343
|
+
function pt(t) {
|
|
344
|
+
return t.highlightToken ?? j;
|
|
345
|
+
}
|
|
346
|
+
function O(t) {
|
|
347
|
+
const n = /* @__PURE__ */ new Set();
|
|
348
|
+
if (t.highlight) {
|
|
349
|
+
const a = t.highlightToken ?? j;
|
|
350
|
+
n.add(a), n.add(`${a}-foreground`);
|
|
351
|
+
}
|
|
352
|
+
const i = pt(t);
|
|
353
|
+
if (n.add(i), t.gauge)
|
|
354
|
+
if (E(t.gauge))
|
|
355
|
+
for (const a of t.gauge.bands) n.add(a.colorToken);
|
|
356
|
+
else
|
|
357
|
+
n.add(t.gauge.colorToken);
|
|
358
|
+
return [...n];
|
|
359
|
+
}
|
|
360
|
+
function z(t, n = []) {
|
|
361
|
+
const i = {
|
|
362
|
+
fg: "currentColor",
|
|
363
|
+
muted: "currentColor",
|
|
364
|
+
accent: "currentColor",
|
|
365
|
+
border: "currentColor",
|
|
366
|
+
bg: "transparent",
|
|
367
|
+
font: "sans-serif",
|
|
368
|
+
tokens: {}
|
|
369
|
+
};
|
|
370
|
+
if (!t) return i;
|
|
371
|
+
const a = (s) => {
|
|
372
|
+
const e = t.querySelector(`[data-k="${s}"]`);
|
|
373
|
+
return e && getComputedStyle(e).color || "currentColor";
|
|
374
|
+
}, r = {};
|
|
375
|
+
for (const s of n) {
|
|
376
|
+
const e = t.querySelector(
|
|
377
|
+
`[data-token="${ht(s)}"]`
|
|
378
|
+
);
|
|
379
|
+
if (e) {
|
|
380
|
+
const c = getComputedStyle(e).color;
|
|
381
|
+
c && (r[s] = c);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
fg: a("fg"),
|
|
386
|
+
muted: a("muted"),
|
|
387
|
+
accent: a("accent"),
|
|
388
|
+
border: a("border"),
|
|
389
|
+
bg: a("bg"),
|
|
390
|
+
font: getComputedStyle(t).fontFamily || "sans-serif",
|
|
391
|
+
tokens: r
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function H(t, n, i) {
|
|
395
|
+
var a;
|
|
396
|
+
return n ? ((a = t.tokens) == null ? void 0 : a[n]) ?? i : i;
|
|
397
|
+
}
|
|
398
|
+
const k = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
399
|
+
function bt(t) {
|
|
400
|
+
const n = [t.title];
|
|
401
|
+
t.highlight && n.push(t.highlight);
|
|
402
|
+
for (const i of t.fields) n.push(`• ${i.label}: ${i.value}`);
|
|
403
|
+
return n.join(`
|
|
404
|
+
`);
|
|
405
|
+
}
|
|
406
|
+
function mt(t) {
|
|
407
|
+
const n = t.fields.map((a) => `<li>${k(a.label)}: ${k(a.value)}</li>`).join(""), i = t.highlight ? `<p><strong>${k(t.highlight)}</strong></p>` : "";
|
|
408
|
+
return `<p><strong>${k(t.title)}</strong></p>${i}<ul>${n}</ul>`;
|
|
409
|
+
}
|
|
410
|
+
const w = 20, B = w + 18, N = 22, Xt = 10, F = 22, nt = 16, et = 12, Vt = 12, xt = 34, W = 9, X = (xt + W) * 2, jt = 16, at = dt, qt = 6;
|
|
411
|
+
function K(t, n) {
|
|
412
|
+
const i = n !== void 0 ? n : t.brand;
|
|
413
|
+
return typeof i == "string" ? i : !1;
|
|
414
|
+
}
|
|
415
|
+
function Kt(t) {
|
|
416
|
+
if (typeof t.fraction == "number")
|
|
417
|
+
return Math.min(1, Math.max(0, t.fraction));
|
|
418
|
+
const n = parseFloat(t.value);
|
|
419
|
+
return Number.isFinite(n) && typeof t.max == "number" && t.max > 0 ? Math.min(1, Math.max(0, n / t.max)) : 1;
|
|
420
|
+
}
|
|
421
|
+
function gt(t, n) {
|
|
422
|
+
const i = !!t.highlight, a = B + Xt, r = (i ? a + N + nt : B + nt) + F - 6, s = r + Math.max(0, t.fields.length - 1) * F, e = t.gauge && E(t.gauge), d = t.gauge && !E(t.gauge) ? (i ? a : B) + X : 0, f = e ? s + jt : null, p = f !== null ? f + V : 0, v = Math.max(s, d, p), h = n ? v + et + Vt - 4 : v, $ = Math.round(h + (n ? et : w));
|
|
423
|
+
return {
|
|
424
|
+
hasChip: i,
|
|
425
|
+
chipY: a,
|
|
426
|
+
firstFieldY: r,
|
|
427
|
+
fieldsEndY: s,
|
|
428
|
+
bandedGaugeY: f,
|
|
429
|
+
footerY: h,
|
|
430
|
+
height: $
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function vt(t, n) {
|
|
434
|
+
return gt(t, n !== !1).height;
|
|
435
|
+
}
|
|
436
|
+
function Zt(t, n, i, a, r) {
|
|
437
|
+
const s = xt, e = 2 * Math.PI * s, c = Kt(t), u = H(n, t.colorToken, n.accent), d = typeof t.segments == "number" && t.segments > 1 ? t.segments : 0, f = d ? 3 : 0, p = d ? e / d - f : e, v = d ? `${p} ${f}` : "", h = `${e * c} ${e}`, $ = `transform="rotate(-90 ${a} ${r})"`, l = k(
|
|
438
|
+
t.label ? `${t.value} — ${t.label}` : t.value
|
|
439
|
+
), L = `<circle cx="${a}" cy="${r}" r="${s}" fill="none" stroke="${n.border}" stroke-width="${W}"${v ? ` stroke-dasharray="${v}"` : ""} ${$}/>`, y = `<circle cx="${a}" cy="${r}" r="${s}" fill="none" stroke="${u}" stroke-width="${W}" stroke-linecap="round" stroke-dasharray="${h}" ${$}/>`, b = `<text x="${a}" y="${r + 1}" text-anchor="middle" dominant-baseline="middle" font-family="${i}" font-size="16" font-weight="700" fill="${n.fg}">${k(
|
|
440
|
+
t.value
|
|
441
|
+
)}</text>`, T = t.label ? `<text x="${a}" y="${r + 15}" text-anchor="middle" dominant-baseline="middle" font-family="${i}" font-size="9" fill="${n.muted}">${k(
|
|
442
|
+
t.label
|
|
443
|
+
)}</text>` : "";
|
|
444
|
+
return `<g role="img" aria-label="${l}"><title>${l}</title>${L}${y}${b}${T}</g>`;
|
|
445
|
+
}
|
|
446
|
+
function Jt(t, n, i, a) {
|
|
447
|
+
const r = w - P, s = i - 2 * r, e = ct(
|
|
448
|
+
{
|
|
449
|
+
value: t.value,
|
|
450
|
+
bands: t.bands,
|
|
451
|
+
min: t.min,
|
|
452
|
+
max: t.max,
|
|
453
|
+
valueLabel: t.valueLabel,
|
|
454
|
+
categoryLabel: t.categoryLabel,
|
|
455
|
+
rangeLabel: t.rangeLabel,
|
|
456
|
+
ariaLabel: t.ariaLabel,
|
|
457
|
+
ticks: t.ticks
|
|
458
|
+
},
|
|
459
|
+
{ width: s, height: V }
|
|
460
|
+
), c = Dt(e, {
|
|
461
|
+
resolve: (u) => H(n, u, n.accent),
|
|
462
|
+
// Raw theme font — buildBandedGaugeSvgString escapes it once. Passing the
|
|
463
|
+
// card's already-escaped `font` here would double-escape and break it.
|
|
464
|
+
font: n.font,
|
|
465
|
+
fg: n.fg,
|
|
466
|
+
muted: n.muted,
|
|
467
|
+
track: n.border
|
|
468
|
+
});
|
|
469
|
+
return `<g transform="translate(${r} ${a})">${c}</g>`;
|
|
470
|
+
}
|
|
471
|
+
function ot(t) {
|
|
472
|
+
const n = t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
|
|
473
|
+
return n ? [Number(n[1]), Number(n[2]), Number(n[3])] : null;
|
|
474
|
+
}
|
|
475
|
+
function rt([t, n, i]) {
|
|
476
|
+
const a = (r) => {
|
|
477
|
+
const s = r / 255;
|
|
478
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
479
|
+
};
|
|
480
|
+
return 0.2126 * a(t) + 0.7152 * a(n) + 0.0722 * a(i);
|
|
481
|
+
}
|
|
482
|
+
function Qt(t, n) {
|
|
483
|
+
const i = ot(t), a = ot(n);
|
|
484
|
+
if (!i || !a) return 0;
|
|
485
|
+
const r = rt(i), s = rt(a);
|
|
486
|
+
return (Math.max(r, s) + 0.05) / (Math.min(r, s) + 0.05);
|
|
487
|
+
}
|
|
488
|
+
function tn(t, n, i, a) {
|
|
489
|
+
const r = t.highlight, s = t.highlightToken ?? j, e = H(n, s, n.accent), c = Qt(n.bg, e) >= 3 ? n.bg : n.fg, u = Math.round(r.length * 7.2 + 28), d = w + u / 2, f = a + N / 2 + 1;
|
|
490
|
+
return `<rect x="${w}" y="${a}" width="${u}" height="${N}" rx="${N / 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}">${k(
|
|
491
|
+
r
|
|
492
|
+
)}</text>`;
|
|
493
|
+
}
|
|
494
|
+
function Z(t, n, i = !1) {
|
|
495
|
+
const a = q, r = gt(t, i !== !1), s = r.height, e = k(n.font), c = pt(t), u = H(n, c, n.accent), d = t.icon ? tt(
|
|
496
|
+
t.icon,
|
|
497
|
+
u,
|
|
498
|
+
a - w - at,
|
|
499
|
+
B - at + 2,
|
|
500
|
+
dt
|
|
501
|
+
) : "", f = w + Y + qt, p = t.fields.map((b, T) => {
|
|
502
|
+
const M = r.firstFieldY + T * F, A = T === 0, R = A ? 14 : 13, D = A ? 700 : 500, m = A ? u : n.fg, g = M - 4;
|
|
503
|
+
let I;
|
|
504
|
+
if (b.icon && $t(b.icon)) {
|
|
505
|
+
const _ = u;
|
|
506
|
+
I = tt(
|
|
507
|
+
b.icon,
|
|
508
|
+
_,
|
|
509
|
+
w,
|
|
510
|
+
g - Y / 2,
|
|
511
|
+
Y
|
|
512
|
+
);
|
|
513
|
+
} else
|
|
514
|
+
I = `<circle cx="${w + Y / 2}" cy="${g}" r="2" fill="${n.muted}"/>`;
|
|
515
|
+
return `${I}<text x="${f}" y="${M}" font-family="${e}" font-size="13"><tspan fill="${n.muted}">${k(
|
|
516
|
+
b.label
|
|
517
|
+
)}: </tspan><tspan font-size="${R}" font-weight="${D}" fill="${m}">${k(
|
|
518
|
+
b.value
|
|
519
|
+
)}</tspan></text>`;
|
|
520
|
+
}).join(""), v = r.hasChip ? tn(t, n, e, r.chipY) : "";
|
|
521
|
+
let h = "";
|
|
522
|
+
t.gauge && (E(t.gauge) && r.bandedGaugeY !== null ? h = Jt(t.gauge, n, a, r.bandedGaugeY) : E(t.gauge) || (h = Zt(
|
|
523
|
+
t.gauge,
|
|
524
|
+
n,
|
|
525
|
+
e,
|
|
526
|
+
a - w - X / 2,
|
|
527
|
+
(r.hasChip ? r.chipY : B) + X / 2
|
|
528
|
+
)));
|
|
529
|
+
const $ = i !== !1 ? `<text x="${w}" y="${r.footerY}" font-family="${e}" font-size="10" font-weight="500" fill="${n.muted}">${k(
|
|
530
|
+
i
|
|
531
|
+
)}</text>` : "", l = `<text x="${w}" y="${B}" font-family="${e}" font-size="16" font-weight="700" fill="${n.fg}">${k(
|
|
532
|
+
t.title
|
|
533
|
+
)}</text>`, L = `<rect x="0.5" y="0.5" width="${a - 1}" height="${s - 1}" rx="12" fill="${n.bg}"/>`, y = `<rect x="0.5" y="0.5" width="${a - 1}" height="${s - 1}" rx="12" fill="none" stroke="${n.border}"/>`;
|
|
534
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${s}" viewBox="0 0 ${a} ${s}" role="img" aria-label="${k(
|
|
535
|
+
t.title
|
|
536
|
+
)}">${L}${l}${d}${v}${h}${p}${$}${y}</svg>`;
|
|
537
|
+
}
|
|
538
|
+
function nn() {
|
|
539
|
+
var t;
|
|
540
|
+
return typeof navigator < "u" && typeof ((t = navigator.clipboard) == null ? void 0 : t.write) == "function" && typeof ClipboardItem < "u";
|
|
541
|
+
}
|
|
542
|
+
function kt(t, n, i) {
|
|
543
|
+
return new Promise((a, r) => {
|
|
544
|
+
const s = new Image();
|
|
545
|
+
s.decoding = "async", s.onload = () => {
|
|
546
|
+
const e = document.createElement("canvas");
|
|
547
|
+
e.width = n, e.height = i;
|
|
548
|
+
const c = e.getContext("2d");
|
|
549
|
+
if (!c) {
|
|
550
|
+
r(new Error("2D canvas context unavailable"));
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
c.drawImage(s, 0, 0, n, i), e.toBlob((u) => {
|
|
554
|
+
u ? a(u) : r(new Error("canvas.toBlob produced no PNG"));
|
|
555
|
+
}, "image/png");
|
|
556
|
+
}, s.onerror = () => r(new Error("SVG failed to decode as an image")), s.src = t;
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
function yt() {
|
|
560
|
+
const t = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : 1;
|
|
561
|
+
return Math.max(2, t);
|
|
562
|
+
}
|
|
563
|
+
async function mn(t, n = {}) {
|
|
564
|
+
return (await wt(t, n)).dataUri;
|
|
565
|
+
}
|
|
566
|
+
async function wt(t, n = {}) {
|
|
567
|
+
const { colours: i, scale: a = yt() } = n, r = i ?? z(null), s = K(t, n.brand), e = Z(t, r, s), c = `data:image/svg+xml,${encodeURIComponent(e)}`, u = q, d = vt(t, s), f = await kt(
|
|
568
|
+
c,
|
|
569
|
+
Math.round(u * a),
|
|
570
|
+
Math.round(d * a)
|
|
571
|
+
);
|
|
572
|
+
return { dataUri: await en(f), width: u, height: d };
|
|
573
|
+
}
|
|
574
|
+
function en(t) {
|
|
575
|
+
return new Promise((n, i) => {
|
|
576
|
+
const a = new FileReader();
|
|
577
|
+
a.onload = () => n(String(a.result)), a.onerror = () => i(a.error ?? new Error("FileReader error")), a.readAsDataURL(t);
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
async function an(t, n, i) {
|
|
581
|
+
const a = bt(n), r = new Blob([a], { type: "text/plain" });
|
|
582
|
+
if (t === "text")
|
|
583
|
+
return new ClipboardItem({ "text/plain": r });
|
|
584
|
+
const s = K(n, void 0), e = Z(n, i, s), c = `data:image/svg+xml,${encodeURIComponent(e)}`, u = yt(), d = await kt(
|
|
585
|
+
c,
|
|
586
|
+
Math.round(q * u),
|
|
587
|
+
Math.round(vt(n, s) * u)
|
|
588
|
+
);
|
|
589
|
+
if (t === "image")
|
|
590
|
+
return new ClipboardItem({ "image/png": d, "text/plain": r });
|
|
591
|
+
const f = new Blob([mt(n)], { type: "text/html" });
|
|
592
|
+
return new ClipboardItem({
|
|
593
|
+
"text/html": f,
|
|
594
|
+
"image/png": d,
|
|
595
|
+
"text/plain": r
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
const on = It(
|
|
599
|
+
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
600
|
+
{
|
|
601
|
+
variants: {
|
|
602
|
+
variant: {
|
|
603
|
+
insert: "",
|
|
604
|
+
copy: ""
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
defaultVariants: { variant: "insert" }
|
|
608
|
+
}
|
|
609
|
+
), rn = ["text", "image", "text-image"], sn = {
|
|
610
|
+
text: /* @__PURE__ */ x(St, { "aria-hidden": !0 }),
|
|
611
|
+
image: /* @__PURE__ */ x(Ct, { "aria-hidden": !0 }),
|
|
612
|
+
"text-image": /* @__PURE__ */ x(Et, { "aria-hidden": !0 })
|
|
613
|
+
}, st = {
|
|
614
|
+
insert: {
|
|
615
|
+
text: "insert.text",
|
|
616
|
+
image: "insert.image",
|
|
617
|
+
"text-image": "insert.textImage"
|
|
618
|
+
},
|
|
619
|
+
copy: {
|
|
620
|
+
text: "insert.copyText",
|
|
621
|
+
image: "insert.copyImage",
|
|
622
|
+
"text-image": "insert.copyTextImage"
|
|
623
|
+
}
|
|
624
|
+
}, ln = it(
|
|
625
|
+
function({
|
|
626
|
+
card: n,
|
|
627
|
+
variant: i = "insert",
|
|
628
|
+
onInsert: a,
|
|
629
|
+
onCopy: r,
|
|
630
|
+
onError: s,
|
|
631
|
+
size: e = "sm",
|
|
632
|
+
intent: c = "primary"
|
|
633
|
+
}, u) {
|
|
634
|
+
const { t: d } = Mt(), f = Tt(null), p = (l) => {
|
|
635
|
+
const L = bt(n), y = mt(n);
|
|
636
|
+
let b = "", T = "";
|
|
637
|
+
const M = l === "text" ? null : z(f.current, O(n));
|
|
638
|
+
return M && (b = Z(n, M, K(n, void 0)), T = `data:image/svg+xml,${encodeURIComponent(b)}`), { mode: l, text: L, html: y, svg: b, imageDataUri: T, pngDataUri: () => M ? wt(n, { colours: M }) : Promise.resolve({ dataUri: "", width: 0, height: 0 }) };
|
|
639
|
+
}, $ = i === "copy" ? (l) => {
|
|
640
|
+
if (!nn()) {
|
|
641
|
+
s == null || s(new Error("Clipboard write unavailable in this context"));
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const L = z(
|
|
645
|
+
f.current,
|
|
646
|
+
O(n)
|
|
647
|
+
);
|
|
648
|
+
(async () => {
|
|
649
|
+
try {
|
|
650
|
+
const y = await an(l, n, L);
|
|
651
|
+
await navigator.clipboard.write([y]), r == null || r(l);
|
|
652
|
+
} catch (y) {
|
|
653
|
+
s == null || s(y);
|
|
654
|
+
}
|
|
655
|
+
})();
|
|
656
|
+
} : (l) => {
|
|
657
|
+
a == null || a(p(l));
|
|
658
|
+
};
|
|
659
|
+
return /* @__PURE__ */ G(
|
|
660
|
+
"div",
|
|
661
|
+
{
|
|
662
|
+
ref: u,
|
|
663
|
+
"data-component": "insert-result",
|
|
664
|
+
"data-variant": i,
|
|
665
|
+
className: on({ variant: i }),
|
|
666
|
+
children: [
|
|
667
|
+
/* @__PURE__ */ G("span", { ref: f, "aria-hidden": !0, className: "ds:sr-only", children: [
|
|
668
|
+
Ft.map((l) => /* @__PURE__ */ x(
|
|
669
|
+
"span",
|
|
670
|
+
{
|
|
671
|
+
"data-k": l,
|
|
672
|
+
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)]"
|
|
673
|
+
},
|
|
674
|
+
l
|
|
675
|
+
)),
|
|
676
|
+
O(n).map((l) => /* @__PURE__ */ x(
|
|
677
|
+
"span",
|
|
678
|
+
{
|
|
679
|
+
"data-token": ht(l),
|
|
680
|
+
className: Wt(l)
|
|
681
|
+
},
|
|
682
|
+
l
|
|
683
|
+
))
|
|
684
|
+
] }),
|
|
685
|
+
rn.map((l) => /* @__PURE__ */ x(
|
|
686
|
+
At,
|
|
687
|
+
{
|
|
688
|
+
type: "button",
|
|
689
|
+
intent: c,
|
|
690
|
+
size: e,
|
|
691
|
+
startIcon: sn[l],
|
|
692
|
+
"aria-label": d(st[i][l]),
|
|
693
|
+
onClick: () => $(l),
|
|
694
|
+
children: d(st[i][l])
|
|
695
|
+
},
|
|
696
|
+
l
|
|
697
|
+
))
|
|
698
|
+
]
|
|
699
|
+
}
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
);
|
|
703
|
+
ln.displayName = "InsertButton";
|
|
704
|
+
export {
|
|
705
|
+
Ut as B,
|
|
706
|
+
ln as I,
|
|
707
|
+
mn as a,
|
|
708
|
+
bn as b,
|
|
709
|
+
wt as s
|
|
710
|
+
};
|
|
711
|
+
//# sourceMappingURL=insert-result-C5ABnzDl.js.map
|