randmarcomps 1.170.0 → 1.172.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/randmarcomps.d.ts +24 -0
- package/dist/randmarcomps.js +233 -104
- package/dist/randmarcomps.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/randmarcomps.d.ts
CHANGED
|
@@ -50,6 +50,14 @@ export declare interface AiGeneratedContentProps {
|
|
|
50
50
|
smartAndSlow?: boolean;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
export declare const Alert: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
54
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
55
|
+
} & ClassProp) | undefined) => string> & React_2.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
|
|
57
|
+
export declare const AlertDescription: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLParagraphElement> & React_2.RefAttributes<HTMLParagraphElement>>;
|
|
58
|
+
|
|
59
|
+
export declare const AlertTitle: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLHeadingElement> & React_2.RefAttributes<HTMLParagraphElement>>;
|
|
60
|
+
|
|
53
61
|
declare interface ApiKeyContextType {
|
|
54
62
|
apiKey: string | null;
|
|
55
63
|
}
|
|
@@ -566,6 +574,22 @@ export declare function Skeleton({ className, ...props }: React.HTMLAttributes<H
|
|
|
566
574
|
|
|
567
575
|
export declare const Switch: React_2.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
|
|
568
576
|
|
|
577
|
+
export declare const Table: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableElement> & React_2.RefAttributes<HTMLTableElement>>;
|
|
578
|
+
|
|
579
|
+
export declare const TableBody: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableSectionElement> & React_2.RefAttributes<HTMLTableSectionElement>>;
|
|
580
|
+
|
|
581
|
+
export declare const TableCaption: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableCaptionElement> & React_2.RefAttributes<HTMLTableCaptionElement>>;
|
|
582
|
+
|
|
583
|
+
export declare const TableCell: React_2.ForwardRefExoticComponent<React_2.TdHTMLAttributes<HTMLTableCellElement> & React_2.RefAttributes<HTMLTableCellElement>>;
|
|
584
|
+
|
|
585
|
+
export declare const TableFooter: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableSectionElement> & React_2.RefAttributes<HTMLTableSectionElement>>;
|
|
586
|
+
|
|
587
|
+
export declare const TableHead: React_2.ForwardRefExoticComponent<React_2.ThHTMLAttributes<HTMLTableCellElement> & React_2.RefAttributes<HTMLTableCellElement>>;
|
|
588
|
+
|
|
589
|
+
export declare const TableHeader: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableSectionElement> & React_2.RefAttributes<HTMLTableSectionElement>>;
|
|
590
|
+
|
|
591
|
+
export declare const TableRow: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableRowElement> & React_2.RefAttributes<HTMLTableRowElement>>;
|
|
592
|
+
|
|
569
593
|
export declare const Tabs: React_2.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
570
594
|
|
|
571
595
|
export declare const TabsContent: React_2.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
package/dist/randmarcomps.js
CHANGED
|
@@ -68,10 +68,10 @@ var jt = React.createContext({}), Lt = React.forwardRef((e, t) => {
|
|
|
68
68
|
l == null || l(se), L(se);
|
|
69
69
|
}, [l]), H = React.useMemo(() => f ? typeof f == "string" ? new RegExp(f) : f : null, [f]), U = React.useRef(null), G = React.useRef(null), J = React.useRef({ value: j, onChange: F, isIOS: typeof window < "u" && ((O = (N = window == null ? void 0 : window.CSS) == null ? void 0 : N.supports) == null ? void 0 : O.call(N, "-webkit-touch-callout", "none")) }), ee = React.useRef({ prev: [(V = U.current) == null ? void 0 : V.selectionStart, (M = U.current) == null ? void 0 : M.selectionEnd, (I = U.current) == null ? void 0 : I.selectionDirection] });
|
|
70
70
|
React.useImperativeHandle(t, () => U.current, []), React.useEffect(() => {
|
|
71
|
-
let se = U.current,
|
|
72
|
-
if (!se || !
|
|
71
|
+
let se = U.current, xe = G.current;
|
|
72
|
+
if (!se || !xe) return;
|
|
73
73
|
J.current.value !== se.value && J.current.onChange(se.value), ee.current.prev = [se.selectionStart, se.selectionEnd, se.selectionDirection];
|
|
74
|
-
function
|
|
74
|
+
function _e() {
|
|
75
75
|
if (document.activeElement !== se) {
|
|
76
76
|
le(null), pe(null);
|
|
77
77
|
return;
|
|
@@ -98,7 +98,7 @@ var jt = React.createContext({}), Lt = React.forwardRef((e, t) => {
|
|
|
98
98
|
let Ge = Le !== -1 ? Le : we, Je = Ne !== -1 ? Ne : ke, Xe = qe ?? Be;
|
|
99
99
|
le(Ge), pe(Je), ee.current.prev = [Ge, Je, Xe];
|
|
100
100
|
}
|
|
101
|
-
if (document.addEventListener("selectionchange",
|
|
101
|
+
if (document.addEventListener("selectionchange", _e, { capture: !0 }), _e(), document.activeElement === se && Z(!0), !document.getElementById("input-otp-style")) {
|
|
102
102
|
let we = document.createElement("style");
|
|
103
103
|
if (we.id = "input-otp-style", document.head.appendChild(we), we.sheet) {
|
|
104
104
|
let ke = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";
|
|
@@ -106,68 +106,68 @@ var jt = React.createContext({}), Lt = React.forwardRef((e, t) => {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
let Ee = () => {
|
|
109
|
-
|
|
109
|
+
xe && xe.style.setProperty("--root-height", `${se.clientHeight}px`);
|
|
110
110
|
};
|
|
111
111
|
Ee();
|
|
112
112
|
let Ae = new ResizeObserver(Ee);
|
|
113
113
|
return Ae.observe(se), () => {
|
|
114
|
-
document.removeEventListener("selectionchange",
|
|
114
|
+
document.removeEventListener("selectionchange", _e, { capture: !0 }), Ae.disconnect();
|
|
115
115
|
};
|
|
116
116
|
}, []);
|
|
117
117
|
let [ie, W] = React.useState(!1), [Q, Z] = React.useState(!1), [ae, le] = React.useState(null), [ue, pe] = React.useState(null);
|
|
118
118
|
React.useEffect(() => {
|
|
119
119
|
ht(() => {
|
|
120
|
-
var se,
|
|
120
|
+
var se, xe, _e, Ee;
|
|
121
121
|
(se = U.current) == null || se.dispatchEvent(new Event("input"));
|
|
122
|
-
let Ae = (
|
|
122
|
+
let Ae = (xe = U.current) == null ? void 0 : xe.selectionStart, we = (_e = U.current) == null ? void 0 : _e.selectionEnd, ke = (Ee = U.current) == null ? void 0 : Ee.selectionDirection;
|
|
123
123
|
Ae !== null && we !== null && (le(Ae), pe(we), ee.current.prev = [Ae, we, ke]);
|
|
124
124
|
});
|
|
125
125
|
}, [j, Q]), React.useEffect(() => {
|
|
126
126
|
q !== void 0 && j !== q && q.length < u && j.length === u && (g == null || g(j));
|
|
127
127
|
}, [u, g, q, j]);
|
|
128
128
|
let de = Tt({ containerRef: G, inputRef: U, pushPasswordManagerStrategy: b, isFocused: Q }), ve = React.useCallback((se) => {
|
|
129
|
-
let
|
|
130
|
-
if (
|
|
129
|
+
let xe = se.currentTarget.value.slice(0, u);
|
|
130
|
+
if (xe.length > 0 && H && !H.test(xe)) {
|
|
131
131
|
se.preventDefault();
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
typeof q == "string" &&
|
|
134
|
+
typeof q == "string" && xe.length < q.length && document.dispatchEvent(new Event("selectionchange")), F(xe);
|
|
135
135
|
}, [u, F, q, H]), he = React.useCallback(() => {
|
|
136
136
|
var se;
|
|
137
137
|
if (U.current) {
|
|
138
|
-
let
|
|
139
|
-
(se = U.current) == null || se.setSelectionRange(
|
|
138
|
+
let xe = Math.min(U.current.value.length, u - 1), _e = U.current.value.length;
|
|
139
|
+
(se = U.current) == null || se.setSelectionRange(xe, _e), le(xe), pe(_e);
|
|
140
140
|
}
|
|
141
141
|
Z(!0);
|
|
142
142
|
}, [u]), ye = React.useCallback((se) => {
|
|
143
|
-
var
|
|
143
|
+
var xe, _e;
|
|
144
144
|
let Ee = U.current;
|
|
145
145
|
if (!_ && (!J.current.isIOS || !se.clipboardData || !Ee)) return;
|
|
146
146
|
let Ae = se.clipboardData.getData("text/plain"), we = _ ? _(Ae) : Ae;
|
|
147
147
|
se.preventDefault();
|
|
148
|
-
let ke = (
|
|
148
|
+
let ke = (xe = U.current) == null ? void 0 : xe.selectionStart, Be = (_e = U.current) == null ? void 0 : _e.selectionEnd, Me = (ke !== Be ? j.slice(0, ke) + we + j.slice(Be) : j.slice(0, ke) + we + j.slice(ke)).slice(0, u);
|
|
149
149
|
if (Me.length > 0 && H && !H.test(Me)) return;
|
|
150
150
|
Ee.value = Me, F(Me);
|
|
151
151
|
let Fe = Math.min(Me.length, u - 1), He = Me.length;
|
|
152
152
|
Ee.setSelectionRange(Fe, He), le(Fe), pe(He);
|
|
153
153
|
}, [u, F, H, j]), fe = React.useMemo(() => ({ position: "relative", cursor: R.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [R.disabled]), ce = React.useMemo(() => ({ position: "absolute", inset: 0, width: de.willPushPWMBadge ? `calc(100% + ${de.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: de.willPushPWMBadge ? `inset(0 ${de.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: d, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [de.PWM_BADGE_SPACE_WIDTH, de.willPushPWMBadge, d]), oe = React.useMemo(() => React.createElement("input", bt(St({ autoComplete: R.autoComplete || "one-time-code" }, R), { "data-input-otp": !0, "data-input-otp-placeholder-shown": j.length === 0 || void 0, "data-input-otp-mss": ae, "data-input-otp-mse": ue, inputMode: m, pattern: H == null ? void 0 : H.source, "aria-placeholder": p, style: ce, maxLength: u, value: j, ref: U, onPaste: (se) => {
|
|
154
|
-
var
|
|
155
|
-
ye(se), (
|
|
154
|
+
var xe;
|
|
155
|
+
ye(se), (xe = R.onPaste) == null || xe.call(R, se);
|
|
156
156
|
}, onChange: ve, onMouseOver: (se) => {
|
|
157
|
-
var
|
|
158
|
-
W(!0), (
|
|
157
|
+
var xe;
|
|
158
|
+
W(!0), (xe = R.onMouseOver) == null || xe.call(R, se);
|
|
159
159
|
}, onMouseLeave: (se) => {
|
|
160
|
-
var
|
|
161
|
-
W(!1), (
|
|
160
|
+
var xe;
|
|
161
|
+
W(!1), (xe = R.onMouseLeave) == null || xe.call(R, se);
|
|
162
162
|
}, onFocus: (se) => {
|
|
163
|
-
var
|
|
164
|
-
he(), (
|
|
163
|
+
var xe;
|
|
164
|
+
he(), (xe = R.onFocus) == null || xe.call(R, se);
|
|
165
165
|
}, onBlur: (se) => {
|
|
166
|
-
var _e;
|
|
167
|
-
Z(!1), (_e = R.onBlur) == null || _e.call(R, se);
|
|
168
|
-
} })), [ve, he, ye, m, ce, u, ue, ae, R, H == null ? void 0 : H.source, j]), te = React.useMemo(() => ({ slots: Array.from({ length: u }).map((se, _e) => {
|
|
169
166
|
var xe;
|
|
170
|
-
|
|
167
|
+
Z(!1), (xe = R.onBlur) == null || xe.call(R, se);
|
|
168
|
+
} })), [ve, he, ye, m, ce, u, ue, ae, R, H == null ? void 0 : H.source, j]), te = React.useMemo(() => ({ slots: Array.from({ length: u }).map((se, xe) => {
|
|
169
|
+
var _e;
|
|
170
|
+
let Ee = Q && ae !== null && ue !== null && (ae === ue && xe === ae || xe >= ae && xe < ue), Ae = j[xe] !== void 0 ? j[xe] : null, we = j[0] !== void 0 ? null : (_e = p == null ? void 0 : p[xe]) != null ? _e : null;
|
|
171
171
|
return { char: Ae, placeholderChar: we, isActive: Ee, hasFakeCaret: Ee && Ae === null };
|
|
172
172
|
}), isFocused: Q, isHovering: !R.disabled && ie }), [Q, ie, u, ue, ae, R.disabled, j]), be = React.useMemo(() => E ? E(te) : React.createElement(jt.Provider, { value: te }, C), [C, te, E]);
|
|
173
173
|
return React.createElement(React.Fragment, null, T !== null && React.createElement("noscript", null, React.createElement("style", null, T)), React.createElement("div", { ref: G, "data-input-otp-container": !0, style: fe, className: S }, be, React.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, oe)));
|
|
@@ -6464,9 +6464,9 @@ var CONTENT_NAME$5 = "PopperContent", [PopperContentProvider, useContentContext]
|
|
|
6464
6464
|
p && flip({ ...U }),
|
|
6465
6465
|
size({
|
|
6466
6466
|
...U,
|
|
6467
|
-
apply: ({ elements: be, rects: se, availableWidth:
|
|
6467
|
+
apply: ({ elements: be, rects: se, availableWidth: xe, availableHeight: _e }) => {
|
|
6468
6468
|
const { width: Ee, height: Ae } = se.reference, we = be.floating.style;
|
|
6469
|
-
we.setProperty("--radix-popper-available-width", `${
|
|
6469
|
+
we.setProperty("--radix-popper-available-width", `${xe}px`), we.setProperty("--radix-popper-available-height", `${_e}px`), we.setProperty("--radix-popper-anchor-width", `${Ee}px`), we.setProperty("--radix-popper-anchor-height", `${Ae}px`);
|
|
6470
6470
|
}
|
|
6471
6471
|
}),
|
|
6472
6472
|
V && arrow({ element: V, padding: f }),
|
|
@@ -10239,19 +10239,19 @@ function requireReactIs_development$1() {
|
|
|
10239
10239
|
}
|
|
10240
10240
|
function M(se) {
|
|
10241
10241
|
if (typeof se == "object" && se !== null) {
|
|
10242
|
-
var
|
|
10243
|
-
switch (
|
|
10242
|
+
var xe = se.$$typeof;
|
|
10243
|
+
switch (xe) {
|
|
10244
10244
|
case e:
|
|
10245
|
-
var
|
|
10246
|
-
switch (
|
|
10245
|
+
var _e = se.type;
|
|
10246
|
+
switch (_e) {
|
|
10247
10247
|
case n:
|
|
10248
10248
|
case l:
|
|
10249
10249
|
case o:
|
|
10250
10250
|
case m:
|
|
10251
10251
|
case g:
|
|
10252
|
-
return
|
|
10252
|
+
return _e;
|
|
10253
10253
|
default:
|
|
10254
|
-
var Ee =
|
|
10254
|
+
var Ee = _e && _e.$$typeof;
|
|
10255
10255
|
switch (Ee) {
|
|
10256
10256
|
case f:
|
|
10257
10257
|
case d:
|
|
@@ -10261,11 +10261,11 @@ function requireReactIs_development$1() {
|
|
|
10261
10261
|
case u:
|
|
10262
10262
|
return Ee;
|
|
10263
10263
|
default:
|
|
10264
|
-
return
|
|
10264
|
+
return xe;
|
|
10265
10265
|
}
|
|
10266
10266
|
}
|
|
10267
10267
|
case t:
|
|
10268
|
-
return
|
|
10268
|
+
return xe;
|
|
10269
10269
|
}
|
|
10270
10270
|
}
|
|
10271
10271
|
}
|
|
@@ -16541,31 +16541,31 @@ function formatLocale(e) {
|
|
|
16541
16541
|
O.x = I(n, O), O.X = I(o, O), O.c = I(t, O), V.x = I(n, V), V.X = I(o, V), V.c = I(t, V);
|
|
16542
16542
|
function I(fe, ce) {
|
|
16543
16543
|
return function(oe) {
|
|
16544
|
-
var te = [], be = -1, se = 0,
|
|
16545
|
-
for (oe instanceof Date || (oe = /* @__PURE__ */ new Date(+oe)); ++be <
|
|
16546
|
-
fe.charCodeAt(be) === 37 && (te.push(fe.slice(se, be)), (Ee = pads[
|
|
16544
|
+
var te = [], be = -1, se = 0, xe = fe.length, _e, Ee, Ae;
|
|
16545
|
+
for (oe instanceof Date || (oe = /* @__PURE__ */ new Date(+oe)); ++be < xe; )
|
|
16546
|
+
fe.charCodeAt(be) === 37 && (te.push(fe.slice(se, be)), (Ee = pads[_e = fe.charAt(++be)]) != null ? _e = fe.charAt(++be) : Ee = _e === "e" ? " " : "0", (Ae = ce[_e]) && (_e = Ae(oe, Ee)), te.push(_e), se = be + 1);
|
|
16547
16547
|
return te.push(fe.slice(se, be)), te.join("");
|
|
16548
16548
|
};
|
|
16549
16549
|
}
|
|
16550
16550
|
function D(fe, ce) {
|
|
16551
16551
|
return function(oe) {
|
|
16552
|
-
var te = newDate(1900, void 0, 1), be = L(te, fe, oe += "", 0), se,
|
|
16552
|
+
var te = newDate(1900, void 0, 1), be = L(te, fe, oe += "", 0), se, xe;
|
|
16553
16553
|
if (be != oe.length) return null;
|
|
16554
16554
|
if ("Q" in te) return new Date(te.Q);
|
|
16555
16555
|
if ("s" in te) return new Date(te.s * 1e3 + ("L" in te ? te.L : 0));
|
|
16556
16556
|
if (ce && !("Z" in te) && (te.Z = 0), "p" in te && (te.H = te.H % 12 + te.p * 12), te.m === void 0 && (te.m = "q" in te ? te.q : 0), "V" in te) {
|
|
16557
16557
|
if (te.V < 1 || te.V > 53) return null;
|
|
16558
|
-
"w" in te || (te.w = 1), "Z" in te ? (se = utcDate(newDate(te.y, 0, 1)),
|
|
16559
|
-
} else ("W" in te || "U" in te) && ("w" in te || (te.w = "u" in te ? te.u % 7 : "W" in te ? 1 : 0),
|
|
16558
|
+
"w" in te || (te.w = 1), "Z" in te ? (se = utcDate(newDate(te.y, 0, 1)), xe = se.getUTCDay(), se = xe > 4 || xe === 0 ? utcMonday.ceil(se) : utcMonday(se), se = utcDay.offset(se, (te.V - 1) * 7), te.y = se.getUTCFullYear(), te.m = se.getUTCMonth(), te.d = se.getUTCDate() + (te.w + 6) % 7) : (se = localDate(newDate(te.y, 0, 1)), xe = se.getDay(), se = xe > 4 || xe === 0 ? timeMonday.ceil(se) : timeMonday(se), se = timeDay.offset(se, (te.V - 1) * 7), te.y = se.getFullYear(), te.m = se.getMonth(), te.d = se.getDate() + (te.w + 6) % 7);
|
|
16559
|
+
} else ("W" in te || "U" in te) && ("w" in te || (te.w = "u" in te ? te.u % 7 : "W" in te ? 1 : 0), xe = "Z" in te ? utcDate(newDate(te.y, 0, 1)).getUTCDay() : localDate(newDate(te.y, 0, 1)).getDay(), te.m = 0, te.d = "W" in te ? (te.w + 6) % 7 + te.W * 7 - (xe + 5) % 7 : te.w + te.U * 7 - (xe + 6) % 7);
|
|
16560
16560
|
return "Z" in te ? (te.H += te.Z / 100 | 0, te.M += te.Z % 100, utcDate(te)) : localDate(te);
|
|
16561
16561
|
};
|
|
16562
16562
|
}
|
|
16563
16563
|
function L(fe, ce, oe, te) {
|
|
16564
|
-
for (var be = 0, se = ce.length,
|
|
16565
|
-
if (te >=
|
|
16566
|
-
if (
|
|
16567
|
-
if (
|
|
16568
|
-
} else if (
|
|
16564
|
+
for (var be = 0, se = ce.length, xe = oe.length, _e, Ee; be < se; ) {
|
|
16565
|
+
if (te >= xe) return -1;
|
|
16566
|
+
if (_e = ce.charCodeAt(be++), _e === 37) {
|
|
16567
|
+
if (_e = ce.charAt(be++), Ee = M[_e in pads ? ce.charAt(be++) : _e], !Ee || (te = Ee(fe, oe, te)) < 0) return -1;
|
|
16568
|
+
} else if (_e != oe.charCodeAt(te++))
|
|
16569
16569
|
return -1;
|
|
16570
16570
|
}
|
|
16571
16571
|
return te;
|
|
@@ -19842,14 +19842,14 @@ function requireReactIs_development() {
|
|
|
19842
19842
|
case b:
|
|
19843
19843
|
return se;
|
|
19844
19844
|
default:
|
|
19845
|
-
var
|
|
19846
|
-
switch (
|
|
19845
|
+
var xe = se && se.$$typeof;
|
|
19846
|
+
switch (xe) {
|
|
19847
19847
|
case f:
|
|
19848
19848
|
case g:
|
|
19849
19849
|
case T:
|
|
19850
19850
|
case S:
|
|
19851
19851
|
case d:
|
|
19852
|
-
return
|
|
19852
|
+
return xe;
|
|
19853
19853
|
default:
|
|
19854
19854
|
return be;
|
|
19855
19855
|
}
|
|
@@ -26655,18 +26655,18 @@ var getTooltipContent = function(t, n, o, l) {
|
|
|
26655
26655
|
).concat((Fe = Q == null || (He = Q.type) === null || He === void 0 ? void 0 : He.displayName) !== null && Fe !== void 0 ? Fe : "")) : invariant());
|
|
26656
26656
|
var qe = Le[Ne];
|
|
26657
26657
|
return _objectSpread(_objectSpread({}, Be), {}, _defineProperty(_defineProperty({}, Me.axisType, qe), "".concat(Me.axisType, "Ticks"), getTicksOfAxis(qe)));
|
|
26658
|
-
}, he), fe = ye[ee], ce = ye["".concat(ee, "Ticks")], oe = V && V[de] && V[de].hasStack && getStackedDataOfItem(Q, V[de].stackGroups), te = getDisplayName(Q.type).indexOf("Bar") >= 0, be = getBandSizeOfAxis(fe, ce), se = [],
|
|
26658
|
+
}, he), fe = ye[ee], ce = ye["".concat(ee, "Ticks")], oe = V && V[de] && V[de].hasStack && getStackedDataOfItem(Q, V[de].stackGroups), te = getDisplayName(Q.type).indexOf("Bar") >= 0, be = getBandSizeOfAxis(fe, ce), se = [], xe = ie && getBarSizeList({
|
|
26659
26659
|
barSize: j,
|
|
26660
26660
|
stackGroups: V,
|
|
26661
26661
|
totalSize: getCartesianAxisSize(ye, ee)
|
|
26662
26662
|
});
|
|
26663
26663
|
if (te) {
|
|
26664
|
-
var
|
|
26664
|
+
var _e, Ee, Ae = isNil(pe) ? U : pe, we = (_e = (Ee = getBandSizeOfAxis(fe, ce, !0)) !== null && Ee !== void 0 ? Ee : Ae) !== null && _e !== void 0 ? _e : 0;
|
|
26665
26665
|
se = getBarPosition({
|
|
26666
26666
|
barGap: F,
|
|
26667
26667
|
barCategoryGap: H,
|
|
26668
26668
|
bandSize: we !== be ? we : be,
|
|
26669
|
-
sizeList:
|
|
26669
|
+
sizeList: xe[ve],
|
|
26670
26670
|
maxBarSize: Ae
|
|
26671
26671
|
}), we !== be && (se = se.map(function(Be) {
|
|
26672
26672
|
return _objectSpread(_objectSpread({}, Be), {}, {
|
|
@@ -27064,9 +27064,9 @@ var getTooltipContent = function(t, n, o, l) {
|
|
|
27064
27064
|
isRange: Z
|
|
27065
27065
|
})));
|
|
27066
27066
|
} else {
|
|
27067
|
-
var
|
|
27067
|
+
var xe, _e = (xe = M.getItemByXY(M.state.activeCoordinate)) !== null && xe !== void 0 ? xe : {
|
|
27068
27068
|
graphicalItem: fe
|
|
27069
|
-
}, Ee =
|
|
27069
|
+
}, Ee = _e.graphicalItem, Ae = Ee.item, we = Ae === void 0 ? I : Ae, ke = Ee.childIndex, Be = _objectSpread(_objectSpread(_objectSpread({}, j.props), ye), {}, {
|
|
27070
27070
|
activeIndex: ke
|
|
27071
27071
|
});
|
|
27072
27072
|
return [/* @__PURE__ */ cloneElement(we, Be), null, null];
|
|
@@ -29126,8 +29126,8 @@ var lottie = createCommonjsModule(function(module, exports) {
|
|
|
29126
29126
|
function E(W, Q, Z, ae, le, ue, pe, de, ve, he, ye, fe, ce, oe, te, be) {
|
|
29127
29127
|
var se = this.props;
|
|
29128
29128
|
if (W === 1 && Q === 0 && Z === 0 && ae === 0 && le === 0 && ue === 1 && pe === 0 && de === 0 && ve === 0 && he === 0 && ye === 1 && fe === 0) return se[12] = se[12] * W + se[15] * ce, se[13] = se[13] * ue + se[15] * oe, se[14] = se[14] * ye + se[15] * te, se[15] *= be, this._identityCalculated = !1, this;
|
|
29129
|
-
var
|
|
29130
|
-
return se[0] =
|
|
29129
|
+
var xe = se[0], _e = se[1], Ee = se[2], Ae = se[3], we = se[4], ke = se[5], Be = se[6], Me = se[7], Fe = se[8], He = se[9], Le = se[10], Ne = se[11], qe = se[12], Ge = se[13], Je = se[14], Xe = se[15];
|
|
29130
|
+
return se[0] = xe * W + _e * le + Ee * ve + Ae * ce, se[1] = xe * Q + _e * ue + Ee * he + Ae * oe, se[2] = xe * Z + _e * pe + Ee * ye + Ae * te, se[3] = xe * ae + _e * de + Ee * fe + Ae * be, se[4] = we * W + ke * le + Be * ve + Me * ce, se[5] = we * Q + ke * ue + Be * he + Me * oe, se[6] = we * Z + ke * pe + Be * ye + Me * te, se[7] = we * ae + ke * de + Be * fe + Me * be, se[8] = Fe * W + He * le + Le * ve + Ne * ce, se[9] = Fe * Q + He * ue + Le * he + Ne * oe, se[10] = Fe * Z + He * pe + Le * ye + Ne * te, se[11] = Fe * ae + He * de + Le * fe + Ne * be, se[12] = qe * W + Ge * le + Je * ve + Xe * ce, se[13] = qe * Q + Ge * ue + Je * he + Xe * oe, se[14] = qe * Z + Ge * pe + Je * ye + Xe * te, se[15] = qe * ae + Ge * de + Je * fe + Xe * be, this._identityCalculated = !1, this;
|
|
29131
29131
|
}
|
|
29132
29132
|
function C(W) {
|
|
29133
29133
|
var Q = W.props;
|
|
@@ -30857,7 +30857,7 @@ var lottie = createCommonjsModule(function(module, exports) {
|
|
|
30857
30857
|
u = F.length, n = 0, o = 0;
|
|
30858
30858
|
var G, J, ee, ie, W, Q = 1.2 * e.finalSize * 0.714, Z = !0;
|
|
30859
30859
|
ee = I.length;
|
|
30860
|
-
var ae, le, ue, pe, de, ve, he, ye, fe, ce, oe, te, be = -1, se = f,
|
|
30860
|
+
var ae, le, ue, pe, de, ve, he, ye, fe, ce, oe, te, be = -1, se = f, xe = _, _e = b, Ee = -1, Ae = "", we = this.defaultPropsArray;
|
|
30861
30861
|
if (e.j === 2 || e.j === 1) {
|
|
30862
30862
|
var ke = 0, Be = 0, Me = e.j === 2 ? -0.5 : -1, Fe = 0, He = !0;
|
|
30863
30863
|
for (l = 0; l < u; l += 1) if (F[l].n) {
|
|
@@ -30870,7 +30870,7 @@ var lottie = createCommonjsModule(function(module, exports) {
|
|
|
30870
30870
|
for (ke && (ke += Be); Fe < l; ) F[Fe].animatorJustifyOffset = ke, Fe += 1;
|
|
30871
30871
|
}
|
|
30872
30872
|
for (l = 0; l < u; l += 1) {
|
|
30873
|
-
if (L.reset(), pe = 1, F[l].n) n = 0, o += e.yOffset, o += Z ? 1 : 0, f = se, Z = !1, this._hasMaskedPath && (b =
|
|
30873
|
+
if (L.reset(), pe = 1, F[l].n) n = 0, o += e.yOffset, o += Z ? 1 : 0, f = se, Z = !1, this._hasMaskedPath && (b = _e, S = (T = E[_ = xe].points)[b - 1], C = (p = T[b]).partialLength, m = 0), Ae = "", oe = "", fe = "", te = "", we = this.defaultPropsArray;
|
|
30874
30874
|
else {
|
|
30875
30875
|
if (this._hasMaskedPath) {
|
|
30876
30876
|
if (Ee !== F[l].line) {
|
|
@@ -41753,13 +41753,13 @@ function buildThunks({
|
|
|
41753
41753
|
const se = {
|
|
41754
41754
|
queryArg: F.originalArgs,
|
|
41755
41755
|
pageParam: oe
|
|
41756
|
-
},
|
|
41756
|
+
}, xe = await fe(se), _e = be ? b : _;
|
|
41757
41757
|
return {
|
|
41758
41758
|
data: {
|
|
41759
|
-
pages:
|
|
41760
|
-
pageParams:
|
|
41759
|
+
pages: _e(ce.pages, xe.data, te),
|
|
41760
|
+
pageParams: _e(ce.pageParams, oe, te)
|
|
41761
41761
|
},
|
|
41762
|
-
meta:
|
|
41762
|
+
meta: xe.meta
|
|
41763
41763
|
};
|
|
41764
41764
|
};
|
|
41765
41765
|
async function fe(ce) {
|
|
@@ -41768,7 +41768,7 @@ function buildThunks({
|
|
|
41768
41768
|
extraOptions: te,
|
|
41769
41769
|
argSchema: be,
|
|
41770
41770
|
rawResponseSchema: se,
|
|
41771
|
-
responseSchema:
|
|
41771
|
+
responseSchema: xe
|
|
41772
41772
|
} = Q;
|
|
41773
41773
|
if (be && !ae && (ce = await parseWithSchema(
|
|
41774
41774
|
be,
|
|
@@ -41800,11 +41800,11 @@ function buildThunks({
|
|
|
41800
41800
|
}
|
|
41801
41801
|
if (oe.error) throw new HandledError(oe.error, oe.meta);
|
|
41802
41802
|
let {
|
|
41803
|
-
data:
|
|
41803
|
+
data: _e
|
|
41804
41804
|
} = oe;
|
|
41805
|
-
se && !ae && (
|
|
41806
|
-
let Ee = await pe(
|
|
41807
|
-
return
|
|
41805
|
+
se && !ae && (_e = await parseWithSchema(se, oe.data, "rawResponseSchema", oe.meta));
|
|
41806
|
+
let Ee = await pe(_e, oe.meta, ce);
|
|
41807
|
+
return xe && !ae && (Ee = await parseWithSchema(xe, Ee, "responseSchema", oe.meta)), {
|
|
41808
41808
|
...oe,
|
|
41809
41809
|
data: Ee
|
|
41810
41810
|
};
|
|
@@ -41819,15 +41819,15 @@ function buildThunks({
|
|
|
41819
41819
|
const be = {
|
|
41820
41820
|
pages: [],
|
|
41821
41821
|
pageParams: []
|
|
41822
|
-
}, se = (le = d.selectQueryEntry(ie(), F.queryCacheKey)) == null ? void 0 : le.data,
|
|
41823
|
-
if ("direction" in F && F.direction &&
|
|
41824
|
-
const Ee = F.direction === "backward", we = (Ee ? getPreviousPageParam : getNextPageParam)(ce,
|
|
41825
|
-
te = await ye(
|
|
41822
|
+
}, se = (le = d.selectQueryEntry(ie(), F.queryCacheKey)) == null ? void 0 : le.data, _e = /* arg.forceRefetch */ R(F, ie()) && !F.direction || !se ? be : se;
|
|
41823
|
+
if ("direction" in F && F.direction && _e.pages.length) {
|
|
41824
|
+
const Ee = F.direction === "backward", we = (Ee ? getPreviousPageParam : getNextPageParam)(ce, _e);
|
|
41825
|
+
te = await ye(_e, we, oe, Ee);
|
|
41826
41826
|
} else {
|
|
41827
41827
|
const {
|
|
41828
41828
|
initialPageParam: Ee = ce.initialPageParam
|
|
41829
41829
|
} = F, Ae = (se == null ? void 0 : se.pageParams) ?? [], we = Ae[0] ?? Ee, ke = Ae.length;
|
|
41830
|
-
te = await ye(
|
|
41830
|
+
te = await ye(_e, we, oe), ve && (te = {
|
|
41831
41831
|
data: te.data.pages[0]
|
|
41832
41832
|
});
|
|
41833
41833
|
for (let Be = 1; Be < ke; Be++) {
|
|
@@ -52413,8 +52413,8 @@ const ASSISTANT_ID = "RandmarAIChatAssistant", ChatLayout = forwardRef(
|
|
|
52413
52413
|
const te = [oe.fromPartnerID, oe.toPartnerID];
|
|
52414
52414
|
te.sort(), j((be) => {
|
|
52415
52415
|
let se = !1;
|
|
52416
|
-
const
|
|
52417
|
-
return se && D([te[0], te[1]]),
|
|
52416
|
+
const xe = be.map((_e) => _e.partner1 !== te[0] || _e.partner2 !== te[1] || _e.messages.findIndex((Ee) => Ee.id == oe.id) !== -1 ? _e : (se = !0, { ..._e, unread: _e.unread + 1, messages: [..._e.messages, oe] }));
|
|
52417
|
+
return se && D([te[0], te[1]]), xe;
|
|
52418
52418
|
});
|
|
52419
52419
|
}
|
|
52420
52420
|
useEffect(() => {
|
|
@@ -52444,21 +52444,21 @@ const ASSISTANT_ID = "RandmarAIChatAssistant", ChatLayout = forwardRef(
|
|
|
52444
52444
|
applicationId: e,
|
|
52445
52445
|
conversationId: oe.conversationID
|
|
52446
52446
|
}).unwrap().then((be) => {
|
|
52447
|
-
const se = be.map((
|
|
52448
|
-
id: "history" +
|
|
52449
|
-
fromPartnerID:
|
|
52450
|
-
toPartnerID:
|
|
52451
|
-
senderName:
|
|
52452
|
-
timestamp: (/* @__PURE__ */ new Date(
|
|
52453
|
-
content:
|
|
52447
|
+
const se = be.map((xe) => ({
|
|
52448
|
+
id: "history" + xe.MessageId,
|
|
52449
|
+
fromPartnerID: xe.SenderId,
|
|
52450
|
+
toPartnerID: xe.SenderId == N[0] ? N[1] : N[0],
|
|
52451
|
+
senderName: xe.SenderName ?? "missing name",
|
|
52452
|
+
timestamp: (/* @__PURE__ */ new Date(xe.SentDate + "Z")).getTime(),
|
|
52453
|
+
content: xe.Content ?? "no content"
|
|
52454
52454
|
}));
|
|
52455
|
-
j((
|
|
52456
|
-
...
|
|
52455
|
+
j((xe) => xe.map((_e) => _e.partner1 === N[0] && _e.partner2 === N[1] ? {
|
|
52456
|
+
..._e,
|
|
52457
52457
|
messages: se,
|
|
52458
52458
|
historyFetched: !0
|
|
52459
|
-
} :
|
|
52460
|
-
var
|
|
52461
|
-
return (
|
|
52459
|
+
} : _e)), setTimeout(() => {
|
|
52460
|
+
var xe;
|
|
52461
|
+
return (xe = W.current) == null ? void 0 : xe.scrollIntoView({ behavior: "smooth" });
|
|
52462
52462
|
}, 100);
|
|
52463
52463
|
}).catch((be) => {
|
|
52464
52464
|
console.error("Error fetching conversation messages:", be);
|
|
@@ -52473,7 +52473,7 @@ const ASSISTANT_ID = "RandmarAIChatAssistant", ChatLayout = forwardRef(
|
|
|
52473
52473
|
content: oe,
|
|
52474
52474
|
timestamp: Date.now()
|
|
52475
52475
|
};
|
|
52476
|
-
j((
|
|
52476
|
+
j((xe) => xe.map((_e) => _e.partner1 === te[0] && _e.partner2 === te[1] ? { ..._e, messages: [..._e.messages, se] } : _e)), D([te[0], te[1]]), se.toPartnerID == ASSISTANT_ID ? m(se.content) : be.invoke("NewMessage", se).catch((xe) => console.error("Error sending message:", xe)), M("");
|
|
52477
52477
|
}, pe = (oe, te) => {
|
|
52478
52478
|
if (!L.length || !H || !_) return !1;
|
|
52479
52479
|
const be = L.find((se) => se.conversationID === oe);
|
|
@@ -53525,7 +53525,7 @@ Defaulting to 2020, but this will stop working in the future.`)), B.ecmaVersion
|
|
|
53525
53525
|
A.locations && (Pe.loc = new ue(this, ge, Se)), A.ranges && (Pe.range = [ne, me]), B.push(Pe);
|
|
53526
53526
|
};
|
|
53527
53527
|
}
|
|
53528
|
-
var fe = 1, ce = 2, oe = 4, te = 8, be = 16, se = 32,
|
|
53528
|
+
var fe = 1, ce = 2, oe = 4, te = 8, be = 16, se = 32, xe = 64, _e = 128, Ee = 256, Ae = fe | ce | Ee;
|
|
53529
53529
|
function we(A, B) {
|
|
53530
53530
|
return ce | (A ? oe : 0) | (B ? te : 0);
|
|
53531
53531
|
}
|
|
@@ -53557,9 +53557,9 @@ Defaulting to 2020, but this will stop working in the future.`)), B.ecmaVersion
|
|
|
53557
53557
|
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
53558
53558
|
}, qe.allowSuper.get = function() {
|
|
53559
53559
|
var A = this.currentThisScope(), B = A.flags, z = A.inClassFieldInit;
|
|
53560
|
-
return (B &
|
|
53560
|
+
return (B & xe) > 0 || z || this.options.allowSuperOutsideMethod;
|
|
53561
53561
|
}, qe.allowDirectSuper.get = function() {
|
|
53562
|
-
return (this.currentThisScope().flags &
|
|
53562
|
+
return (this.currentThisScope().flags & _e) > 0;
|
|
53563
53563
|
}, qe.treatFunctionsAsVar.get = function() {
|
|
53564
53564
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
53565
53565
|
}, qe.allowNewDotTarget.get = function() {
|
|
@@ -53887,7 +53887,7 @@ Defaulting to 2020, but this will stop working in the future.`)), B.ecmaVersion
|
|
|
53887
53887
|
}, Te.parseClassStaticBlock = function(A) {
|
|
53888
53888
|
A.body = [];
|
|
53889
53889
|
var B = this.labels;
|
|
53890
|
-
for (this.labels = [], this.enterScope(Ee |
|
|
53890
|
+
for (this.labels = [], this.enterScope(Ee | xe); this.type !== I.braceR; ) {
|
|
53891
53891
|
var z = this.parseStatement(null);
|
|
53892
53892
|
A.body.push(z);
|
|
53893
53893
|
}
|
|
@@ -54581,7 +54581,7 @@ Defaulting to 2020, but this will stop working in the future.`)), B.ecmaVersion
|
|
|
54581
54581
|
A.id = null, this.options.ecmaVersion >= 6 && (A.generator = A.expression = !1), this.options.ecmaVersion >= 8 && (A.async = !1);
|
|
54582
54582
|
}, Re.parseMethod = function(A, B, z) {
|
|
54583
54583
|
var K = this.startNode(), ne = this.yieldPos, me = this.awaitPos, ge = this.awaitIdentPos;
|
|
54584
|
-
return this.initFunction(K), this.options.ecmaVersion >= 6 && (K.generator = A), this.options.ecmaVersion >= 8 && (K.async = !!B), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(we(B, K.generator) |
|
|
54584
|
+
return this.initFunction(K), this.options.ecmaVersion >= 6 && (K.generator = A), this.options.ecmaVersion >= 8 && (K.async = !!B), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(we(B, K.generator) | xe | (z ? _e : 0)), this.expect(I.parenL), K.params = this.parseBindingList(I.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(K, !1, !0, !1), this.yieldPos = ne, this.awaitPos = me, this.awaitIdentPos = ge, this.finishNode(K, "FunctionExpression");
|
|
54585
54585
|
}, Re.parseArrowExpression = function(A, B, z, K) {
|
|
54586
54586
|
var ne = this.yieldPos, me = this.awaitPos, ge = this.awaitIdentPos;
|
|
54587
54587
|
return this.enterScope(we(z, !1) | be), this.initFunction(A), this.options.ecmaVersion >= 8 && (A.async = !!z), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, A.params = this.toAssignableList(B, !0), this.parseFunctionBody(A, !0, !1, K), this.yieldPos = ne, this.awaitPos = me, this.awaitIdentPos = ge, this.finishNode(A, "ArrowFunctionExpression");
|
|
@@ -55603,13 +55603,13 @@ Defaulting to 2020, but this will stop working in the future.`)), B.ecmaVersion
|
|
|
55603
55603
|
}
|
|
55604
55604
|
return B += this.input.slice(z, this.pos++), this.finishToken(I.string, B);
|
|
55605
55605
|
};
|
|
55606
|
-
var
|
|
55606
|
+
var xr = {};
|
|
55607
55607
|
Oe.tryReadTemplateToken = function() {
|
|
55608
55608
|
this.inTemplateElement = !0;
|
|
55609
55609
|
try {
|
|
55610
55610
|
this.readTmplToken();
|
|
55611
55611
|
} catch (A) {
|
|
55612
|
-
if (A ===
|
|
55612
|
+
if (A === xr)
|
|
55613
55613
|
this.readInvalidTemplateToken();
|
|
55614
55614
|
else
|
|
55615
55615
|
throw A;
|
|
@@ -55617,7 +55617,7 @@ Defaulting to 2020, but this will stop working in the future.`)), B.ecmaVersion
|
|
|
55617
55617
|
this.inTemplateElement = !1;
|
|
55618
55618
|
}, Oe.invalidStringToken = function(A, B) {
|
|
55619
55619
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9)
|
|
55620
|
-
throw
|
|
55620
|
+
throw xr;
|
|
55621
55621
|
this.raise(A, B);
|
|
55622
55622
|
}, Oe.readTmplToken = function() {
|
|
55623
55623
|
for (var A = "", B = this.pos; ; ) {
|
|
@@ -55726,10 +55726,10 @@ Defaulting to 2020, but this will stop working in the future.`)), B.ecmaVersion
|
|
|
55726
55726
|
var A = this.readWord1(), B = I.name;
|
|
55727
55727
|
return this.keywords.test(A) && (B = V[A]), this.finishToken(B, A);
|
|
55728
55728
|
};
|
|
55729
|
-
var
|
|
55729
|
+
var _r = "8.12.1";
|
|
55730
55730
|
Ne.acorn = {
|
|
55731
55731
|
Parser: Ne,
|
|
55732
|
-
version:
|
|
55732
|
+
version: _r,
|
|
55733
55733
|
defaultOptions: de,
|
|
55734
55734
|
Position: le,
|
|
55735
55735
|
SourceLocation: ue,
|
|
@@ -55757,7 +55757,7 @@ Defaulting to 2020, but this will stop working in the future.`)), B.ecmaVersion
|
|
|
55757
55757
|
function Wr(A, B) {
|
|
55758
55758
|
return Ne.tokenizer(A, B);
|
|
55759
55759
|
}
|
|
55760
|
-
n.Node = ft, n.Parser = Ne, n.Position = le, n.SourceLocation = ue, n.TokContext = Ke, n.Token = $t, n.TokenType = C, n.defaultOptions = de, n.getLineInfo = pe, n.isIdentifierChar = E, n.isIdentifierStart = T, n.isNewLine = j, n.keywordTypes = V, n.lineBreak = D, n.lineBreakG = L, n.nonASCIIwhitespace = F, n.parse = Gr, n.parseExpressionAt = zr, n.tokContexts = Ue, n.tokTypes = I, n.tokenizer = Wr, n.version =
|
|
55760
|
+
n.Node = ft, n.Parser = Ne, n.Position = le, n.SourceLocation = ue, n.TokContext = Ke, n.Token = $t, n.TokenType = C, n.defaultOptions = de, n.getLineInfo = pe, n.isIdentifierChar = E, n.isIdentifierStart = T, n.isNewLine = j, n.keywordTypes = V, n.lineBreak = D, n.lineBreakG = L, n.nonASCIIwhitespace = F, n.parse = Gr, n.parseExpressionAt = zr, n.tokContexts = Ue, n.tokTypes = I, n.tokenizer = Wr, n.version = _r;
|
|
55761
55761
|
});
|
|
55762
55762
|
}), require_acorn_jsx = __commonJS((e, t) => {
|
|
55763
55763
|
var n = require_xhtml(), o = /^[\da-fA-F]+$/, l = /^\d+$/, u = /* @__PURE__ */ new WeakMap();
|
|
@@ -60157,20 +60157,20 @@ var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition", SelectItemAlignedP
|
|
|
60157
60157
|
if (u.trigger && u.valueNode && f && m && E && C && R) {
|
|
60158
60158
|
const D = u.trigger.getBoundingClientRect(), L = m.getBoundingClientRect(), j = u.valueNode.getBoundingClientRect(), q = R.getBoundingClientRect();
|
|
60159
60159
|
if (u.dir !== "rtl") {
|
|
60160
|
-
const oe = q.left - L.left, te = j.left - oe, be = D.left - te, se = D.width + be,
|
|
60160
|
+
const oe = q.left - L.left, te = j.left - oe, be = D.left - te, se = D.width + be, xe = Math.max(se, L.width), _e = window.innerWidth - CONTENT_MARGIN, Ee = clamp(te, [
|
|
60161
60161
|
CONTENT_MARGIN,
|
|
60162
60162
|
// Prevents the content from going off the starting edge of the
|
|
60163
60163
|
// viewport. It may still go off the ending edge, but this can be
|
|
60164
60164
|
// controlled by the user since they may want to manage overflow in a
|
|
60165
60165
|
// specific way.
|
|
60166
60166
|
// https://github.com/radix-ui/primitives/issues/2049
|
|
60167
|
-
Math.max(CONTENT_MARGIN,
|
|
60167
|
+
Math.max(CONTENT_MARGIN, _e - xe)
|
|
60168
60168
|
]);
|
|
60169
60169
|
f.style.minWidth = se + "px", f.style.left = Ee + "px";
|
|
60170
60170
|
} else {
|
|
60171
|
-
const oe = L.right - q.right, te = window.innerWidth - j.right - oe, be = window.innerWidth - D.right - te, se = D.width + be,
|
|
60171
|
+
const oe = L.right - q.right, te = window.innerWidth - j.right - oe, be = window.innerWidth - D.right - te, se = D.width + be, xe = Math.max(se, L.width), _e = window.innerWidth - CONTENT_MARGIN, Ee = clamp(te, [
|
|
60172
60172
|
CONTENT_MARGIN,
|
|
60173
|
-
Math.max(CONTENT_MARGIN,
|
|
60173
|
+
Math.max(CONTENT_MARGIN, _e - xe)
|
|
60174
60174
|
]);
|
|
60175
60175
|
f.style.minWidth = se + "px", f.style.right = Ee + "px";
|
|
60176
60176
|
}
|
|
@@ -61636,9 +61636,130 @@ function ManufacturerGetStartedButton({
|
|
|
61636
61636
|
] }) })
|
|
61637
61637
|
] });
|
|
61638
61638
|
}
|
|
61639
|
+
const alertVariants = cva(
|
|
61640
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
|
|
61641
|
+
{
|
|
61642
|
+
variants: {
|
|
61643
|
+
variant: {
|
|
61644
|
+
default: "bg-background text-foreground",
|
|
61645
|
+
destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
|
|
61646
|
+
}
|
|
61647
|
+
},
|
|
61648
|
+
defaultVariants: {
|
|
61649
|
+
variant: "default"
|
|
61650
|
+
}
|
|
61651
|
+
}
|
|
61652
|
+
), Alert = React.forwardRef(({ className: e, variant: t, ...n }, o) => /* @__PURE__ */ jsx(
|
|
61653
|
+
"div",
|
|
61654
|
+
{
|
|
61655
|
+
ref: o,
|
|
61656
|
+
role: "alert",
|
|
61657
|
+
className: cn(alertVariants({ variant: t }), e),
|
|
61658
|
+
...n
|
|
61659
|
+
}
|
|
61660
|
+
));
|
|
61661
|
+
Alert.displayName = "Alert";
|
|
61662
|
+
const AlertTitle = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx(
|
|
61663
|
+
"h5",
|
|
61664
|
+
{
|
|
61665
|
+
ref: n,
|
|
61666
|
+
className: cn("mb-1 font-medium leading-none tracking-tight", e),
|
|
61667
|
+
...t
|
|
61668
|
+
}
|
|
61669
|
+
));
|
|
61670
|
+
AlertTitle.displayName = "AlertTitle";
|
|
61671
|
+
const AlertDescription = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx(
|
|
61672
|
+
"div",
|
|
61673
|
+
{
|
|
61674
|
+
ref: n,
|
|
61675
|
+
className: cn("text-sm [&_p]:leading-relaxed", e),
|
|
61676
|
+
...t
|
|
61677
|
+
}
|
|
61678
|
+
));
|
|
61679
|
+
AlertDescription.displayName = "AlertDescription";
|
|
61680
|
+
const Table = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
|
|
61681
|
+
"table",
|
|
61682
|
+
{
|
|
61683
|
+
ref: n,
|
|
61684
|
+
className: cn("w-full caption-bottom text-sm", e),
|
|
61685
|
+
...t
|
|
61686
|
+
}
|
|
61687
|
+
) }));
|
|
61688
|
+
Table.displayName = "Table";
|
|
61689
|
+
const TableHeader = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx("thead", { ref: n, className: cn("[&_tr]:border-b", e), ...t }));
|
|
61690
|
+
TableHeader.displayName = "TableHeader";
|
|
61691
|
+
const TableBody = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx(
|
|
61692
|
+
"tbody",
|
|
61693
|
+
{
|
|
61694
|
+
ref: n,
|
|
61695
|
+
className: cn("[&_tr:last-child]:border-0", e),
|
|
61696
|
+
...t
|
|
61697
|
+
}
|
|
61698
|
+
));
|
|
61699
|
+
TableBody.displayName = "TableBody";
|
|
61700
|
+
const TableFooter = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx(
|
|
61701
|
+
"tfoot",
|
|
61702
|
+
{
|
|
61703
|
+
ref: n,
|
|
61704
|
+
className: cn(
|
|
61705
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
61706
|
+
e
|
|
61707
|
+
),
|
|
61708
|
+
...t
|
|
61709
|
+
}
|
|
61710
|
+
));
|
|
61711
|
+
TableFooter.displayName = "TableFooter";
|
|
61712
|
+
const TableRow = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx(
|
|
61713
|
+
"tr",
|
|
61714
|
+
{
|
|
61715
|
+
ref: n,
|
|
61716
|
+
className: cn(
|
|
61717
|
+
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
61718
|
+
e
|
|
61719
|
+
),
|
|
61720
|
+
...t
|
|
61721
|
+
}
|
|
61722
|
+
));
|
|
61723
|
+
TableRow.displayName = "TableRow";
|
|
61724
|
+
const TableHead = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx(
|
|
61725
|
+
"th",
|
|
61726
|
+
{
|
|
61727
|
+
ref: n,
|
|
61728
|
+
className: cn(
|
|
61729
|
+
"h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
61730
|
+
e
|
|
61731
|
+
),
|
|
61732
|
+
...t
|
|
61733
|
+
}
|
|
61734
|
+
));
|
|
61735
|
+
TableHead.displayName = "TableHead";
|
|
61736
|
+
const TableCell = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx(
|
|
61737
|
+
"td",
|
|
61738
|
+
{
|
|
61739
|
+
ref: n,
|
|
61740
|
+
className: cn(
|
|
61741
|
+
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
61742
|
+
e
|
|
61743
|
+
),
|
|
61744
|
+
...t
|
|
61745
|
+
}
|
|
61746
|
+
));
|
|
61747
|
+
TableCell.displayName = "TableCell";
|
|
61748
|
+
const TableCaption = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx(
|
|
61749
|
+
"caption",
|
|
61750
|
+
{
|
|
61751
|
+
ref: n,
|
|
61752
|
+
className: cn("mt-4 text-sm text-muted-foreground", e),
|
|
61753
|
+
...t
|
|
61754
|
+
}
|
|
61755
|
+
));
|
|
61756
|
+
TableCaption.displayName = "TableCaption";
|
|
61639
61757
|
export {
|
|
61640
61758
|
ActiveOrdersCard,
|
|
61641
61759
|
AiGeneratedContent,
|
|
61760
|
+
Alert,
|
|
61761
|
+
AlertDescription,
|
|
61762
|
+
AlertTitle,
|
|
61642
61763
|
ApiKeyProvider,
|
|
61643
61764
|
AreaChart,
|
|
61644
61765
|
Avatar,
|
|
@@ -61749,6 +61870,14 @@ export {
|
|
|
61749
61870
|
SidebarTrigger,
|
|
61750
61871
|
Skeleton,
|
|
61751
61872
|
Switch,
|
|
61873
|
+
Table,
|
|
61874
|
+
TableBody,
|
|
61875
|
+
TableCaption,
|
|
61876
|
+
TableCell,
|
|
61877
|
+
TableFooter,
|
|
61878
|
+
TableHead,
|
|
61879
|
+
TableHeader,
|
|
61880
|
+
TableRow,
|
|
61752
61881
|
Tabs,
|
|
61753
61882
|
TabsContent,
|
|
61754
61883
|
TabsList,
|
|
@@ -893,4 +893,4 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
893
893
|
ProductCard, for data that fits this shape:
|
|
894
894
|
{ "RandmarSKU": "3007864", "RandmarTitle": "CTTN450 COMPATIBLE TN450 TONER", "Category": "CT", "UnitWeight": 1.5500, "UPC": "628277000035", "ManufacturerName": "Balloon Brand", "ProductType": "Toners", "AutoUpdate": 1, "CreatedBy": "", "LastMaintainedDate": 20190314.0, "Title": "CTTN450 COMPATIBLE TN450 TONER", "BodyHTML": "<p>CTTN450 COMPATIBLE TN450 TONER</p>", "MAP": 17.5500, "ManufacturerId": "90200", "State": "Active", "MPN": "CTTN450", "MasterCarton": 12, "SkidQuantity": null, "SerialNumber": true, "OpportunityOnly": false, "VoiceoverCaption": "example...", "SceneName": "Top of Clouds", "Require3DScan": false, "TransparencyCode": false, "CountryCodeOfOrigin": null, "UnitLength": null, "UnitWidth": null, "UnitHeight": null, "Distribution": { "Price": 14.29, "RegularPrice": 14.29, "MAP": 17.55, "Currency": "CAD", "ExchangeRate": 1.000000000, "Inventory": [ { "RandmarSKU": "3007864", "WarehouseId": "EDM", "WarehouseType": "Fulfillment Center", "Name": "Randmar Edmonton", "City": "Edmonton", "Province": "AB", "Country": "CA", "AvailableQuantity": 7, "PurchaseOrderQuantity": 0, "BinLocation": "" }, { "RandmarSKU": "3007864", "WarehouseId": "MTL", "WarehouseType": "Fulfillment Center", "Name": "Randmar Montreal", "City": "Pierrefonds", "Province": "QC", "Country": "CA", "AvailableQuantity": 45, "PurchaseOrderQuantity": 0, "BinLocation": "C3EB" }, { "RandmarSKU": "3007864", "WarehouseId": "TOR", "WarehouseType": "Fulfillment Center", "Name": "Randmar Toronto", "City": "Mississauga", "Province": "ON", "Country": "CA", "AvailableQuantity": 15, "PurchaseOrderQuantity": 0, "BinLocation": "A6A" }, { "RandmarSKU": "3007864", "WarehouseId": "VAN", "WarehouseType": "Fulfillment Center", "Name": "Randmar Vancouver", "City": "Richmond", "Province": "BC", "Country": "CA", "AvailableQuantity": 8, "PurchaseOrderQuantity": 0, "BinLocation": "" } ] }, "ManufacturerCategory": { "ManufacturerId": "90200", "CategoryCode": "CT", "CategoryName": "Toners", "Starred": false, "AutoReorder": true, "QualificationRequired": false, "Niche": "Print" }, "InstantRebate": null, "Opportunities": null, "AvailableToBuy": true }
|
|
895
895
|
Use <ProductCard item={data}>`],basicComponents=["<Card> <CardHeader> <CardTitle>...</CardTitle> <CardDescription>...</CardDescription> </CardHeader> <CardContent> ... </CardContent> </Card>","<Badge>...</Badge>",'<Tabs defaultValue="eg1"> <TabsList> <TabsTrigger value="eg1">Example1</TabsTrigger> <TabsTrigger value="eg2">Example2</TabsTrigger> </TabsList> <TabsContent value="eg1"> ... </TabsContent> <TabsContent value="eg2"> ... </TabsContent> </Tabs>',"<ScrollArea>...</ScrollArea>","<ScrollArea orientation='horizontal'>...</ScrollArea>"],GetJSXFromAI=async(e,t,n,o,l=3)=>{const u="In addition to basic html tags, You have access to these beautiful Handmade Components. Try to use them even when you get an array of search results. For example, use ProductCard when ContentType is Product:",p="You also have access to these few Shadcn UI components:",d='Here is the data to display to the user (If a Handmade Component is a good fit for the data, use it. Otherwise, use regular html tags) (You have access to this data object in React via the data variable. Do not use JSON.parse, it is already parsed. For example, if data is an array, you can use {data.map(item, idx => <>...</>)} directly. CAUTION: when using map, you must use implicit return rather than a block body, as shown before. AGAIN: never use JSON.parse - data is already parsed and never a block body with arrow functions such as: (item => { return "EXAMPLE - DO NOT DO THIS" }):',f="Only output a single JSX code snippet. Start with <> and end with </>. All other code will be ignored, so make sure to place all CSS styles inline. Use CSS flex layouts when there is a lot of stuff to display.",m=JSON.stringify(n),g=[t,u,...complexComponents,p,...basicComponents,f,d,m,f].join(`\r
|
|
896
|
-
`),S=await new GoogleGenAI({apiKey:e}).chats.create({model:o?"gemini-2.5-pro-preview-03-25":"gemini-2.0-flash-lite"}).sendMessage({message:g}),E=trimJSXString(S.text??"");return E&&!containsBlockArrowFunc(E)?E:l==0?"<p>Could not generate visuals for this data.</p>":await GetJSXFromAI(e,t,n,o,l-1)};function containsBlockArrowFunc(e){return e.replace(/\s+/g,"").indexOf("=>{")>=0}function trimJSXString(e){const t=e.indexOf("<"),n=e.lastIndexOf("</");return t===-1||n===-1?"":e.slice(t,e.indexOf(">",n)+1)}function AiGeneratedContent(e){const[t,n]=React.useState(""),{apiKey:o}=useApiKey();return React.useEffect(()=>{if(!o||!e.prompt||!e.data)return;n("");let l=!1;return GetJSXFromAI(o,e.prompt,e.data,e.smartAndSlow===!0).then(u=>{l||n(u)}),()=>{l=!0}},[e.prompt,e.data,n,o,e.smartAndSlow]),t?jsxRuntime.jsx(source_default,{bindings:{data:e.data},components:{ResellerCard,ManufacturerCard,PartnerCard,ProductCard,Card,CardHeader,CardTitle,CardContent,CardDescription,Badge,Tabs,TabsList,TabsContent,TabsTrigger,ScrollArea},jsx:t}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(Skeleton,{className:"h-32 w-32",children:jsxRuntime.jsx(Bot,{className:"m-auto align-middle h-full"})})})}function GeneralDocumentCard({document:e,loading:t=!1}){return t?jsxRuntime.jsx("div",{children:"loading..."}):jsxRuntime.jsxs("div",{children:["GENERAL DOCUMENT CARD - ",e==null?void 0:e.OrderNumber," for P.O. ",e==null?void 0:e.PONumber]})}const Navbar=React.forwardRef(({routes:e,footer:t,dashboardTitle:n,withRandmarAssistant:o,chatUserName:l,chatApiKey:u},p)=>{const{appID:d}=reactRouterDom.useParams(),f=e.filter(_=>_.showInNav),m=React.useRef(null),g=React.useRef(null),b=React.useRef(null);return React.useImperativeHandle(p,()=>({setActiveChatAndSendMessage:(_,S)=>{var E;return(E=b.current)==null||E.click(),setTimeout(()=>{var C;(C=m.current)==null||C.focus(),g.current&&g.current.setActiveChatAndSendMessage(_,S)},100),!0}})),jsxRuntime.jsxs(Sidebar,{className:"border-r border-sidebar-border",children:[jsxRuntime.jsx(SidebarHeader,{className:"border-b border-sidebar-border px-6 h-16 justify-center bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center",children:jsxRuntime.jsx("img",{src:"https://api.randmar.io/images/RandmarIcon.svg",alt:"Randmar Icon",className:"h-4 w-4 filter brightness-0 saturate-100 invert"})}),jsxRuntime.jsx("span",{className:"font-semibold text-lg",children:n})]})}),jsxRuntime.jsx(SidebarContent,{className:"py-4 bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsx(SidebarMenu,{children:f.map(_=>{const S=_.icon,E=`/${_.path.replace(":appID",d??"")}`;return jsxRuntime.jsx(SidebarMenuItem,{children:jsxRuntime.jsx(SidebarMenuButton,{asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:E,className:"transition-colors hover:bg-muted px-6",children:[S&&jsxRuntime.jsx(S,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:_.label})]})})},_.key)})})}),jsxRuntime.jsxs(SidebarFooter,{className:"border-t border-sidebar-border p-4 bg-sidebar-background text-sidebar-foreground",children:[o===!0&&jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:b,size:"lg",className:"collapse md:visible",onClick:()=>setTimeout(()=>{var _;return(_=m.current)==null?void 0:_.focus()},50),children:[jsxRuntime.jsx(Bot,{}),"Assistant"]})}),jsxRuntime.jsx(DialogContent,{className:"max-w-[85vw] p-0 data-[state=open]:visible data-[state=closed]:invisible",forceMount:!0,animateExit:!1,children:jsxRuntime.jsx(ChatLayout,{ref:g,inputRef:m,userId:d??"2",userName:l??"Unknown user",apiKey:u??""})})]}),t]})]})}),Layout=React.forwardRef(({children:e,rightMenu:t,routes:n,footer:o,handleValidSearch:l,dashboardTitle:u,onSignOut:p,searchPlaceholder:d,withRandmarAssistant:f,chatUserName:m,chatApiKey:g,chatRef:b},_)=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(SidebarProvider,{children:jsxRuntime.jsxs("div",{className:"flex grow",children:[jsxRuntime.jsx(Navbar,{routes:n,footer:o,dashboardTitle:u,withRandmarAssistant:f,chatUserName:m,chatApiKey:g,ref:b}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[jsxRuntime.jsx(Topbar,{ref:_,onSignOut:p,rightMenu:t,handleValidSearch:l,searchPlaceholder:d}),jsxRuntime.jsx("main",{className:"flex-1 overflow-auto mt-16",children:e}),jsxRuntime.jsx(Toaster,{})]})]})})}));Layout.displayName="Layout";function usePrevious(e){const t=React__namespace.useRef({value:e,previous:e});return React__namespace.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection,useCollection,createCollectionScope]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope,createPopperScope]),usePopperScope=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:l,onOpenChange:u,value:p,defaultValue:d,onValueChange:f,dir:m,name:g,autoComplete:b,disabled:_,required:S,form:E}=e,C=usePopperScope(t),[R,A]=React__namespace.useState(null),[N,O]=React__namespace.useState(null),[j,M]=React__namespace.useState(!1),I=useDirection(m),[V,B]=useControllableState({prop:o,defaultProp:l??!1,onChange:u,caller:SELECT_NAME}),[L,q]=useControllableState({prop:p,defaultProp:d,onChange:f,caller:SELECT_NAME}),F=React__namespace.useRef(null),H=R?E||!!R.closest("form"):!0,[U,G]=React__namespace.useState(new Set),J=Array.from(U).map(ee=>ee.props.value).join(";");return jsxRuntime.jsx(Root2$4,{...C,children:jsxRuntime.jsxs(SelectProvider,{required:S,scope:t,trigger:R,onTriggerChange:A,valueNode:N,onValueNodeChange:O,valueNodeHasChildren:j,onValueNodeHasChildrenChange:M,contentId:useId(),value:L,onValueChange:q,open:V,onOpenChange:B,dir:I,triggerPointerDownPosRef:F,disabled:_,children:[jsxRuntime.jsx(Collection.Provider,{scope:t,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:e.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(ee=>{G(ie=>new Set(ie).add(ee))},[]),onNativeOptionRemove:React__namespace.useCallback(ee=>{G(ie=>{const W=new Set(ie);return W.delete(ee),W})},[]),children:n})}),H?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:S,tabIndex:-1,name:g,autoComplete:b,value:L,onChange:ee=>q(ee.target.value),disabled:_,form:E,children:[L===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(U)]},J):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...l}=e,u=usePopperScope(n),p=useSelectContext(TRIGGER_NAME,n),d=p.disabled||o,f=useComposedRefs(t,p.onTriggerChange),m=useCollection(n),g=React__namespace.useRef("touch"),[b,_,S]=useTypeaheadSearch(C=>{const R=m().filter(O=>!O.disabled),A=R.find(O=>O.value===p.value),N=findNextItem(R,C,A);N!==void 0&&p.onValueChange(N.value)}),E=C=>{d||(p.onOpenChange(!0),S()),C&&(p.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...u,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":p.contentId,"aria-expanded":p.open,"aria-required":p.required,"aria-autocomplete":"none",dir:p.dir,"data-state":p.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":shouldShowPlaceholder(p.value)?"":void 0,...l,ref:f,onClick:composeEventHandlers(l.onClick,C=>{C.currentTarget.focus(),g.current!=="mouse"&&E(C)}),onPointerDown:composeEventHandlers(l.onPointerDown,C=>{g.current=C.pointerType;const R=C.target;R.hasPointerCapture(C.pointerId)&&R.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(E(C),C.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,C=>{const R=b.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&_(C.key),!(R&&C.key===" ")&&OPEN_KEYS.includes(C.key)&&(E(),C.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:l,children:u,placeholder:p="",...d}=e,f=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:m}=f,g=u!==void 0,b=useComposedRefs(t,f.onValueNodeChange);return useLayoutEffect2(()=>{m(g)},[m,g]),jsxRuntime.jsx(Primitive.span,{...d,ref:b,style:{pointerEvents:"none"},children:shouldShowPlaceholder(f.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:p}):u})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...l}=e;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:t,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME="SelectPortal",SelectPortal=e=>jsxRuntime.jsx(Portal$4,{asChild:!0,...e});SelectPortal.displayName=PORTAL_NAME;var CONTENT_NAME="SelectContent",SelectContent$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContext(CONTENT_NAME,e.__scopeSelect),[o,l]=React__namespace.useState();if(useLayoutEffect2(()=>{l(new DocumentFragment)},[]),!n.open){const u=o;return u?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:e.__scopeSelect,children:jsxRuntime.jsx(Collection.Slot,{scope:e.__scopeSelect,children:jsxRuntime.jsx("div",{children:e.children})})}),u):null}return jsxRuntime.jsx(SelectContentImpl,{...e,ref:t})});SelectContent$1.displayName=CONTENT_NAME;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME),CONTENT_IMPL_NAME="SelectContentImpl",Slot=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:u,onPointerDownOutside:p,side:d,sideOffset:f,align:m,alignOffset:g,arrowPadding:b,collisionBoundary:_,collisionPadding:S,sticky:E,hideWhenDetached:C,avoidCollisions:R,...A}=e,N=useSelectContext(CONTENT_NAME,n),[O,j]=React__namespace.useState(null),[M,I]=React__namespace.useState(null),V=useComposedRefs(t,de=>j(de)),[B,L]=React__namespace.useState(null),[q,F]=React__namespace.useState(null),H=useCollection(n),[U,G]=React__namespace.useState(!1),J=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(O)return hideOthers(O)},[O]),useFocusGuards();const ee=React__namespace.useCallback(de=>{const[ye,...he]=H().map(te=>te.ref.current),[ce]=he.slice(-1),se=document.activeElement;for(const te of de)if(te===se||(te==null||te.scrollIntoView({block:"nearest"}),te===ye&&M&&(M.scrollTop=0),te===ce&&M&&(M.scrollTop=M.scrollHeight),te==null||te.focus(),document.activeElement!==se))return},[H,M]),ie=React__namespace.useCallback(()=>ee([B,O]),[ee,B,O]);React__namespace.useEffect(()=>{U&&ie()},[U,ie]);const{onOpenChange:W,triggerPointerDownPosRef:Q}=N;React__namespace.useEffect(()=>{if(O){let de={x:0,y:0};const ye=ce=>{var se,te;de={x:Math.abs(Math.round(ce.pageX)-(((se=Q.current)==null?void 0:se.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((te=Q.current)==null?void 0:te.y)??0))}},he=ce=>{de.x<=10&&de.y<=10?ce.preventDefault():O.contains(ce.target)||W(!1),document.removeEventListener("pointermove",ye),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",he,{capture:!0})}}},[O,W,Q]),React__namespace.useEffect(()=>{const de=()=>W(!1);return window.addEventListener("blur",de),window.addEventListener("resize",de),()=>{window.removeEventListener("blur",de),window.removeEventListener("resize",de)}},[W]);const[Z,ae]=useTypeaheadSearch(de=>{const ye=H().filter(se=>!se.disabled),he=ye.find(se=>se.ref.current===document.activeElement),ce=findNextItem(ye,de,he);ce&&setTimeout(()=>ce.ref.current.focus())}),le=React__namespace.useCallback((de,ye,he)=>{const ce=!J.current&&!he;(N.value!==void 0&&N.value===ye||ce)&&(L(de),ce&&(J.current=!0))},[N.value]),ue=React__namespace.useCallback(()=>O==null?void 0:O.focus(),[O]),fe=React__namespace.useCallback((de,ye,he)=>{const ce=!J.current&&!he;(N.value!==void 0&&N.value===ye||ce)&&F(de)},[N.value]),pe=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,ve=pe===SelectPopperPosition?{side:d,sideOffset:f,align:m,alignOffset:g,arrowPadding:b,collisionBoundary:_,collisionPadding:S,sticky:E,hideWhenDetached:C,avoidCollisions:R}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:O,viewport:M,onViewportChange:I,itemRefCallback:le,selectedItem:B,onItemLeave:ue,itemTextRefCallback:fe,focusSelectedItem:ie,selectedItemText:q,position:o,isPositioned:U,searchRef:Z,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:N.open,onMountAutoFocus:de=>{de.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,de=>{var ye;(ye=N.trigger)==null||ye.focus({preventScroll:!0}),de.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:p,onFocusOutside:de=>de.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:jsxRuntime.jsx(pe,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:de=>de.preventDefault(),...A,...ve,onPlaced:()=>G(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:composeEventHandlers(A.onKeyDown,de=>{const ye=de.ctrlKey||de.altKey||de.metaKey;if(de.key==="Tab"&&de.preventDefault(),!ye&&de.key.length===1&&ae(de.key),["ArrowUp","ArrowDown","Home","End"].includes(de.key)){let ce=H().filter(se=>!se.disabled).map(se=>se.ref.current);if(["ArrowUp","End"].includes(de.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(de.key)){const se=de.target,te=ce.indexOf(se);ce=ce.slice(te+1)}setTimeout(()=>ee(ce)),de.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...l}=e,u=useSelectContext(CONTENT_NAME,n),p=useSelectContentContext(CONTENT_NAME,n),[d,f]=React__namespace.useState(null),[m,g]=React__namespace.useState(null),b=useComposedRefs(t,V=>g(V)),_=useCollection(n),S=React__namespace.useRef(!1),E=React__namespace.useRef(!0),{viewport:C,selectedItem:R,selectedItemText:A,focusSelectedItem:N}=p,O=React__namespace.useCallback(()=>{if(u.trigger&&u.valueNode&&d&&m&&C&&R&&A){const V=u.trigger.getBoundingClientRect(),B=m.getBoundingClientRect(),L=u.valueNode.getBoundingClientRect(),q=A.getBoundingClientRect();if(u.dir!=="rtl"){const se=q.left-B.left,te=L.left-se,xe=V.left-te,oe=V.width+xe,be=Math.max(oe,B.width),_e=window.innerWidth-CONTENT_MARGIN,Ce=clamp(te,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,_e-be)]);d.style.minWidth=oe+"px",d.style.left=Ce+"px"}else{const se=B.right-q.right,te=window.innerWidth-L.right-se,xe=window.innerWidth-V.right-te,oe=V.width+xe,be=Math.max(oe,B.width),_e=window.innerWidth-CONTENT_MARGIN,Ce=clamp(te,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,_e-be)]);d.style.minWidth=oe+"px",d.style.right=Ce+"px"}const F=_(),H=window.innerHeight-CONTENT_MARGIN*2,U=C.scrollHeight,G=window.getComputedStyle(m),J=parseInt(G.borderTopWidth,10),ee=parseInt(G.paddingTop,10),ie=parseInt(G.borderBottomWidth,10),W=parseInt(G.paddingBottom,10),Q=J+ee+U+W+ie,Z=Math.min(R.offsetHeight*5,Q),ae=window.getComputedStyle(C),le=parseInt(ae.paddingTop,10),ue=parseInt(ae.paddingBottom,10),fe=V.top+V.height/2-CONTENT_MARGIN,pe=H-fe,ve=R.offsetHeight/2,de=R.offsetTop+ve,ye=J+ee+de,he=Q-ye;if(ye<=fe){const se=F.length>0&&R===F[F.length-1].ref.current;d.style.bottom="0px";const te=m.clientHeight-C.offsetTop-C.offsetHeight,xe=Math.max(pe,ve+(se?ue:0)+te+ie),oe=ye+xe;d.style.height=oe+"px"}else{const se=F.length>0&&R===F[0].ref.current;d.style.top="0px";const xe=Math.max(fe,J+C.offsetTop+(se?le:0)+ve)+he;d.style.height=xe+"px",C.scrollTop=ye-fe+C.offsetTop}d.style.margin=`${CONTENT_MARGIN}px 0`,d.style.minHeight=Z+"px",d.style.maxHeight=H+"px",o==null||o(),requestAnimationFrame(()=>S.current=!0)}},[_,u.trigger,u.valueNode,d,m,C,R,A,u.dir,o]);useLayoutEffect2(()=>O(),[O]);const[j,M]=React__namespace.useState();useLayoutEffect2(()=>{m&&M(window.getComputedStyle(m).zIndex)},[m]);const I=React__namespace.useCallback(V=>{V&&E.current===!0&&(O(),N==null||N(),E.current=!1)},[O,N]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:S,onScrollButtonChange:I,children:jsxRuntime.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:jsxRuntime.jsx(Primitive.div,{...l,ref:b,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...u}=e,p=usePopperScope(n);return jsxRuntime.jsx(Content$1,{...p,...u,ref:t,align:o,collisionPadding:l,style:{boxSizing:"border-box",...u.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});SelectPopperPosition.displayName=POPPER_POSITION_NAME;var[SelectViewportProvider,useSelectViewportContext]=createSelectContext(CONTENT_NAME,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...l}=e,u=useSelectContentContext(VIEWPORT_NAME,n),p=useSelectViewportContext(VIEWPORT_NAME,n),d=useComposedRefs(t,u.onViewportChange),f=React__namespace.useRef(0);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:composeEventHandlers(l.onScroll,m=>{const g=m.currentTarget,{contentWrapper:b,shouldExpandOnScrollRef:_}=p;if(_!=null&&_.current&&b){const S=Math.abs(f.current-g.scrollTop);if(S>0){const E=window.innerHeight-CONTENT_MARGIN*2,C=parseFloat(b.style.minHeight),R=parseFloat(b.style.height),A=Math.max(C,R);if(A<E){const N=A+S,O=Math.min(E,N),j=N-O;b.style.height=O+"px",b.style.bottom==="0px"&&(g.scrollTop=j>0?j:0,b.style.justifyContent="flex-end")}}}f.current=g.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:t})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,ref:t})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME),SelectItem$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:l=!1,textValue:u,...p}=e,d=useSelectContext(ITEM_NAME,n),f=useSelectContentContext(ITEM_NAME,n),m=d.value===o,[g,b]=React__namespace.useState(u??""),[_,S]=React__namespace.useState(!1),E=useComposedRefs(t,N=>{var O;return(O=f.itemRefCallback)==null?void 0:O.call(f,N,o,l)}),C=useId(),R=React__namespace.useRef("touch"),A=()=>{l||(d.onValueChange(o),d.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return jsxRuntime.jsx(SelectItemContextProvider,{scope:n,value:o,disabled:l,textId:C,isSelected:m,onItemTextChange:React__namespace.useCallback(N=>{b(O=>O||((N==null?void 0:N.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection.ItemSlot,{scope:n,value:o,disabled:l,textValue:g,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":C,"data-highlighted":_?"":void 0,"aria-selected":m&&_,"data-state":m?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...p,ref:E,onFocus:composeEventHandlers(p.onFocus,()=>S(!0)),onBlur:composeEventHandlers(p.onBlur,()=>S(!1)),onClick:composeEventHandlers(p.onClick,()=>{R.current!=="mouse"&&A()}),onPointerUp:composeEventHandlers(p.onPointerUp,()=>{R.current==="mouse"&&A()}),onPointerDown:composeEventHandlers(p.onPointerDown,N=>{R.current=N.pointerType}),onPointerMove:composeEventHandlers(p.onPointerMove,N=>{var O;R.current=N.pointerType,l?(O=f.onItemLeave)==null||O.call(f):R.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(p.onPointerLeave,N=>{var O;N.currentTarget===document.activeElement&&((O=f.onItemLeave)==null||O.call(f))}),onKeyDown:composeEventHandlers(p.onKeyDown,N=>{var j;((j=f.searchRef)==null?void 0:j.current)!==""&&N.key===" "||(SELECTION_KEYS.includes(N.key)&&A(),N.key===" "&&N.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:l,...u}=e,p=useSelectContext(ITEM_TEXT_NAME,n),d=useSelectContentContext(ITEM_TEXT_NAME,n),f=useSelectItemContext(ITEM_TEXT_NAME,n),m=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[g,b]=React__namespace.useState(null),_=useComposedRefs(t,A=>b(A),f.onItemTextChange,A=>{var N;return(N=d.itemTextRefCallback)==null?void 0:N.call(d,A,f.value,f.disabled)}),S=g==null?void 0:g.textContent,E=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:f.value,disabled:f.disabled,children:S},f.value),[f.disabled,f.value,S]),{onNativeOptionAdd:C,onNativeOptionRemove:R}=m;return useLayoutEffect2(()=>(C(E),()=>R(E)),[C,R,E]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:f.textId,...u,ref:_}),f.isSelected&&p.valueNode&&!p.valueNodeHasChildren?ReactDOM__namespace.createPortal(u.children,p.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:t}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,e.__scopeSelect),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,e.__scopeSelect),[l,u]=React__namespace.useState(!1),p=useComposedRefs(t,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let d=function(){const m=f.scrollTop>0;u(m)};const f=n.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...e,ref:p,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=n;d&&f&&(d.scrollTop=d.scrollTop-f.offsetHeight)}}):null});SelectScrollUpButton$1.displayName=SCROLL_UP_BUTTON_NAME;var SCROLL_DOWN_BUTTON_NAME="SelectScrollDownButton",SelectScrollDownButton$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,e.__scopeSelect),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,e.__scopeSelect),[l,u]=React__namespace.useState(!1),p=useComposedRefs(t,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let d=function(){const m=f.scrollHeight-f.clientHeight,g=Math.ceil(f.scrollTop)<m;u(g)};const f=n.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...e,ref:p,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=n;d&&f&&(d.scrollTop=d.scrollTop+f.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=e,u=useSelectContentContext("SelectScrollButton",n),p=React__namespace.useRef(null),d=useCollection(n),f=React__namespace.useCallback(()=>{p.current!==null&&(window.clearInterval(p.current),p.current=null)},[]);return React__namespace.useEffect(()=>()=>f(),[f]),useLayoutEffect2(()=>{var g;const m=d().find(b=>b.ref.current===document.activeElement);(g=m==null?void 0:m.ref.current)==null||g.scrollIntoView({block:"nearest"})},[d]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:t,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{p.current===null&&(p.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var m;(m=u.onItemLeave)==null||m.call(u),p.current===null&&(p.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{f()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:t})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME="SelectArrow",SelectArrow=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=usePopperScope(n),u=useSelectContext(ARROW_NAME,n),p=useSelectContentContext(ARROW_NAME,n);return u.open&&p.position==="popper"?jsxRuntime.jsx(Arrow,{...l,...o,ref:t}):null});SelectArrow.displayName=ARROW_NAME;var BUBBLE_INPUT_NAME$2="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const l=React__namespace.useRef(null),u=useComposedRefs(o,l),p=usePrevious(t);return React__namespace.useEffect(()=>{const d=l.current;if(!d)return;const f=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(f,"value").set;if(p!==t&&g){const b=new Event("change",{bubbles:!0});g.call(d,t),d.dispatchEvent(b)}},[p,t]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:u,defaultValue:t})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function shouldShowPlaceholder(e){return e===""||e===void 0}function useTypeaheadSearch(e){const t=useCallbackRef$1(e),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(p=>{const d=n.current+p;t(d),function f(m){n.current=m,window.clearTimeout(o.current),m!==""&&(o.current=window.setTimeout(()=>f(""),1e3))}(d)},[t]),u=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,u]}function findNextItem(e,t,n){const l=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,u=n?e.indexOf(n):-1;let p=wrapArray(e,Math.max(u,0));l.length===1&&(p=p.filter(m=>m!==n));const f=p.find(m=>m.textValue.toLowerCase().startsWith(l.toLowerCase()));return f!==n?f:void 0}function wrapArray(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Root2=Select$1,Trigger=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal=SelectPortal,Content2=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(Trigger,{ref:o,className:cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:e,children:t,position:n="popper",...o},l)=>jsxRuntime.jsx(Portal,{children:jsxRuntime.jsxs(Content2,{ref:l,className:cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[jsxRuntime.jsx(SelectScrollUpButton,{}),jsxRuntime.jsx(Viewport,{className:cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2.displayName;const SelectLabel=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",e),...t}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(Item,{ref:o,className:cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),jsxRuntime.jsx(ItemText,{children:t})]}));SelectItem.displayName=Item.displayName;const SelectSeparator=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",e),...t}));SelectSeparator.displayName=Separator.displayName;var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:u,required:p,disabled:d,value:f="on",onCheckedChange:m,form:g,...b}=e,[_,S]=React__namespace.useState(null),E=useComposedRefs(t,O=>S(O)),C=React__namespace.useRef(!1),R=_?g||!!_.closest("form"):!0,[A,N]=useControllableState({prop:l,defaultProp:u??!1,onChange:m,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:A,disabled:d,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":A,"aria-required":p,"data-state":getState$1(A),"data-disabled":d?"":void 0,disabled:d,value:f,...b,ref:E,onClick:composeEventHandlers(e.onClick,O=>{N(j=>!j),R&&(C.current=O.isPropagationStopped(),C.current||O.stopPropagation())})}),R&&jsxRuntime.jsx(SwitchBubbleInput,{control:_,bubbles:!C.current,name:o,value:f,checked:A,required:p,disabled:d,form:g,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$1(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$1="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...l},u)=>{const p=React__namespace.useRef(null),d=useComposedRefs(p,u),f=usePrevious(n),m=useSize(t);return React__namespace.useEffect(()=>{const g=p.current;if(!g)return;const b=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(b,"checked").set;if(f!==n&&S){const E=new Event("click",{bubbles:o});S.call(g,n),g.dispatchEvent(E)}},[f,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:d,style:{...l.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function getState$1(e){return e?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DAYS_OF_WEEK=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ManufacturerReorderingCard({manufacturer:e,onSave:t,loading:n=!1,saving:o=!1}){const[l,u]=React.useState({...e}),p=(_,S)=>{u(E=>({...E,[_]:S}))},d=(_,S)=>{u(E=>({...E,[_]:S}))},f=(_,S)=>{u(E=>({...E,[_]:S}))},m=()=>{o||t(l)},g=_=>_===-1?"ASAP":_===void 0||_<0||_>6?"Sunday":DAYS_OF_WEEK[_],b=_=>_==="ASAP"?-1:DAYS_OF_WEEK.indexOf(_);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[n?jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}):jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Reordering"}),n?jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}):jsxRuntime.jsx(CardDescription,{className:"text-sm",children:"Adjust your reordering settings to control lead times, stocking weeks, minimum orders, and reorder dates, enhancing efficiency in restocking processes."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"automatic-reordering",checked:l.AutoUpdate,onCheckedChange:_=>p("AutoUpdate",_),disabled:o}),jsxRuntime.jsx(Label$2,{htmlFor:"automatic-reordering",children:"Automatic Reordering"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"reorder-date",children:"Automatic Reorder Date"}),jsxRuntime.jsxs(Select,{value:g(l.AutoReorderDate),onValueChange:_=>d("AutoReorderDate",b(_)),disabled:o,children:[jsxRuntime.jsx(SelectTrigger,{id:"reorder-date",children:jsxRuntime.jsx(SelectValue,{placeholder:"Select day"})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"ASAP",children:"ASAP"}),DAYS_OF_WEEK.map(_=>jsxRuntime.jsx(SelectItem,{value:_,children:_},_))]})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"weeks-stocking",children:"Default Weeks of Stocking"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"weeks-stocking",type:"number",value:l.DefaultWeeksOfStocking||"",onChange:_=>d("DefaultWeeksOfStocking",Number(_.target.value)),disabled:o}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"weeks"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"minimum-order",children:"Default Minimum Order"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"minimum-order",type:"number",className:"pl-6",value:l.DefaultMinimumOrder||"",onChange:_=>d("DefaultMinimumOrder",Number(_.target.value)),disabled:o})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"lead-time",children:"Default Lead Time"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"lead-time",type:"number",value:l.DefaultLeadTime||"",onChange:_=>d("DefaultLeadTime",Number(_.target.value)),disabled:o}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"days"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"maximum-inventory-value",children:"Default Maximum Inventory Value"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"maximum-inventory-value",type:"number",className:"pl-6",value:l.DefaultMaxInventoryValue||"",onChange:_=>d("DefaultMaxInventoryValue",Number(_.target.value)),disabled:o})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"order-confirmations",children:"Send Order Confirmations To"}),jsxRuntime.jsx(Input,{id:"order-confirmations",type:"email",value:l.POEmail||"",onChange:_=>f("POEmail",_.target.value),placeholder:"email@example.com",disabled:o})]})]})]})}),jsxRuntime.jsx(CardFooter,{className:"flex justify-end",children:n?jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"}):jsxRuntime.jsxs(Button,{onClick:m,disabled:o,children:[o&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}function ResellerBillingOverviewCard({reseller:e,actions:t,loading:n=!1}){return n||!e?jsxRuntime.jsx(ResellerBillingOverviewSkeleton,{}):jsxRuntime.jsx(ResellerBillingOverviewData,{reseller:e,actions:t})}function ResellerBillingOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-40"})})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:Array(3).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))}),jsxRuntime.jsx("div",{className:"space-y-4",children:Array(2).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))})]}),jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-28 rounded-md"})})]})]})}function ResellerBillingOverviewData({reseller:e,actions:t}){const n=p=>p===void 0?"$0.00":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(p),o=e.Statement||{},l=[{title:"0 - 30 Days",amount:o.Over0||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"31 - 45 Days",amount:o.Over30||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"45+ Days",amount:o.Over45||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"}],u=[{title:"Total",amount:o.Total||0,icon:jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-white"}),color:"bg-green-500"},{title:"Credit Limit",amount:e.CreditLimit||0,icon:jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"}];return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:l.map((p,d)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:p.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${p.color}`,children:p.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(p.amount)})})]},d))}),jsxRuntime.jsx("div",{className:"space-y-4",children:u.map((p,d)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:p.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${p.color}`,children:p.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(p.amount)})})]},d))})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:t})]})]})}function ResellerQualificationsCard({qualifications:e=[],loading:t=!1}){return t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:Array.from({length:10}).map((n,o)=>jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]},o))})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:e.map((n,o)=>jsxRuntime.jsx(ManufacturerLogo,{manufacturerId:n.ManufacturerId,opportunityNumber:n.DefaultOpportunityNumber},`${n.ManufacturerId}-${o}`))})})]})}function ManufacturerLogo({manufacturerId:e,opportunityNumber:t}){const[n,o]=React.useState(null),[l,u]=React.useState(!0),[p,d]=React.useState(!1),[f,m]=React.useState(null),g=React.useMemo(()=>e?{logoUrl:`https://api.randmar.io/V4/Partner/${e}/Account/Logo?width=96&height=48`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${e}/Account/Logo/Exists`}:null,[e]);return React.useEffect(()=>{if(!g)return;let b=!0;m(null);const _=async()=>{try{const C=await fetch(g.logoExistsUrl);if(C.ok){const A=(await C.text()).toLowerCase()==="true";return b&&d(A),A}return!1}catch(C){return console.error("Failed to check if logo exists:",C),b&&d(!1),!1}},S=async()=>{b&&u(!0);try{const C=await fetch(g.logoUrl);if(C.ok){const R=await C.blob();b&&(n&&URL.revokeObjectURL(n),o(URL.createObjectURL(R)))}else throw new Error(`Failed to load logo: ${C.status}`)}catch(C){console.error("Failed to load logo:",C),b&&m("Failed to load manufacturer logo")}finally{b&&u(!1)}};return(async()=>{await _()?S():u(!1)})(),()=>{b=!1,n&&URL.revokeObjectURL(n)}},[g]),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"h-12 flex items-center justify-center mb-2",children:l?jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md"}):p&&n?jsxRuntime.jsx("img",{src:n,alt:"Manufacturer logo",className:"max-h-12 max-w-24 object-contain",onError:()=>m("Failed to load logo")}):jsxRuntime.jsx("div",{className:"h-12 w-24 flex items-center justify-center bg-slate-100 rounded-md text-xs text-slate-500",children:e?e.substring(0,8):"No ID"})}),t&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs",children:t}),f&&jsxRuntime.jsx("div",{className:"text-red-500 text-xs mt-1",role:"alert",children:f})]})}function SalesOverviewCard({salesData:e,salesStatistics:t=[],loading:n=!1}){return n||!e?jsxRuntime.jsx(SalesOverviewSkeleton,{}):jsxRuntime.jsx(SalesOverviewData,{salesData:e,salesStatistics:t})}function SalesOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array(3).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-[250px] w-full rounded-lg"})]})})]})]})}function SalesOverviewData({salesData:e,salesStatistics:t=[]}){const n=u=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(u),o=[{title:"Last 30 days",amount:e.SalesLast30Days||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"},{title:"Last 3 months",amount:e.SalesLast3Months||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-amber-500"},{title:"Year to date",amount:e.SalesYearToDay||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-emerald-500"}],l=React.useMemo(()=>{const u=new Map;return t.forEach(p=>{var f;const d=((f=p.Day)==null?void 0:f.toString())||"";if(d.length===8){const m=parseInt(d.substring(0,4),10),g=parseInt(d.substring(4,6),10)-1,b=parseInt(d.substring(6,8),10),_=new Date(m,g,b),S=new Date(_),E=_.getDay();S.setDate(_.getDate()-E);const C=`${S.getFullYear()}-${String(S.getMonth()+1).padStart(2,"0")}-${String(S.getDate()).padStart(2,"0")}`,R=p.ExtendedPrice||0;u.has(C)?u.set(C,u.get(C)+R):u.set(C,R)}}),Array.from(u).sort(([p],[d])=>p.localeCompare(d)).map(([p,d])=>({date:`${p.substring(5,7)}/${p.substring(8,10)}`,amount:d}))},[t]);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:"Sales Overview"})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map((u,p)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:u.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${u.color}`,children:u.icon})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(u.amount)})]})]},p))}),jsxRuntime.jsx("div",{className:"mt-6",children:t&&t.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h3",{className:"text-sm font-medium mb-4",children:"Sales Trend"}),jsxRuntime.jsx("div",{className:"space-y-6",children:jsxRuntime.jsx(AreaChart,{data:l,units:"$",unitsPosition:"left",height:200})})]})})]})]})}var CHECKBOX_NAME="Checkbox",[createCheckboxContext,createCheckboxScope]=createContextScope(CHECKBOX_NAME),[CheckboxProvider,useCheckboxContext]=createCheckboxContext(CHECKBOX_NAME),Checkbox$1=React__namespace.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:l,defaultChecked:u,required:p,disabled:d,value:f="on",onCheckedChange:m,form:g,...b}=e,[_,S]=React__namespace.useState(null),E=useComposedRefs(t,j=>S(j)),C=React__namespace.useRef(!1),R=_?g||!!_.closest("form"):!0,[A,N]=useControllableState({prop:l,defaultProp:u??!1,onChange:m,caller:CHECKBOX_NAME}),O=React__namespace.useRef(A);return React__namespace.useEffect(()=>{const j=_==null?void 0:_.form;if(j){const M=()=>N(O.current);return j.addEventListener("reset",M),()=>j.removeEventListener("reset",M)}},[_,N]),jsxRuntime.jsxs(CheckboxProvider,{scope:n,state:A,disabled:d,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"checkbox","aria-checked":isIndeterminate(A)?"mixed":A,"aria-required":p,"data-state":getState(A),"data-disabled":d?"":void 0,disabled:d,value:f,...b,ref:E,onKeyDown:composeEventHandlers(e.onKeyDown,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:composeEventHandlers(e.onClick,j=>{N(M=>isIndeterminate(M)?!0:!M),R&&(C.current=j.isPropagationStopped(),C.current||j.stopPropagation())})}),R&&jsxRuntime.jsx(CheckboxBubbleInput,{control:_,bubbles:!C.current,name:o,value:f,checked:A,required:p,disabled:d,form:g,style:{transform:"translateX(-100%)"},defaultChecked:isIndeterminate(u)?!1:u})]})});Checkbox$1.displayName=CHECKBOX_NAME;var INDICATOR_NAME="CheckboxIndicator",CheckboxIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...l}=e,u=useCheckboxContext(INDICATOR_NAME,n);return jsxRuntime.jsx(Presence,{present:o||isIndeterminate(u.state)||u.state===!0,children:jsxRuntime.jsx(Primitive.span,{"data-state":getState(u.state),"data-disabled":u.disabled?"":void 0,...l,ref:t,style:{pointerEvents:"none",...e.style}})})});CheckboxIndicator.displayName=INDICATOR_NAME;var BUBBLE_INPUT_NAME="CheckboxBubbleInput",CheckboxBubbleInput=React__namespace.forwardRef(({__scopeCheckbox:e,control:t,checked:n,bubbles:o=!0,defaultChecked:l,...u},p)=>{const d=React__namespace.useRef(null),f=useComposedRefs(d,p),m=usePrevious(n),g=useSize(t);React__namespace.useEffect(()=>{const _=d.current;if(!_)return;const S=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(S,"checked").set;if(m!==n&&C){const R=new Event("click",{bubbles:o});_.indeterminate=isIndeterminate(n),C.call(_,isIndeterminate(n)?!1:n),_.dispatchEvent(R)}},[m,n,o]);const b=React__namespace.useRef(isIndeterminate(n)?!1:n);return jsxRuntime.jsx(Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??b.current,...u,tabIndex:-1,ref:f,style:{...u.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});CheckboxBubbleInput.displayName=BUBBLE_INPUT_NAME;function isIndeterminate(e){return e==="indeterminate"}function getState(e){return isIndeterminate(e)?"indeterminate":e?"checked":"unchecked"}var Root=Checkbox$1,Indicator=CheckboxIndicator;const Checkbox=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root,{ref:n,className:cn("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:jsxRuntime.jsx(Indicator,{className:cn("flex items-center justify-center text-current"),children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}));Checkbox.displayName=Root.displayName;const salesChannels=[{id:"online-store",label:"Online store (Shopify, Amazon, etc.)"},{id:"brick-and-mortar",label:"Brick-and-mortar (Physical Store)"},{id:"marketplace",label:"Marketplace seller (eBay, Walmart, etc.)"},{id:"b2b",label:"B2B wholesale"},{id:"other-channel",label:"Other (please specify)"}],markets=[{id:"canada",label:"Canada - Nationwide"},{id:"ontario",label:"Ontario & Quebec"},{id:"atlantic",label:"Atlantic Provinces (NS, NB, PEI, NL)"},{id:"prairie",label:"Prairie (Saskatchewan, Manitoba)"},{id:"western",label:"Western Provinces (BC, Alberta, etc.)"},{id:"united-states",label:"United States"},{id:"other-market",label:"Other (please specify)"}];function ManufacturerGetStartedButton({manufacturer:e,loading:t=!1,onQualificationSubmit:n,onIntroduceYourselfSubmit:o}){const[l,u]=React.useState(!1),[p,d]=React.useState(!1),[f,m]=React.useState(""),[g,b]=React.useState(""),[_,S]=React.useState(""),[E,C]=React.useState(""),[R,A]=React.useState([]),[N,O]=React.useState(""),[j,M]=React.useState(""),[I,V]=React.useState([]),[B,L]=React.useState(""),[q,F]=React.useState(""),H=React.useRef(t),U=()=>{e.PartnerRegistrationLink&&e.PartnerRegistrationLink!==""?u(!0):e.OpenToWork&&d(!0)},G=Z=>{if(Z.preventDefault(),!f.trim()){b("Qualification ID is required");return}n&&n(e,{qualificationId:f})},J=Z=>{Z.preventDefault(),C(""),O(""),L("");let ae=!1;_.trim().length<10&&(C("Please provide a brief description of your business (minimum 10 characters)"),ae=!0),R.length===0&&(O("Please select at least one sales channel"),ae=!0),I.length===0&&(L("Please select at least one market"),ae=!0),!ae&&o&&o(e,{businessDescription:_,salesChannels:R,otherSalesChannel:j,markets:I,otherMarket:q})},ee=(Z,ae)=>{A(ae?[...R,Z]:R.filter(le=>le!==Z))},ie=(Z,ae)=>{V(ae?[...I,Z]:I.filter(le=>le!==Z))};React.useEffect(()=>{H.current===!0&&t===!1&&(l&&(u(!1),m(""),b("")),p&&(d(!1),S(""),C(""),A([]),O(""),M(""),V([]),L(""),F(""))),H.current=t},[t,l,p]);const W=R.includes("other-channel"),Q=I.includes("other-market");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!e.Qualification&&jsxRuntime.jsxs(Button,{onClick:U,disabled:!e.PartnerRegistrationLink&&!e.OpenToWork,children:[jsxRuntime.jsx(Check,{className:"mr-2"}),"Get Started"]}),jsxRuntime.jsx(Dialog,{open:l,onOpenChange:u,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[512px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:e.PublicName}),jsxRuntime.jsxs(DialogDescription,{children:[jsxRuntime.jsx("span",{className:"font-bold",children:"Already qualified?"})," Provide your Qualification ID."]})]}),jsxRuntime.jsxs("form",{onSubmit:G,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"qualificationId",children:"Qualification ID"}),jsxRuntime.jsx(Input,{id:"qualificationId",placeholder:"Enter your qualification ID",value:f,onChange:Z=>{m(Z.target.value),b("")}}),g&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:g})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",disabled:t,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):`Apply for ${e.PublicName} Qualification`})})]})]})}),jsxRuntime.jsx(Dialog,{open:p,onOpenChange:d,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[768px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Introduce Yourself"})}),jsxRuntime.jsxs("form",{onSubmit:J,className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{htmlFor:"businessDescription",children:["Tell Us About Your Business"," ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Briefly describe your business)"})]}),jsxRuntime.jsx(Textarea,{id:"businessDescription",placeholder:"We are an online retailer specializing in office supplies, serving businesses since 2018...",className:"min-h-[100px]",value:_,onChange:Z=>{S(Z.target.value),C("")}}),E&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:E})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"mb-2",children:jsxRuntime.jsxs(Label$2,{children:["Sales Channel(s)"," ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select where you currently sell your products)"})]})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:salesChannels.map(Z=>jsxRuntime.jsxs("div",{className:"flex flex-row items-start space-x-2 space-y-0",children:[jsxRuntime.jsx(Checkbox,{id:`channel-${Z.id}`,checked:R.includes(Z.id),onCheckedChange:ae=>{ee(Z.id,ae===!0),O("")}}),jsxRuntime.jsx(Label$2,{htmlFor:`channel-${Z.id}`,className:"text-sm font-normal",children:Z.label})]},Z.id))}),W&&jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(Input,{placeholder:"Please specify",value:j,onChange:Z=>M(Z.target.value)})}),N&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:N})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"mb-2",children:jsxRuntime.jsxs(Label$2,{children:["Your Primary Market(s)"," ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select which regions you sell to)"})]})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:markets.map(Z=>jsxRuntime.jsxs("div",{className:"flex flex-row items-start space-x-2 space-y-0",children:[jsxRuntime.jsx(Checkbox,{id:`market-${Z.id}`,checked:I.includes(Z.id),onCheckedChange:ae=>{ie(Z.id,ae===!0),L("")}}),jsxRuntime.jsx(Label$2,{htmlFor:`market-${Z.id}`,className:"text-sm font-normal",children:Z.label})]},Z.id))}),Q&&jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(Input,{placeholder:"Please specify",value:q,onChange:Z=>F(Z.target.value)})}),B&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:B})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",disabled:t,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):"Submit"})})]})]})})]})}exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.ApiKeyProvider=ApiKeyProvider,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.Checkbox=Checkbox,exports.CountryFlag=CountryFlag,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.Navbar=Navbar,exports.PartnerCard=PartnerCard,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useApiKey=useApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
896
|
+
`),S=await new GoogleGenAI({apiKey:e}).chats.create({model:o?"gemini-2.5-pro-preview-03-25":"gemini-2.0-flash-lite"}).sendMessage({message:g}),E=trimJSXString(S.text??"");return E&&!containsBlockArrowFunc(E)?E:l==0?"<p>Could not generate visuals for this data.</p>":await GetJSXFromAI(e,t,n,o,l-1)};function containsBlockArrowFunc(e){return e.replace(/\s+/g,"").indexOf("=>{")>=0}function trimJSXString(e){const t=e.indexOf("<"),n=e.lastIndexOf("</");return t===-1||n===-1?"":e.slice(t,e.indexOf(">",n)+1)}function AiGeneratedContent(e){const[t,n]=React.useState(""),{apiKey:o}=useApiKey();return React.useEffect(()=>{if(!o||!e.prompt||!e.data)return;n("");let l=!1;return GetJSXFromAI(o,e.prompt,e.data,e.smartAndSlow===!0).then(u=>{l||n(u)}),()=>{l=!0}},[e.prompt,e.data,n,o,e.smartAndSlow]),t?jsxRuntime.jsx(source_default,{bindings:{data:e.data},components:{ResellerCard,ManufacturerCard,PartnerCard,ProductCard,Card,CardHeader,CardTitle,CardContent,CardDescription,Badge,Tabs,TabsList,TabsContent,TabsTrigger,ScrollArea},jsx:t}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(Skeleton,{className:"h-32 w-32",children:jsxRuntime.jsx(Bot,{className:"m-auto align-middle h-full"})})})}function GeneralDocumentCard({document:e,loading:t=!1}){return t?jsxRuntime.jsx("div",{children:"loading..."}):jsxRuntime.jsxs("div",{children:["GENERAL DOCUMENT CARD - ",e==null?void 0:e.OrderNumber," for P.O. ",e==null?void 0:e.PONumber]})}const Navbar=React.forwardRef(({routes:e,footer:t,dashboardTitle:n,withRandmarAssistant:o,chatUserName:l,chatApiKey:u},p)=>{const{appID:d}=reactRouterDom.useParams(),f=e.filter(_=>_.showInNav),m=React.useRef(null),g=React.useRef(null),b=React.useRef(null);return React.useImperativeHandle(p,()=>({setActiveChatAndSendMessage:(_,S)=>{var E;return(E=b.current)==null||E.click(),setTimeout(()=>{var C;(C=m.current)==null||C.focus(),g.current&&g.current.setActiveChatAndSendMessage(_,S)},100),!0}})),jsxRuntime.jsxs(Sidebar,{className:"border-r border-sidebar-border",children:[jsxRuntime.jsx(SidebarHeader,{className:"border-b border-sidebar-border px-6 h-16 justify-center bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center",children:jsxRuntime.jsx("img",{src:"https://api.randmar.io/images/RandmarIcon.svg",alt:"Randmar Icon",className:"h-4 w-4 filter brightness-0 saturate-100 invert"})}),jsxRuntime.jsx("span",{className:"font-semibold text-lg",children:n})]})}),jsxRuntime.jsx(SidebarContent,{className:"py-4 bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsx(SidebarMenu,{children:f.map(_=>{const S=_.icon,E=`/${_.path.replace(":appID",d??"")}`;return jsxRuntime.jsx(SidebarMenuItem,{children:jsxRuntime.jsx(SidebarMenuButton,{asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:E,className:"transition-colors hover:bg-muted px-6",children:[S&&jsxRuntime.jsx(S,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:_.label})]})})},_.key)})})}),jsxRuntime.jsxs(SidebarFooter,{className:"border-t border-sidebar-border p-4 bg-sidebar-background text-sidebar-foreground",children:[o===!0&&jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:b,size:"lg",className:"collapse md:visible",onClick:()=>setTimeout(()=>{var _;return(_=m.current)==null?void 0:_.focus()},50),children:[jsxRuntime.jsx(Bot,{}),"Assistant"]})}),jsxRuntime.jsx(DialogContent,{className:"max-w-[85vw] p-0 data-[state=open]:visible data-[state=closed]:invisible",forceMount:!0,animateExit:!1,children:jsxRuntime.jsx(ChatLayout,{ref:g,inputRef:m,userId:d??"2",userName:l??"Unknown user",apiKey:u??""})})]}),t]})]})}),Layout=React.forwardRef(({children:e,rightMenu:t,routes:n,footer:o,handleValidSearch:l,dashboardTitle:u,onSignOut:p,searchPlaceholder:d,withRandmarAssistant:f,chatUserName:m,chatApiKey:g,chatRef:b},_)=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(SidebarProvider,{children:jsxRuntime.jsxs("div",{className:"flex grow",children:[jsxRuntime.jsx(Navbar,{routes:n,footer:o,dashboardTitle:u,withRandmarAssistant:f,chatUserName:m,chatApiKey:g,ref:b}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[jsxRuntime.jsx(Topbar,{ref:_,onSignOut:p,rightMenu:t,handleValidSearch:l,searchPlaceholder:d}),jsxRuntime.jsx("main",{className:"flex-1 overflow-auto mt-16",children:e}),jsxRuntime.jsx(Toaster,{})]})]})})}));Layout.displayName="Layout";function usePrevious(e){const t=React__namespace.useRef({value:e,previous:e});return React__namespace.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection,useCollection,createCollectionScope]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope,createPopperScope]),usePopperScope=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:l,onOpenChange:u,value:p,defaultValue:d,onValueChange:f,dir:m,name:g,autoComplete:b,disabled:_,required:S,form:E}=e,C=usePopperScope(t),[R,A]=React__namespace.useState(null),[N,O]=React__namespace.useState(null),[j,M]=React__namespace.useState(!1),I=useDirection(m),[V,B]=useControllableState({prop:o,defaultProp:l??!1,onChange:u,caller:SELECT_NAME}),[L,q]=useControllableState({prop:p,defaultProp:d,onChange:f,caller:SELECT_NAME}),F=React__namespace.useRef(null),H=R?E||!!R.closest("form"):!0,[U,G]=React__namespace.useState(new Set),J=Array.from(U).map(ee=>ee.props.value).join(";");return jsxRuntime.jsx(Root2$4,{...C,children:jsxRuntime.jsxs(SelectProvider,{required:S,scope:t,trigger:R,onTriggerChange:A,valueNode:N,onValueNodeChange:O,valueNodeHasChildren:j,onValueNodeHasChildrenChange:M,contentId:useId(),value:L,onValueChange:q,open:V,onOpenChange:B,dir:I,triggerPointerDownPosRef:F,disabled:_,children:[jsxRuntime.jsx(Collection.Provider,{scope:t,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:e.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(ee=>{G(ie=>new Set(ie).add(ee))},[]),onNativeOptionRemove:React__namespace.useCallback(ee=>{G(ie=>{const W=new Set(ie);return W.delete(ee),W})},[]),children:n})}),H?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:S,tabIndex:-1,name:g,autoComplete:b,value:L,onChange:ee=>q(ee.target.value),disabled:_,form:E,children:[L===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(U)]},J):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...l}=e,u=usePopperScope(n),p=useSelectContext(TRIGGER_NAME,n),d=p.disabled||o,f=useComposedRefs(t,p.onTriggerChange),m=useCollection(n),g=React__namespace.useRef("touch"),[b,_,S]=useTypeaheadSearch(C=>{const R=m().filter(O=>!O.disabled),A=R.find(O=>O.value===p.value),N=findNextItem(R,C,A);N!==void 0&&p.onValueChange(N.value)}),E=C=>{d||(p.onOpenChange(!0),S()),C&&(p.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...u,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":p.contentId,"aria-expanded":p.open,"aria-required":p.required,"aria-autocomplete":"none",dir:p.dir,"data-state":p.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":shouldShowPlaceholder(p.value)?"":void 0,...l,ref:f,onClick:composeEventHandlers(l.onClick,C=>{C.currentTarget.focus(),g.current!=="mouse"&&E(C)}),onPointerDown:composeEventHandlers(l.onPointerDown,C=>{g.current=C.pointerType;const R=C.target;R.hasPointerCapture(C.pointerId)&&R.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(E(C),C.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,C=>{const R=b.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&_(C.key),!(R&&C.key===" ")&&OPEN_KEYS.includes(C.key)&&(E(),C.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:l,children:u,placeholder:p="",...d}=e,f=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:m}=f,g=u!==void 0,b=useComposedRefs(t,f.onValueNodeChange);return useLayoutEffect2(()=>{m(g)},[m,g]),jsxRuntime.jsx(Primitive.span,{...d,ref:b,style:{pointerEvents:"none"},children:shouldShowPlaceholder(f.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:p}):u})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...l}=e;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:t,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME="SelectPortal",SelectPortal=e=>jsxRuntime.jsx(Portal$4,{asChild:!0,...e});SelectPortal.displayName=PORTAL_NAME;var CONTENT_NAME="SelectContent",SelectContent$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContext(CONTENT_NAME,e.__scopeSelect),[o,l]=React__namespace.useState();if(useLayoutEffect2(()=>{l(new DocumentFragment)},[]),!n.open){const u=o;return u?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:e.__scopeSelect,children:jsxRuntime.jsx(Collection.Slot,{scope:e.__scopeSelect,children:jsxRuntime.jsx("div",{children:e.children})})}),u):null}return jsxRuntime.jsx(SelectContentImpl,{...e,ref:t})});SelectContent$1.displayName=CONTENT_NAME;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME),CONTENT_IMPL_NAME="SelectContentImpl",Slot=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:u,onPointerDownOutside:p,side:d,sideOffset:f,align:m,alignOffset:g,arrowPadding:b,collisionBoundary:_,collisionPadding:S,sticky:E,hideWhenDetached:C,avoidCollisions:R,...A}=e,N=useSelectContext(CONTENT_NAME,n),[O,j]=React__namespace.useState(null),[M,I]=React__namespace.useState(null),V=useComposedRefs(t,de=>j(de)),[B,L]=React__namespace.useState(null),[q,F]=React__namespace.useState(null),H=useCollection(n),[U,G]=React__namespace.useState(!1),J=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(O)return hideOthers(O)},[O]),useFocusGuards();const ee=React__namespace.useCallback(de=>{const[ye,...he]=H().map(te=>te.ref.current),[ce]=he.slice(-1),se=document.activeElement;for(const te of de)if(te===se||(te==null||te.scrollIntoView({block:"nearest"}),te===ye&&M&&(M.scrollTop=0),te===ce&&M&&(M.scrollTop=M.scrollHeight),te==null||te.focus(),document.activeElement!==se))return},[H,M]),ie=React__namespace.useCallback(()=>ee([B,O]),[ee,B,O]);React__namespace.useEffect(()=>{U&&ie()},[U,ie]);const{onOpenChange:W,triggerPointerDownPosRef:Q}=N;React__namespace.useEffect(()=>{if(O){let de={x:0,y:0};const ye=ce=>{var se,te;de={x:Math.abs(Math.round(ce.pageX)-(((se=Q.current)==null?void 0:se.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((te=Q.current)==null?void 0:te.y)??0))}},he=ce=>{de.x<=10&&de.y<=10?ce.preventDefault():O.contains(ce.target)||W(!1),document.removeEventListener("pointermove",ye),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",he,{capture:!0})}}},[O,W,Q]),React__namespace.useEffect(()=>{const de=()=>W(!1);return window.addEventListener("blur",de),window.addEventListener("resize",de),()=>{window.removeEventListener("blur",de),window.removeEventListener("resize",de)}},[W]);const[Z,ae]=useTypeaheadSearch(de=>{const ye=H().filter(se=>!se.disabled),he=ye.find(se=>se.ref.current===document.activeElement),ce=findNextItem(ye,de,he);ce&&setTimeout(()=>ce.ref.current.focus())}),le=React__namespace.useCallback((de,ye,he)=>{const ce=!J.current&&!he;(N.value!==void 0&&N.value===ye||ce)&&(L(de),ce&&(J.current=!0))},[N.value]),ue=React__namespace.useCallback(()=>O==null?void 0:O.focus(),[O]),fe=React__namespace.useCallback((de,ye,he)=>{const ce=!J.current&&!he;(N.value!==void 0&&N.value===ye||ce)&&F(de)},[N.value]),pe=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,ve=pe===SelectPopperPosition?{side:d,sideOffset:f,align:m,alignOffset:g,arrowPadding:b,collisionBoundary:_,collisionPadding:S,sticky:E,hideWhenDetached:C,avoidCollisions:R}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:O,viewport:M,onViewportChange:I,itemRefCallback:le,selectedItem:B,onItemLeave:ue,itemTextRefCallback:fe,focusSelectedItem:ie,selectedItemText:q,position:o,isPositioned:U,searchRef:Z,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:N.open,onMountAutoFocus:de=>{de.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,de=>{var ye;(ye=N.trigger)==null||ye.focus({preventScroll:!0}),de.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:p,onFocusOutside:de=>de.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:jsxRuntime.jsx(pe,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:de=>de.preventDefault(),...A,...ve,onPlaced:()=>G(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:composeEventHandlers(A.onKeyDown,de=>{const ye=de.ctrlKey||de.altKey||de.metaKey;if(de.key==="Tab"&&de.preventDefault(),!ye&&de.key.length===1&&ae(de.key),["ArrowUp","ArrowDown","Home","End"].includes(de.key)){let ce=H().filter(se=>!se.disabled).map(se=>se.ref.current);if(["ArrowUp","End"].includes(de.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(de.key)){const se=de.target,te=ce.indexOf(se);ce=ce.slice(te+1)}setTimeout(()=>ee(ce)),de.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...l}=e,u=useSelectContext(CONTENT_NAME,n),p=useSelectContentContext(CONTENT_NAME,n),[d,f]=React__namespace.useState(null),[m,g]=React__namespace.useState(null),b=useComposedRefs(t,V=>g(V)),_=useCollection(n),S=React__namespace.useRef(!1),E=React__namespace.useRef(!0),{viewport:C,selectedItem:R,selectedItemText:A,focusSelectedItem:N}=p,O=React__namespace.useCallback(()=>{if(u.trigger&&u.valueNode&&d&&m&&C&&R&&A){const V=u.trigger.getBoundingClientRect(),B=m.getBoundingClientRect(),L=u.valueNode.getBoundingClientRect(),q=A.getBoundingClientRect();if(u.dir!=="rtl"){const se=q.left-B.left,te=L.left-se,xe=V.left-te,oe=V.width+xe,be=Math.max(oe,B.width),_e=window.innerWidth-CONTENT_MARGIN,Ce=clamp(te,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,_e-be)]);d.style.minWidth=oe+"px",d.style.left=Ce+"px"}else{const se=B.right-q.right,te=window.innerWidth-L.right-se,xe=window.innerWidth-V.right-te,oe=V.width+xe,be=Math.max(oe,B.width),_e=window.innerWidth-CONTENT_MARGIN,Ce=clamp(te,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,_e-be)]);d.style.minWidth=oe+"px",d.style.right=Ce+"px"}const F=_(),H=window.innerHeight-CONTENT_MARGIN*2,U=C.scrollHeight,G=window.getComputedStyle(m),J=parseInt(G.borderTopWidth,10),ee=parseInt(G.paddingTop,10),ie=parseInt(G.borderBottomWidth,10),W=parseInt(G.paddingBottom,10),Q=J+ee+U+W+ie,Z=Math.min(R.offsetHeight*5,Q),ae=window.getComputedStyle(C),le=parseInt(ae.paddingTop,10),ue=parseInt(ae.paddingBottom,10),fe=V.top+V.height/2-CONTENT_MARGIN,pe=H-fe,ve=R.offsetHeight/2,de=R.offsetTop+ve,ye=J+ee+de,he=Q-ye;if(ye<=fe){const se=F.length>0&&R===F[F.length-1].ref.current;d.style.bottom="0px";const te=m.clientHeight-C.offsetTop-C.offsetHeight,xe=Math.max(pe,ve+(se?ue:0)+te+ie),oe=ye+xe;d.style.height=oe+"px"}else{const se=F.length>0&&R===F[0].ref.current;d.style.top="0px";const xe=Math.max(fe,J+C.offsetTop+(se?le:0)+ve)+he;d.style.height=xe+"px",C.scrollTop=ye-fe+C.offsetTop}d.style.margin=`${CONTENT_MARGIN}px 0`,d.style.minHeight=Z+"px",d.style.maxHeight=H+"px",o==null||o(),requestAnimationFrame(()=>S.current=!0)}},[_,u.trigger,u.valueNode,d,m,C,R,A,u.dir,o]);useLayoutEffect2(()=>O(),[O]);const[j,M]=React__namespace.useState();useLayoutEffect2(()=>{m&&M(window.getComputedStyle(m).zIndex)},[m]);const I=React__namespace.useCallback(V=>{V&&E.current===!0&&(O(),N==null||N(),E.current=!1)},[O,N]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:S,onScrollButtonChange:I,children:jsxRuntime.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:jsxRuntime.jsx(Primitive.div,{...l,ref:b,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...u}=e,p=usePopperScope(n);return jsxRuntime.jsx(Content$1,{...p,...u,ref:t,align:o,collisionPadding:l,style:{boxSizing:"border-box",...u.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});SelectPopperPosition.displayName=POPPER_POSITION_NAME;var[SelectViewportProvider,useSelectViewportContext]=createSelectContext(CONTENT_NAME,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...l}=e,u=useSelectContentContext(VIEWPORT_NAME,n),p=useSelectViewportContext(VIEWPORT_NAME,n),d=useComposedRefs(t,u.onViewportChange),f=React__namespace.useRef(0);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:composeEventHandlers(l.onScroll,m=>{const g=m.currentTarget,{contentWrapper:b,shouldExpandOnScrollRef:_}=p;if(_!=null&&_.current&&b){const S=Math.abs(f.current-g.scrollTop);if(S>0){const E=window.innerHeight-CONTENT_MARGIN*2,C=parseFloat(b.style.minHeight),R=parseFloat(b.style.height),A=Math.max(C,R);if(A<E){const N=A+S,O=Math.min(E,N),j=N-O;b.style.height=O+"px",b.style.bottom==="0px"&&(g.scrollTop=j>0?j:0,b.style.justifyContent="flex-end")}}}f.current=g.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:t})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,ref:t})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME),SelectItem$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:l=!1,textValue:u,...p}=e,d=useSelectContext(ITEM_NAME,n),f=useSelectContentContext(ITEM_NAME,n),m=d.value===o,[g,b]=React__namespace.useState(u??""),[_,S]=React__namespace.useState(!1),E=useComposedRefs(t,N=>{var O;return(O=f.itemRefCallback)==null?void 0:O.call(f,N,o,l)}),C=useId(),R=React__namespace.useRef("touch"),A=()=>{l||(d.onValueChange(o),d.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return jsxRuntime.jsx(SelectItemContextProvider,{scope:n,value:o,disabled:l,textId:C,isSelected:m,onItemTextChange:React__namespace.useCallback(N=>{b(O=>O||((N==null?void 0:N.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection.ItemSlot,{scope:n,value:o,disabled:l,textValue:g,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":C,"data-highlighted":_?"":void 0,"aria-selected":m&&_,"data-state":m?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...p,ref:E,onFocus:composeEventHandlers(p.onFocus,()=>S(!0)),onBlur:composeEventHandlers(p.onBlur,()=>S(!1)),onClick:composeEventHandlers(p.onClick,()=>{R.current!=="mouse"&&A()}),onPointerUp:composeEventHandlers(p.onPointerUp,()=>{R.current==="mouse"&&A()}),onPointerDown:composeEventHandlers(p.onPointerDown,N=>{R.current=N.pointerType}),onPointerMove:composeEventHandlers(p.onPointerMove,N=>{var O;R.current=N.pointerType,l?(O=f.onItemLeave)==null||O.call(f):R.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(p.onPointerLeave,N=>{var O;N.currentTarget===document.activeElement&&((O=f.onItemLeave)==null||O.call(f))}),onKeyDown:composeEventHandlers(p.onKeyDown,N=>{var j;((j=f.searchRef)==null?void 0:j.current)!==""&&N.key===" "||(SELECTION_KEYS.includes(N.key)&&A(),N.key===" "&&N.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:l,...u}=e,p=useSelectContext(ITEM_TEXT_NAME,n),d=useSelectContentContext(ITEM_TEXT_NAME,n),f=useSelectItemContext(ITEM_TEXT_NAME,n),m=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[g,b]=React__namespace.useState(null),_=useComposedRefs(t,A=>b(A),f.onItemTextChange,A=>{var N;return(N=d.itemTextRefCallback)==null?void 0:N.call(d,A,f.value,f.disabled)}),S=g==null?void 0:g.textContent,E=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:f.value,disabled:f.disabled,children:S},f.value),[f.disabled,f.value,S]),{onNativeOptionAdd:C,onNativeOptionRemove:R}=m;return useLayoutEffect2(()=>(C(E),()=>R(E)),[C,R,E]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:f.textId,...u,ref:_}),f.isSelected&&p.valueNode&&!p.valueNodeHasChildren?ReactDOM__namespace.createPortal(u.children,p.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:t}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,e.__scopeSelect),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,e.__scopeSelect),[l,u]=React__namespace.useState(!1),p=useComposedRefs(t,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let d=function(){const m=f.scrollTop>0;u(m)};const f=n.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...e,ref:p,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=n;d&&f&&(d.scrollTop=d.scrollTop-f.offsetHeight)}}):null});SelectScrollUpButton$1.displayName=SCROLL_UP_BUTTON_NAME;var SCROLL_DOWN_BUTTON_NAME="SelectScrollDownButton",SelectScrollDownButton$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,e.__scopeSelect),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,e.__scopeSelect),[l,u]=React__namespace.useState(!1),p=useComposedRefs(t,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let d=function(){const m=f.scrollHeight-f.clientHeight,g=Math.ceil(f.scrollTop)<m;u(g)};const f=n.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...e,ref:p,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=n;d&&f&&(d.scrollTop=d.scrollTop+f.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=e,u=useSelectContentContext("SelectScrollButton",n),p=React__namespace.useRef(null),d=useCollection(n),f=React__namespace.useCallback(()=>{p.current!==null&&(window.clearInterval(p.current),p.current=null)},[]);return React__namespace.useEffect(()=>()=>f(),[f]),useLayoutEffect2(()=>{var g;const m=d().find(b=>b.ref.current===document.activeElement);(g=m==null?void 0:m.ref.current)==null||g.scrollIntoView({block:"nearest"})},[d]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:t,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{p.current===null&&(p.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var m;(m=u.onItemLeave)==null||m.call(u),p.current===null&&(p.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{f()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:t})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME="SelectArrow",SelectArrow=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=usePopperScope(n),u=useSelectContext(ARROW_NAME,n),p=useSelectContentContext(ARROW_NAME,n);return u.open&&p.position==="popper"?jsxRuntime.jsx(Arrow,{...l,...o,ref:t}):null});SelectArrow.displayName=ARROW_NAME;var BUBBLE_INPUT_NAME$2="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const l=React__namespace.useRef(null),u=useComposedRefs(o,l),p=usePrevious(t);return React__namespace.useEffect(()=>{const d=l.current;if(!d)return;const f=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(f,"value").set;if(p!==t&&g){const b=new Event("change",{bubbles:!0});g.call(d,t),d.dispatchEvent(b)}},[p,t]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:u,defaultValue:t})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function shouldShowPlaceholder(e){return e===""||e===void 0}function useTypeaheadSearch(e){const t=useCallbackRef$1(e),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(p=>{const d=n.current+p;t(d),function f(m){n.current=m,window.clearTimeout(o.current),m!==""&&(o.current=window.setTimeout(()=>f(""),1e3))}(d)},[t]),u=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,u]}function findNextItem(e,t,n){const l=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,u=n?e.indexOf(n):-1;let p=wrapArray(e,Math.max(u,0));l.length===1&&(p=p.filter(m=>m!==n));const f=p.find(m=>m.textValue.toLowerCase().startsWith(l.toLowerCase()));return f!==n?f:void 0}function wrapArray(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Root2=Select$1,Trigger=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal=SelectPortal,Content2=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(Trigger,{ref:o,className:cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:e,children:t,position:n="popper",...o},l)=>jsxRuntime.jsx(Portal,{children:jsxRuntime.jsxs(Content2,{ref:l,className:cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[jsxRuntime.jsx(SelectScrollUpButton,{}),jsxRuntime.jsx(Viewport,{className:cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2.displayName;const SelectLabel=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",e),...t}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(Item,{ref:o,className:cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),jsxRuntime.jsx(ItemText,{children:t})]}));SelectItem.displayName=Item.displayName;const SelectSeparator=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",e),...t}));SelectSeparator.displayName=Separator.displayName;var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:u,required:p,disabled:d,value:f="on",onCheckedChange:m,form:g,...b}=e,[_,S]=React__namespace.useState(null),E=useComposedRefs(t,O=>S(O)),C=React__namespace.useRef(!1),R=_?g||!!_.closest("form"):!0,[A,N]=useControllableState({prop:l,defaultProp:u??!1,onChange:m,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:A,disabled:d,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":A,"aria-required":p,"data-state":getState$1(A),"data-disabled":d?"":void 0,disabled:d,value:f,...b,ref:E,onClick:composeEventHandlers(e.onClick,O=>{N(j=>!j),R&&(C.current=O.isPropagationStopped(),C.current||O.stopPropagation())})}),R&&jsxRuntime.jsx(SwitchBubbleInput,{control:_,bubbles:!C.current,name:o,value:f,checked:A,required:p,disabled:d,form:g,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$1(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$1="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...l},u)=>{const p=React__namespace.useRef(null),d=useComposedRefs(p,u),f=usePrevious(n),m=useSize(t);return React__namespace.useEffect(()=>{const g=p.current;if(!g)return;const b=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(b,"checked").set;if(f!==n&&S){const E=new Event("click",{bubbles:o});S.call(g,n),g.dispatchEvent(E)}},[f,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:d,style:{...l.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function getState$1(e){return e?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DAYS_OF_WEEK=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ManufacturerReorderingCard({manufacturer:e,onSave:t,loading:n=!1,saving:o=!1}){const[l,u]=React.useState({...e}),p=(_,S)=>{u(E=>({...E,[_]:S}))},d=(_,S)=>{u(E=>({...E,[_]:S}))},f=(_,S)=>{u(E=>({...E,[_]:S}))},m=()=>{o||t(l)},g=_=>_===-1?"ASAP":_===void 0||_<0||_>6?"Sunday":DAYS_OF_WEEK[_],b=_=>_==="ASAP"?-1:DAYS_OF_WEEK.indexOf(_);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[n?jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}):jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Reordering"}),n?jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}):jsxRuntime.jsx(CardDescription,{className:"text-sm",children:"Adjust your reordering settings to control lead times, stocking weeks, minimum orders, and reorder dates, enhancing efficiency in restocking processes."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"automatic-reordering",checked:l.AutoUpdate,onCheckedChange:_=>p("AutoUpdate",_),disabled:o}),jsxRuntime.jsx(Label$2,{htmlFor:"automatic-reordering",children:"Automatic Reordering"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"reorder-date",children:"Automatic Reorder Date"}),jsxRuntime.jsxs(Select,{value:g(l.AutoReorderDate),onValueChange:_=>d("AutoReorderDate",b(_)),disabled:o,children:[jsxRuntime.jsx(SelectTrigger,{id:"reorder-date",children:jsxRuntime.jsx(SelectValue,{placeholder:"Select day"})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"ASAP",children:"ASAP"}),DAYS_OF_WEEK.map(_=>jsxRuntime.jsx(SelectItem,{value:_,children:_},_))]})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"weeks-stocking",children:"Default Weeks of Stocking"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"weeks-stocking",type:"number",value:l.DefaultWeeksOfStocking||"",onChange:_=>d("DefaultWeeksOfStocking",Number(_.target.value)),disabled:o}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"weeks"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"minimum-order",children:"Default Minimum Order"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"minimum-order",type:"number",className:"pl-6",value:l.DefaultMinimumOrder||"",onChange:_=>d("DefaultMinimumOrder",Number(_.target.value)),disabled:o})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"lead-time",children:"Default Lead Time"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"lead-time",type:"number",value:l.DefaultLeadTime||"",onChange:_=>d("DefaultLeadTime",Number(_.target.value)),disabled:o}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"days"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"maximum-inventory-value",children:"Default Maximum Inventory Value"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"maximum-inventory-value",type:"number",className:"pl-6",value:l.DefaultMaxInventoryValue||"",onChange:_=>d("DefaultMaxInventoryValue",Number(_.target.value)),disabled:o})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"order-confirmations",children:"Send Order Confirmations To"}),jsxRuntime.jsx(Input,{id:"order-confirmations",type:"email",value:l.POEmail||"",onChange:_=>f("POEmail",_.target.value),placeholder:"email@example.com",disabled:o})]})]})]})}),jsxRuntime.jsx(CardFooter,{className:"flex justify-end",children:n?jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"}):jsxRuntime.jsxs(Button,{onClick:m,disabled:o,children:[o&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}function ResellerBillingOverviewCard({reseller:e,actions:t,loading:n=!1}){return n||!e?jsxRuntime.jsx(ResellerBillingOverviewSkeleton,{}):jsxRuntime.jsx(ResellerBillingOverviewData,{reseller:e,actions:t})}function ResellerBillingOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-40"})})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:Array(3).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))}),jsxRuntime.jsx("div",{className:"space-y-4",children:Array(2).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))})]}),jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-28 rounded-md"})})]})]})}function ResellerBillingOverviewData({reseller:e,actions:t}){const n=p=>p===void 0?"$0.00":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(p),o=e.Statement||{},l=[{title:"0 - 30 Days",amount:o.Over0||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"31 - 45 Days",amount:o.Over30||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"45+ Days",amount:o.Over45||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"}],u=[{title:"Total",amount:o.Total||0,icon:jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-white"}),color:"bg-green-500"},{title:"Credit Limit",amount:e.CreditLimit||0,icon:jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"}];return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:l.map((p,d)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:p.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${p.color}`,children:p.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(p.amount)})})]},d))}),jsxRuntime.jsx("div",{className:"space-y-4",children:u.map((p,d)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:p.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${p.color}`,children:p.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(p.amount)})})]},d))})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:t})]})]})}function ResellerQualificationsCard({qualifications:e=[],loading:t=!1}){return t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:Array.from({length:10}).map((n,o)=>jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]},o))})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:e.map((n,o)=>jsxRuntime.jsx(ManufacturerLogo,{manufacturerId:n.ManufacturerId,opportunityNumber:n.DefaultOpportunityNumber},`${n.ManufacturerId}-${o}`))})})]})}function ManufacturerLogo({manufacturerId:e,opportunityNumber:t}){const[n,o]=React.useState(null),[l,u]=React.useState(!0),[p,d]=React.useState(!1),[f,m]=React.useState(null),g=React.useMemo(()=>e?{logoUrl:`https://api.randmar.io/V4/Partner/${e}/Account/Logo?width=96&height=48`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${e}/Account/Logo/Exists`}:null,[e]);return React.useEffect(()=>{if(!g)return;let b=!0;m(null);const _=async()=>{try{const C=await fetch(g.logoExistsUrl);if(C.ok){const A=(await C.text()).toLowerCase()==="true";return b&&d(A),A}return!1}catch(C){return console.error("Failed to check if logo exists:",C),b&&d(!1),!1}},S=async()=>{b&&u(!0);try{const C=await fetch(g.logoUrl);if(C.ok){const R=await C.blob();b&&(n&&URL.revokeObjectURL(n),o(URL.createObjectURL(R)))}else throw new Error(`Failed to load logo: ${C.status}`)}catch(C){console.error("Failed to load logo:",C),b&&m("Failed to load manufacturer logo")}finally{b&&u(!1)}};return(async()=>{await _()?S():u(!1)})(),()=>{b=!1,n&&URL.revokeObjectURL(n)}},[g]),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"h-12 flex items-center justify-center mb-2",children:l?jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md"}):p&&n?jsxRuntime.jsx("img",{src:n,alt:"Manufacturer logo",className:"max-h-12 max-w-24 object-contain",onError:()=>m("Failed to load logo")}):jsxRuntime.jsx("div",{className:"h-12 w-24 flex items-center justify-center bg-slate-100 rounded-md text-xs text-slate-500",children:e?e.substring(0,8):"No ID"})}),t&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs",children:t}),f&&jsxRuntime.jsx("div",{className:"text-red-500 text-xs mt-1",role:"alert",children:f})]})}function SalesOverviewCard({salesData:e,salesStatistics:t=[],loading:n=!1}){return n||!e?jsxRuntime.jsx(SalesOverviewSkeleton,{}):jsxRuntime.jsx(SalesOverviewData,{salesData:e,salesStatistics:t})}function SalesOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array(3).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-[250px] w-full rounded-lg"})]})})]})]})}function SalesOverviewData({salesData:e,salesStatistics:t=[]}){const n=u=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(u),o=[{title:"Last 30 days",amount:e.SalesLast30Days||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"},{title:"Last 3 months",amount:e.SalesLast3Months||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-amber-500"},{title:"Year to date",amount:e.SalesYearToDay||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-emerald-500"}],l=React.useMemo(()=>{const u=new Map;return t.forEach(p=>{var f;const d=((f=p.Day)==null?void 0:f.toString())||"";if(d.length===8){const m=parseInt(d.substring(0,4),10),g=parseInt(d.substring(4,6),10)-1,b=parseInt(d.substring(6,8),10),_=new Date(m,g,b),S=new Date(_),E=_.getDay();S.setDate(_.getDate()-E);const C=`${S.getFullYear()}-${String(S.getMonth()+1).padStart(2,"0")}-${String(S.getDate()).padStart(2,"0")}`,R=p.ExtendedPrice||0;u.has(C)?u.set(C,u.get(C)+R):u.set(C,R)}}),Array.from(u).sort(([p],[d])=>p.localeCompare(d)).map(([p,d])=>({date:`${p.substring(5,7)}/${p.substring(8,10)}`,amount:d}))},[t]);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:"Sales Overview"})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map((u,p)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:u.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${u.color}`,children:u.icon})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(u.amount)})]})]},p))}),jsxRuntime.jsx("div",{className:"mt-6",children:t&&t.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h3",{className:"text-sm font-medium mb-4",children:"Sales Trend"}),jsxRuntime.jsx("div",{className:"space-y-6",children:jsxRuntime.jsx(AreaChart,{data:l,units:"$",unitsPosition:"left",height:200})})]})})]})]})}var CHECKBOX_NAME="Checkbox",[createCheckboxContext,createCheckboxScope]=createContextScope(CHECKBOX_NAME),[CheckboxProvider,useCheckboxContext]=createCheckboxContext(CHECKBOX_NAME),Checkbox$1=React__namespace.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:l,defaultChecked:u,required:p,disabled:d,value:f="on",onCheckedChange:m,form:g,...b}=e,[_,S]=React__namespace.useState(null),E=useComposedRefs(t,j=>S(j)),C=React__namespace.useRef(!1),R=_?g||!!_.closest("form"):!0,[A,N]=useControllableState({prop:l,defaultProp:u??!1,onChange:m,caller:CHECKBOX_NAME}),O=React__namespace.useRef(A);return React__namespace.useEffect(()=>{const j=_==null?void 0:_.form;if(j){const M=()=>N(O.current);return j.addEventListener("reset",M),()=>j.removeEventListener("reset",M)}},[_,N]),jsxRuntime.jsxs(CheckboxProvider,{scope:n,state:A,disabled:d,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"checkbox","aria-checked":isIndeterminate(A)?"mixed":A,"aria-required":p,"data-state":getState(A),"data-disabled":d?"":void 0,disabled:d,value:f,...b,ref:E,onKeyDown:composeEventHandlers(e.onKeyDown,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:composeEventHandlers(e.onClick,j=>{N(M=>isIndeterminate(M)?!0:!M),R&&(C.current=j.isPropagationStopped(),C.current||j.stopPropagation())})}),R&&jsxRuntime.jsx(CheckboxBubbleInput,{control:_,bubbles:!C.current,name:o,value:f,checked:A,required:p,disabled:d,form:g,style:{transform:"translateX(-100%)"},defaultChecked:isIndeterminate(u)?!1:u})]})});Checkbox$1.displayName=CHECKBOX_NAME;var INDICATOR_NAME="CheckboxIndicator",CheckboxIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...l}=e,u=useCheckboxContext(INDICATOR_NAME,n);return jsxRuntime.jsx(Presence,{present:o||isIndeterminate(u.state)||u.state===!0,children:jsxRuntime.jsx(Primitive.span,{"data-state":getState(u.state),"data-disabled":u.disabled?"":void 0,...l,ref:t,style:{pointerEvents:"none",...e.style}})})});CheckboxIndicator.displayName=INDICATOR_NAME;var BUBBLE_INPUT_NAME="CheckboxBubbleInput",CheckboxBubbleInput=React__namespace.forwardRef(({__scopeCheckbox:e,control:t,checked:n,bubbles:o=!0,defaultChecked:l,...u},p)=>{const d=React__namespace.useRef(null),f=useComposedRefs(d,p),m=usePrevious(n),g=useSize(t);React__namespace.useEffect(()=>{const _=d.current;if(!_)return;const S=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(S,"checked").set;if(m!==n&&C){const R=new Event("click",{bubbles:o});_.indeterminate=isIndeterminate(n),C.call(_,isIndeterminate(n)?!1:n),_.dispatchEvent(R)}},[m,n,o]);const b=React__namespace.useRef(isIndeterminate(n)?!1:n);return jsxRuntime.jsx(Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??b.current,...u,tabIndex:-1,ref:f,style:{...u.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});CheckboxBubbleInput.displayName=BUBBLE_INPUT_NAME;function isIndeterminate(e){return e==="indeterminate"}function getState(e){return isIndeterminate(e)?"indeterminate":e?"checked":"unchecked"}var Root=Checkbox$1,Indicator=CheckboxIndicator;const Checkbox=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root,{ref:n,className:cn("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:jsxRuntime.jsx(Indicator,{className:cn("flex items-center justify-center text-current"),children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}));Checkbox.displayName=Root.displayName;const salesChannels=[{id:"online-store",label:"Online store (Shopify, Amazon, etc.)"},{id:"brick-and-mortar",label:"Brick-and-mortar (Physical Store)"},{id:"marketplace",label:"Marketplace seller (eBay, Walmart, etc.)"},{id:"b2b",label:"B2B wholesale"},{id:"other-channel",label:"Other (please specify)"}],markets=[{id:"canada",label:"Canada - Nationwide"},{id:"ontario",label:"Ontario & Quebec"},{id:"atlantic",label:"Atlantic Provinces (NS, NB, PEI, NL)"},{id:"prairie",label:"Prairie (Saskatchewan, Manitoba)"},{id:"western",label:"Western Provinces (BC, Alberta, etc.)"},{id:"united-states",label:"United States"},{id:"other-market",label:"Other (please specify)"}];function ManufacturerGetStartedButton({manufacturer:e,loading:t=!1,onQualificationSubmit:n,onIntroduceYourselfSubmit:o}){const[l,u]=React.useState(!1),[p,d]=React.useState(!1),[f,m]=React.useState(""),[g,b]=React.useState(""),[_,S]=React.useState(""),[E,C]=React.useState(""),[R,A]=React.useState([]),[N,O]=React.useState(""),[j,M]=React.useState(""),[I,V]=React.useState([]),[B,L]=React.useState(""),[q,F]=React.useState(""),H=React.useRef(t),U=()=>{e.PartnerRegistrationLink&&e.PartnerRegistrationLink!==""?u(!0):e.OpenToWork&&d(!0)},G=Z=>{if(Z.preventDefault(),!f.trim()){b("Qualification ID is required");return}n&&n(e,{qualificationId:f})},J=Z=>{Z.preventDefault(),C(""),O(""),L("");let ae=!1;_.trim().length<10&&(C("Please provide a brief description of your business (minimum 10 characters)"),ae=!0),R.length===0&&(O("Please select at least one sales channel"),ae=!0),I.length===0&&(L("Please select at least one market"),ae=!0),!ae&&o&&o(e,{businessDescription:_,salesChannels:R,otherSalesChannel:j,markets:I,otherMarket:q})},ee=(Z,ae)=>{A(ae?[...R,Z]:R.filter(le=>le!==Z))},ie=(Z,ae)=>{V(ae?[...I,Z]:I.filter(le=>le!==Z))};React.useEffect(()=>{H.current===!0&&t===!1&&(l&&(u(!1),m(""),b("")),p&&(d(!1),S(""),C(""),A([]),O(""),M(""),V([]),L(""),F(""))),H.current=t},[t,l,p]);const W=R.includes("other-channel"),Q=I.includes("other-market");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!e.Qualification&&jsxRuntime.jsxs(Button,{onClick:U,disabled:!e.PartnerRegistrationLink&&!e.OpenToWork,children:[jsxRuntime.jsx(Check,{className:"mr-2"}),"Get Started"]}),jsxRuntime.jsx(Dialog,{open:l,onOpenChange:u,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[512px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:e.PublicName}),jsxRuntime.jsxs(DialogDescription,{children:[jsxRuntime.jsx("span",{className:"font-bold",children:"Already qualified?"})," Provide your Qualification ID."]})]}),jsxRuntime.jsxs("form",{onSubmit:G,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"qualificationId",children:"Qualification ID"}),jsxRuntime.jsx(Input,{id:"qualificationId",placeholder:"Enter your qualification ID",value:f,onChange:Z=>{m(Z.target.value),b("")}}),g&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:g})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",disabled:t,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):`Apply for ${e.PublicName} Qualification`})})]})]})}),jsxRuntime.jsx(Dialog,{open:p,onOpenChange:d,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[768px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Introduce Yourself"})}),jsxRuntime.jsxs("form",{onSubmit:J,className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{htmlFor:"businessDescription",children:["Tell Us About Your Business"," ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Briefly describe your business)"})]}),jsxRuntime.jsx(Textarea,{id:"businessDescription",placeholder:"We are an online retailer specializing in office supplies, serving businesses since 2018...",className:"min-h-[100px]",value:_,onChange:Z=>{S(Z.target.value),C("")}}),E&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:E})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"mb-2",children:jsxRuntime.jsxs(Label$2,{children:["Sales Channel(s)"," ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select where you currently sell your products)"})]})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:salesChannels.map(Z=>jsxRuntime.jsxs("div",{className:"flex flex-row items-start space-x-2 space-y-0",children:[jsxRuntime.jsx(Checkbox,{id:`channel-${Z.id}`,checked:R.includes(Z.id),onCheckedChange:ae=>{ee(Z.id,ae===!0),O("")}}),jsxRuntime.jsx(Label$2,{htmlFor:`channel-${Z.id}`,className:"text-sm font-normal",children:Z.label})]},Z.id))}),W&&jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(Input,{placeholder:"Please specify",value:j,onChange:Z=>M(Z.target.value)})}),N&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:N})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"mb-2",children:jsxRuntime.jsxs(Label$2,{children:["Your Primary Market(s)"," ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select which regions you sell to)"})]})}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:markets.map(Z=>jsxRuntime.jsxs("div",{className:"flex flex-row items-start space-x-2 space-y-0",children:[jsxRuntime.jsx(Checkbox,{id:`market-${Z.id}`,checked:I.includes(Z.id),onCheckedChange:ae=>{ie(Z.id,ae===!0),L("")}}),jsxRuntime.jsx(Label$2,{htmlFor:`market-${Z.id}`,className:"text-sm font-normal",children:Z.label})]},Z.id))}),Q&&jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(Input,{placeholder:"Please specify",value:q,onChange:Z=>F(Z.target.value)})}),B&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:B})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",disabled:t,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):"Submit"})})]})]})})]})}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:e,variant:t,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:t}),e),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",e),...t}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",e),...t}));AlertDescription.displayName="AlertDescription";const Table=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",e),...t})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",e),...t}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",e),...t}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("th",{ref:n,className:cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",e),...t}));TableCaption.displayName="TableCaption",exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertTitle=AlertTitle,exports.ApiKeyProvider=ApiKeyProvider,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.Checkbox=Checkbox,exports.CountryFlag=CountryFlag,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.Navbar=Navbar,exports.PartnerCard=PartnerCard,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useApiKey=useApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|