randmarcomps 1.372.0 → 1.375.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 +9 -0
- package/dist/randmarcomps.js +36 -13
- package/dist/randmarcomps.umd.cjs +4 -4
- package/package.json +1 -1
package/dist/randmarcomps.d.ts
CHANGED
|
@@ -638,6 +638,15 @@ declare interface OpportunitiesTableProps {
|
|
|
638
638
|
loading?: boolean;
|
|
639
639
|
}
|
|
640
640
|
|
|
641
|
+
export declare function OrdersCard({ applicationId, orders, loading, title }: OrdersCardProps): JSX.Element;
|
|
642
|
+
|
|
643
|
+
declare interface OrdersCardProps {
|
|
644
|
+
applicationId: string;
|
|
645
|
+
orders?: OrderDetail[] | null;
|
|
646
|
+
loading?: boolean;
|
|
647
|
+
title?: string;
|
|
648
|
+
}
|
|
649
|
+
|
|
641
650
|
export declare function PageHeader({ title, children, className }: PageHeaderProps): JSX.Element;
|
|
642
651
|
|
|
643
652
|
export declare interface PageHeaderProps {
|
package/dist/randmarcomps.js
CHANGED
|
@@ -63802,10 +63802,7 @@ function ManufacturerProducts({
|
|
|
63802
63802
|
}, V = () => {
|
|
63803
63803
|
var ae, ge;
|
|
63804
63804
|
return ((ge = (ae = e.Categories) == null ? void 0 : ae.find((se) => se.CategoryCode === l)) == null ? void 0 : ge.CategoryName) || l;
|
|
63805
|
-
}, q = useMemo(() => R != null && R.Products ? [...R.Products].sort((ae, ge) =>
|
|
63806
|
-
var se, Ae, Ve, Ne;
|
|
63807
|
-
return _ === "price-asc" ? (((se = ae.Distribution) == null ? void 0 : se.Price) ?? 0) - (((Ae = ge.Distribution) == null ? void 0 : Ae.Price) ?? 0) : _ === "price-desc" ? (((Ve = ge.Distribution) == null ? void 0 : Ve.Price) ?? 0) - (((Ne = ae.Distribution) == null ? void 0 : Ne.Price) ?? 0) : _ === "name" ? (ae.Title ?? "").localeCompare(ge.Title ?? "") : _ === "percentile" ? (ge.OverallPercentileRank ?? 0) - (ae.OverallPercentileRank ?? 0) : 0;
|
|
63808
|
-
}) : [], [R == null ? void 0 : R.Products, _]);
|
|
63805
|
+
}, q = useMemo(() => R != null && R.Products ? [...R.Products].sort((ae, ge) => _ === "price-asc" ? (ae.MAP ?? 0) - (ge.MAP ?? 0) : _ === "price-desc" ? (ge.MAP ?? 0) - (ae.MAP ?? 0) : _ === "name" ? (ae.Title ?? "").localeCompare(ge.Title ?? "") : _ === "percentile" ? (ge.OverallPercentileRank ?? 0) - (ae.OverallPercentileRank ?? 0) : 0) : [], [R == null ? void 0 : R.Products, _]);
|
|
63809
63806
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
63810
63807
|
/* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
|
|
63811
63808
|
/* @__PURE__ */ jsx(
|
|
@@ -63871,8 +63868,8 @@ function ManufacturerProducts({
|
|
|
63871
63868
|
/* @__PURE__ */ jsxs(Select, { value: _, onValueChange: C, children: [
|
|
63872
63869
|
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-[220px]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
63873
63870
|
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
63874
|
-
/* @__PURE__ */ jsx(SelectItem, { value: "price-asc", children: "
|
|
63875
|
-
/* @__PURE__ */ jsx(SelectItem, { value: "price-desc", children: "
|
|
63871
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "price-asc", children: "MAP: Low to High" }),
|
|
63872
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "price-desc", children: "MAP: High to Low" }),
|
|
63876
63873
|
/* @__PURE__ */ jsx(SelectItem, { value: "name", children: "Name" }),
|
|
63877
63874
|
/* @__PURE__ */ jsx(SelectItem, { value: "percentile", children: "Best Selling" })
|
|
63878
63875
|
] })
|
|
@@ -65298,6 +65295,19 @@ function OrdersCard({
|
|
|
65298
65295
|
enableSorting: !0,
|
|
65299
65296
|
enableFiltering: !0
|
|
65300
65297
|
},
|
|
65298
|
+
{
|
|
65299
|
+
accessorKey: "MPN",
|
|
65300
|
+
header: "MPN",
|
|
65301
|
+
cell: ({ row: g }) => g.original.MPN ? /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 100, children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
65302
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Link, { to: `/${t}/Product/${g.original.MPN}`, className: "font-medium text-primary hover:underline", children: g.original.MPN }) }),
|
|
65303
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsxs("p", { children: [
|
|
65304
|
+
"View details for MPN ",
|
|
65305
|
+
g.original.MPN
|
|
65306
|
+
] }) })
|
|
65307
|
+
] }) }) : "N/A",
|
|
65308
|
+
enableSorting: !0,
|
|
65309
|
+
enableFiltering: !0
|
|
65310
|
+
},
|
|
65301
65311
|
{
|
|
65302
65312
|
accessorKey: "Quantity",
|
|
65303
65313
|
header: "Quantity",
|
|
@@ -65318,6 +65328,14 @@ function OrdersCard({
|
|
|
65318
65328
|
cell: ({ row: g }) => g.original.UnitPrice ? formatMoney(g.original.UnitPrice) : "N/A",
|
|
65319
65329
|
enableSorting: !0,
|
|
65320
65330
|
enableFiltering: !1
|
|
65331
|
+
},
|
|
65332
|
+
{
|
|
65333
|
+
accessorKey: "actions",
|
|
65334
|
+
header: "Actions",
|
|
65335
|
+
cell: () => {
|
|
65336
|
+
},
|
|
65337
|
+
enableSorting: !1,
|
|
65338
|
+
enableFiltering: !1
|
|
65321
65339
|
}
|
|
65322
65340
|
],
|
|
65323
65341
|
[t]
|
|
@@ -65325,25 +65343,29 @@ function OrdersCard({
|
|
|
65325
65343
|
const g = {};
|
|
65326
65344
|
if (e) {
|
|
65327
65345
|
const b = Array.from(
|
|
65328
|
-
new Set(e.map((
|
|
65346
|
+
new Set(e.map((A) => A.WarehouseCode).filter((A) => A != null))
|
|
65329
65347
|
);
|
|
65330
65348
|
g.WarehouseCode = b;
|
|
65331
65349
|
const S = Array.from(
|
|
65332
|
-
new Set(e.map((
|
|
65350
|
+
new Set(e.map((A) => A.ShipToName).filter((A) => A != null))
|
|
65333
65351
|
);
|
|
65334
65352
|
g.ShipToName = S;
|
|
65335
65353
|
const _ = Array.from(
|
|
65336
|
-
new Set(e.map((
|
|
65354
|
+
new Set(e.map((A) => A.DocumentNumber).filter((A) => A != null))
|
|
65337
65355
|
);
|
|
65338
65356
|
g.DocumentNumber = _;
|
|
65339
65357
|
const C = Array.from(
|
|
65340
|
-
new Set(e.map((
|
|
65358
|
+
new Set(e.map((A) => A.OrderNumber).filter((A) => A != null))
|
|
65341
65359
|
);
|
|
65342
65360
|
g.OrderNumber = C;
|
|
65343
65361
|
const E = Array.from(
|
|
65344
|
-
new Set(e.map((
|
|
65362
|
+
new Set(e.map((A) => A.PONumber).filter((A) => A != null))
|
|
65345
65363
|
);
|
|
65346
65364
|
g.PONumber = E;
|
|
65365
|
+
const R = Array.from(
|
|
65366
|
+
new Set(e.map((A) => A.MPN).filter((A) => A != null))
|
|
65367
|
+
);
|
|
65368
|
+
g.MPN = R;
|
|
65347
65369
|
}
|
|
65348
65370
|
return g;
|
|
65349
65371
|
}, [e]), f = e || [];
|
|
@@ -68146,7 +68168,7 @@ function ActiveOrdersCard({ orders: t, loading: e = !1 }) {
|
|
|
68146
68168
|
amount: n.delayed.amount
|
|
68147
68169
|
}
|
|
68148
68170
|
];
|
|
68149
|
-
return e ? /* @__PURE__ */ jsxs(Card, { children: [
|
|
68171
|
+
return e ? /* @__PURE__ */ jsxs(Card, { className: "@container", children: [
|
|
68150
68172
|
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg font-bold", children: "Active Orders" }) }),
|
|
68151
68173
|
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4", children: [1, 2, 3, 4].map((l) => /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border", children: [
|
|
68152
68174
|
/* @__PURE__ */ jsx("div", { className: "bg-slate-200 dark:bg-slate-700 h-[3px]" }),
|
|
@@ -68167,7 +68189,7 @@ function ActiveOrdersCard({ orders: t, loading: e = !1 }) {
|
|
|
68167
68189
|
] })
|
|
68168
68190
|
] })
|
|
68169
68191
|
] }, l)) })
|
|
68170
|
-
] }) : /* @__PURE__ */ jsxs(Card, { children: [
|
|
68192
|
+
] }) : /* @__PURE__ */ jsxs(Card, { className: "@container", children: [
|
|
68171
68193
|
/* @__PURE__ */ jsx(CardHeader, { className: "pb-0", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-lg font-bold", children: "Active Orders" }) }),
|
|
68172
68194
|
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4", children: o.map((l) => /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border", children: [
|
|
68173
68195
|
/* @__PURE__ */ jsx("div", { className: `${l.color} bg-opacity-60 h-[3px]` }),
|
|
@@ -93646,6 +93668,7 @@ export {
|
|
|
93646
93668
|
MultiSelect,
|
|
93647
93669
|
Navbar,
|
|
93648
93670
|
OpportunitiesTable,
|
|
93671
|
+
OrdersCard,
|
|
93649
93672
|
PageHeader,
|
|
93650
93673
|
PartnerCard,
|
|
93651
93674
|
PartnerRelationshipPage,
|
|
@@ -1145,7 +1145,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
|
|
|
1145
1145
|
- less than the value passed to \`max\` (or ${DEFAULT_MAX} if no \`max\` prop is set)
|
|
1146
1146
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
1147
1147
|
|
|
1148
|
-
Defaulting to \`null\`.`}var Root$1=Progress$1,Indicator=ProgressIndicator;const Progress=React__namespace.forwardRef(({className:t,value:e,...n},o)=>jsxRuntime.jsx(Root$1,{ref:o,className:cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:jsxRuntime.jsx(Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Progress.displayName=Root$1.displayName;function ManufacturerInventoryFinanceCard({manufacturer:t,isLoading:e}){const{data:n,isLoading:o,isFetching:l}=useGetV4ManufacturerByRouteManufacturerIdInventoryValueQuery({routeManufacturerId:(t==null?void 0:t.ManufacturerId)??""},{skip:!(t!=null&&t.ManufacturerId)}),d=(t==null?void 0:t.DefaultMaxInventoryValue)??0,f=(n||[]).reduce((S,_)=>S+(_.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100);return e||o||l?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-muted-foreground"}),"Inventory Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current inventory financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[d!==0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Max Allowance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Current value"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(f)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available"}),jsxRuntime.jsx("span",{className:`font-bold ${g>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(g)})]})]}),d!==0&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Budget Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[b,"%"]}),b>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b>80?"High usage alert":"Budget usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:b,className:"h-2"})]})]})]})}function ManufacturerCreditFinanceCard({manufacturer:t,isLoading:e}){const n=(t==null?void 0:t.CreditLimit)??0,o=(t==null?void 0:t.OutstandingBalance)??0,l=n-o,d=Math.round(o/n*100);return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-muted-foreground"}),"Credit Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current credit financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Limit"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(n)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Outstanding Balance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(o)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Credit"}),jsxRuntime.jsx("span",{className:`font-bold ${l>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(l)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[d,"%"]}),d>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:d>80?"High credit usage alert":"Credit usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:d,className:"h-2"})]})]})]})}function SalesChartCard({statistics:t,loading:e=!1,mode:n="month",chartHeight:o=300,className:l,size:d="default"}){return e?jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48 rounded-md"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:o},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),d==="default"&&n==="month"&&jsxRuntime.jsxs("div",{className:"mt-4 flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 rounded-md"})]})]})]}):jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:n==="week"?"Weekly Sales Performance":"Monthly Sales Performance"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(SalesChart,{statistics:t,mode:n,chartHeight:o,size:d})})]})}function ManufacturerOverviewPage({applicationId:t,readonly:e,withReports:n,manufacturer:o,userEmail:l}){const{data:d,isLoading:f,isError:g}=useGetV4PartnerByApplicationIdAccountManufacturerQuery({applicationId:t,withSpecification:!0},{skip:!!o}),[b,S]=React.useState({publicInfo:{hasUnsavedChanges:!1},qualifications:{hasUnsavedChanges:!1},billingInfo:{hasUnsavedChanges:!1}}),_=React.useCallback(()=>e?!1:b.publicInfo.hasUnsavedChanges||b.qualifications.hasUnsavedChanges||b.billingInfo.hasUnsavedChanges,[e,b]),R=React.useCallback((A,M)=>{S(I=>{var j;return((j=I[A])==null?void 0:j.hasUnsavedChanges)!==M.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,M.hasUnsavedChanges),{...I,[A]:M}):I})},[]),{NavigationGuardDialog:C}=useRouterNavigationGuard(_),E=o??d;return jsxRuntime.jsxs("div",{className:"@container",children:[g?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your manufacturer information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:E==null?void 0:E.FiscalYearMonthStart,salesData:E==null?void 0:E.SalesData,isLoading:f}),jsxRuntime.jsxs("div",{className:"grid @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(E==null?void 0:E.SalesStatistics)??[],loading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",activeOrders:(E==null?void 0:E.ActiveOrderDetails)??void 0,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerInventoryFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerCreditFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerReorderingCard,{manufacturer:E??{},onSave:()=>{},loading:f,readonly:e}),n&&jsxRuntime.jsx(ManufacturerPublicInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("publicInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(OpenToWorkSection,{manufacturer:E,readonly:e,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerBillingInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("billingInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(ManufacturerQualificationsSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("qualifications",{hasUnsavedChanges:A})})]}),n&&jsxRuntime.jsx(ManufacturerReportsSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function CategoryStats(t){const{data:e,isLoading:n,isFetching:o}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t.appID,manufacturerId:t.manufID,categoryCode:t.categoryCode});return jsxRuntime.jsx(Card,{className:"w-full",children:jsxRuntime.jsx(CardContent,{className:"p-4 space-y-1",children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:t.categoryName}),jsxRuntime.jsx(SalesChart,{statistics:(e==null?void 0:e.SalesStatistics)??[],loading:n||o,chartHeight:300})]})})})}function ManufacturerCategoriesStats(t){return(t.categories??[]).filter(n=>n.CategoryName).map(n=>jsxRuntime.jsx(CategoryStats,{appID:t.appID,manufID:t.manufID,categoryCode:n.CategoryCode,categoryName:n.CategoryName},`${t.manufID}-${n.CategoryCode}`))}const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:t,variant:e,size:n,icon:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:e,size:n}),t),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function ManufacturerCategorySummary({name:t="N/A",niche:e="N/A",productsNumber:n=0,autoreorder:o=!1,starred:l=!1,isLoading:d=!1,children:f}){return d?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-4",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"space-y-1 flex-1",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-28 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-48 bg-muted rounded-md animate-pulse"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-12 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-5 bg-muted rounded-md animate-pulse"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-8 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-32 bg-muted rounded-md animate-pulse"})]}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-16 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-6 bg-muted rounded-md animate-pulse"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex-1 flex flex-col items-end",children:[jsxRuntime.jsx("div",{className:"h-3 w-20 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-6 w-16 bg-muted rounded-md animate-pulse"})]})]})]})]})]}):jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"grid grid-cols-[1fr_auto] items-start gap-4 pt-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Category Name"}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold leading-none tracking-tight",children:t})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Niche"}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:e})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Package,{className:"h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end justify-between gap-4 h-full",children:[f,jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Starred"}),l?jsxRuntime.jsx(Star,{className:"h-5 w-5 fill-yellow-400 text-yellow-400"}):jsxRuntime.jsx(Star,{className:"h-5 w-5 text-muted-foreground"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex flex-col items-end",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Auto-reorder"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o?jsxRuntime.jsx(RefreshCw,{className:"size-4 text-green-600"}):jsxRuntime.jsx(RefreshCwOff,{className:"size-4 text-amber-600"}),jsxRuntime.jsx(Badge,{variant:o?"default":"secondary",className:cn("text-xs",o?"text-green-600 bg-green-100 hover:bg-green-200":"text-amber-600 bg-amber-100 hover:bg-amber-200"),children:o?"Enabled":"Disabled"})]})]})]})]})})}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection$1,useCollection$1,createCollectionScope$1]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope$1,createPopperScope]),usePopperScope$1=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=t=>{const{__scopeSelect:e,children:n,open:o,defaultOpen:l,onOpenChange:d,value:f,defaultValue:g,onValueChange:b,dir:S,name:_,autoComplete:R,disabled:C,required:E,form:A}=t,M=usePopperScope$1(e),[I,j]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),O=useDirection(S),[te,ne]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[ae,ge]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),oe=React__namespace.useRef(null),Ae=I?A||!!I.closest("form"):!0,[je,Ne]=React__namespace.useState(new Set),Ve=Array.from(je).map(Le=>Le.props.value).join(";");return jsxRuntime.jsx(Root2$7,{...M,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:e,trigger:I,onTriggerChange:j,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:ae,onValueChange:ge,open:te,onOpenChange:ne,dir:O,triggerPointerDownPosRef:oe,disabled:C,children:[jsxRuntime.jsx(Collection$1.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Le=>{Ne(ze=>new Set(ze).add(Le))},[]),onNativeOptionRemove:React__namespace.useCallback(Le=>{Ne(ze=>{const $e=new Set(ze);return $e.delete(Le),$e})},[]),children:n})}),Ae?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:_,autoComplete:R,value:ae,onChange:Le=>ge(Le.target.value),disabled:C,form:A,children:[ae===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(je)]},Ve):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME$5="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:o=!1,...l}=t,d=usePopperScope$1(n),f=useSelectContext(TRIGGER_NAME$5,n),g=f.disabled||o,b=useComposedRefs(e,f.onTriggerChange),S=useCollection$1(n),_=React__namespace.useRef("touch"),[R,C,E]=useTypeaheadSearch(M=>{const I=S().filter(z=>!z.disabled),j=I.find(z=>z.value===f.value),q=findNextItem(I,M,j);q!==void 0&&f.onValueChange(q.value)}),A=M=>{g||(f.onOpenChange(!0),E()),M&&(f.triggerPointerDownPosRef.current={x:Math.round(M.pageX),y:Math.round(M.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:g,"data-disabled":g?"":void 0,"data-placeholder":shouldShowPlaceholder(f.value)?"":void 0,...l,ref:b,onClick:composeEventHandlers(l.onClick,M=>{M.currentTarget.focus(),_.current!=="mouse"&&A(M)}),onPointerDown:composeEventHandlers(l.onPointerDown,M=>{_.current=M.pointerType;const I=M.target;I.hasPointerCapture(M.pointerId)&&I.releasePointerCapture(M.pointerId),M.button===0&&M.ctrlKey===!1&&M.pointerType==="mouse"&&(A(M),M.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,M=>{const I=R.current!=="";!(M.ctrlKey||M.altKey||M.metaKey)&&M.key.length===1&&C(M.key),!(I&&M.key===" ")&&OPEN_KEYS.includes(M.key)&&(A(),M.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME$5;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,children:d,placeholder:f="",...g}=t,b=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:S}=b,_=d!==void 0,R=useComposedRefs(e,b.onValueNodeChange);return useLayoutEffect2(()=>{S(_)},[S,_]),jsxRuntime.jsx(Primitive.span,{...g,ref:R,style:{pointerEvents:"none"},children:shouldShowPlaceholder(b.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:f}):d})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,children:o,...l}=t;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:e,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME$2="SelectPortal",SelectPortal=t=>jsxRuntime.jsx(Portal$5,{asChild:!0,...t});SelectPortal.displayName=PORTAL_NAME$2;var CONTENT_NAME$4="SelectContent",SelectContent$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContext(CONTENT_NAME$4,t.__scopeSelect),[o,l]=React__namespace.useState();if(useLayoutEffect2(()=>{l(new DocumentFragment)},[]),!n.open){const d=o;return d?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:t.__scopeSelect,children:jsxRuntime.jsx(Collection$1.Slot,{scope:t.__scopeSelect,children:jsxRuntime.jsx("div",{children:t.children})})}),d):null}return jsxRuntime.jsx(SelectContentImpl,{...t,ref:e})});SelectContent$1.displayName=CONTENT_NAME$4;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME$4),CONTENT_IMPL_NAME="SelectContentImpl",Slot$1=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,side:g,sideOffset:b,align:S,alignOffset:_,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I,...j}=t,q=useSelectContext(CONTENT_NAME$4,n),[z,Q]=React__namespace.useState(null),[F,O]=React__namespace.useState(null),te=useComposedRefs(e,Xe=>Q(Xe)),[ne,ae]=React__namespace.useState(null),[ge,oe]=React__namespace.useState(null),Ae=useCollection$1(n),[je,Ne]=React__namespace.useState(!1),Ve=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Le=React__namespace.useCallback(Xe=>{const[it,...et]=Ae().map(Ue=>Ue.ref.current),[at]=et.slice(-1),ot=document.activeElement;for(const Ue of Xe)if(Ue===ot||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===it&&F&&(F.scrollTop=0),Ue===at&&F&&(F.scrollTop=F.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==ot))return},[Ae,F]),ze=React__namespace.useCallback(()=>Le([ne,z]),[Le,ne,z]);React__namespace.useEffect(()=>{je&&ze()},[je,ze]);const{onOpenChange:$e,triggerPointerDownPosRef:Oe}=q;React__namespace.useEffect(()=>{if(z){let Xe={x:0,y:0};const it=at=>{var ot,Ue;Xe={x:Math.abs(Math.round(at.pageX)-(((ot=Oe.current)==null?void 0:ot.x)??0)),y:Math.abs(Math.round(at.pageY)-(((Ue=Oe.current)==null?void 0:Ue.y)??0))}},et=at=>{Xe.x<=10&&Xe.y<=10?at.preventDefault():z.contains(at.target)||$e(!1),document.removeEventListener("pointermove",it),Oe.current=null};return Oe.current!==null&&(document.addEventListener("pointermove",it),document.addEventListener("pointerup",et,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",it),document.removeEventListener("pointerup",et,{capture:!0})}}},[z,$e,Oe]),React__namespace.useEffect(()=>{const Xe=()=>$e(!1);return window.addEventListener("blur",Xe),window.addEventListener("resize",Xe),()=>{window.removeEventListener("blur",Xe),window.removeEventListener("resize",Xe)}},[$e]);const[qe,Ge]=useTypeaheadSearch(Xe=>{const it=Ae().filter(ot=>!ot.disabled),et=it.find(ot=>ot.ref.current===document.activeElement),at=findNextItem(it,Xe,et);at&&setTimeout(()=>at.ref.current.focus())}),He=React__namespace.useCallback((Xe,it,et)=>{const at=!Ve.current&&!et;(q.value!==void 0&&q.value===it||at)&&(ae(Xe),at&&(Ve.current=!0))},[q.value]),Je=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),Ze=React__namespace.useCallback((Xe,it,et)=>{const at=!Ve.current&&!et;(q.value!==void 0&&q.value===it||at)&&oe(Xe)},[q.value]),We=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,tt=We===SelectPopperPosition?{side:g,sideOffset:b,align:S,alignOffset:_,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:O,itemRefCallback:He,selectedItem:ne,onItemLeave:Je,itemTextRefCallback:Ze,focusSelectedItem:ze,selectedItemText:ge,position:o,isPositioned:je,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Xe=>{Xe.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Xe=>{var it;(it=q.trigger)==null||it.focus({preventScroll:!0}),Xe.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Xe=>Xe.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(We,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Xe=>Xe.preventDefault(),...j,...tt,onPlaced:()=>Ne(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:composeEventHandlers(j.onKeyDown,Xe=>{const it=Xe.ctrlKey||Xe.altKey||Xe.metaKey;if(Xe.key==="Tab"&&Xe.preventDefault(),!it&&Xe.key.length===1&&Ge(Xe.key),["ArrowUp","ArrowDown","Home","End"].includes(Xe.key)){let at=Ae().filter(ot=>!ot.disabled).map(ot=>ot.ref.current);if(["ArrowUp","End"].includes(Xe.key)&&(at=at.slice().reverse()),["ArrowUp","ArrowDown"].includes(Xe.key)){const ot=Xe.target,Ue=at.indexOf(ot);at=at.slice(Ue+1)}setTimeout(()=>Le(at)),Xe.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:o,...l}=t,d=useSelectContext(CONTENT_NAME$4,n),f=useSelectContentContext(CONTENT_NAME$4,n),[g,b]=React__namespace.useState(null),[S,_]=React__namespace.useState(null),R=useComposedRefs(e,te=>_(te)),C=useCollection$1(n),E=React__namespace.useRef(!1),A=React__namespace.useRef(!0),{viewport:M,selectedItem:I,selectedItemText:j,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&S&&M&&I&&j){const te=d.trigger.getBoundingClientRect(),ne=S.getBoundingClientRect(),ae=d.valueNode.getBoundingClientRect(),ge=j.getBoundingClientRect();if(d.dir!=="rtl"){const ot=ge.left-ne.left,Ue=ae.left-ot,mt=te.left-Ue,Qe=te.width+mt,Rt=Math.max(Qe,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Ft=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-Rt)]);g.style.minWidth=Qe+"px",g.style.left=Ft+"px"}else{const ot=ne.right-ge.right,Ue=window.innerWidth-ae.right-ot,mt=window.innerWidth-te.right-Ue,Qe=te.width+mt,Rt=Math.max(Qe,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Ft=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-Rt)]);g.style.minWidth=Qe+"px",g.style.right=Ft+"px"}const oe=C(),Ae=window.innerHeight-CONTENT_MARGIN*2,je=M.scrollHeight,Ne=window.getComputedStyle(S),Ve=parseInt(Ne.borderTopWidth,10),Le=parseInt(Ne.paddingTop,10),ze=parseInt(Ne.borderBottomWidth,10),$e=parseInt(Ne.paddingBottom,10),Oe=Ve+Le+je+$e+ze,qe=Math.min(I.offsetHeight*5,Oe),Ge=window.getComputedStyle(M),He=parseInt(Ge.paddingTop,10),Je=parseInt(Ge.paddingBottom,10),Ze=te.top+te.height/2-CONTENT_MARGIN,We=Ae-Ze,tt=I.offsetHeight/2,Xe=I.offsetTop+tt,it=Ve+Le+Xe,et=Oe-it;if(it<=Ze){const ot=oe.length>0&&I===oe[oe.length-1].ref.current;g.style.bottom="0px";const Ue=S.clientHeight-M.offsetTop-M.offsetHeight,mt=Math.max(We,tt+(ot?Je:0)+Ue+ze),Qe=it+mt;g.style.height=Qe+"px"}else{const ot=oe.length>0&&I===oe[0].ref.current;g.style.top="0px";const mt=Math.max(Ze,Ve+M.offsetTop+(ot?He:0)+tt)+et;g.style.height=mt+"px",M.scrollTop=it-Ze+M.offsetTop}g.style.margin=`${CONTENT_MARGIN}px 0`,g.style.minHeight=qe+"px",g.style.maxHeight=Ae+"px",o==null||o(),requestAnimationFrame(()=>E.current=!0)}},[C,d.trigger,d.valueNode,g,S,M,I,j,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{S&&F(window.getComputedStyle(S).zIndex)},[S]);const O=React__namespace.useCallback(te=>{te&&A.current===!0&&(z(),q==null||q(),A.current=!1)},[z,q]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:g,shouldExpandOnScrollRef:E,onScrollButtonChange:O,children:jsxRuntime.jsx("div",{ref:b,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:Q},children:jsxRuntime.jsx(Primitive.div,{...l,ref:R,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...d}=t,f=usePopperScope$1(n);return jsxRuntime.jsx(Content$2,{...f,...d,ref:e,align:o,collisionPadding:l,style:{boxSizing:"border-box",...d.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$4,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:o,...l}=t,d=useSelectContentContext(VIEWPORT_NAME,n),f=useSelectViewportContext(VIEWPORT_NAME,n),g=useComposedRefs(e,d.onViewportChange),b=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$1.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:g,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:composeEventHandlers(l.onScroll,S=>{const _=S.currentTarget,{contentWrapper:R,shouldExpandOnScrollRef:C}=f;if(C!=null&&C.current&&R){const E=Math.abs(b.current-_.scrollTop);if(E>0){const A=window.innerHeight-CONTENT_MARGIN*2,M=parseFloat(R.style.minHeight),I=parseFloat(R.style.height),j=Math.max(M,I);if(j<A){const q=j+E,z=Math.min(A,q),Q=q-z;R.style.height=z+"px",R.style.bottom==="0px"&&(_.scrollTop=Q>0?Q:0,R.style.justifyContent="flex-end")}}}b.current=_.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:e})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,ref:e})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME$1="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME$1),SelectItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,value:o,disabled:l=!1,textValue:d,...f}=t,g=useSelectContext(ITEM_NAME$1,n),b=useSelectContentContext(ITEM_NAME$1,n),S=g.value===o,[_,R]=React__namespace.useState(d??""),[C,E]=React__namespace.useState(!1),A=useComposedRefs(e,q=>{var z;return(z=b.itemRefCallback)==null?void 0:z.call(b,q,o,l)}),M=useId(),I=React__namespace.useRef("touch"),j=()=>{l||(g.onValueChange(o),g.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:M,isSelected:S,onItemTextChange:React__namespace.useCallback(q=>{R(z=>z||((q==null?void 0:q.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection$1.ItemSlot,{scope:n,value:o,disabled:l,textValue:_,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":M,"data-highlighted":C?"":void 0,"aria-selected":S&&C,"data-state":S?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...f,ref:A,onFocus:composeEventHandlers(f.onFocus,()=>E(!0)),onBlur:composeEventHandlers(f.onBlur,()=>E(!1)),onClick:composeEventHandlers(f.onClick,()=>{I.current!=="mouse"&&j()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{I.current==="mouse"&&j()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{I.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;I.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):I.current==="mouse"&&q.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(f.onPointerLeave,q=>{var z;q.currentTarget===document.activeElement&&((z=b.onItemLeave)==null||z.call(b))}),onKeyDown:composeEventHandlers(f.onKeyDown,q=>{var Q;((Q=b.searchRef)==null?void 0:Q.current)!==""&&q.key===" "||(SELECTION_KEYS.includes(q.key)&&j(),q.key===" "&&q.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME$1;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,...d}=t,f=useSelectContext(ITEM_TEXT_NAME,n),g=useSelectContentContext(ITEM_TEXT_NAME,n),b=useSelectItemContext(ITEM_TEXT_NAME,n),S=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[_,R]=React__namespace.useState(null),C=useComposedRefs(e,j=>R(j),b.onItemTextChange,j=>{var q;return(q=g.itemTextRefCallback)==null?void 0:q.call(g,j,b.value,b.disabled)}),E=_==null?void 0:_.textContent,A=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:b.value,disabled:b.disabled,children:E},b.value),[b.disabled,b.value,E]),{onNativeOptionAdd:M,onNativeOptionRemove:I}=S;return useLayoutEffect2(()=>(M(A),()=>I(A)),[M,I,A]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:b.textId,...d,ref:C}),b.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ReactDOM__namespace.createPortal(d.children,f.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:e}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const S=b.scrollTop>0;d(S)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop-b.offsetHeight)}}):null});SelectScrollUpButton$1.displayName=SCROLL_UP_BUTTON_NAME;var SCROLL_DOWN_BUTTON_NAME="SelectScrollDownButton",SelectScrollDownButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const S=b.scrollHeight-b.clientHeight,_=Math.ceil(b.scrollTop)<S;d(_)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop+b.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=t,d=useSelectContentContext("SelectScrollButton",n),f=React__namespace.useRef(null),g=useCollection$1(n),b=React__namespace.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return React__namespace.useEffect(()=>()=>b(),[b]),useLayoutEffect2(()=>{var _;const S=g().find(R=>R.ref.current===document.activeElement);(_=S==null?void 0:S.ref.current)==null||_.scrollIntoView({block:"nearest"})},[g]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:e,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var S;(S=d.onItemLeave)==null||S.call(d),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{b()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:e})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME$1="SelectArrow",SelectArrow=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=usePopperScope$1(n),d=useSelectContext(ARROW_NAME$1,n),f=useSelectContentContext(ARROW_NAME$1,n);return d.open&&f.position==="popper"?jsxRuntime.jsx(Arrow,{...l,...o,ref:e}):null});SelectArrow.displayName=ARROW_NAME$1;var BUBBLE_INPUT_NAME$1="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:t,value:e,...n},o)=>{const l=React__namespace.useRef(null),d=useComposedRefs(o,l),f=usePrevious(e);return React__namespace.useEffect(()=>{const g=l.current;if(!g)return;const b=window.HTMLSelectElement.prototype,_=Object.getOwnPropertyDescriptor(b,"value").set;if(f!==e&&_){const R=new Event("change",{bubbles:!0});_.call(g,e),g.dispatchEvent(R)}},[f,e]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:d,defaultValue:e})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function shouldShowPlaceholder(t){return t===""||t===void 0}function useTypeaheadSearch(t){const e=useCallbackRef$1(t),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(f=>{const g=n.current+f;e(g),function b(S){n.current=S,window.clearTimeout(o.current),S!==""&&(o.current=window.setTimeout(()=>b(""),1e3))}(g)},[e]),d=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,d]}function findNextItem(t,e,n){const l=e.length>1&&Array.from(e).every(S=>S===e[0])?e[0]:e,d=n?t.indexOf(n):-1;let f=wrapArray(t,Math.max(d,0));l.length===1&&(f=f.filter(S=>S!==n));const b=f.find(S=>S.textValue.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function wrapArray(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Root2$3=Select$1,Trigger$2=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal$1=SelectPortal,Content2$3=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item$2=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2$3,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Trigger$2,{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",t),...n,children:[e,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger$2.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:t,children:e,position:n="popper",...o},l)=>jsxRuntime.jsx(Portal$1,{children:jsxRuntime.jsxs(Content2$3,{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",t),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:e}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2$3.displayName;const SelectLabel=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",t),...e}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Item$2,{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",t),...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:e})]}));SelectItem.displayName=Item$2.displayName;const SelectSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));SelectSeparator.displayName=Separator.displayName;function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var z,Q,F,O,te,ne;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((Q=(z=e.Categories)==null?void 0:z[0])==null?void 0:Q.CategoryCode)||""),[f,g]=React.useState(!1),[b,S]=React.useState(!1),[_,R]=React.useState("percentile"),{toast:C}=useToast(),{data:E,isLoading:A,isFetching:M}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),I=async()=>{try{g(!0),S(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&C({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(ae){console.error("Error syncing to Shopify:",ae),C({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},j=()=>{var ae,ge;return((ge=(ae=e.Categories)==null?void 0:ae.find(oe=>oe.CategoryCode===l))==null?void 0:ge.CategoryName)||l},q=React.useMemo(()=>E!=null&&E.Products?[...E.Products].sort((ae,ge)=>{var oe,Ae,je,Ne;return _==="price-asc"?(((oe=ae.Distribution)==null?void 0:oe.Price)??0)-(((Ae=ge.Distribution)==null?void 0:Ae.Price)??0):_==="price-desc"?(((je=ge.Distribution)==null?void 0:je.Price)??0)-(((Ne=ae.Distribution)==null?void 0:Ne.Price)??0):_==="name"?(ae.Title??"").localeCompare(ge.Title??""):_==="percentile"?(ge.OverallPercentileRank??0)-(ae.OverallPercentileRank??0):0}):[],[E==null?void 0:E.Products,_]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),jsxRuntime.jsx("div",{className:"mb-4 w-full",children:jsxRuntime.jsx(ManufacturerCategorySummary,{name:j(),niche:(E==null?void 0:E.Niche)||"",productsNumber:((F=E==null?void 0:E.Products)==null?void 0:F.length)||0,autoreorder:(E==null?void 0:E.AutoReorder)||!1,starred:(E==null?void 0:E.Starred)||!1,isLoading:A||M,children:n&&((O=e.Categories)==null?void 0:O.findIndex(ae=>ae.AvailableToBuy))!==-1&&jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",disabled:f,onClick:()=>S(!0),children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})})}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx(ManufacturerCategoriesStats,{categories:[(te=e.Categories)==null?void 0:te.find(ae=>ae.CategoryCode===l)].filter(Boolean),manufID:e.ManufacturerId,appID:t}),jsxRuntime.jsx(ActiveOrdersCard,{orders:(ne=E==null?void 0:E.Products)==null?void 0:ne.flatMap(ae=>(ae.ActiveOrderDetails||[]).filter(ge=>ge.Category===l)),loading:A||M})]})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-7 mb-4",children:[jsxRuntime.jsx("h4",{className:"text-xl md:text-2xl text-foreground font-bold",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 ms-auto",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Sort by:"}),jsxRuntime.jsxs(Select,{value:_,onValueChange:R,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[220px]",children:jsxRuntime.jsx(SelectValue,{})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"price-asc",children:"Price: Low to High"}),jsxRuntime.jsx(SelectItem,{value:"price-desc",children:"Price: High to Low"}),jsxRuntime.jsx(SelectItem,{value:"name",children:"Name"}),jsxRuntime.jsx(SelectItem,{value:"percentile",children:"Best Selling"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:A||M?Array.from({length:4}).map((ae,ge)=>jsxRuntime.jsx(ProductCard,{},ge)):q.length>0?q.map(ae=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:ae,viewProductLink:`/${t}/Product/${ae.RandmarSKU}`,shopifyHostname:n},ae.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})}),jsxRuntime.jsx(Dialog,{open:b,onOpenChange:S,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',j(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:I,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var q,z,Q;const{data:d}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t}),{data:f,isLoading:g,isFetching:b}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:S}=useToast(),[_]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[R,C]=React.useState(!1),[E,A]=React.useState(!1),M=async()=>{try{C(!0),A(!1),await _({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&S({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(F){console.error("Error syncing to Shopify:",F),S({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{C(!1)}},I=()=>f!=null&&f.Reseller?"reseller-overview":f!=null&&f.Manufacturer?"manufacturer-overview":"",j=React.useMemo(()=>!d||!f?"":`
|
|
1148
|
+
Defaulting to \`null\`.`}var Root$1=Progress$1,Indicator=ProgressIndicator;const Progress=React__namespace.forwardRef(({className:t,value:e,...n},o)=>jsxRuntime.jsx(Root$1,{ref:o,className:cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:jsxRuntime.jsx(Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Progress.displayName=Root$1.displayName;function ManufacturerInventoryFinanceCard({manufacturer:t,isLoading:e}){const{data:n,isLoading:o,isFetching:l}=useGetV4ManufacturerByRouteManufacturerIdInventoryValueQuery({routeManufacturerId:(t==null?void 0:t.ManufacturerId)??""},{skip:!(t!=null&&t.ManufacturerId)}),d=(t==null?void 0:t.DefaultMaxInventoryValue)??0,f=(n||[]).reduce((S,_)=>S+(_.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100);return e||o||l?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-muted-foreground"}),"Inventory Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current inventory financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[d!==0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Max Allowance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Current value"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(f)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available"}),jsxRuntime.jsx("span",{className:`font-bold ${g>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(g)})]})]}),d!==0&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Budget Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[b,"%"]}),b>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b>80?"High usage alert":"Budget usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:b,className:"h-2"})]})]})]})}function ManufacturerCreditFinanceCard({manufacturer:t,isLoading:e}){const n=(t==null?void 0:t.CreditLimit)??0,o=(t==null?void 0:t.OutstandingBalance)??0,l=n-o,d=Math.round(o/n*100);return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-muted-foreground"}),"Credit Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current credit financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Limit"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(n)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Outstanding Balance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(o)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Credit"}),jsxRuntime.jsx("span",{className:`font-bold ${l>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(l)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[d,"%"]}),d>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:d>80?"High credit usage alert":"Credit usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:d,className:"h-2"})]})]})]})}function SalesChartCard({statistics:t,loading:e=!1,mode:n="month",chartHeight:o=300,className:l,size:d="default"}){return e?jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48 rounded-md"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:o},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),d==="default"&&n==="month"&&jsxRuntime.jsxs("div",{className:"mt-4 flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 rounded-md"})]})]})]}):jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:n==="week"?"Weekly Sales Performance":"Monthly Sales Performance"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(SalesChart,{statistics:t,mode:n,chartHeight:o,size:d})})]})}function ManufacturerOverviewPage({applicationId:t,readonly:e,withReports:n,manufacturer:o,userEmail:l}){const{data:d,isLoading:f,isError:g}=useGetV4PartnerByApplicationIdAccountManufacturerQuery({applicationId:t,withSpecification:!0},{skip:!!o}),[b,S]=React.useState({publicInfo:{hasUnsavedChanges:!1},qualifications:{hasUnsavedChanges:!1},billingInfo:{hasUnsavedChanges:!1}}),_=React.useCallback(()=>e?!1:b.publicInfo.hasUnsavedChanges||b.qualifications.hasUnsavedChanges||b.billingInfo.hasUnsavedChanges,[e,b]),R=React.useCallback((A,M)=>{S(I=>{var j;return((j=I[A])==null?void 0:j.hasUnsavedChanges)!==M.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,M.hasUnsavedChanges),{...I,[A]:M}):I})},[]),{NavigationGuardDialog:C}=useRouterNavigationGuard(_),E=o??d;return jsxRuntime.jsxs("div",{className:"@container",children:[g?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your manufacturer information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:E==null?void 0:E.FiscalYearMonthStart,salesData:E==null?void 0:E.SalesData,isLoading:f}),jsxRuntime.jsxs("div",{className:"grid @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(E==null?void 0:E.SalesStatistics)??[],loading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",activeOrders:(E==null?void 0:E.ActiveOrderDetails)??void 0,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerInventoryFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerCreditFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerReorderingCard,{manufacturer:E??{},onSave:()=>{},loading:f,readonly:e}),n&&jsxRuntime.jsx(ManufacturerPublicInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("publicInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(OpenToWorkSection,{manufacturer:E,readonly:e,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerBillingInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("billingInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(ManufacturerQualificationsSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("qualifications",{hasUnsavedChanges:A})})]}),n&&jsxRuntime.jsx(ManufacturerReportsSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function CategoryStats(t){const{data:e,isLoading:n,isFetching:o}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t.appID,manufacturerId:t.manufID,categoryCode:t.categoryCode});return jsxRuntime.jsx(Card,{className:"w-full",children:jsxRuntime.jsx(CardContent,{className:"p-4 space-y-1",children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:t.categoryName}),jsxRuntime.jsx(SalesChart,{statistics:(e==null?void 0:e.SalesStatistics)??[],loading:n||o,chartHeight:300})]})})})}function ManufacturerCategoriesStats(t){return(t.categories??[]).filter(n=>n.CategoryName).map(n=>jsxRuntime.jsx(CategoryStats,{appID:t.appID,manufID:t.manufID,categoryCode:n.CategoryCode,categoryName:n.CategoryName},`${t.manufID}-${n.CategoryCode}`))}const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:t,variant:e,size:n,icon:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:e,size:n}),t),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function ManufacturerCategorySummary({name:t="N/A",niche:e="N/A",productsNumber:n=0,autoreorder:o=!1,starred:l=!1,isLoading:d=!1,children:f}){return d?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-4",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"space-y-1 flex-1",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-28 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-48 bg-muted rounded-md animate-pulse"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-12 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-5 bg-muted rounded-md animate-pulse"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-8 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-32 bg-muted rounded-md animate-pulse"})]}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-16 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-6 bg-muted rounded-md animate-pulse"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex-1 flex flex-col items-end",children:[jsxRuntime.jsx("div",{className:"h-3 w-20 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-6 w-16 bg-muted rounded-md animate-pulse"})]})]})]})]})]}):jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"grid grid-cols-[1fr_auto] items-start gap-4 pt-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Category Name"}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold leading-none tracking-tight",children:t})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Niche"}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:e})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Package,{className:"h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end justify-between gap-4 h-full",children:[f,jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Starred"}),l?jsxRuntime.jsx(Star,{className:"h-5 w-5 fill-yellow-400 text-yellow-400"}):jsxRuntime.jsx(Star,{className:"h-5 w-5 text-muted-foreground"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex flex-col items-end",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Auto-reorder"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o?jsxRuntime.jsx(RefreshCw,{className:"size-4 text-green-600"}):jsxRuntime.jsx(RefreshCwOff,{className:"size-4 text-amber-600"}),jsxRuntime.jsx(Badge,{variant:o?"default":"secondary",className:cn("text-xs",o?"text-green-600 bg-green-100 hover:bg-green-200":"text-amber-600 bg-amber-100 hover:bg-amber-200"),children:o?"Enabled":"Disabled"})]})]})]})]})})}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection$1,useCollection$1,createCollectionScope$1]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope$1,createPopperScope]),usePopperScope$1=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=t=>{const{__scopeSelect:e,children:n,open:o,defaultOpen:l,onOpenChange:d,value:f,defaultValue:g,onValueChange:b,dir:S,name:_,autoComplete:R,disabled:C,required:E,form:A}=t,M=usePopperScope$1(e),[I,j]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),O=useDirection(S),[te,ne]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[ae,ge]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),oe=React__namespace.useRef(null),Ae=I?A||!!I.closest("form"):!0,[je,Ne]=React__namespace.useState(new Set),Ve=Array.from(je).map(Le=>Le.props.value).join(";");return jsxRuntime.jsx(Root2$7,{...M,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:e,trigger:I,onTriggerChange:j,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:ae,onValueChange:ge,open:te,onOpenChange:ne,dir:O,triggerPointerDownPosRef:oe,disabled:C,children:[jsxRuntime.jsx(Collection$1.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Le=>{Ne(ze=>new Set(ze).add(Le))},[]),onNativeOptionRemove:React__namespace.useCallback(Le=>{Ne(ze=>{const $e=new Set(ze);return $e.delete(Le),$e})},[]),children:n})}),Ae?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:_,autoComplete:R,value:ae,onChange:Le=>ge(Le.target.value),disabled:C,form:A,children:[ae===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(je)]},Ve):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME$5="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:o=!1,...l}=t,d=usePopperScope$1(n),f=useSelectContext(TRIGGER_NAME$5,n),g=f.disabled||o,b=useComposedRefs(e,f.onTriggerChange),S=useCollection$1(n),_=React__namespace.useRef("touch"),[R,C,E]=useTypeaheadSearch(M=>{const I=S().filter(z=>!z.disabled),j=I.find(z=>z.value===f.value),q=findNextItem(I,M,j);q!==void 0&&f.onValueChange(q.value)}),A=M=>{g||(f.onOpenChange(!0),E()),M&&(f.triggerPointerDownPosRef.current={x:Math.round(M.pageX),y:Math.round(M.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:g,"data-disabled":g?"":void 0,"data-placeholder":shouldShowPlaceholder(f.value)?"":void 0,...l,ref:b,onClick:composeEventHandlers(l.onClick,M=>{M.currentTarget.focus(),_.current!=="mouse"&&A(M)}),onPointerDown:composeEventHandlers(l.onPointerDown,M=>{_.current=M.pointerType;const I=M.target;I.hasPointerCapture(M.pointerId)&&I.releasePointerCapture(M.pointerId),M.button===0&&M.ctrlKey===!1&&M.pointerType==="mouse"&&(A(M),M.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,M=>{const I=R.current!=="";!(M.ctrlKey||M.altKey||M.metaKey)&&M.key.length===1&&C(M.key),!(I&&M.key===" ")&&OPEN_KEYS.includes(M.key)&&(A(),M.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME$5;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,children:d,placeholder:f="",...g}=t,b=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:S}=b,_=d!==void 0,R=useComposedRefs(e,b.onValueNodeChange);return useLayoutEffect2(()=>{S(_)},[S,_]),jsxRuntime.jsx(Primitive.span,{...g,ref:R,style:{pointerEvents:"none"},children:shouldShowPlaceholder(b.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:f}):d})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,children:o,...l}=t;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:e,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME$2="SelectPortal",SelectPortal=t=>jsxRuntime.jsx(Portal$5,{asChild:!0,...t});SelectPortal.displayName=PORTAL_NAME$2;var CONTENT_NAME$4="SelectContent",SelectContent$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContext(CONTENT_NAME$4,t.__scopeSelect),[o,l]=React__namespace.useState();if(useLayoutEffect2(()=>{l(new DocumentFragment)},[]),!n.open){const d=o;return d?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:t.__scopeSelect,children:jsxRuntime.jsx(Collection$1.Slot,{scope:t.__scopeSelect,children:jsxRuntime.jsx("div",{children:t.children})})}),d):null}return jsxRuntime.jsx(SelectContentImpl,{...t,ref:e})});SelectContent$1.displayName=CONTENT_NAME$4;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME$4),CONTENT_IMPL_NAME="SelectContentImpl",Slot$1=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,side:g,sideOffset:b,align:S,alignOffset:_,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I,...j}=t,q=useSelectContext(CONTENT_NAME$4,n),[z,Q]=React__namespace.useState(null),[F,O]=React__namespace.useState(null),te=useComposedRefs(e,Xe=>Q(Xe)),[ne,ae]=React__namespace.useState(null),[ge,oe]=React__namespace.useState(null),Ae=useCollection$1(n),[je,Ne]=React__namespace.useState(!1),Ve=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Le=React__namespace.useCallback(Xe=>{const[it,...et]=Ae().map(Ue=>Ue.ref.current),[at]=et.slice(-1),ot=document.activeElement;for(const Ue of Xe)if(Ue===ot||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===it&&F&&(F.scrollTop=0),Ue===at&&F&&(F.scrollTop=F.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==ot))return},[Ae,F]),ze=React__namespace.useCallback(()=>Le([ne,z]),[Le,ne,z]);React__namespace.useEffect(()=>{je&&ze()},[je,ze]);const{onOpenChange:$e,triggerPointerDownPosRef:Oe}=q;React__namespace.useEffect(()=>{if(z){let Xe={x:0,y:0};const it=at=>{var ot,Ue;Xe={x:Math.abs(Math.round(at.pageX)-(((ot=Oe.current)==null?void 0:ot.x)??0)),y:Math.abs(Math.round(at.pageY)-(((Ue=Oe.current)==null?void 0:Ue.y)??0))}},et=at=>{Xe.x<=10&&Xe.y<=10?at.preventDefault():z.contains(at.target)||$e(!1),document.removeEventListener("pointermove",it),Oe.current=null};return Oe.current!==null&&(document.addEventListener("pointermove",it),document.addEventListener("pointerup",et,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",it),document.removeEventListener("pointerup",et,{capture:!0})}}},[z,$e,Oe]),React__namespace.useEffect(()=>{const Xe=()=>$e(!1);return window.addEventListener("blur",Xe),window.addEventListener("resize",Xe),()=>{window.removeEventListener("blur",Xe),window.removeEventListener("resize",Xe)}},[$e]);const[qe,Ge]=useTypeaheadSearch(Xe=>{const it=Ae().filter(ot=>!ot.disabled),et=it.find(ot=>ot.ref.current===document.activeElement),at=findNextItem(it,Xe,et);at&&setTimeout(()=>at.ref.current.focus())}),He=React__namespace.useCallback((Xe,it,et)=>{const at=!Ve.current&&!et;(q.value!==void 0&&q.value===it||at)&&(ae(Xe),at&&(Ve.current=!0))},[q.value]),Je=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),Ze=React__namespace.useCallback((Xe,it,et)=>{const at=!Ve.current&&!et;(q.value!==void 0&&q.value===it||at)&&oe(Xe)},[q.value]),We=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,tt=We===SelectPopperPosition?{side:g,sideOffset:b,align:S,alignOffset:_,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:A,hideWhenDetached:M,avoidCollisions:I}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:O,itemRefCallback:He,selectedItem:ne,onItemLeave:Je,itemTextRefCallback:Ze,focusSelectedItem:ze,selectedItemText:ge,position:o,isPositioned:je,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Xe=>{Xe.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Xe=>{var it;(it=q.trigger)==null||it.focus({preventScroll:!0}),Xe.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Xe=>Xe.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(We,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Xe=>Xe.preventDefault(),...j,...tt,onPlaced:()=>Ne(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:composeEventHandlers(j.onKeyDown,Xe=>{const it=Xe.ctrlKey||Xe.altKey||Xe.metaKey;if(Xe.key==="Tab"&&Xe.preventDefault(),!it&&Xe.key.length===1&&Ge(Xe.key),["ArrowUp","ArrowDown","Home","End"].includes(Xe.key)){let at=Ae().filter(ot=>!ot.disabled).map(ot=>ot.ref.current);if(["ArrowUp","End"].includes(Xe.key)&&(at=at.slice().reverse()),["ArrowUp","ArrowDown"].includes(Xe.key)){const ot=Xe.target,Ue=at.indexOf(ot);at=at.slice(Ue+1)}setTimeout(()=>Le(at)),Xe.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:o,...l}=t,d=useSelectContext(CONTENT_NAME$4,n),f=useSelectContentContext(CONTENT_NAME$4,n),[g,b]=React__namespace.useState(null),[S,_]=React__namespace.useState(null),R=useComposedRefs(e,te=>_(te)),C=useCollection$1(n),E=React__namespace.useRef(!1),A=React__namespace.useRef(!0),{viewport:M,selectedItem:I,selectedItemText:j,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&S&&M&&I&&j){const te=d.trigger.getBoundingClientRect(),ne=S.getBoundingClientRect(),ae=d.valueNode.getBoundingClientRect(),ge=j.getBoundingClientRect();if(d.dir!=="rtl"){const ot=ge.left-ne.left,Ue=ae.left-ot,mt=te.left-Ue,Qe=te.width+mt,Rt=Math.max(Qe,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Ft=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-Rt)]);g.style.minWidth=Qe+"px",g.style.left=Ft+"px"}else{const ot=ne.right-ge.right,Ue=window.innerWidth-ae.right-ot,mt=window.innerWidth-te.right-Ue,Qe=te.width+mt,Rt=Math.max(Qe,ne.width),$t=window.innerWidth-CONTENT_MARGIN,Ft=clamp(Ue,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,$t-Rt)]);g.style.minWidth=Qe+"px",g.style.right=Ft+"px"}const oe=C(),Ae=window.innerHeight-CONTENT_MARGIN*2,je=M.scrollHeight,Ne=window.getComputedStyle(S),Ve=parseInt(Ne.borderTopWidth,10),Le=parseInt(Ne.paddingTop,10),ze=parseInt(Ne.borderBottomWidth,10),$e=parseInt(Ne.paddingBottom,10),Oe=Ve+Le+je+$e+ze,qe=Math.min(I.offsetHeight*5,Oe),Ge=window.getComputedStyle(M),He=parseInt(Ge.paddingTop,10),Je=parseInt(Ge.paddingBottom,10),Ze=te.top+te.height/2-CONTENT_MARGIN,We=Ae-Ze,tt=I.offsetHeight/2,Xe=I.offsetTop+tt,it=Ve+Le+Xe,et=Oe-it;if(it<=Ze){const ot=oe.length>0&&I===oe[oe.length-1].ref.current;g.style.bottom="0px";const Ue=S.clientHeight-M.offsetTop-M.offsetHeight,mt=Math.max(We,tt+(ot?Je:0)+Ue+ze),Qe=it+mt;g.style.height=Qe+"px"}else{const ot=oe.length>0&&I===oe[0].ref.current;g.style.top="0px";const mt=Math.max(Ze,Ve+M.offsetTop+(ot?He:0)+tt)+et;g.style.height=mt+"px",M.scrollTop=it-Ze+M.offsetTop}g.style.margin=`${CONTENT_MARGIN}px 0`,g.style.minHeight=qe+"px",g.style.maxHeight=Ae+"px",o==null||o(),requestAnimationFrame(()=>E.current=!0)}},[C,d.trigger,d.valueNode,g,S,M,I,j,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{S&&F(window.getComputedStyle(S).zIndex)},[S]);const O=React__namespace.useCallback(te=>{te&&A.current===!0&&(z(),q==null||q(),A.current=!1)},[z,q]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:g,shouldExpandOnScrollRef:E,onScrollButtonChange:O,children:jsxRuntime.jsx("div",{ref:b,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:Q},children:jsxRuntime.jsx(Primitive.div,{...l,ref:R,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...d}=t,f=usePopperScope$1(n);return jsxRuntime.jsx(Content$2,{...f,...d,ref:e,align:o,collisionPadding:l,style:{boxSizing:"border-box",...d.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$4,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:o,...l}=t,d=useSelectContentContext(VIEWPORT_NAME,n),f=useSelectViewportContext(VIEWPORT_NAME,n),g=useComposedRefs(e,d.onViewportChange),b=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$1.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:g,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:composeEventHandlers(l.onScroll,S=>{const _=S.currentTarget,{contentWrapper:R,shouldExpandOnScrollRef:C}=f;if(C!=null&&C.current&&R){const E=Math.abs(b.current-_.scrollTop);if(E>0){const A=window.innerHeight-CONTENT_MARGIN*2,M=parseFloat(R.style.minHeight),I=parseFloat(R.style.height),j=Math.max(M,I);if(j<A){const q=j+E,z=Math.min(A,q),Q=q-z;R.style.height=z+"px",R.style.bottom==="0px"&&(_.scrollTop=Q>0?Q:0,R.style.justifyContent="flex-end")}}}b.current=_.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:e})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,ref:e})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME$1="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME$1),SelectItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,value:o,disabled:l=!1,textValue:d,...f}=t,g=useSelectContext(ITEM_NAME$1,n),b=useSelectContentContext(ITEM_NAME$1,n),S=g.value===o,[_,R]=React__namespace.useState(d??""),[C,E]=React__namespace.useState(!1),A=useComposedRefs(e,q=>{var z;return(z=b.itemRefCallback)==null?void 0:z.call(b,q,o,l)}),M=useId(),I=React__namespace.useRef("touch"),j=()=>{l||(g.onValueChange(o),g.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:M,isSelected:S,onItemTextChange:React__namespace.useCallback(q=>{R(z=>z||((q==null?void 0:q.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection$1.ItemSlot,{scope:n,value:o,disabled:l,textValue:_,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":M,"data-highlighted":C?"":void 0,"aria-selected":S&&C,"data-state":S?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...f,ref:A,onFocus:composeEventHandlers(f.onFocus,()=>E(!0)),onBlur:composeEventHandlers(f.onBlur,()=>E(!1)),onClick:composeEventHandlers(f.onClick,()=>{I.current!=="mouse"&&j()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{I.current==="mouse"&&j()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{I.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;I.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):I.current==="mouse"&&q.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(f.onPointerLeave,q=>{var z;q.currentTarget===document.activeElement&&((z=b.onItemLeave)==null||z.call(b))}),onKeyDown:composeEventHandlers(f.onKeyDown,q=>{var Q;((Q=b.searchRef)==null?void 0:Q.current)!==""&&q.key===" "||(SELECTION_KEYS.includes(q.key)&&j(),q.key===" "&&q.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME$1;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:o,style:l,...d}=t,f=useSelectContext(ITEM_TEXT_NAME,n),g=useSelectContentContext(ITEM_TEXT_NAME,n),b=useSelectItemContext(ITEM_TEXT_NAME,n),S=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[_,R]=React__namespace.useState(null),C=useComposedRefs(e,j=>R(j),b.onItemTextChange,j=>{var q;return(q=g.itemTextRefCallback)==null?void 0:q.call(g,j,b.value,b.disabled)}),E=_==null?void 0:_.textContent,A=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:b.value,disabled:b.disabled,children:E},b.value),[b.disabled,b.value,E]),{onNativeOptionAdd:M,onNativeOptionRemove:I}=S;return useLayoutEffect2(()=>(M(A),()=>I(A)),[M,I,A]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:b.textId,...d,ref:C}),b.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ReactDOM__namespace.createPortal(d.children,f.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:e}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const S=b.scrollTop>0;d(S)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop-b.offsetHeight)}}):null});SelectScrollUpButton$1.displayName=SCROLL_UP_BUTTON_NAME;var SCROLL_DOWN_BUTTON_NAME="SelectScrollDownButton",SelectScrollDownButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(e,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const S=b.scrollHeight-b.clientHeight,_=Math.ceil(b.scrollTop)<S;d(_)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:f,onAutoScroll:()=>{const{viewport:g,selectedItem:b}=n;g&&b&&(g.scrollTop=g.scrollTop+b.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=t,d=useSelectContentContext("SelectScrollButton",n),f=React__namespace.useRef(null),g=useCollection$1(n),b=React__namespace.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return React__namespace.useEffect(()=>()=>b(),[b]),useLayoutEffect2(()=>{var _;const S=g().find(R=>R.ref.current===document.activeElement);(_=S==null?void 0:S.ref.current)==null||_.scrollIntoView({block:"nearest"})},[g]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:e,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var S;(S=d.onItemLeave)==null||S.call(d),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{b()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:e})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME$1="SelectArrow",SelectArrow=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...o}=t,l=usePopperScope$1(n),d=useSelectContext(ARROW_NAME$1,n),f=useSelectContentContext(ARROW_NAME$1,n);return d.open&&f.position==="popper"?jsxRuntime.jsx(Arrow,{...l,...o,ref:e}):null});SelectArrow.displayName=ARROW_NAME$1;var BUBBLE_INPUT_NAME$1="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:t,value:e,...n},o)=>{const l=React__namespace.useRef(null),d=useComposedRefs(o,l),f=usePrevious(e);return React__namespace.useEffect(()=>{const g=l.current;if(!g)return;const b=window.HTMLSelectElement.prototype,_=Object.getOwnPropertyDescriptor(b,"value").set;if(f!==e&&_){const R=new Event("change",{bubbles:!0});_.call(g,e),g.dispatchEvent(R)}},[f,e]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:d,defaultValue:e})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function shouldShowPlaceholder(t){return t===""||t===void 0}function useTypeaheadSearch(t){const e=useCallbackRef$1(t),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(f=>{const g=n.current+f;e(g),function b(S){n.current=S,window.clearTimeout(o.current),S!==""&&(o.current=window.setTimeout(()=>b(""),1e3))}(g)},[e]),d=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,d]}function findNextItem(t,e,n){const l=e.length>1&&Array.from(e).every(S=>S===e[0])?e[0]:e,d=n?t.indexOf(n):-1;let f=wrapArray(t,Math.max(d,0));l.length===1&&(f=f.filter(S=>S!==n));const b=f.find(S=>S.textValue.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function wrapArray(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Root2$3=Select$1,Trigger$2=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal$1=SelectPortal,Content2$3=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item$2=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2$3,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Trigger$2,{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",t),...n,children:[e,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger$2.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:t,children:e,position:n="popper",...o},l)=>jsxRuntime.jsx(Portal$1,{children:jsxRuntime.jsxs(Content2$3,{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",t),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:e}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2$3.displayName;const SelectLabel=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",t),...e}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsxs(Item$2,{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",t),...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:e})]}));SelectItem.displayName=Item$2.displayName;const SelectSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));SelectSeparator.displayName=Separator.displayName;function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var z,Q,F,O,te,ne;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((Q=(z=e.Categories)==null?void 0:z[0])==null?void 0:Q.CategoryCode)||""),[f,g]=React.useState(!1),[b,S]=React.useState(!1),[_,R]=React.useState("percentile"),{toast:C}=useToast(),{data:E,isLoading:A,isFetching:M}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),I=async()=>{try{g(!0),S(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&C({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(ae){console.error("Error syncing to Shopify:",ae),C({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},j=()=>{var ae,ge;return((ge=(ae=e.Categories)==null?void 0:ae.find(oe=>oe.CategoryCode===l))==null?void 0:ge.CategoryName)||l},q=React.useMemo(()=>E!=null&&E.Products?[...E.Products].sort((ae,ge)=>_==="price-asc"?(ae.MAP??0)-(ge.MAP??0):_==="price-desc"?(ge.MAP??0)-(ae.MAP??0):_==="name"?(ae.Title??"").localeCompare(ge.Title??""):_==="percentile"?(ge.OverallPercentileRank??0)-(ae.OverallPercentileRank??0):0):[],[E==null?void 0:E.Products,_]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),jsxRuntime.jsx("div",{className:"mb-4 w-full",children:jsxRuntime.jsx(ManufacturerCategorySummary,{name:j(),niche:(E==null?void 0:E.Niche)||"",productsNumber:((F=E==null?void 0:E.Products)==null?void 0:F.length)||0,autoreorder:(E==null?void 0:E.AutoReorder)||!1,starred:(E==null?void 0:E.Starred)||!1,isLoading:A||M,children:n&&((O=e.Categories)==null?void 0:O.findIndex(ae=>ae.AvailableToBuy))!==-1&&jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",disabled:f,onClick:()=>S(!0),children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})})}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx(ManufacturerCategoriesStats,{categories:[(te=e.Categories)==null?void 0:te.find(ae=>ae.CategoryCode===l)].filter(Boolean),manufID:e.ManufacturerId,appID:t}),jsxRuntime.jsx(ActiveOrdersCard,{orders:(ne=E==null?void 0:E.Products)==null?void 0:ne.flatMap(ae=>(ae.ActiveOrderDetails||[]).filter(ge=>ge.Category===l)),loading:A||M})]})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-7 mb-4",children:[jsxRuntime.jsx("h4",{className:"text-xl md:text-2xl text-foreground font-bold",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 ms-auto",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Sort by:"}),jsxRuntime.jsxs(Select,{value:_,onValueChange:R,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[220px]",children:jsxRuntime.jsx(SelectValue,{})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"price-asc",children:"MAP: Low to High"}),jsxRuntime.jsx(SelectItem,{value:"price-desc",children:"MAP: High to Low"}),jsxRuntime.jsx(SelectItem,{value:"name",children:"Name"}),jsxRuntime.jsx(SelectItem,{value:"percentile",children:"Best Selling"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:A||M?Array.from({length:4}).map((ae,ge)=>jsxRuntime.jsx(ProductCard,{},ge)):q.length>0?q.map(ae=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:ae,viewProductLink:`/${t}/Product/${ae.RandmarSKU}`,shopifyHostname:n},ae.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})}),jsxRuntime.jsx(Dialog,{open:b,onOpenChange:S,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',j(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:I,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var q,z,Q;const{data:d}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t}),{data:f,isLoading:g,isFetching:b}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:S}=useToast(),[_]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[R,C]=React.useState(!1),[E,A]=React.useState(!1),M=async()=>{try{C(!0),A(!1),await _({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&S({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(F){console.error("Error syncing to Shopify:",F),S({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{C(!1)}},I=()=>f!=null&&f.Reseller?"reseller-overview":f!=null&&f.Manufacturer?"manufacturer-overview":"",j=React.useMemo(()=>!d||!f?"":`
|
|
1149
1149
|
Act as a business analyst. Your task is to provide a short, high-level summary
|
|
1150
1150
|
of the relationship between the two companies described in the JSON data below.
|
|
1151
1151
|
Suggest how these two entities can best work together.
|
|
@@ -1167,7 +1167,7 @@ Defaulting to \`null\`.`}var Root$1=Progress$1,Indicator=ProgressIndicator;const
|
|
|
1167
1167
|
\`\`\`
|
|
1168
1168
|
`,[d,f]);return jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 @2xl:grid-cols-2",children:[jsxRuntime.jsx(PartnerCard,{account:f,loading:g||b,withAbout:!0,withVoice:!1,action:" "}),jsxRuntime.jsxs("div",{className:"grid gap-4",children:[((f==null?void 0:f.Manufacturer)||g||b)&&jsxRuntime.jsx(ManufacturerCard,{manufacturer:f==null?void 0:f.Manufacturer,loading:g||b,mainAction:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(ManufacturerGetStartedButton,{applicationId:t,manufacturer:f==null?void 0:f.Manufacturer}),o&&((z=(q=f==null?void 0:f.Manufacturer)==null?void 0:q.Categories)==null?void 0:z.findIndex(F=>F.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:E,onOpenChange:A,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 ml-2",disabled:R,children:R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Manufacturer to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the manufacturer "',(Q=f==null?void 0:f.Manufacturer)==null?void 0:Q.PublicName,'" to Shopify? This will add all products from this manufacturer to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:M,disabled:R,children:R?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]})}),(f==null?void 0:f.Reseller)&&jsxRuntime.jsx(ResellerCard,{reseller:f==null?void 0:f.Reseller,loading:g||b})]})]}),((f==null?void 0:f.Reseller)||(f==null?void 0:f.Manufacturer))&&!g&&!b&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4",children:jsxRuntime.jsxs(Tabs,{defaultValue:I(),className:"w-full",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[(f==null?void 0:f.Reseller)&&jsxRuntime.jsx(TabsTrigger,{value:"reseller-overview",className:"reseller-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Reseller Overview"}),(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"manufacturer-overview",className:"manufacturer-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Manufacturer Overview"}),(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"products",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Products"}),jsxRuntime.jsxs(TabsTrigger,{value:"assistant",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:[jsxRuntime.jsx(Bot,{className:"mr-2 w-4 h-4"}),"Assistant"]})]}),(f==null?void 0:f.Reseller)&&jsxRuntime.jsx(TabsContent,{value:"reseller-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOverview,{readonly:!0,appID:f.ApplicationId||"",reseller:f==null?void 0:f.Reseller,userEmail:n,isSuperAdmin:l,withoutReports:!0})})}),(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"manufacturer-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerOverviewPage,{readonly:!0,manufacturer:f==null?void 0:f.Manufacturer,applicationId:t,userEmail:n})})}),(f==null?void 0:f.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"products",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerProducts,{applicationId:t,manufacturer:f.Manufacturer,shopifyHostName:o})})}),jsxRuntime.jsx(TabsContent,{value:"assistant",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(AssistantInsight,{prompt:j,thinkingPlaceholderText:"Thinking about the relationship..."})})})]})}),(g||b)&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4 mt-4 flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})})]})}const PublicInfo=({reseller:t,appID:e,isLoading:n,readonly:o,onUnsavedChanges:l})=>{const{toast:d}=useToast(),[f]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),[g,b]=React.useState({}),S=React.useMemo(()=>({publicEmail:t.PublicEmail??"",contactName:t.ContactName??"",phone:t.Phone??"",website:t.Website??""}),[t]),{register:_,handleSubmit:R,reset:C,watch:E,formState:{errors:A,isSubmitting:M}}=useForm({defaultValues:S}),I=E(),j=React.useCallback(()=>g?JSON.stringify(I)!==JSON.stringify(g):!1,[I,g]);React.useEffect(()=>{l&&l(j())},[j,l]),React.useEffect(()=>{t&&Object.keys(t).length>0&&(C(S),b(S))},[t,C,S]);const q=async Q=>{let F=!0,O=!1;const te=Object.keys(Q).map(ne=>({key:ne,keyApi:ne.charAt(0).toUpperCase()+ne.slice(1)}));for(const ne of te){const ae=Q[ne.key],ge=t[ne.keyApi];if(ae!==ge&&ae!==void 0){O=!0;try{await f({applicationId:e,fieldName:ne.keyApi,newValue:String(ae)}).unwrap()||(F=!1)}catch(oe){console.error(`Error updating ${ne.keyApi}:`,oe),F=!1}}}F&&O?(d({title:"Public info",description:"Information updated successfully",variant:"success"}),b({...Q}),l&&l(!1)):F||d({title:"Updation error",description:"Failed to update",variant:"destructive"})},z=Q=>!Q||Q.trim()==="";return n?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Public Information"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})})]})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{className:"text-1xl font-bold",children:["Public Information ",o?"(read only)":""]})}),jsxRuntime.jsxs(CardContent,{children:[(z(E("contactName"))||z(E("publicEmail"))||z(E("website"))||z(E("phone")))&&jsxRuntime.jsxs(Alert,{variant:"destructive",className:"mb-6",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Missing information"}),jsxRuntime.jsx(AlertDescription,{children:"All fields are required to get started at working with Manufacturers."})]}),jsxRuntime.jsxs("form",{onSubmit:R(q),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"contactName",children:"Main Representative *"}),jsxRuntime.jsx(Input,{id:"contactName",placeholder:"John Doe",readOnly:o,..._("contactName",{}),className:A.contactName||z(E("contactName"))?"input-error-indicator":""}),A.contactName&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.contactName.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"publicEmail",children:"Public Email *"}),jsxRuntime.jsx(Input,{id:"publicEmail",placeholder:"contact@company.com",readOnly:o,..._("publicEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:A.publicEmail||z(E("publicEmail"))?"input-error-indicator":""}),A.publicEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.publicEmail.message})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"website",children:"Website *"}),jsxRuntime.jsx(Input,{id:"website",placeholder:"https://company.com",readOnly:o,..._("website",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:A.website||z(E("website"))?"input-error-indicator":""}),A.website&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.website.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-sm font-medium leading-none",htmlFor:"phone",children:"Phone Number *"}),jsxRuntime.jsx(Input,{id:"phone",placeholder:"+1 (555) 123-4567",readOnly:o,..._("phone",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:A.phone||z(E("phone"))?"input-error-indicator":""}),A.phone&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:A.phone.message})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:M||o,className:o?"hidden":"",children:M?"Saving...":"Save"})})]})]})]})};function BillingCard({appID:t,reseller:e,isLoading:n,withoutReports:o,userEmail:l}){const{toast:d}=useToast(),{Statement:f,CreditLimit:g}=e,[b,S]=React.useState(!1),[_,R]=React.useState(!1),[C,E]=React.useState(!1),[A,M]=React.useState(!1),[I,j]=React.useState(!1),[q,z]=React.useState(l||""),Q=[{label:"0 - 30 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over0)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:Calendar},{label:"31 - 45 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over30)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarDays},{label:"45+ Days",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Over45)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarRange},{label:"Total",value:jsxRuntime.jsx(FormattedNumber,{value:(f==null?void 0:f.Total)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:DollarSign},{label:"Credit Limit",value:jsxRuntime.jsx(FormattedNumber,{value:g||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CreditCard}],[F]=useLazyGetV4ResellerByRouteResellerIdDocumentAndDocumentNumberPdfQuery(),O=async ge=>{S(!1),ge?R(!0):E(!0);try{const Ae=(await F({routeResellerId:t,documentNumber:`ST${t}`})).data;if(!Ae)throw new Error("No data received for download.");if(ge)window.open(Ae);else{const je=document.createElement("a");je.href=Ae,je.download=`ST${t}.pdf`,document.body.appendChild(je),je.click(),je.remove()}d({title:"Success",description:"Statement downloaded successfully.",variant:"success"})}catch(oe){console.error("Download Error:",oe),d({title:"Error",description:"An error occurred while downloading the statement. Please try again.",variant:"destructive"})}finally{ge?R(!1):E(!1)}},[te]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),ne=async()=>{if(!q||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(q)){d({title:"Invalid Email",description:"Please enter a valid email address.",variant:"destructive"});return}M(!0);try{await te({routeResellerId:t,emailAddress:q}).unwrap(),d({title:"Success",description:`Statement sent to ${q} successfully.`,variant:"success"}),j(!1)}catch(oe){console.error("Send Email Error:",oe),d({title:"Error",description:"An error occurred while sending the statement. Please try again.",variant:"destructive"})}finally{M(!1)}};if(n)return jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-36"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]},ge))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:[1,2].map(ge=>jsxRuntime.jsx("div",{className:ge===2?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]})},ge))})]}),jsxRuntime.jsxs("div",{className:"flex justify-end mt-6 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-28"})]})]})]});const ae=!o;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:Q.slice(0,3).map((ge,oe)=>jsxRuntime.jsx(BillingItem,{icon:ge.icon,label:ge.label,value:ge.value},oe))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:Q.slice(3).map((ge,oe)=>jsxRuntime.jsx("div",{className:oe===1?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsx(BillingItem,{icon:ge.icon,label:ge.label,value:ge.value})},oe))})]}),ae&&jsxRuntime.jsxs("div",{className:"flex justify-end mt-6 gap-2",children:[jsxRuntime.jsxs(DropdownMenu,{open:b,onOpenChange:S,children:[jsxRuntime.jsx(DropdownMenuTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"outline",disabled:_||C,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Printing..."]}):C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Downloading..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(FileText,{className:"mr-2 h-4 w-4"}),"Statement",jsxRuntime.jsx(ChevronDown,{className:"ml-2 h-4 w-4"})]})})}),jsxRuntime.jsxs(DropdownMenuContent,{align:"end",children:[jsxRuntime.jsxs(DropdownMenuItem,{onClick:()=>O(!0),disabled:_,children:[jsxRuntime.jsx(Printer,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Print"})]}),jsxRuntime.jsx(DropdownMenuSeparator,{}),jsxRuntime.jsxs(DropdownMenuItem,{onClick:()=>O(!1),disabled:C,children:[jsxRuntime.jsx(Download,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Download"})]}),jsxRuntime.jsx(DropdownMenuSeparator,{}),jsxRuntime.jsxs(DropdownMenuItem,{onSelect:()=>j(!0),children:[jsxRuntime.jsx(Mail,{className:"mr-2 h-4 w-4"}),jsxRuntime.jsx("span",{children:"Send by Email"})]})]})]}),jsxRuntime.jsx(reactRouterDom.Link,{to:`${window.location.hostname==="dashboard.randmar.io"?"":"https://dashboard.randmar.io"}/${t}/PayInvoice`,target:window.location.hostname==="dashboard.randmar.io"?"_self":"_blank",children:jsxRuntime.jsxs(Button,{children:[jsxRuntime.jsx(CreditCard,{className:"mr-2 h-4 w-4"}),"Pay Invoices"]})})]})]})]}),jsxRuntime.jsx(Dialog,{open:I,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Statement by Email"}),jsxRuntime.jsx(DialogDescription,{children:"Enter the recipient's email address below. The statement will be sent as a PDF attachment."})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:q,onChange:ge=>z(ge.target.value),className:"col-span-3",placeholder:"recipient@example.com"})]})}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",onClick:ne,disabled:A||!q,children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"}),"Send"]})})})]})})]})}function BillingItem({icon:t,label:e,value:n}){return jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(t,{className:"size-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:e})]}),jsxRuntime.jsx("span",{className:"text-base font-semibold ms-auto",children:n})]})}function ChangePricingTierModal({open:t,setOpen:e,tier:n,onTierChange:o,isLoading:l}){const d=()=>{e(!1)};return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Change Pricing Tier"})}),jsxRuntime.jsxs("div",{className:"grid gap-1.5 py-2",children:[jsxRuntime.jsxs("p",{className:"text-lg text-muted-foreground",children:["Requested Pricing Tier: ",jsxRuntime.jsx("span",{className:"font-bold",children:n})]}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If your account qualifies, your pricing will update immediately."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If not, we'll review your request and notify you of the decision."})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:d,disabled:l,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:o,disabled:l,children:l?"Loading...":`Apply for ${n}`})]})]})})}const getPricingText=t=>t===1?"The Best":t===2?"Fixed 12.5% GP on all items":t===3?"Advantageous":t===4?"Buying Group":t===5?"Cost":t,getShippingText=t=>t==="A"?"Free or Custom":t==="B"?"Fixed $10 anywhere":t==="C"?`Free shipping on $150+ orders to your location,
|
|
1169
1169
|
$15 for drop shipped orders under $1,500,
|
|
1170
|
-
$10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full shipping charges":t,getTermsText=t=>t==="STRIPE"?"Credit card payment":t==="NET30"?"Net 30 days":t,AccountTier=({isSuperAdmin:t,readonly:e,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,S]=React.useState(""),[_,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=Ve=>Ve&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[Ve]||"",E=Ve=>Ve&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[Ve]||"",A=Ve=>Ve&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[Ve]||"",[M,I]=React.useState(C((n==null?void 0:n.Priority)??"")),[j,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(A(n==null?void 0:n.PriceProfile)),F=Ve=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[Ve]||Ve,O=Ve=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[Ve]||Ve,te=Ve=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[Ve]||Ve;React.useEffect(()=>{I(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(A(n==null?void 0:n.PriceProfile))},[n]);const ne=async(Ve,Le,ze,$e)=>{try{(await _({applicationId:o,fieldName:Ve,newValue:Le})).error?d({title:"Error",description:$e,variant:"destructive"}):d({title:"Success",description:ze,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},ae=async Ve=>{I(Ve);const Le=F(Ve);ne("Priority",Le,`Priority updated to ${Le}`,"Failed to update priority")},ge=async Ve=>{q(Ve);const Le=O(Ve);ne("ShippingProfile",Le,`Shipping profile updated to ${Le}`,"Failed to update shipping profile")},oe=async Ve=>{Q(Ve);const Le=te(Ve);ne("PriceProfile",Le,`Pricing profile updated to ${Le}`,"Failed to update pricing profile")},Ae=async()=>{try{const Ve=await _({applicationId:o,fieldName:"Tier",newValue:b});Ve.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):Ve.data?d({title:"Success",description:`Pricing Tier changed to ${b}`,variant:"success"}):d({title:"Considered",description:"Request being considered",variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{g(!1),S("")}},je=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:t}],Ne=Ve=>{S(Ve),g(!0)};return l?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-16 rounded-full"})]})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-56"})]}),jsxRuntime.jsx("div",{className:"grid gap-3",children:[1,2,3].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]})]},Ve))}),jsxRuntime.jsxs("div",{className:"flex gap-2 mt-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{className:"pb-2 pt-4 px-4 flex flex-row items-center justify-between",children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Account Tier"}),jsxRuntime.jsx(Badge,{variant:"secondary",className:"bg-green-100 text-green-700 hover:bg-green-200 text-xs",children:"Active"})]}),jsxRuntime.jsxs(CardContent,{className:"pt-2 px-4 pb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 bg-primary/5 p-4 rounded-lg",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-bold text-primary",children:[(n==null?void 0:n.Priority)||""," Tier"]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Optimized for online retail"})]}),jsxRuntime.jsx(CircleCheck,{className:"h-6 w-6 text-green-600"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-2 mb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Package2,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Pricing"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground truncate",children:getPricingText(n.PriceProfile||0)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Truck,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Shipping"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getShippingText(n.ShippingProfile||"").split(".")[0]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Calendar,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Payment terms"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getTermsText((n==null?void 0:n.Terms)||"")})]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[!e&&jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4 mr-1"}),"Pricing Tiers"]})}),jsxRuntime.jsxs(Popover,{children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{disabled:e,className:e?"hidden":"flex-1",children:["Upgrade Tier ",jsxRuntime.jsx(ChevronRight,{className:"h-3 w-3 ml-1"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56 p-2",children:jsxRuntime.jsxs("div",{className:"grid gap-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-xs mb-1",children:"Select a tier"}),je.map(Ve=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!Ve.enabled,onClick:()=>Ne(Ve.name),children:Ve.name},Ve.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:Ae}),t&&!e&&jsxRuntime.jsxs(Card,{className:"mt-4",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2 pt-3 px-4",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Admin Configuration"})}),jsxRuntime.jsx(CardContent,{className:"pt-2 px-4 pb-4",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Priority"}),jsxRuntime.jsx(RadioGroup$1,{value:M,onValueChange:ae,className:"grid grid-cols-2 @sm:grid-cols-3 @md:grid-cols-4 gap-1",children:[{value:"starter",label:"Starter"},{value:"ecommerce",label:"E-Commerce"},{value:"commercial",label:"Commercial"},{value:"cws",label:"CWS (Basics)"},{value:"novexco",label:"Novexco"},{value:"jeancoutu",label:"Jean Coutu"},{value:"exclusive",label:"Exclusive"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`priority-${Ve.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Shipping Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:j,onValueChange:ge,className:"grid grid-cols-1 @md:grid-cols-2 gap-1",children:[{value:"free",label:"Free (A)"},{value:"fixed",label:"Fixed $10 Shipping (B)"},{value:"dropshipped",label:"$15 for drop shipped (C)"},{value:"under1500",label:"15$ under 1,500 (D)"},{value:"fullcharges",label:"Full shipping charges (E)"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`shipping-${Ve.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Pricing Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:z,onValueChange:oe,className:"grid grid-cols-2 @sm:grid-cols-3 gap-1",children:[{value:"exclusive",label:"Exclusive (1)"},{value:"ecommerce",label:"E-Commerce (2)"},{value:"commercial",label:"Commercial (3)"},{value:"buyinggroup",label:"Buying Group (4)"},{value:"cost",label:"Cost (5)"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`pricing-${Ve.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]})]})})]})]})};function OrderCategories({openOrders:t=[],isLoading:e=!1}){const n=(t==null?void 0:t.filter(M=>M.DocumentType==="Order"))||[],o=(t==null?void 0:t.filter(M=>M.DocumentType==="Shipment"))||[],l=n.filter(M=>M.WarehouseCode!=="3PLE"),d=l.reduce((M,I)=>M+(I.Quantity??0),0),f=l.reduce((M,I)=>M+(I.ExtendedPrice??0),0),g=n.filter(M=>M.WarehouseCode==="3PLE"),b=g.reduce((M,I)=>M+(I.Quantity??0),0),S=g.reduce((M,I)=>M+(I.ExtendedPrice??0),0),_=o.reduce((M,I)=>M+(I.Quantity??0),0),R=o.reduce((M,I)=>M+(I.ExtendedPrice??0),0),C=d+b+_,E=f+S+R,A=[{name:"All",icon:Package,color:"bg-blue-500",orders:C,amount:E},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:d,amount:f},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:_,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:S}];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:"bg-gray-200 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",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-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]})},M))})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Order Categories"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:A.map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:M.name}),jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(M.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:M.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:M.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},M.name))})})]})}function ReportsSection({isLoading:t,userEmail:e,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:S}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[_,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[A,{isLoading:M}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[I,j]=React.useState(null),[q,z]=React.useState(e),[Q,F]=React.useState(!1),O=[{name:"Products",reports:[{id:"Products",title:"Universal Product List",description:"A comprehensive overview of your product list with detailed specifications and pricing information.",icon:Package}]},{name:"Operation Details",reports:[{id:"OpenOrders",title:"Order Details",description:"A detailed report of all your orders and shipments, including status, tracking information, and delivery estimates.",icon:ShoppingCart},{id:"Invoices",title:"Invoices and Credits Report",description:"Detailed overview of your invoices and credits within a specific date range. It also contains reports about additional charges, serial numbers, and other relevant information.",icon:ScrollText},{id:"Statement",title:"Statement and RMAs Report",description:"A detailed report of all unpaid invoices and active RMAs.",icon:Banknote}]},{name:"Tracking Files",reports:[{id:"AmazonTrackingFile",title:"Amazon Tracking File",description:"Track products sold on Amazon marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing},{id:"WalmartTrackingFile",title:"Walmart Tracking File",description:"Track products sold on Walmart marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing}]}],te=async ge=>{j(ge),F(!0)},ne=async()=>{if(!(!I||!n))try{switch(I.id){case"Products":await _({routeResellerId:n,emailAddress:q}).unwrap();break;case"AmazonTrackingFile":await f({routeResellerId:n,emailAddress:q}).unwrap();break;case"WalmartTrackingFile":await l({routeResellerId:n,emailAddress:q}).unwrap();break;case"OpenOrders":await b({routeResellerId:n,emailAddress:q}).unwrap();break;case"Invoices":await C({routeResellerId:n,emailAddress:q}).unwrap();break;case"Statement":await A({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${I.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(ge){console.error("Error requesting report:",ge),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},ae=S||R||g||d||M||E;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Product List to your Order Details."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},oe))]},ge))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:O.map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:ge.name}),ge.reports.map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(oe.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:oe.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:oe.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(oe),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},oe.id))]},ge.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",I==null?void 0:I.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:q,onChange:ge=>z(ge.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsx(DialogDescription,{children:"The report will take around 5 minutes to generate."}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:ne,disabled:!q||ae,children:ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function SalesChart({statistics:t,mode:e="month",chartHeight:n,loading:o=!1,size:l="default"}){const[d,f]=React.useState([]),[g,b]=React.useState(!1),S=[{name:"dollarVolume",label:"Dollar Volume",color:"var(--primary)",yAxisId:"left",format:"money"},{name:"unitsSold",label:"Units Sold",color:"#888",units:" units",yAxisId:"right",format:"integer"}];return React.useEffect(()=>{if(o||!t){f([]);return}let _=[];if(e==="week"){const R=new Map;t.forEach(C=>{var A;const E=((A=C.Day)==null?void 0:A.toString())||"";if(E.length===8){const M=parseInt(E.substring(0,4),10),I=parseInt(E.substring(4,6),10)-1,j=parseInt(E.substring(6,8),10),q=new Date(M,I,j),z=new Date(q);z.setDate(q.getDate()-q.getDay());const Q=`${z.getFullYear()}-${String(z.getMonth()+1).padStart(2,"0")}-${String(z.getDate()).padStart(2,"0")}`,F=R.get(Q)||{price:0,quantity:0};F.price+=C.ExtendedPrice||0,F.quantity+=C.Quantity||0,R.set(Q,F)}}),_=Array.from(R).sort(([C],[E])=>C.localeCompare(E)).map(([C,E])=>({date:`${C.substring(5,7)}/${C.substring(8,10)}`,dollarVolume:E.price,unitsSold:E.quantity}))}else{const R=new Date,C=R.getFullYear(),E=R.getMonth(),A=R.getDate(),M=`${C}-${(E+1).toString().padStart(2,"0")}`,I=Array.from({length:12},(q,z)=>{const Q=new Date(C,E-(11-z),1);return`${Q.getFullYear()}-${(Q.getMonth()+1).toString().padStart(2,"0")}`}),j=Object.fromEntries(I.map(q=>[q,{price:0,quantity:0}]));if(t.forEach(q=>{const z=String(q.Day??0);if(z.length!==8)return;const Q=`${z.substring(0,4)}-${z.substring(4,6)}`;j[Q]&&(j[Q].price+=q.ExtendedPrice??0,j[Q].quantity+=q.Quantity??0)}),_=I.map(q=>{const z=j[q],[Q,F]=q.split("-").map(Number);return{date:new Date(Q,F-1).toLocaleString("default",{month:"short",year:"numeric"}),dollarVolume:z.price,unitsSold:z.quantity}}),g){const q=j[M];if(q&&q.price>0&&A>0){const z=new Date(C,E+1,0).getDate();if(A<z){const Q=q.price/A,F=q.quantity/A,O=Q*z,te=F*z,ne=_[_.length-1];ne&&(ne.dollarVolume=O,ne.unitsSold=te)}}}}f(_)},[t,e,g,o]),o?jsxRuntime.jsx("div",{style:{height:n},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}):d.length===0?jsxRuntime.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground",children:"No sales data available."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:d,series:S,height:n,size:l}),l==="default"&&e==="month"&&jsxRuntime.jsxs("div",{className:"mt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{checked:g,onCheckedChange:b,id:"extrapolate-switch"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate Current Month"})]}),g&&jsxRuntime.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["* Values for ",new Date().toLocaleString("default",{month:"long"})," are projected estimates."]})]})]})}function PartnerCardHeader({type:t,applicationId:e,publicName:n,name:o,location:l,link:d,linkNewTab:f=!0,children:g}){const[b,S]=React.useState(!1),_=C=>{C.preventDefault(),C.stopPropagation(),navigator.clipboard.writeText(e),S(!0),setTimeout(()=>S(!1),2e3)},R=jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:e,width:48,height:48},`partner_logo_${e}`)}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:t}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{delayDuration:300,children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex cursor-pointer items-center gap-1",onClick:_,children:[jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:e}),b?jsxRuntime.jsx(Check,{className:"h-3 w-3 text-green-500"}):jsxRuntime.jsx(Copy,{className:"h-3 w-3 text-muted-foreground"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b?"Copied!":"Copy ID"})})]})})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:n||"N/A"}),o&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:o}),l&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:l})]})]}),g&&jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:g})]});return d?jsxRuntime.jsx(reactRouterDom.Link,{to:d,target:f?"_blank":"_self",children:R}):R}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var S,_,R;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=[t.City,t.Province,t.Country].filter(Boolean),g=f.length>0?f.join(", "):"",b=((S=t.Tags)==null?void 0:S.split(",").map(C=>C.trim()).filter(Boolean))||[];return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(PartnerCardHeader,{type:"Manufacturer",applicationId:t.ManufacturerId,publicName:t.PublicName,name:t.Name,location:g,link:e,linkNewTab:n,children:jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((_=t.Qualification)!=null&&_.QualificationId)&&((R=t.Qualification)==null?void 0:R.QualificationId)!=="Suspended"||!!t.OpenToWork||!!t.OnHold&&t.OnHold!==0||b.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),b.map((C,E)=>jsxRuntime.jsx(Badge,{variant:"outline",children:C},E))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l||t.PublicResourcesLink)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o&&o,t.PublicResourcesLink&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:t.PublicResourcesLink,target:"_blank",children:jsxRuntime.jsx(Button,{size:"icon",children:jsxRuntime.jsx(HardDriveDownload,{className:"h-4 w-4"})})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Public Resources Link"})})]})})]}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function OrdersCard({applicationId:t,orders:e=null,loading:n=!1,title:o="Order Details"}){const l=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:g})=>g.original.DocumentNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g.original.DocumentNumber}`,className:"font-medium text-primary hover:underline",children:g.original.DocumentNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for order ",g.original.DocumentNumber]})})]})}):"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:g})=>formatYYYYMMDDIntToDateString(g.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:g})=>g.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:g})=>g.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:g})=>g.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:g})=>g.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:g})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:g.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:g})=>g.original.UnitPrice?formatMoney(g.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1}],[t]),d=React.useMemo(()=>{const g={};if(e){const b=Array.from(new Set(e.map(E=>E.WarehouseCode).filter(E=>E!=null)));g.WarehouseCode=b;const S=Array.from(new Set(e.map(E=>E.ShipToName).filter(E=>E!=null)));g.ShipToName=S;const _=Array.from(new Set(e.map(E=>E.DocumentNumber).filter(E=>E!=null)));g.DocumentNumber=_;const R=Array.from(new Set(e.map(E=>E.OrderNumber).filter(E=>E!=null)));g.OrderNumber=R;const C=Array.from(new Set(e.map(E=>E.PONumber).filter(E=>E!=null)));g.PONumber=C}return g},[e]),f=e||[];return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:o})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:l,data:f,uniqueValues:d})})]})}function ResellerOverview({appID:t,reseller:e,readonly:n,userEmail:o,isSuperAdmin:l,withoutReports:d=!1}){var q,z,Q,F;const{data:f,isLoading:g,isError:b}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:t??"",withSpecification:!0},{skip:!!e}),[S,_]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),R=React.useCallback(()=>n?!1:S.publicInfo.hasUnsavedChanges,[n,S]),C=React.useCallback((O,te)=>{_(ne=>{var ae;return((ae=ne[O])==null?void 0:ae.hasUnsavedChanges)!==te.hasUnsavedChanges?{...ne,[O]:te}:ne})},[]),{NavigationGuardDialog:E}=useRouterNavigationGuard(R),A=e??f,M=!n||!!(A!=null&&A.Statement)&&(A.Statement.Total??0)>0,I=(A==null?void 0:A.QualifiedManufacturers)??[],j=(A==null?void 0:A.Qualifications)??[];return jsxRuntime.jsxs("div",{className:"@container",children:[b?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your reseller information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:(A==null?void 0:A.FiscalYearMonthStart)||1,salesData:A==null?void 0:A.SalesData,isLoading:g}),jsxRuntime.jsxs("div",{className:"grid @lg:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(A==null?void 0:A.SalesStatistics)??[],loading:g}),jsxRuntime.jsx(OrderCategories,{openOrders:(A==null?void 0:A.ActiveOrderDetails)??[],isLoading:g}),M&&jsxRuntime.jsx(BillingCard,{appID:t,reseller:A||{},withoutReports:d,isLoading:g,userEmail:o}),jsxRuntime.jsx(PublicInfo,{reseller:A||{},appID:t??"",isLoading:g,readonly:n,onUnsavedChanges:O=>C("publicInfo",{hasUnsavedChanges:O})}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:l,readonly:n,reseller:A||{},appID:t??"",isLoading:g})]}),g||I.length>0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Manufacturers you are qualified for"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid @lg:grid-cols-2 gap-4",children:g?Array.from({length:2}).map((O,te)=>jsxRuntime.jsx(ManufacturerCard,{loading:!0},te)):I.map(O=>jsxRuntime.jsx(ManufacturerCard,{manufacturer:O,link:`https://dashboard.randmar.io/${t}/Partner/${O.ManufacturerId}`},O.ManufacturerId))})})]}):j.length>0&&jsxRuntime.jsx(ResellerQualificationsCard,{qualifications:j}),(((q=A==null?void 0:A.Opportunities)==null?void 0:q.length)??0)>0&&jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:A==null?void 0:A.Opportunities,loading:g}),(((z=A==null?void 0:A.ActiveOrderDetails)==null?void 0:z.length)??0)>0&&jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Active Orders",orders:A==null?void 0:A.ActiveOrderDetails,loading:g}),(((Q=A==null?void 0:A.CompletedOrderDetails)==null?void 0:Q.length)??0)>0&&jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Completed Orders",orders:A==null?void 0:A.CompletedOrderDetails,loading:g}),(((F=A==null?void 0:A.Returns)==null?void 0:F.length)??0)>0&&jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:A==null?void 0:A.Returns,loading:g}),!d&&jsxRuntime.jsx(ReportsSection,{appID:t,userEmail:o,isLoading:g})]}),jsxRuntime.jsx(E,{})]})}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",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";/**
|
|
1170
|
+
$10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full shipping charges":t,getTermsText=t=>t==="STRIPE"?"Credit card payment":t==="NET30"?"Net 30 days":t,AccountTier=({isSuperAdmin:t,readonly:e,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,S]=React.useState(""),[_,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=Ve=>Ve&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[Ve]||"",E=Ve=>Ve&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[Ve]||"",A=Ve=>Ve&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[Ve]||"",[M,I]=React.useState(C((n==null?void 0:n.Priority)??"")),[j,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(A(n==null?void 0:n.PriceProfile)),F=Ve=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[Ve]||Ve,O=Ve=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[Ve]||Ve,te=Ve=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[Ve]||Ve;React.useEffect(()=>{I(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(A(n==null?void 0:n.PriceProfile))},[n]);const ne=async(Ve,Le,ze,$e)=>{try{(await _({applicationId:o,fieldName:Ve,newValue:Le})).error?d({title:"Error",description:$e,variant:"destructive"}):d({title:"Success",description:ze,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},ae=async Ve=>{I(Ve);const Le=F(Ve);ne("Priority",Le,`Priority updated to ${Le}`,"Failed to update priority")},ge=async Ve=>{q(Ve);const Le=O(Ve);ne("ShippingProfile",Le,`Shipping profile updated to ${Le}`,"Failed to update shipping profile")},oe=async Ve=>{Q(Ve);const Le=te(Ve);ne("PriceProfile",Le,`Pricing profile updated to ${Le}`,"Failed to update pricing profile")},Ae=async()=>{try{const Ve=await _({applicationId:o,fieldName:"Tier",newValue:b});Ve.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):Ve.data?d({title:"Success",description:`Pricing Tier changed to ${b}`,variant:"success"}):d({title:"Considered",description:"Request being considered",variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{g(!1),S("")}},je=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:t}],Ne=Ve=>{S(Ve),g(!0)};return l?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-16 rounded-full"})]})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-56"})]}),jsxRuntime.jsx("div",{className:"grid gap-3",children:[1,2,3].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]})]},Ve))}),jsxRuntime.jsxs("div",{className:"flex gap-2 mt-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{className:"pb-2 pt-4 px-4 flex flex-row items-center justify-between",children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Account Tier"}),jsxRuntime.jsx(Badge,{variant:"secondary",className:"bg-green-100 text-green-700 hover:bg-green-200 text-xs",children:"Active"})]}),jsxRuntime.jsxs(CardContent,{className:"pt-2 px-4 pb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 bg-primary/5 p-4 rounded-lg",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-bold text-primary",children:[(n==null?void 0:n.Priority)||""," Tier"]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Optimized for online retail"})]}),jsxRuntime.jsx(CircleCheck,{className:"h-6 w-6 text-green-600"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-2 mb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Package2,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Pricing"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground truncate",children:getPricingText(n.PriceProfile||0)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Truck,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Shipping"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getShippingText(n.ShippingProfile||"").split(".")[0]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Calendar,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Payment terms"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getTermsText((n==null?void 0:n.Terms)||"")})]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[!e&&jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4 mr-1"}),"Pricing Tiers"]})}),jsxRuntime.jsxs(Popover,{children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{disabled:e,className:e?"hidden":"flex-1",children:["Upgrade Tier ",jsxRuntime.jsx(ChevronRight,{className:"h-3 w-3 ml-1"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56 p-2",children:jsxRuntime.jsxs("div",{className:"grid gap-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-xs mb-1",children:"Select a tier"}),je.map(Ve=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!Ve.enabled,onClick:()=>Ne(Ve.name),children:Ve.name},Ve.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:Ae}),t&&!e&&jsxRuntime.jsxs(Card,{className:"mt-4",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2 pt-3 px-4",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Admin Configuration"})}),jsxRuntime.jsx(CardContent,{className:"pt-2 px-4 pb-4",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Priority"}),jsxRuntime.jsx(RadioGroup$1,{value:M,onValueChange:ae,className:"grid grid-cols-2 @sm:grid-cols-3 @md:grid-cols-4 gap-1",children:[{value:"starter",label:"Starter"},{value:"ecommerce",label:"E-Commerce"},{value:"commercial",label:"Commercial"},{value:"cws",label:"CWS (Basics)"},{value:"novexco",label:"Novexco"},{value:"jeancoutu",label:"Jean Coutu"},{value:"exclusive",label:"Exclusive"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`priority-${Ve.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Shipping Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:j,onValueChange:ge,className:"grid grid-cols-1 @md:grid-cols-2 gap-1",children:[{value:"free",label:"Free (A)"},{value:"fixed",label:"Fixed $10 Shipping (B)"},{value:"dropshipped",label:"$15 for drop shipped (C)"},{value:"under1500",label:"15$ under 1,500 (D)"},{value:"fullcharges",label:"Full shipping charges (E)"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`shipping-${Ve.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Pricing Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:z,onValueChange:oe,className:"grid grid-cols-2 @sm:grid-cols-3 gap-1",children:[{value:"exclusive",label:"Exclusive (1)"},{value:"ecommerce",label:"E-Commerce (2)"},{value:"commercial",label:"Commercial (3)"},{value:"buyinggroup",label:"Buying Group (4)"},{value:"cost",label:"Cost (5)"}].map(Ve=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:Ve.value,id:`pricing-${Ve.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${Ve.value}`,className:"cursor-pointer text-xs",children:Ve.label})]},Ve.value))})]})]})})]})]})};function OrderCategories({openOrders:t=[],isLoading:e=!1}){const n=(t==null?void 0:t.filter(M=>M.DocumentType==="Order"))||[],o=(t==null?void 0:t.filter(M=>M.DocumentType==="Shipment"))||[],l=n.filter(M=>M.WarehouseCode!=="3PLE"),d=l.reduce((M,I)=>M+(I.Quantity??0),0),f=l.reduce((M,I)=>M+(I.ExtendedPrice??0),0),g=n.filter(M=>M.WarehouseCode==="3PLE"),b=g.reduce((M,I)=>M+(I.Quantity??0),0),S=g.reduce((M,I)=>M+(I.ExtendedPrice??0),0),_=o.reduce((M,I)=>M+(I.Quantity??0),0),R=o.reduce((M,I)=>M+(I.ExtendedPrice??0),0),C=d+b+_,E=f+S+R,A=[{name:"All",icon:Package,color:"bg-blue-500",orders:C,amount:E},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:d,amount:f},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:_,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:S}];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:"bg-gray-200 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",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-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]})},M))})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Order Categories"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:A.map(M=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:M.name}),jsxRuntime.jsx("div",{className:`${M.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(M.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:M.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:M.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},M.name))})})]})}function ReportsSection({isLoading:t,userEmail:e,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:S}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[_,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[A,{isLoading:M}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[I,j]=React.useState(null),[q,z]=React.useState(e),[Q,F]=React.useState(!1),O=[{name:"Products",reports:[{id:"Products",title:"Universal Product List",description:"A comprehensive overview of your product list with detailed specifications and pricing information.",icon:Package}]},{name:"Operation Details",reports:[{id:"OpenOrders",title:"Order Details",description:"A detailed report of all your orders and shipments, including status, tracking information, and delivery estimates.",icon:ShoppingCart},{id:"Invoices",title:"Invoices and Credits Report",description:"Detailed overview of your invoices and credits within a specific date range. It also contains reports about additional charges, serial numbers, and other relevant information.",icon:ScrollText},{id:"Statement",title:"Statement and RMAs Report",description:"A detailed report of all unpaid invoices and active RMAs.",icon:Banknote}]},{name:"Tracking Files",reports:[{id:"AmazonTrackingFile",title:"Amazon Tracking File",description:"Track products sold on Amazon marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing},{id:"WalmartTrackingFile",title:"Walmart Tracking File",description:"Track products sold on Walmart marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing}]}],te=async ge=>{j(ge),F(!0)},ne=async()=>{if(!(!I||!n))try{switch(I.id){case"Products":await _({routeResellerId:n,emailAddress:q}).unwrap();break;case"AmazonTrackingFile":await f({routeResellerId:n,emailAddress:q}).unwrap();break;case"WalmartTrackingFile":await l({routeResellerId:n,emailAddress:q}).unwrap();break;case"OpenOrders":await b({routeResellerId:n,emailAddress:q}).unwrap();break;case"Invoices":await C({routeResellerId:n,emailAddress:q}).unwrap();break;case"Statement":await A({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${I.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(ge){console.error("Error requesting report:",ge),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},ae=S||R||g||d||M||E;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Product List to your Order Details."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},oe))]},ge))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:O.map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:ge.name}),ge.reports.map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(oe.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:oe.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:oe.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(oe),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},oe.id))]},ge.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",I==null?void 0:I.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:q,onChange:ge=>z(ge.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsx(DialogDescription,{children:"The report will take around 5 minutes to generate."}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:ne,disabled:!q||ae,children:ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function SalesChart({statistics:t,mode:e="month",chartHeight:n,loading:o=!1,size:l="default"}){const[d,f]=React.useState([]),[g,b]=React.useState(!1),S=[{name:"dollarVolume",label:"Dollar Volume",color:"var(--primary)",yAxisId:"left",format:"money"},{name:"unitsSold",label:"Units Sold",color:"#888",units:" units",yAxisId:"right",format:"integer"}];return React.useEffect(()=>{if(o||!t){f([]);return}let _=[];if(e==="week"){const R=new Map;t.forEach(C=>{var A;const E=((A=C.Day)==null?void 0:A.toString())||"";if(E.length===8){const M=parseInt(E.substring(0,4),10),I=parseInt(E.substring(4,6),10)-1,j=parseInt(E.substring(6,8),10),q=new Date(M,I,j),z=new Date(q);z.setDate(q.getDate()-q.getDay());const Q=`${z.getFullYear()}-${String(z.getMonth()+1).padStart(2,"0")}-${String(z.getDate()).padStart(2,"0")}`,F=R.get(Q)||{price:0,quantity:0};F.price+=C.ExtendedPrice||0,F.quantity+=C.Quantity||0,R.set(Q,F)}}),_=Array.from(R).sort(([C],[E])=>C.localeCompare(E)).map(([C,E])=>({date:`${C.substring(5,7)}/${C.substring(8,10)}`,dollarVolume:E.price,unitsSold:E.quantity}))}else{const R=new Date,C=R.getFullYear(),E=R.getMonth(),A=R.getDate(),M=`${C}-${(E+1).toString().padStart(2,"0")}`,I=Array.from({length:12},(q,z)=>{const Q=new Date(C,E-(11-z),1);return`${Q.getFullYear()}-${(Q.getMonth()+1).toString().padStart(2,"0")}`}),j=Object.fromEntries(I.map(q=>[q,{price:0,quantity:0}]));if(t.forEach(q=>{const z=String(q.Day??0);if(z.length!==8)return;const Q=`${z.substring(0,4)}-${z.substring(4,6)}`;j[Q]&&(j[Q].price+=q.ExtendedPrice??0,j[Q].quantity+=q.Quantity??0)}),_=I.map(q=>{const z=j[q],[Q,F]=q.split("-").map(Number);return{date:new Date(Q,F-1).toLocaleString("default",{month:"short",year:"numeric"}),dollarVolume:z.price,unitsSold:z.quantity}}),g){const q=j[M];if(q&&q.price>0&&A>0){const z=new Date(C,E+1,0).getDate();if(A<z){const Q=q.price/A,F=q.quantity/A,O=Q*z,te=F*z,ne=_[_.length-1];ne&&(ne.dollarVolume=O,ne.unitsSold=te)}}}}f(_)},[t,e,g,o]),o?jsxRuntime.jsx("div",{style:{height:n},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}):d.length===0?jsxRuntime.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground",children:"No sales data available."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:d,series:S,height:n,size:l}),l==="default"&&e==="month"&&jsxRuntime.jsxs("div",{className:"mt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{checked:g,onCheckedChange:b,id:"extrapolate-switch"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate Current Month"})]}),g&&jsxRuntime.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["* Values for ",new Date().toLocaleString("default",{month:"long"})," are projected estimates."]})]})]})}function PartnerCardHeader({type:t,applicationId:e,publicName:n,name:o,location:l,link:d,linkNewTab:f=!0,children:g}){const[b,S]=React.useState(!1),_=C=>{C.preventDefault(),C.stopPropagation(),navigator.clipboard.writeText(e),S(!0),setTimeout(()=>S(!1),2e3)},R=jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:e,width:48,height:48},`partner_logo_${e}`)}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:t}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{delayDuration:300,children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex cursor-pointer items-center gap-1",onClick:_,children:[jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:e}),b?jsxRuntime.jsx(Check,{className:"h-3 w-3 text-green-500"}):jsxRuntime.jsx(Copy,{className:"h-3 w-3 text-muted-foreground"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b?"Copied!":"Copy ID"})})]})})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:n||"N/A"}),o&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:o}),l&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:l})]})]}),g&&jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:g})]});return d?jsxRuntime.jsx(reactRouterDom.Link,{to:d,target:f?"_blank":"_self",children:R}):R}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var S,_,R;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=[t.City,t.Province,t.Country].filter(Boolean),g=f.length>0?f.join(", "):"",b=((S=t.Tags)==null?void 0:S.split(",").map(C=>C.trim()).filter(Boolean))||[];return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(PartnerCardHeader,{type:"Manufacturer",applicationId:t.ManufacturerId,publicName:t.PublicName,name:t.Name,location:g,link:e,linkNewTab:n,children:jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((_=t.Qualification)!=null&&_.QualificationId)&&((R=t.Qualification)==null?void 0:R.QualificationId)!=="Suspended"||!!t.OpenToWork||!!t.OnHold&&t.OnHold!==0||b.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),b.map((C,E)=>jsxRuntime.jsx(Badge,{variant:"outline",children:C},E))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l||t.PublicResourcesLink)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o&&o,t.PublicResourcesLink&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:t.PublicResourcesLink,target:"_blank",children:jsxRuntime.jsx(Button,{size:"icon",children:jsxRuntime.jsx(HardDriveDownload,{className:"h-4 w-4"})})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Public Resources Link"})})]})})]}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function OrdersCard({applicationId:t,orders:e=null,loading:n=!1,title:o="Order Details"}){const l=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:g})=>g.original.DocumentNumber?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g.original.DocumentNumber}`,className:"font-medium text-primary hover:underline",children:g.original.DocumentNumber})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for order ",g.original.DocumentNumber]})})]})}):"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:g})=>formatYYYYMMDDIntToDateString(g.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:g})=>g.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:g})=>g.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:g})=>g.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"MPN",header:"MPN",cell:({row:g})=>g.original.MPN?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Product/${g.original.MPN}`,className:"font-medium text-primary hover:underline",children:g.original.MPN})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for MPN ",g.original.MPN]})})]})}):"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:g})=>g.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:g})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:g.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:g})=>g.original.UnitPrice?formatMoney(g.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"actions",header:"Actions",cell:()=>{},enableSorting:!1,enableFiltering:!1}],[t]),d=React.useMemo(()=>{const g={};if(e){const b=Array.from(new Set(e.map(A=>A.WarehouseCode).filter(A=>A!=null)));g.WarehouseCode=b;const S=Array.from(new Set(e.map(A=>A.ShipToName).filter(A=>A!=null)));g.ShipToName=S;const _=Array.from(new Set(e.map(A=>A.DocumentNumber).filter(A=>A!=null)));g.DocumentNumber=_;const R=Array.from(new Set(e.map(A=>A.OrderNumber).filter(A=>A!=null)));g.OrderNumber=R;const C=Array.from(new Set(e.map(A=>A.PONumber).filter(A=>A!=null)));g.PONumber=C;const E=Array.from(new Set(e.map(A=>A.MPN).filter(A=>A!=null)));g.MPN=E}return g},[e]),f=e||[];return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:o})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:l,data:f,uniqueValues:d})})]})}function ResellerOverview({appID:t,reseller:e,readonly:n,userEmail:o,isSuperAdmin:l,withoutReports:d=!1}){var q,z,Q,F;const{data:f,isLoading:g,isError:b}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:t??"",withSpecification:!0},{skip:!!e}),[S,_]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),R=React.useCallback(()=>n?!1:S.publicInfo.hasUnsavedChanges,[n,S]),C=React.useCallback((O,te)=>{_(ne=>{var ae;return((ae=ne[O])==null?void 0:ae.hasUnsavedChanges)!==te.hasUnsavedChanges?{...ne,[O]:te}:ne})},[]),{NavigationGuardDialog:E}=useRouterNavigationGuard(R),A=e??f,M=!n||!!(A!=null&&A.Statement)&&(A.Statement.Total??0)>0,I=(A==null?void 0:A.QualifiedManufacturers)??[],j=(A==null?void 0:A.Qualifications)??[];return jsxRuntime.jsxs("div",{className:"@container",children:[b?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your reseller information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:(A==null?void 0:A.FiscalYearMonthStart)||1,salesData:A==null?void 0:A.SalesData,isLoading:g}),jsxRuntime.jsxs("div",{className:"grid @lg:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(A==null?void 0:A.SalesStatistics)??[],loading:g}),jsxRuntime.jsx(OrderCategories,{openOrders:(A==null?void 0:A.ActiveOrderDetails)??[],isLoading:g}),M&&jsxRuntime.jsx(BillingCard,{appID:t,reseller:A||{},withoutReports:d,isLoading:g,userEmail:o}),jsxRuntime.jsx(PublicInfo,{reseller:A||{},appID:t??"",isLoading:g,readonly:n,onUnsavedChanges:O=>C("publicInfo",{hasUnsavedChanges:O})}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:l,readonly:n,reseller:A||{},appID:t??"",isLoading:g})]}),g||I.length>0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Manufacturers you are qualified for"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid @lg:grid-cols-2 gap-4",children:g?Array.from({length:2}).map((O,te)=>jsxRuntime.jsx(ManufacturerCard,{loading:!0},te)):I.map(O=>jsxRuntime.jsx(ManufacturerCard,{manufacturer:O,link:`https://dashboard.randmar.io/${t}/Partner/${O.ManufacturerId}`},O.ManufacturerId))})})]}):j.length>0&&jsxRuntime.jsx(ResellerQualificationsCard,{qualifications:j}),(((q=A==null?void 0:A.Opportunities)==null?void 0:q.length)??0)>0&&jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:A==null?void 0:A.Opportunities,loading:g}),(((z=A==null?void 0:A.ActiveOrderDetails)==null?void 0:z.length)??0)>0&&jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Active Orders",orders:A==null?void 0:A.ActiveOrderDetails,loading:g}),(((Q=A==null?void 0:A.CompletedOrderDetails)==null?void 0:Q.length)??0)>0&&jsxRuntime.jsx(OrdersCard,{applicationId:t,title:"Completed Orders",orders:A==null?void 0:A.CompletedOrderDetails,loading:g}),(((F=A==null?void 0:A.Returns)==null?void 0:F.length)??0)>0&&jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:A==null?void 0:A.Returns,loading:g}),!d&&jsxRuntime.jsx(ReportsSection,{appID:t,userEmail:o,isLoading:g})]}),jsxRuntime.jsx(E,{})]})}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",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";/**
|
|
1171
1171
|
* table-core
|
|
1172
1172
|
*
|
|
1173
1173
|
* Copyright (c) TanStack
|
|
@@ -1188,7 +1188,7 @@ $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full sh
|
|
|
1188
1188
|
* LICENSE.md file in the root directory of this source tree.
|
|
1189
1189
|
*
|
|
1190
1190
|
* @license MIT
|
|
1191
|
-
*/function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n,tableClass:o,loading:l}){var M;const[d,f]=React.useState([]),[g,b]=React.useState([]),[S,_]=React.useState({pageIndex:0,pageSize:10}),[R,C]=React.useState(null),E=useReactTable({data:l?[]:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:f,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:b,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:_,state:{sorting:d,columnFilters:g,pagination:S},manualPagination:l,manualSorting:l,manualFiltering:l}),A=(I,j)=>{I.toggleSorting(j),C(null)};return l?jsxRuntime.jsxs("div",{className:"@container space-y-4",children:[jsxRuntime.jsx("div",{className:`rounded-md border ${o??""}`,children:jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:jsxRuntime.jsx(TableRow,{children:t.map((I,j)=>jsxRuntime.jsx(TableHead,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-full"})},`skeleton-header-${j}`))})}),jsxRuntime.jsx(TableBody,{children:Array.from({length:S.pageSize}).map((I,j)=>jsxRuntime.jsx(TableRow,{children:t.map((q,z)=>jsxRuntime.jsx(TableCell,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-full"})},`skeleton-cell-${j}-${z}`))},`skeleton-row-${j}`))})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 @[35rem]:flex-row @[35rem]:justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-[110px]"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-[70px]"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"hidden h-8 w-8 lg:flex"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-8"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-8"})]}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8"}),jsxRuntime.jsx(Skeleton,{className:"hidden h-8 w-8 lg:flex"})]})]})]}):jsxRuntime.jsxs("div",{className:"@container space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:`rounded-md border ${o??""}`,children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:E.getHeaderGroups().map(I=>jsxRuntime.jsx(TableRow,{children:I.headers.map(j=>{var q;return jsxRuntime.jsx(TableHead,{children:j.isPlaceholder?null:j.column.getCanSort()||j.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:R===j.id,onOpenChange:z=>C(z?j.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(j.column.columnDef.header,j.getContext()),j.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):j.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):j.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[j.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>A(j.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>A(j.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),j.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[j.column.id]?jsxRuntime.jsxs(Select,{onValueChange:z=>j.column.setFilterValue(z==="all"?void 0:[z]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${j.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(q=n[j.column.id])==null?void 0:q.map(z=>jsxRuntime.jsx(SelectItem,{value:z||"empty",children:z||"(Empty)"},z))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${j.column.columnDef.header}...`,value:j.column.getFilterValue()??"",onChange:z=>j.column.setFilterValue(z.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(j.column.columnDef.header,j.getContext())})},j.id)})},I.id))}),jsxRuntime.jsx(TableBody,{children:(M=E.getRowModel().rows)!=null&&M.length?E.getRowModel().rows.map(I=>jsxRuntime.jsx(TableRow,{"data-state":I.getIsSelected()&&"selected",children:I.getVisibleCells().map(j=>jsxRuntime.jsx(TableCell,{children:flexRender(j.column.columnDef.cell,j.getContext())},j.id))},I.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 @[35rem]:flex-row @[35rem]:justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${E.getState().pagination.pageSize}`,onValueChange:I=>{E.setPageSize(Number(I))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:E.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(I=>jsxRuntime.jsx(SelectItem,{value:`${I}`,children:jsxRuntime.jsx("span",{children:I})},I))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>E.setPageIndex(0),disabled:!E.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>E.previousPage(),disabled:!E.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>E.nextPage(),disabled:!E.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>E.setPageIndex(E.getPageCount()-1),disabled:!E.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function PartnerCard({account:t,action:e,loading:n=!1,className:o,withAbout:l=!1,withVoice:d=!0}){const[f,g]=React.useState(!1),[b,S]=React.useState(!0),[_,R]=React.useState(null),[C,E]=React.useState(!1),A=React.useMemo(()=>t!=null&&t.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video/Exists`}:null,[t==null?void 0:t.ApplicationId]);React.useEffect(()=>{if(!A||n)return;R(null);const I=async()=>{try{const q=await fetch(A.videoExistsUrl);if(q.ok){const z=await q.text();g(z.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${q.status}`)}catch(q){console.error("Failed to check if video exists:",q),g(!1)}};(async()=>{I()})()},[A,n]);const M=()=>{S(!1)};return n||!t?jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),l&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"})]}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(PartnerCardHeader,{type:"Partner",applicationId:t.ApplicationId,publicName:t.PublicName}),jsxRuntime.jsxs(CardContent,{className:"pb-2 flex-grow",children:[_&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:_}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(t.IsManufacturer||t.IsReseller||t.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),t.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),t.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),l&&t.About&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.About??""}}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[f&&A?jsxRuntime.jsxs(Dialog,{open:C,onOpenChange:E,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[t.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[b&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:A.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${t.PublicName}`,className:`w-full h-full object-cover ${b?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:M,onError:()=>S(!1)})]})]})]}):jsxRuntime.jsx("div",{}),e||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}function ResellerCard({reseller:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var b,S;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=[t.City,t.Province,t.Country].filter(Boolean),g=f.length>0?f.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsx(PartnerCardHeader,{type:"Reseller",applicationId:t.ResellerId,publicName:t.PublicName,name:t.Name,location:g,link:e,linkNewTab:n,children:jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((b=t.Qualification)!=null&&b.QualificationId)&&((S=t.Qualification)==null?void 0:S.QualificationId)!=="Suspended"||!!t.OnHold&&t.OnHold!==0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesYearToDay?formatMoney(t==null?void 0:t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast3Months?formatMoney(t==null?void 0:t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast30Days?formatMoney(t==null?void 0:t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},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]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const S=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},_=R=>{R.key==="Enter"&&S()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:S,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:_,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(I=>I.DocumentType==="Order"),d=t.filter(I=>I.DocumentType==="Shipment"),f=l.filter(I=>I.WarehouseCode!=="3PLE"),g=f.reduce((I,j)=>I+(j.Quantity||0),0),b=f.reduce((I,j)=>I+(j.ExtendedPrice||0),0),S=l.filter(I=>I.WarehouseCode==="3PLE"),_=S.reduce((I,j)=>I+(j.Quantity||0),0),R=S.reduce((I,j)=>I+(j.ExtendedPrice||0),0),C=d.length,E=d.reduce((I,j)=>I+(j.ExtendedPrice||0),0),A=g+_+C,M=b+R+E;return{all:{orders:A,amount:M},processing:{orders:g,amount:b},shipped:{orders:C,amount:E},delayed:{orders:_,amount:R}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:n.all.orders,amount:n.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:n.processing.orders,amount:n.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:n.shipped.orders,amount:n.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:n.delayed.orders,amount:n.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",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-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:formatMoney(l.amount)})]})]})]})]},l.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=__defProp(n,"default",{value:t,enumerable:!0});for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",S={5:b,"5module":b+" export import",6:b+" const class extends export import super"},_=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(V,se){for(var Be=65536,Fe=0;Fe<se.length;Fe+=2){if(Be+=se[Fe],Be>V)return!1;if(Be+=se[Fe+1],Be>=V)return!0}return!1}function A(V,se){return V<65?V===36:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&R.test(String.fromCharCode(V)):se===!1?!1:E(V,l)}function M(V,se){return V<48?V===36:V<58?!0:V<65?!1:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&C.test(String.fromCharCode(V)):se===!1?!1:E(V,l)||E(V,o)}var I=function(se,Be){Be===void 0&&(Be={}),this.label=se,this.keyword=Be.keyword,this.beforeExpr=!!Be.beforeExpr,this.startsExpr=!!Be.startsExpr,this.isLoop=!!Be.isLoop,this.isAssign=!!Be.isAssign,this.prefix=!!Be.prefix,this.postfix=!!Be.postfix,this.binop=Be.binop||null,this.updateContext=null};function j(V,se){return new I(V,{beforeExpr:!0,binop:se})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(V,se){return se===void 0&&(se={}),se.keyword=V,Q[V]=new I(V,se)}var O={num:new I("num",z),regexp:new I("regexp",z),string:new I("string",z),name:new I("name",z),privateId:new I("privateId",z),eof:new I("eof"),bracketL:new I("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new I("]"),braceL:new I("{",{beforeExpr:!0,startsExpr:!0}),braceR:new I("}"),parenL:new I("(",{beforeExpr:!0,startsExpr:!0}),parenR:new I(")"),comma:new I(",",q),semi:new I(";",q),colon:new I(":",q),dot:new I("."),question:new I("?",q),questionDot:new I("?."),arrow:new I("=>",q),template:new I("template"),invalidTemplate:new I("invalidTemplate"),ellipsis:new I("...",q),backQuote:new I("`",z),dollarBraceL:new I("${",{beforeExpr:!0,startsExpr:!0}),eq:new I("=",{beforeExpr:!0,isAssign:!0}),assign:new I("_=",{beforeExpr:!0,isAssign:!0}),incDec:new I("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new I("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new I("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new I("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function ae(V){return V===10||V===13||V===8232||V===8233}function ge(V,se,Be){Be===void 0&&(Be=V.length);for(var Fe=se;Fe<Be;Fe++){var Ke=V.charCodeAt(Fe);if(ae(Ke))return Fe<Be-1&&Ke===13&&V.charCodeAt(Fe+1)===10?Fe+2:Fe+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Ae=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,je=Object.prototype,Ne=je.hasOwnProperty,Ve=je.toString,Le=Object.hasOwn||function(V,se){return Ne.call(V,se)},ze=Array.isArray||function(V){return Ve.call(V)==="[object Array]"},$e=Object.create(null);function Oe(V){return $e[V]||($e[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function qe(V){return V<=65535?String.fromCharCode(V):(V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320))}var Ge=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(se,Be){this.line=se,this.column=Be};He.prototype.offset=function(se){return new He(this.line,this.column+se)};var Je=function(se,Be,Fe){this.start=Be,this.end=Fe,se.sourceFile!==null&&(this.source=se.sourceFile)};function Ze(V,se){for(var Be=1,Fe=0;;){var Ke=ge(V,Fe,se);if(Ke<0)return new He(Be,se-Fe);++Be,Fe=Ke}}var We={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},tt=!1;function Xe(V){var se={};for(var Be in We)se[Be]=V&&Le(V,Be)?V[Be]:We[Be];if(se.ecmaVersion==="latest"?se.ecmaVersion=1e8:se.ecmaVersion==null?(!tt&&typeof console=="object"&&console.warn&&(tt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
1191
|
+
*/function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n,tableClass:o,loading:l}){var M;const[d,f]=React.useState([]),[g,b]=React.useState([]),[S,_]=React.useState({pageIndex:0,pageSize:10}),[R,C]=React.useState(null),E=useReactTable({data:l?[]:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:f,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:b,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:_,state:{sorting:d,columnFilters:g,pagination:S},manualPagination:l,manualSorting:l,manualFiltering:l}),A=(I,j)=>{I.toggleSorting(j),C(null)};return l?jsxRuntime.jsxs("div",{className:"@container space-y-4",children:[jsxRuntime.jsx("div",{className:`rounded-md border ${o??""}`,children:jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:jsxRuntime.jsx(TableRow,{children:t.map((I,j)=>jsxRuntime.jsx(TableHead,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-full"})},`skeleton-header-${j}`))})}),jsxRuntime.jsx(TableBody,{children:Array.from({length:S.pageSize}).map((I,j)=>jsxRuntime.jsx(TableRow,{children:t.map((q,z)=>jsxRuntime.jsx(TableCell,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-full"})},`skeleton-cell-${j}-${z}`))},`skeleton-row-${j}`))})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 @[35rem]:flex-row @[35rem]:justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-[110px]"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-[70px]"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"hidden h-8 w-8 lg:flex"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-8"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-8"})]}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8"}),jsxRuntime.jsx(Skeleton,{className:"hidden h-8 w-8 lg:flex"})]})]})]}):jsxRuntime.jsxs("div",{className:"@container space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:`rounded-md border ${o??""}`,children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:E.getHeaderGroups().map(I=>jsxRuntime.jsx(TableRow,{children:I.headers.map(j=>{var q;return jsxRuntime.jsx(TableHead,{children:j.isPlaceholder?null:j.column.getCanSort()||j.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:R===j.id,onOpenChange:z=>C(z?j.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(j.column.columnDef.header,j.getContext()),j.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):j.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):j.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[j.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>A(j.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>A(j.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),j.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[j.column.id]?jsxRuntime.jsxs(Select,{onValueChange:z=>j.column.setFilterValue(z==="all"?void 0:[z]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${j.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(q=n[j.column.id])==null?void 0:q.map(z=>jsxRuntime.jsx(SelectItem,{value:z||"empty",children:z||"(Empty)"},z))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${j.column.columnDef.header}...`,value:j.column.getFilterValue()??"",onChange:z=>j.column.setFilterValue(z.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(j.column.columnDef.header,j.getContext())})},j.id)})},I.id))}),jsxRuntime.jsx(TableBody,{children:(M=E.getRowModel().rows)!=null&&M.length?E.getRowModel().rows.map(I=>jsxRuntime.jsx(TableRow,{"data-state":I.getIsSelected()&&"selected",children:I.getVisibleCells().map(j=>jsxRuntime.jsx(TableCell,{children:flexRender(j.column.columnDef.cell,j.getContext())},j.id))},I.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 @[35rem]:flex-row @[35rem]:justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${E.getState().pagination.pageSize}`,onValueChange:I=>{E.setPageSize(Number(I))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:E.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(I=>jsxRuntime.jsx(SelectItem,{value:`${I}`,children:jsxRuntime.jsx("span",{children:I})},I))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>E.setPageIndex(0),disabled:!E.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>E.previousPage(),disabled:!E.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:E.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>E.nextPage(),disabled:!E.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>E.setPageIndex(E.getPageCount()-1),disabled:!E.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function PartnerCard({account:t,action:e,loading:n=!1,className:o,withAbout:l=!1,withVoice:d=!0}){const[f,g]=React.useState(!1),[b,S]=React.useState(!0),[_,R]=React.useState(null),[C,E]=React.useState(!1),A=React.useMemo(()=>t!=null&&t.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video/Exists`}:null,[t==null?void 0:t.ApplicationId]);React.useEffect(()=>{if(!A||n)return;R(null);const I=async()=>{try{const q=await fetch(A.videoExistsUrl);if(q.ok){const z=await q.text();g(z.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${q.status}`)}catch(q){console.error("Failed to check if video exists:",q),g(!1)}};(async()=>{I()})()},[A,n]);const M=()=>{S(!1)};return n||!t?jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),l&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"})]}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(PartnerCardHeader,{type:"Partner",applicationId:t.ApplicationId,publicName:t.PublicName}),jsxRuntime.jsxs(CardContent,{className:"pb-2 flex-grow",children:[_&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:_}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(t.IsManufacturer||t.IsReseller||t.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),t.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),t.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),l&&t.About&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.About??""}}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[f&&A?jsxRuntime.jsxs(Dialog,{open:C,onOpenChange:E,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[t.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[b&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:A.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${t.PublicName}`,className:`w-full h-full object-cover ${b?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:M,onError:()=>S(!1)})]})]})]}):jsxRuntime.jsx("div",{}),e||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}function ResellerCard({reseller:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var b,S;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=[t.City,t.Province,t.Country].filter(Boolean),g=f.length>0?f.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsx(PartnerCardHeader,{type:"Reseller",applicationId:t.ResellerId,publicName:t.PublicName,name:t.Name,location:g,link:e,linkNewTab:n,children:jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:t.SalesStatistics&&t.SalesStatistics.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(SalesChart,{statistics:t.SalesStatistics,size:"mini"})})})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((b=t.Qualification)!=null&&b.QualificationId)&&((S=t.Qualification)==null?void 0:S.QualificationId)!=="Suspended"||!!t.OnHold&&t.OnHold!==0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesYearToDay?formatMoney(t==null?void 0:t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast3Months?formatMoney(t==null?void 0:t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast30Days?formatMoney(t==null?void 0:t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},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]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const S=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},_=R=>{R.key==="Enter"&&S()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:S,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:_,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(I=>I.DocumentType==="Order"),d=t.filter(I=>I.DocumentType==="Shipment"),f=l.filter(I=>I.WarehouseCode!=="3PLE"),g=f.reduce((I,j)=>I+(j.Quantity||0),0),b=f.reduce((I,j)=>I+(j.ExtendedPrice||0),0),S=l.filter(I=>I.WarehouseCode==="3PLE"),_=S.reduce((I,j)=>I+(j.Quantity||0),0),R=S.reduce((I,j)=>I+(j.ExtendedPrice||0),0),C=d.length,E=d.reduce((I,j)=>I+(j.ExtendedPrice||0),0),A=g+_+C,M=b+R+E;return{all:{orders:A,amount:M},processing:{orders:g,amount:b},shipped:{orders:C,amount:E},delayed:{orders:_,amount:R}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:n.all.orders,amount:n.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:n.processing.orders,amount:n.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:n.shipped.orders,amount:n.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:n.delayed.orders,amount:n.delayed.amount}];return e?jsxRuntime.jsxs(Card,{className:"@container",children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",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-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{className:"@container",children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:formatMoney(l.amount)})]})]})]})]},l.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=__defProp(n,"default",{value:t,enumerable:!0});for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",S={5:b,"5module":b+" export import",6:b+" const class extends export import super"},_=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(V,se){for(var Be=65536,Fe=0;Fe<se.length;Fe+=2){if(Be+=se[Fe],Be>V)return!1;if(Be+=se[Fe+1],Be>=V)return!0}return!1}function A(V,se){return V<65?V===36:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&R.test(String.fromCharCode(V)):se===!1?!1:E(V,l)}function M(V,se){return V<48?V===36:V<58?!0:V<65?!1:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&C.test(String.fromCharCode(V)):se===!1?!1:E(V,l)||E(V,o)}var I=function(se,Be){Be===void 0&&(Be={}),this.label=se,this.keyword=Be.keyword,this.beforeExpr=!!Be.beforeExpr,this.startsExpr=!!Be.startsExpr,this.isLoop=!!Be.isLoop,this.isAssign=!!Be.isAssign,this.prefix=!!Be.prefix,this.postfix=!!Be.postfix,this.binop=Be.binop||null,this.updateContext=null};function j(V,se){return new I(V,{beforeExpr:!0,binop:se})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(V,se){return se===void 0&&(se={}),se.keyword=V,Q[V]=new I(V,se)}var O={num:new I("num",z),regexp:new I("regexp",z),string:new I("string",z),name:new I("name",z),privateId:new I("privateId",z),eof:new I("eof"),bracketL:new I("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new I("]"),braceL:new I("{",{beforeExpr:!0,startsExpr:!0}),braceR:new I("}"),parenL:new I("(",{beforeExpr:!0,startsExpr:!0}),parenR:new I(")"),comma:new I(",",q),semi:new I(";",q),colon:new I(":",q),dot:new I("."),question:new I("?",q),questionDot:new I("?."),arrow:new I("=>",q),template:new I("template"),invalidTemplate:new I("invalidTemplate"),ellipsis:new I("...",q),backQuote:new I("`",z),dollarBraceL:new I("${",{beforeExpr:!0,startsExpr:!0}),eq:new I("=",{beforeExpr:!0,isAssign:!0}),assign:new I("_=",{beforeExpr:!0,isAssign:!0}),incDec:new I("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new I("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new I("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new I("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function ae(V){return V===10||V===13||V===8232||V===8233}function ge(V,se,Be){Be===void 0&&(Be=V.length);for(var Fe=se;Fe<Be;Fe++){var Ke=V.charCodeAt(Fe);if(ae(Ke))return Fe<Be-1&&Ke===13&&V.charCodeAt(Fe+1)===10?Fe+2:Fe+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Ae=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,je=Object.prototype,Ne=je.hasOwnProperty,Ve=je.toString,Le=Object.hasOwn||function(V,se){return Ne.call(V,se)},ze=Array.isArray||function(V){return Ve.call(V)==="[object Array]"},$e=Object.create(null);function Oe(V){return $e[V]||($e[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function qe(V){return V<=65535?String.fromCharCode(V):(V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320))}var Ge=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(se,Be){this.line=se,this.column=Be};He.prototype.offset=function(se){return new He(this.line,this.column+se)};var Je=function(se,Be,Fe){this.start=Be,this.end=Fe,se.sourceFile!==null&&(this.source=se.sourceFile)};function Ze(V,se){for(var Be=1,Fe=0;;){var Ke=ge(V,Fe,se);if(Ke<0)return new He(Be,se-Fe);++Be,Fe=Ke}}var We={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},tt=!1;function Xe(V){var se={};for(var Be in We)se[Be]=V&&Le(V,Be)?V[Be]:We[Be];if(se.ecmaVersion==="latest"?se.ecmaVersion=1e8:se.ecmaVersion==null?(!tt&&typeof console=="object"&&console.warn&&(tt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
1192
1192
|
Defaulting to 2020, but this will stop working in the future.`)),se.ecmaVersion=11):se.ecmaVersion>=2015&&(se.ecmaVersion-=2009),se.allowReserved==null&&(se.allowReserved=se.ecmaVersion<5),(!V||V.allowHashBang==null)&&(se.allowHashBang=se.ecmaVersion>=14),ze(se.onToken)){var Fe=se.onToken;se.onToken=function(Ke){return Fe.push(Ke)}}return ze(se.onComment)&&(se.onComment=it(se,se.onComment)),se}function it(V,se){return function(Be,Fe,Ke,ut,dt,It){var Dt={type:Be?"Block":"Line",value:Fe,start:Ke,end:ut};V.locations&&(Dt.loc=new Je(this,dt,It)),V.ranges&&(Dt.range=[Ke,ut]),se.push(Dt)}}var et=1,at=2,ot=4,Ue=8,mt=16,Qe=32,Rt=64,$t=128,Ft=256,Ut=et|at|Ft;function Mt(V,se){return at|(V?ot:0)|(se?Ue:0)}var Ye=0,rt=1,st=2,lt=3,ft=4,pt=5,yt=function(se,Be,Fe){this.options=se=Xe(se),this.sourceFile=se.sourceFile,this.keywords=Oe(S[se.ecmaVersion>=6?6:se.sourceType==="module"?"5module":5]);var Ke="";se.allowReserved!==!0&&(Ke=g[se.ecmaVersion>=6?6:se.ecmaVersion===5?5:3],se.sourceType==="module"&&(Ke+=" await")),this.reservedWords=Oe(Ke);var ut=(Ke?Ke+" ":"")+g.strict;this.reservedWordsStrict=Oe(ut),this.reservedWordsStrictBind=Oe(ut+" "+g.strictBind),this.input=String(Be),this.containsEsc=!1,Fe?(this.pos=Fe,this.lineStart=this.input.lastIndexOf(`
|
|
1193
1193
|
`,Fe-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(te).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=O.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=se.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&se.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(et),this.regexpState=null,this.privateNameStack=[]},zt={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};yt.prototype.parse=function(){var se=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(se)},zt.inFunction.get=function(){return(this.currentVarScope().flags&at)>0},zt.inGenerator.get=function(){return(this.currentVarScope().flags&Ue)>0&&!this.currentVarScope().inClassFieldInit},zt.inAsync.get=function(){return(this.currentVarScope().flags&ot)>0&&!this.currentVarScope().inClassFieldInit},zt.canAwait.get=function(){for(var V=this.scopeStack.length-1;V>=0;V--){var se=this.scopeStack[V];if(se.inClassFieldInit||se.flags&Ft)return!1;if(se.flags&at)return(se.flags&ot)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},zt.allowSuper.get=function(){var V=this.currentThisScope(),se=V.flags,Be=V.inClassFieldInit;return(se&Rt)>0||Be||this.options.allowSuperOutsideMethod},zt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&$t)>0},zt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},zt.allowNewDotTarget.get=function(){var V=this.currentThisScope(),se=V.flags,Be=V.inClassFieldInit;return(se&(at|Ft))>0||Be},zt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Ft)>0},yt.extend=function(){for(var se=[],Be=arguments.length;Be--;)se[Be]=arguments[Be];for(var Fe=this,Ke=0;Ke<se.length;Ke++)Fe=se[Ke](Fe);return Fe},yt.parse=function(se,Be){return new this(Be,se).parse()},yt.parseExpressionAt=function(se,Be,Fe){var Ke=new this(Fe,se,Be);return Ke.nextToken(),Ke.parseExpression()},yt.tokenizer=function(se,Be){return new this(Be,se)},Object.defineProperties(yt.prototype,zt);var Yt=yt.prototype,dn=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Yt.strictDirective=function(V){if(this.options.ecmaVersion<5)return!1;for(;;){Ae.lastIndex=V,V+=Ae.exec(this.input)[0].length;var se=dn.exec(this.input.slice(V));if(!se)return!1;if((se[1]||se[2])==="use strict"){Ae.lastIndex=V+se[0].length;var Be=Ae.exec(this.input),Fe=Be.index+Be[0].length,Ke=this.input.charAt(Fe);return Ke===";"||Ke==="}"||te.test(Be[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Ke)||Ke==="!"&&this.input.charAt(Fe+1)==="=")}V+=se[0].length,Ae.lastIndex=V,V+=Ae.exec(this.input)[0].length,this.input[V]===";"&&V++}},Yt.eat=function(V){return this.type===V?(this.next(),!0):!1},Yt.isContextual=function(V){return this.type===O.name&&this.value===V&&!this.containsEsc},Yt.eatContextual=function(V){return this.isContextual(V)?(this.next(),!0):!1},Yt.expectContextual=function(V){this.eatContextual(V)||this.unexpected()},Yt.canInsertSemicolon=function(){return this.type===O.eof||this.type===O.braceR||te.test(this.input.slice(this.lastTokEnd,this.start))},Yt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Yt.semicolon=function(){!this.eat(O.semi)&&!this.insertSemicolon()&&this.unexpected()},Yt.afterTrailingComma=function(V,se){if(this.type===V)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),se||this.next(),!0},Yt.expect=function(V){this.eat(V)||this.unexpected()},Yt.unexpected=function(V){this.raise(V??this.start,"Unexpected token")};var gn=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Yt.checkPatternErrors=function(V,se){if(V){V.trailingComma>-1&&this.raiseRecoverable(V.trailingComma,"Comma is not permitted after the rest element");var Be=se?V.parenthesizedAssign:V.parenthesizedBind;Be>-1&&this.raiseRecoverable(Be,se?"Assigning to rvalue":"Parenthesized pattern")}},Yt.checkExpressionErrors=function(V,se){if(!V)return!1;var Be=V.shorthandAssign,Fe=V.doubleProto;if(!se)return Be>=0||Fe>=0;Be>=0&&this.raise(Be,"Shorthand property assignments are valid only in destructuring patterns"),Fe>=0&&this.raiseRecoverable(Fe,"Redefinition of __proto__ property")},Yt.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Yt.isSimpleAssignTarget=function(V){return V.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(V.expression):V.type==="Identifier"||V.type==="MemberExpression"};var qt=yt.prototype;qt.parseTopLevel=function(V){var se=Object.create(null);for(V.body||(V.body=[]);this.type!==O.eof;){var Be=this.parseStatement(null,!0,se);V.body.push(Be)}if(this.inModule)for(var Fe=0,Ke=Object.keys(this.undefinedExports);Fe<Ke.length;Fe+=1){var ut=Ke[Fe];this.raiseRecoverable(this.undefinedExports[ut].start,"Export '"+ut+"' is not defined")}return this.adaptDirectivePrologue(V.body),this.next(),V.sourceType=this.options.sourceType,this.finishNode(V,"Program")};var wn={kind:"loop"},Sn={kind:"switch"};qt.isLet=function(V){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Ae.lastIndex=this.pos;var se=Ae.exec(this.input),Be=this.pos+se[0].length,Fe=this.input.charCodeAt(Be);if(Fe===91||Fe===92)return!0;if(V)return!1;if(Fe===123||Fe>55295&&Fe<56320)return!0;if(A(Fe,!0)){for(var Ke=Be+1;M(Fe=this.input.charCodeAt(Ke),!0);)++Ke;if(Fe===92||Fe>55295&&Fe<56320)return!0;var ut=this.input.slice(Be,Ke);if(!_.test(ut))return!0}return!1},qt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Ae.lastIndex=this.pos;var V=Ae.exec(this.input),se=this.pos+V[0].length,Be;return!te.test(this.input.slice(this.pos,se))&&this.input.slice(se,se+8)==="function"&&(se+8===this.input.length||!(M(Be=this.input.charCodeAt(se+8))||Be>55295&&Be<56320))},qt.parseStatement=function(V,se,Be){var Fe=this.type,Ke=this.startNode(),ut;switch(this.isLet(V)&&(Fe=O._var,ut="let"),Fe){case O._break:case O._continue:return this.parseBreakContinueStatement(Ke,Fe.keyword);case O._debugger:return this.parseDebuggerStatement(Ke);case O._do:return this.parseDoStatement(Ke);case O._for:return this.parseForStatement(Ke);case O._function:return V&&(this.strict||V!=="if"&&V!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(Ke,!1,!V);case O._class:return V&&this.unexpected(),this.parseClass(Ke,!0);case O._if:return this.parseIfStatement(Ke);case O._return:return this.parseReturnStatement(Ke);case O._switch:return this.parseSwitchStatement(Ke);case O._throw:return this.parseThrowStatement(Ke);case O._try:return this.parseTryStatement(Ke);case O._const:case O._var:return ut=ut||this.value,V&&ut!=="var"&&this.unexpected(),this.parseVarStatement(Ke,ut);case O._while:return this.parseWhileStatement(Ke);case O._with:return this.parseWithStatement(Ke);case O.braceL:return this.parseBlock(!0,Ke);case O.semi:return this.parseEmptyStatement(Ke);case O._export:case O._import:if(this.options.ecmaVersion>10&&Fe===O._import){Ae.lastIndex=this.pos;var dt=Ae.exec(this.input),It=this.pos+dt[0].length,Dt=this.input.charCodeAt(It);if(Dt===40||Dt===46)return this.parseExpressionStatement(Ke,this.parseExpression())}return this.options.allowImportExportEverywhere||(se||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),Fe===O._import?this.parseImport(Ke):this.parseExport(Ke,Be);default:if(this.isAsyncFunction())return V&&this.unexpected(),this.next(),this.parseFunctionStatement(Ke,!0,!V);var en=this.value,Qt=this.parseExpression();return Fe===O.name&&Qt.type==="Identifier"&&this.eat(O.colon)?this.parseLabeledStatement(Ke,en,Qt,V):this.parseExpressionStatement(Ke,Qt)}},qt.parseBreakContinueStatement=function(V,se){var Be=se==="break";this.next(),this.eat(O.semi)||this.insertSemicolon()?V.label=null:this.type!==O.name?this.unexpected():(V.label=this.parseIdent(),this.semicolon());for(var Fe=0;Fe<this.labels.length;++Fe){var Ke=this.labels[Fe];if((V.label==null||Ke.name===V.label.name)&&(Ke.kind!=null&&(Be||Ke.kind==="loop")||V.label&&Be))break}return Fe===this.labels.length&&this.raise(V.start,"Unsyntactic "+se),this.finishNode(V,Be?"BreakStatement":"ContinueStatement")},qt.parseDebuggerStatement=function(V){return this.next(),this.semicolon(),this.finishNode(V,"DebuggerStatement")},qt.parseDoStatement=function(V){return this.next(),this.labels.push(wn),V.body=this.parseStatement("do"),this.labels.pop(),this.expect(O._while),V.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(O.semi):this.semicolon(),this.finishNode(V,"DoWhileStatement")},qt.parseForStatement=function(V){this.next();var se=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(wn),this.enterScope(0),this.expect(O.parenL),this.type===O.semi)return se>-1&&this.unexpected(se),this.parseFor(V,null);var Be=this.isLet();if(this.type===O._var||this.type===O._const||Be){var Fe=this.startNode(),Ke=Be?"let":this.value;return this.next(),this.parseVar(Fe,!0,Ke),this.finishNode(Fe,"VariableDeclaration"),(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Fe.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===O._in?se>-1&&this.unexpected(se):V.await=se>-1),this.parseForIn(V,Fe)):(se>-1&&this.unexpected(se),this.parseFor(V,Fe))}var ut=this.isContextual("let"),dt=!1,It=this.containsEsc,Dt=new gn,en=this.start,Qt=se>-1?this.parseExprSubscripts(Dt,"await"):this.parseExpression(!0,Dt);return this.type===O._in||(dt=this.options.ecmaVersion>=6&&this.isContextual("of"))?(se>-1?(this.type===O._in&&this.unexpected(se),V.await=!0):dt&&this.options.ecmaVersion>=8&&(Qt.start===en&&!It&&Qt.type==="Identifier"&&Qt.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(V.await=!1)),ut&&dt&&this.raise(Qt.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Qt,!1,Dt),this.checkLValPattern(Qt),this.parseForIn(V,Qt)):(this.checkExpressionErrors(Dt,!0),se>-1&&this.unexpected(se),this.parseFor(V,Qt))},qt.parseFunctionStatement=function(V,se,Be){return this.next(),this.parseFunction(V,Rn|(Be?0:En),!1,se)},qt.parseIfStatement=function(V){return this.next(),V.test=this.parseParenExpression(),V.consequent=this.parseStatement("if"),V.alternate=this.eat(O._else)?this.parseStatement("if"):null,this.finishNode(V,"IfStatement")},qt.parseReturnStatement=function(V){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(O.semi)||this.insertSemicolon()?V.argument=null:(V.argument=this.parseExpression(),this.semicolon()),this.finishNode(V,"ReturnStatement")},qt.parseSwitchStatement=function(V){this.next(),V.discriminant=this.parseParenExpression(),V.cases=[],this.expect(O.braceL),this.labels.push(Sn),this.enterScope(0);for(var se,Be=!1;this.type!==O.braceR;)if(this.type===O._case||this.type===O._default){var Fe=this.type===O._case;se&&this.finishNode(se,"SwitchCase"),V.cases.push(se=this.startNode()),se.consequent=[],this.next(),Fe?se.test=this.parseExpression():(Be&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),Be=!0,se.test=null),this.expect(O.colon)}else se||this.unexpected(),se.consequent.push(this.parseStatement(null));return this.exitScope(),se&&this.finishNode(se,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(V,"SwitchStatement")},qt.parseThrowStatement=function(V){return this.next(),te.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),V.argument=this.parseExpression(),this.semicolon(),this.finishNode(V,"ThrowStatement")};var xn=[];qt.parseCatchClauseParam=function(){var V=this.parseBindingAtom(),se=V.type==="Identifier";return this.enterScope(se?Qe:0),this.checkLValPattern(V,se?ft:st),this.expect(O.parenR),V},qt.parseTryStatement=function(V){if(this.next(),V.block=this.parseBlock(),V.handler=null,this.type===O._catch){var se=this.startNode();this.next(),this.eat(O.parenL)?se.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),se.param=null,this.enterScope(0)),se.body=this.parseBlock(!1),this.exitScope(),V.handler=this.finishNode(se,"CatchClause")}return V.finalizer=this.eat(O._finally)?this.parseBlock():null,!V.handler&&!V.finalizer&&this.raise(V.start,"Missing catch or finally clause"),this.finishNode(V,"TryStatement")},qt.parseVarStatement=function(V,se,Be){return this.next(),this.parseVar(V,!1,se,Be),this.semicolon(),this.finishNode(V,"VariableDeclaration")},qt.parseWhileStatement=function(V){return this.next(),V.test=this.parseParenExpression(),this.labels.push(wn),V.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(V,"WhileStatement")},qt.parseWithStatement=function(V){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),V.object=this.parseParenExpression(),V.body=this.parseStatement("with"),this.finishNode(V,"WithStatement")},qt.parseEmptyStatement=function(V){return this.next(),this.finishNode(V,"EmptyStatement")},qt.parseLabeledStatement=function(V,se,Be,Fe){for(var Ke=0,ut=this.labels;Ke<ut.length;Ke+=1){var dt=ut[Ke];dt.name===se&&this.raise(Be.start,"Label '"+se+"' is already declared")}for(var It=this.type.isLoop?"loop":this.type===O._switch?"switch":null,Dt=this.labels.length-1;Dt>=0;Dt--){var en=this.labels[Dt];if(en.statementStart===V.start)en.statementStart=this.start,en.kind=It;else break}return this.labels.push({name:se,kind:It,statementStart:this.start}),V.body=this.parseStatement(Fe?Fe.indexOf("label")===-1?Fe+"label":Fe:"label"),this.labels.pop(),V.label=Be,this.finishNode(V,"LabeledStatement")},qt.parseExpressionStatement=function(V,se){return V.expression=se,this.semicolon(),this.finishNode(V,"ExpressionStatement")},qt.parseBlock=function(V,se,Be){for(V===void 0&&(V=!0),se===void 0&&(se=this.startNode()),se.body=[],this.expect(O.braceL),V&&this.enterScope(0);this.type!==O.braceR;){var Fe=this.parseStatement(null);se.body.push(Fe)}return Be&&(this.strict=!1),this.next(),V&&this.exitScope(),this.finishNode(se,"BlockStatement")},qt.parseFor=function(V,se){return V.init=se,this.expect(O.semi),V.test=this.type===O.semi?null:this.parseExpression(),this.expect(O.semi),V.update=this.type===O.parenR?null:this.parseExpression(),this.expect(O.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,"ForStatement")},qt.parseForIn=function(V,se){var Be=this.type===O._in;return this.next(),se.type==="VariableDeclaration"&&se.declarations[0].init!=null&&(!Be||this.options.ecmaVersion<8||this.strict||se.kind!=="var"||se.declarations[0].id.type!=="Identifier")&&this.raise(se.start,(Be?"for-in":"for-of")+" loop variable declaration may not have an initializer"),V.left=se,V.right=Be?this.parseExpression():this.parseMaybeAssign(),this.expect(O.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,Be?"ForInStatement":"ForOfStatement")},qt.parseVar=function(V,se,Be,Fe){for(V.declarations=[],V.kind=Be;;){var Ke=this.startNode();if(this.parseVarId(Ke,Be),this.eat(O.eq)?Ke.init=this.parseMaybeAssign(se):!Fe&&Be==="const"&&!(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!Fe&&Ke.id.type!=="Identifier"&&!(se&&(this.type===O._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):Ke.init=null,V.declarations.push(this.finishNode(Ke,"VariableDeclarator")),!this.eat(O.comma))break}return V},qt.parseVarId=function(V,se){V.id=this.parseBindingAtom(),this.checkLValPattern(V.id,se==="var"?rt:st,!1)};var Rn=1,En=2,Ln=4;qt.parseFunction=function(V,se,Be,Fe,Ke){this.initFunction(V),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Fe)&&(this.type===O.star&&se&En&&this.unexpected(),V.generator=this.eat(O.star)),this.options.ecmaVersion>=8&&(V.async=!!Fe),se&Rn&&(V.id=se&Ln&&this.type!==O.name?null:this.parseIdent(),V.id&&!(se&En)&&this.checkLValSimple(V.id,this.strict||V.generator||V.async?this.treatFunctionsAsVar?rt:st:lt));var ut=this.yieldPos,dt=this.awaitPos,It=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Mt(V.async,V.generator)),se&Rn||(V.id=this.type===O.name?this.parseIdent():null),this.parseFunctionParams(V),this.parseFunctionBody(V,Be,!1,Ke),this.yieldPos=ut,this.awaitPos=dt,this.awaitIdentPos=It,this.finishNode(V,se&Rn?"FunctionDeclaration":"FunctionExpression")},qt.parseFunctionParams=function(V){this.expect(O.parenL),V.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},qt.parseClass=function(V,se){this.next();var Be=this.strict;this.strict=!0,this.parseClassId(V,se),this.parseClassSuper(V);var Fe=this.enterClassBody(),Ke=this.startNode(),ut=!1;for(Ke.body=[],this.expect(O.braceL);this.type!==O.braceR;){var dt=this.parseClassElement(V.superClass!==null);dt&&(Ke.body.push(dt),dt.type==="MethodDefinition"&&dt.kind==="constructor"?(ut&&this.raiseRecoverable(dt.start,"Duplicate constructor in the same class"),ut=!0):dt.key&&dt.key.type==="PrivateIdentifier"&&Xt(Fe,dt)&&this.raiseRecoverable(dt.key.start,"Identifier '#"+dt.key.name+"' has already been declared"))}return this.strict=Be,this.next(),V.body=this.finishNode(Ke,"ClassBody"),this.exitClassBody(),this.finishNode(V,se?"ClassDeclaration":"ClassExpression")},qt.parseClassElement=function(V){if(this.eat(O.semi))return null;var se=this.options.ecmaVersion,Be=this.startNode(),Fe="",Ke=!1,ut=!1,dt="method",It=!1;if(this.eatContextual("static")){if(se>=13&&this.eat(O.braceL))return this.parseClassStaticBlock(Be),Be;this.isClassElementNameStart()||this.type===O.star?It=!0:Fe="static"}if(Be.static=It,!Fe&&se>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===O.star)&&!this.canInsertSemicolon()?ut=!0:Fe="async"),!Fe&&(se>=9||!ut)&&this.eat(O.star)&&(Ke=!0),!Fe&&!ut&&!Ke){var Dt=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?dt=Dt:Fe=Dt)}if(Fe?(Be.computed=!1,Be.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Be.key.name=Fe,this.finishNode(Be.key,"Identifier")):this.parseClassElementName(Be),se<13||this.type===O.parenL||dt!=="method"||Ke||ut){var en=!Be.static&&kn(Be,"constructor"),Qt=en&&V;en&&dt!=="method"&&this.raise(Be.key.start,"Constructor can't have get/set modifier"),Be.kind=en?"constructor":dt,this.parseClassMethod(Be,Ke,ut,Qt)}else this.parseClassField(Be);return Be},qt.isClassElementNameStart=function(){return this.type===O.name||this.type===O.privateId||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword},qt.parseClassElementName=function(V){this.type===O.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),V.computed=!1,V.key=this.parsePrivateIdent()):this.parsePropertyName(V)},qt.parseClassMethod=function(V,se,Be,Fe){var Ke=V.key;V.kind==="constructor"?(se&&this.raise(Ke.start,"Constructor can't be a generator"),Be&&this.raise(Ke.start,"Constructor can't be an async method")):V.static&&kn(V,"prototype")&&this.raise(Ke.start,"Classes may not have a static property named prototype");var ut=V.value=this.parseMethod(se,Be,Fe);return V.kind==="get"&&ut.params.length!==0&&this.raiseRecoverable(ut.start,"getter should have no params"),V.kind==="set"&&ut.params.length!==1&&this.raiseRecoverable(ut.start,"setter should have exactly one param"),V.kind==="set"&&ut.params[0].type==="RestElement"&&this.raiseRecoverable(ut.params[0].start,"Setter cannot use rest params"),this.finishNode(V,"MethodDefinition")},qt.parseClassField=function(V){if(kn(V,"constructor")?this.raise(V.key.start,"Classes can't have a field named 'constructor'"):V.static&&kn(V,"prototype")&&this.raise(V.key.start,"Classes can't have a static field named 'prototype'"),this.eat(O.eq)){var se=this.currentThisScope(),Be=se.inClassFieldInit;se.inClassFieldInit=!0,V.value=this.parseMaybeAssign(),se.inClassFieldInit=Be}else V.value=null;return this.semicolon(),this.finishNode(V,"PropertyDefinition")},qt.parseClassStaticBlock=function(V){V.body=[];var se=this.labels;for(this.labels=[],this.enterScope(Ft|Rt);this.type!==O.braceR;){var Be=this.parseStatement(null);V.body.push(Be)}return this.next(),this.exitScope(),this.labels=se,this.finishNode(V,"StaticBlock")},qt.parseClassId=function(V,se){this.type===O.name?(V.id=this.parseIdent(),se&&this.checkLValSimple(V.id,st,!1)):(se===!0&&this.unexpected(),V.id=null)},qt.parseClassSuper=function(V){V.superClass=this.eat(O._extends)?this.parseExprSubscripts(null,!1):null},qt.enterClassBody=function(){var V={declared:Object.create(null),used:[]};return this.privateNameStack.push(V),V.declared},qt.exitClassBody=function(){var V=this.privateNameStack.pop(),se=V.declared,Be=V.used;if(this.options.checkPrivateFields)for(var Fe=this.privateNameStack.length,Ke=Fe===0?null:this.privateNameStack[Fe-1],ut=0;ut<Be.length;++ut){var dt=Be[ut];Le(se,dt.name)||(Ke?Ke.used.push(dt):this.raiseRecoverable(dt.start,"Private field '#"+dt.name+"' must be declared in an enclosing class"))}};function Xt(V,se){var Be=se.key.name,Fe=V[Be],Ke="true";return se.type==="MethodDefinition"&&(se.kind==="get"||se.kind==="set")&&(Ke=(se.static?"s":"i")+se.kind),Fe==="iget"&&Ke==="iset"||Fe==="iset"&&Ke==="iget"||Fe==="sget"&&Ke==="sset"||Fe==="sset"&&Ke==="sget"?(V[Be]="true",!1):Fe?!0:(V[Be]=Ke,!1)}function kn(V,se){var Be=V.computed,Fe=V.key;return!Be&&(Fe.type==="Identifier"&&Fe.name===se||Fe.type==="Literal"&&Fe.value===se)}qt.parseExportAllDeclaration=function(V,se){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(V.exported=this.parseModuleExportName(),this.checkExport(se,V.exported,this.lastTokStart)):V.exported=null),this.expectContextual("from"),this.type!==O.string&&this.unexpected(),V.source=this.parseExprAtom(),this.semicolon(),this.finishNode(V,"ExportAllDeclaration")},qt.parseExport=function(V,se){if(this.next(),this.eat(O.star))return this.parseExportAllDeclaration(V,se);if(this.eat(O._default))return this.checkExport(se,"default",this.lastTokStart),V.declaration=this.parseExportDefaultDeclaration(),this.finishNode(V,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())V.declaration=this.parseExportDeclaration(V),V.declaration.type==="VariableDeclaration"?this.checkVariableExport(se,V.declaration.declarations):this.checkExport(se,V.declaration.id,V.declaration.id.start),V.specifiers=[],V.source=null;else{if(V.declaration=null,V.specifiers=this.parseExportSpecifiers(se),this.eatContextual("from"))this.type!==O.string&&this.unexpected(),V.source=this.parseExprAtom();else{for(var Be=0,Fe=V.specifiers;Be<Fe.length;Be+=1){var Ke=Fe[Be];this.checkUnreserved(Ke.local),this.checkLocalExport(Ke.local),Ke.local.type==="Literal"&&this.raise(Ke.local.start,"A string literal cannot be used as an exported binding without `from`.")}V.source=null}this.semicolon()}return this.finishNode(V,"ExportNamedDeclaration")},qt.parseExportDeclaration=function(V){return this.parseStatement(null)},qt.parseExportDefaultDeclaration=function(){var V;if(this.type===O._function||(V=this.isAsyncFunction())){var se=this.startNode();return this.next(),V&&this.next(),this.parseFunction(se,Rn|Ln,!1,V)}else if(this.type===O._class){var Be=this.startNode();return this.parseClass(Be,"nullableID")}else{var Fe=this.parseMaybeAssign();return this.semicolon(),Fe}},qt.checkExport=function(V,se,Be){V&&(typeof se!="string"&&(se=se.type==="Identifier"?se.name:se.value),Le(V,se)&&this.raiseRecoverable(Be,"Duplicate export '"+se+"'"),V[se]=!0)},qt.checkPatternExport=function(V,se){var Be=se.type;if(Be==="Identifier")this.checkExport(V,se,se.start);else if(Be==="ObjectPattern")for(var Fe=0,Ke=se.properties;Fe<Ke.length;Fe+=1){var ut=Ke[Fe];this.checkPatternExport(V,ut)}else if(Be==="ArrayPattern")for(var dt=0,It=se.elements;dt<It.length;dt+=1){var Dt=It[dt];Dt&&this.checkPatternExport(V,Dt)}else Be==="Property"?this.checkPatternExport(V,se.value):Be==="AssignmentPattern"?this.checkPatternExport(V,se.left):Be==="RestElement"&&this.checkPatternExport(V,se.argument)},qt.checkVariableExport=function(V,se){if(V)for(var Be=0,Fe=se;Be<Fe.length;Be+=1){var Ke=Fe[Be];this.checkPatternExport(V,Ke.id)}},qt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},qt.parseExportSpecifier=function(V){var se=this.startNode();return se.local=this.parseModuleExportName(),se.exported=this.eatContextual("as")?this.parseModuleExportName():se.local,this.checkExport(V,se.exported,se.exported.start),this.finishNode(se,"ExportSpecifier")},qt.parseExportSpecifiers=function(V){var se=[],Be=!0;for(this.expect(O.braceL);!this.eat(O.braceR);){if(Be)Be=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;se.push(this.parseExportSpecifier(V))}return se},qt.parseImport=function(V){return this.next(),this.type===O.string?(V.specifiers=xn,V.source=this.parseExprAtom()):(V.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),V.source=this.type===O.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(V,"ImportDeclaration")},qt.parseImportSpecifier=function(){var V=this.startNode();return V.imported=this.parseModuleExportName(),this.eatContextual("as")?V.local=this.parseIdent():(this.checkUnreserved(V.imported),V.local=V.imported),this.checkLValSimple(V.local,st),this.finishNode(V,"ImportSpecifier")},qt.parseImportDefaultSpecifier=function(){var V=this.startNode();return V.local=this.parseIdent(),this.checkLValSimple(V.local,st),this.finishNode(V,"ImportDefaultSpecifier")},qt.parseImportNamespaceSpecifier=function(){var V=this.startNode();return this.next(),this.expectContextual("as"),V.local=this.parseIdent(),this.checkLValSimple(V.local,st),this.finishNode(V,"ImportNamespaceSpecifier")},qt.parseImportSpecifiers=function(){var V=[],se=!0;if(this.type===O.name&&(V.push(this.parseImportDefaultSpecifier()),!this.eat(O.comma)))return V;if(this.type===O.star)return V.push(this.parseImportNamespaceSpecifier()),V;for(this.expect(O.braceL);!this.eat(O.braceR);){if(se)se=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;V.push(this.parseImportSpecifier())}return V},qt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===O.string){var V=this.parseLiteral(this.value);return Ge.test(V.value)&&this.raise(V.start,"An export name cannot include a lone surrogate."),V}return this.parseIdent(!0)},qt.adaptDirectivePrologue=function(V){for(var se=0;se<V.length&&this.isDirectiveCandidate(V[se]);++se)V[se].directive=V[se].expression.raw.slice(1,-1)},qt.isDirectiveCandidate=function(V){return this.options.ecmaVersion>=5&&V.type==="ExpressionStatement"&&V.expression.type==="Literal"&&typeof V.expression.value=="string"&&(this.input[V.start]==='"'||this.input[V.start]==="'")};var bn=yt.prototype;bn.toAssignable=function(V,se,Be){if(this.options.ecmaVersion>=6&&V)switch(V.type){case"Identifier":this.inAsync&&V.name==="await"&&this.raise(V.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":V.type="ObjectPattern",Be&&this.checkPatternErrors(Be,!0);for(var Fe=0,Ke=V.properties;Fe<Ke.length;Fe+=1){var ut=Ke[Fe];this.toAssignable(ut,se),ut.type==="RestElement"&&(ut.argument.type==="ArrayPattern"||ut.argument.type==="ObjectPattern")&&this.raise(ut.argument.start,"Unexpected token")}break;case"Property":V.kind!=="init"&&this.raise(V.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(V.value,se);break;case"ArrayExpression":V.type="ArrayPattern",Be&&this.checkPatternErrors(Be,!0),this.toAssignableList(V.elements,se);break;case"SpreadElement":V.type="RestElement",this.toAssignable(V.argument,se),V.argument.type==="AssignmentPattern"&&this.raise(V.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":V.operator!=="="&&this.raise(V.left.end,"Only '=' operator can be used for specifying default value."),V.type="AssignmentPattern",delete V.operator,this.toAssignable(V.left,se);break;case"ParenthesizedExpression":this.toAssignable(V.expression,se,Be);break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!se)break;default:this.raise(V.start,"Assigning to rvalue")}else Be&&this.checkPatternErrors(Be,!0);return V},bn.toAssignableList=function(V,se){for(var Be=V.length,Fe=0;Fe<Be;Fe++){var Ke=V[Fe];Ke&&this.toAssignable(Ke,se)}if(Be){var ut=V[Be-1];this.options.ecmaVersion===6&&se&&ut&&ut.type==="RestElement"&&ut.argument.type!=="Identifier"&&this.unexpected(ut.argument.start)}return V},bn.parseSpread=function(V){var se=this.startNode();return this.next(),se.argument=this.parseMaybeAssign(!1,V),this.finishNode(se,"SpreadElement")},bn.parseRestBinding=function(){var V=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==O.name&&this.unexpected(),V.argument=this.parseBindingAtom(),this.finishNode(V,"RestElement")},bn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case O.bracketL:var V=this.startNode();return this.next(),V.elements=this.parseBindingList(O.bracketR,!0,!0),this.finishNode(V,"ArrayPattern");case O.braceL:return this.parseObj(!0)}return this.parseIdent()},bn.parseBindingList=function(V,se,Be,Fe){for(var Ke=[],ut=!0;!this.eat(V);)if(ut?ut=!1:this.expect(O.comma),se&&this.type===O.comma)Ke.push(null);else{if(Be&&this.afterTrailingComma(V))break;if(this.type===O.ellipsis){var dt=this.parseRestBinding();this.parseBindingListItem(dt),Ke.push(dt),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(V);break}else Ke.push(this.parseAssignableListItem(Fe))}return Ke},bn.parseAssignableListItem=function(V){var se=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(se),se},bn.parseBindingListItem=function(V){return V},bn.parseMaybeDefault=function(V,se,Be){if(Be=Be||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(O.eq))return Be;var Fe=this.startNodeAt(V,se);return Fe.left=Be,Fe.right=this.parseMaybeAssign(),this.finishNode(Fe,"AssignmentPattern")},bn.checkLValSimple=function(V,se,Be){se===void 0&&(se=Ye);var Fe=se!==Ye;switch(V.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(V.name)&&this.raiseRecoverable(V.start,(Fe?"Binding ":"Assigning to ")+V.name+" in strict mode"),Fe&&(se===st&&V.name==="let"&&this.raiseRecoverable(V.start,"let is disallowed as a lexically bound name"),Be&&(Le(Be,V.name)&&this.raiseRecoverable(V.start,"Argument name clash"),Be[V.name]=!0),se!==pt&&this.declareName(V.name,se,V.start));break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":Fe&&this.raiseRecoverable(V.start,"Binding member expression");break;case"ParenthesizedExpression":return Fe&&this.raiseRecoverable(V.start,"Binding parenthesized expression"),this.checkLValSimple(V.expression,se,Be);default:this.raise(V.start,(Fe?"Binding":"Assigning to")+" rvalue")}},bn.checkLValPattern=function(V,se,Be){switch(se===void 0&&(se=Ye),V.type){case"ObjectPattern":for(var Fe=0,Ke=V.properties;Fe<Ke.length;Fe+=1){var ut=Ke[Fe];this.checkLValInnerPattern(ut,se,Be)}break;case"ArrayPattern":for(var dt=0,It=V.elements;dt<It.length;dt+=1){var Dt=It[dt];Dt&&this.checkLValInnerPattern(Dt,se,Be)}break;default:this.checkLValSimple(V,se,Be)}},bn.checkLValInnerPattern=function(V,se,Be){switch(se===void 0&&(se=Ye),V.type){case"Property":this.checkLValInnerPattern(V.value,se,Be);break;case"AssignmentPattern":this.checkLValPattern(V.left,se,Be);break;case"RestElement":this.checkLValPattern(V.argument,se,Be);break;default:this.checkLValPattern(V,se,Be)}};var Cn=function(se,Be,Fe,Ke,ut){this.token=se,this.isExpr=!!Be,this.preserveSpace=!!Fe,this.override=Ke,this.generator=!!ut},an={b_stat:new Cn("{",!1),b_expr:new Cn("{",!0),b_tmpl:new Cn("${",!1),p_stat:new Cn("(",!1),p_expr:new Cn("(",!0),q_tmpl:new Cn("`",!0,!0,function(V){return V.tryReadTemplateToken()}),f_stat:new Cn("function",!1),f_expr:new Cn("function",!0),f_expr_gen:new Cn("function",!0,!1,null,!0),f_gen:new Cn("function",!1,!1,null,!0)},Vn=yt.prototype;Vn.initialContext=function(){return[an.b_stat]},Vn.curContext=function(){return this.context[this.context.length-1]},Vn.braceIsBlock=function(V){var se=this.curContext();return se===an.f_expr||se===an.f_stat?!0:V===O.colon&&(se===an.b_stat||se===an.b_expr)?!se.isExpr:V===O._return||V===O.name&&this.exprAllowed?te.test(this.input.slice(this.lastTokEnd,this.start)):V===O._else||V===O.semi||V===O.eof||V===O.parenR||V===O.arrow?!0:V===O.braceL?se===an.b_stat:V===O._var||V===O._const||V===O.name?!1:!this.exprAllowed},Vn.inGeneratorContext=function(){for(var V=this.context.length-1;V>=1;V--){var se=this.context[V];if(se.token==="function")return se.generator}return!1},Vn.updateContext=function(V){var se,Be=this.type;Be.keyword&&V===O.dot?this.exprAllowed=!1:(se=Be.updateContext)?se.call(this,V):this.exprAllowed=Be.beforeExpr},Vn.overrideContext=function(V){this.curContext()!==V&&(this.context[this.context.length-1]=V)},O.parenR.updateContext=O.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var V=this.context.pop();V===an.b_stat&&this.curContext().token==="function"&&(V=this.context.pop()),this.exprAllowed=!V.isExpr},O.braceL.updateContext=function(V){this.context.push(this.braceIsBlock(V)?an.b_stat:an.b_expr),this.exprAllowed=!0},O.dollarBraceL.updateContext=function(){this.context.push(an.b_tmpl),this.exprAllowed=!0},O.parenL.updateContext=function(V){var se=V===O._if||V===O._for||V===O._with||V===O._while;this.context.push(se?an.p_stat:an.p_expr),this.exprAllowed=!0},O.incDec.updateContext=function(){},O._function.updateContext=O._class.updateContext=function(V){V.beforeExpr&&V!==O._else&&!(V===O.semi&&this.curContext()!==an.p_stat)&&!(V===O._return&&te.test(this.input.slice(this.lastTokEnd,this.start)))&&!((V===O.colon||V===O.braceL)&&this.curContext()===an.b_stat)?this.context.push(an.f_expr):this.context.push(an.f_stat),this.exprAllowed=!1},O.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},O.backQuote.updateContext=function(){this.curContext()===an.q_tmpl?this.context.pop():this.context.push(an.q_tmpl),this.exprAllowed=!1},O.star.updateContext=function(V){if(V===O._function){var se=this.context.length-1;this.context[se]===an.f_expr?this.context[se]=an.f_expr_gen:this.context[se]=an.f_gen}this.exprAllowed=!0},O.name.updateContext=function(V){var se=!1;this.options.ecmaVersion>=6&&V!==O.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(se=!0),this.exprAllowed=se};var ct=yt.prototype;ct.checkPropClash=function(V,se,Be){if(!(this.options.ecmaVersion>=9&&V.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(V.computed||V.method||V.shorthand))){var Fe=V.key,Ke;switch(Fe.type){case"Identifier":Ke=Fe.name;break;case"Literal":Ke=String(Fe.value);break;default:return}var ut=V.kind;if(this.options.ecmaVersion>=6){Ke==="__proto__"&&ut==="init"&&(se.proto&&(Be?Be.doubleProto<0&&(Be.doubleProto=Fe.start):this.raiseRecoverable(Fe.start,"Redefinition of __proto__ property")),se.proto=!0);return}Ke="$"+Ke;var dt=se[Ke];if(dt){var It;ut==="init"?It=this.strict&&dt.init||dt.get||dt.set:It=dt.init||dt[ut],It&&this.raiseRecoverable(Fe.start,"Redefinition of property")}else dt=se[Ke]={init:!1,get:!1,set:!1};dt[ut]=!0}},ct.parseExpression=function(V,se){var Be=this.start,Fe=this.startLoc,Ke=this.parseMaybeAssign(V,se);if(this.type===O.comma){var ut=this.startNodeAt(Be,Fe);for(ut.expressions=[Ke];this.eat(O.comma);)ut.expressions.push(this.parseMaybeAssign(V,se));return this.finishNode(ut,"SequenceExpression")}return Ke},ct.parseMaybeAssign=function(V,se,Be){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(V);this.exprAllowed=!1}var Fe=!1,Ke=-1,ut=-1,dt=-1;se?(Ke=se.parenthesizedAssign,ut=se.trailingComma,dt=se.doubleProto,se.parenthesizedAssign=se.trailingComma=-1):(se=new gn,Fe=!0);var It=this.start,Dt=this.startLoc;(this.type===O.parenL||this.type===O.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=V==="await");var en=this.parseMaybeConditional(V,se);if(Be&&(en=Be.call(this,en,It,Dt)),this.type.isAssign){var Qt=this.startNodeAt(It,Dt);return Qt.operator=this.value,this.type===O.eq&&(en=this.toAssignable(en,!1,se)),Fe||(se.parenthesizedAssign=se.trailingComma=se.doubleProto=-1),se.shorthandAssign>=en.start&&(se.shorthandAssign=-1),this.type===O.eq?this.checkLValPattern(en):this.checkLValSimple(en),Qt.left=en,this.next(),Qt.right=this.parseMaybeAssign(V),dt>-1&&(se.doubleProto=dt),this.finishNode(Qt,"AssignmentExpression")}else Fe&&this.checkExpressionErrors(se,!0);return Ke>-1&&(se.parenthesizedAssign=Ke),ut>-1&&(se.trailingComma=ut),en},ct.parseMaybeConditional=function(V,se){var Be=this.start,Fe=this.startLoc,Ke=this.parseExprOps(V,se);if(this.checkExpressionErrors(se))return Ke;if(this.eat(O.question)){var ut=this.startNodeAt(Be,Fe);return ut.test=Ke,ut.consequent=this.parseMaybeAssign(),this.expect(O.colon),ut.alternate=this.parseMaybeAssign(V),this.finishNode(ut,"ConditionalExpression")}return Ke},ct.parseExprOps=function(V,se){var Be=this.start,Fe=this.startLoc,Ke=this.parseMaybeUnary(se,!1,!1,V);return this.checkExpressionErrors(se)||Ke.start===Be&&Ke.type==="ArrowFunctionExpression"?Ke:this.parseExprOp(Ke,Be,Fe,-1,V)},ct.parseExprOp=function(V,se,Be,Fe,Ke){var ut=this.type.binop;if(ut!=null&&(!Ke||this.type!==O._in)&&ut>Fe){var dt=this.type===O.logicalOR||this.type===O.logicalAND,It=this.type===O.coalesce;It&&(ut=O.logicalAND.binop);var Dt=this.value;this.next();var en=this.start,Qt=this.startLoc,_n=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Ke),en,Qt,ut,Ke),zn=this.buildBinary(se,Be,V,_n,Dt,dt||It);return(dt&&this.type===O.coalesce||It&&(this.type===O.logicalOR||this.type===O.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(zn,se,Be,Fe,Ke)}return V},ct.buildBinary=function(V,se,Be,Fe,Ke,ut){Fe.type==="PrivateIdentifier"&&this.raise(Fe.start,"Private identifier can only be left side of binary expression");var dt=this.startNodeAt(V,se);return dt.left=Be,dt.operator=Ke,dt.right=Fe,this.finishNode(dt,ut?"LogicalExpression":"BinaryExpression")},ct.parseMaybeUnary=function(V,se,Be,Fe){var Ke=this.start,ut=this.startLoc,dt;if(this.isContextual("await")&&this.canAwait)dt=this.parseAwait(Fe),se=!0;else if(this.type.prefix){var It=this.startNode(),Dt=this.type===O.incDec;It.operator=this.value,It.prefix=!0,this.next(),It.argument=this.parseMaybeUnary(null,!0,Dt,Fe),this.checkExpressionErrors(V,!0),Dt?this.checkLValSimple(It.argument):this.strict&&It.operator==="delete"&&Ht(It.argument)?this.raiseRecoverable(It.start,"Deleting local variable in strict mode"):It.operator==="delete"&&Jt(It.argument)?this.raiseRecoverable(It.start,"Private fields can not be deleted"):se=!0,dt=this.finishNode(It,Dt?"UpdateExpression":"UnaryExpression")}else if(!se&&this.type===O.privateId)(Fe||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),dt=this.parsePrivateIdent(),this.type!==O._in&&this.unexpected();else{if(dt=this.parseExprSubscripts(V,Fe),this.checkExpressionErrors(V))return dt;for(;this.type.postfix&&!this.canInsertSemicolon();){var en=this.startNodeAt(Ke,ut);en.operator=this.value,en.prefix=!1,en.argument=dt,this.checkLValSimple(dt),this.next(),dt=this.finishNode(en,"UpdateExpression")}}if(!Be&&this.eat(O.starstar))if(se)this.unexpected(this.lastTokStart);else return this.buildBinary(Ke,ut,dt,this.parseMaybeUnary(null,!1,!1,Fe),"**",!1);else return dt};function Ht(V){return V.type==="Identifier"||V.type==="ParenthesizedExpression"&&Ht(V.expression)}function Jt(V){return V.type==="MemberExpression"&&V.property.type==="PrivateIdentifier"||V.type==="ChainExpression"&&Jt(V.expression)||V.type==="ParenthesizedExpression"&&Jt(V.expression)}ct.parseExprSubscripts=function(V,se){var Be=this.start,Fe=this.startLoc,Ke=this.parseExprAtom(V,se);if(Ke.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Ke;var ut=this.parseSubscripts(Ke,Be,Fe,!1,se);return V&&ut.type==="MemberExpression"&&(V.parenthesizedAssign>=ut.start&&(V.parenthesizedAssign=-1),V.parenthesizedBind>=ut.start&&(V.parenthesizedBind=-1),V.trailingComma>=ut.start&&(V.trailingComma=-1)),ut},ct.parseSubscripts=function(V,se,Be,Fe,Ke){for(var ut=this.options.ecmaVersion>=8&&V.type==="Identifier"&&V.name==="async"&&this.lastTokEnd===V.end&&!this.canInsertSemicolon()&&V.end-V.start===5&&this.potentialArrowAt===V.start,dt=!1;;){var It=this.parseSubscript(V,se,Be,Fe,ut,dt,Ke);if(It.optional&&(dt=!0),It===V||It.type==="ArrowFunctionExpression"){if(dt){var Dt=this.startNodeAt(se,Be);Dt.expression=It,It=this.finishNode(Dt,"ChainExpression")}return It}V=It}},ct.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(O.arrow)},ct.parseSubscriptAsyncArrow=function(V,se,Be,Fe){return this.parseArrowExpression(this.startNodeAt(V,se),Be,!0,Fe)},ct.parseSubscript=function(V,se,Be,Fe,Ke,ut,dt){var It=this.options.ecmaVersion>=11,Dt=It&&this.eat(O.questionDot);Fe&&Dt&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var en=this.eat(O.bracketL);if(en||Dt&&this.type!==O.parenL&&this.type!==O.backQuote||this.eat(O.dot)){var Qt=this.startNodeAt(se,Be);Qt.object=V,en?(Qt.property=this.parseExpression(),this.expect(O.bracketR)):this.type===O.privateId&&V.type!=="Super"?Qt.property=this.parsePrivateIdent():Qt.property=this.parseIdent(this.options.allowReserved!=="never"),Qt.computed=!!en,It&&(Qt.optional=Dt),V=this.finishNode(Qt,"MemberExpression")}else if(!Fe&&this.eat(O.parenL)){var _n=new gn,zn=this.yieldPos,rr=this.awaitPos,Jn=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var pr=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1,_n);if(Ke&&!Dt&&this.shouldParseAsyncArrow())return this.checkPatternErrors(_n,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=zn,this.awaitPos=rr,this.awaitIdentPos=Jn,this.parseSubscriptAsyncArrow(se,Be,pr,dt);this.checkExpressionErrors(_n,!0),this.yieldPos=zn||this.yieldPos,this.awaitPos=rr||this.awaitPos,this.awaitIdentPos=Jn||this.awaitIdentPos;var Xn=this.startNodeAt(se,Be);Xn.callee=V,Xn.arguments=pr,It&&(Xn.optional=Dt),V=this.finishNode(Xn,"CallExpression")}else if(this.type===O.backQuote){(Dt||ut)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Qn=this.startNodeAt(se,Be);Qn.tag=V,Qn.quasi=this.parseTemplate({isTagged:!0}),V=this.finishNode(Qn,"TaggedTemplateExpression")}return V},ct.parseExprAtom=function(V,se,Be){this.type===O.slash&&this.readRegexp();var Fe,Ke=this.potentialArrowAt===this.start;switch(this.type){case O._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),Fe=this.startNode(),this.next(),this.type===O.parenL&&!this.allowDirectSuper&&this.raise(Fe.start,"super() call outside constructor of a subclass"),this.type!==O.dot&&this.type!==O.bracketL&&this.type!==O.parenL&&this.unexpected(),this.finishNode(Fe,"Super");case O._this:return Fe=this.startNode(),this.next(),this.finishNode(Fe,"ThisExpression");case O.name:var ut=this.start,dt=this.startLoc,It=this.containsEsc,Dt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!It&&Dt.name==="async"&&!this.canInsertSemicolon()&&this.eat(O._function))return this.overrideContext(an.f_expr),this.parseFunction(this.startNodeAt(ut,dt),0,!1,!0,se);if(Ke&&!this.canInsertSemicolon()){if(this.eat(O.arrow))return this.parseArrowExpression(this.startNodeAt(ut,dt),[Dt],!1,se);if(this.options.ecmaVersion>=8&&Dt.name==="async"&&this.type===O.name&&!It&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return Dt=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(O.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(ut,dt),[Dt],!0,se)}return Dt;case O.regexp:var en=this.value;return Fe=this.parseLiteral(en.value),Fe.regex={pattern:en.pattern,flags:en.flags},Fe;case O.num:case O.string:return this.parseLiteral(this.value);case O._null:case O._true:case O._false:return Fe=this.startNode(),Fe.value=this.type===O._null?null:this.type===O._true,Fe.raw=this.type.keyword,this.next(),this.finishNode(Fe,"Literal");case O.parenL:var Qt=this.start,_n=this.parseParenAndDistinguishExpression(Ke,se);return V&&(V.parenthesizedAssign<0&&!this.isSimpleAssignTarget(_n)&&(V.parenthesizedAssign=Qt),V.parenthesizedBind<0&&(V.parenthesizedBind=Qt)),_n;case O.bracketL:return Fe=this.startNode(),this.next(),Fe.elements=this.parseExprList(O.bracketR,!0,!0,V),this.finishNode(Fe,"ArrayExpression");case O.braceL:return this.overrideContext(an.b_expr),this.parseObj(!1,V);case O._function:return Fe=this.startNode(),this.next(),this.parseFunction(Fe,0);case O._class:return this.parseClass(this.startNode(),!1);case O._new:return this.parseNew();case O.backQuote:return this.parseTemplate();case O._import:return this.options.ecmaVersion>=11?this.parseExprImport(Be):this.unexpected();default:return this.parseExprAtomDefault()}},ct.parseExprAtomDefault=function(){this.unexpected()},ct.parseExprImport=function(V){var se=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===O.parenL&&!V)return this.parseDynamicImport(se);if(this.type===O.dot){var Be=this.startNodeAt(se.start,se.loc&&se.loc.start);return Be.name="import",se.meta=this.finishNode(Be,"Identifier"),this.parseImportMeta(se)}else this.unexpected()},ct.parseDynamicImport=function(V){if(this.next(),V.source=this.parseMaybeAssign(),!this.eat(O.parenR)){var se=this.start;this.eat(O.comma)&&this.eat(O.parenR)?this.raiseRecoverable(se,"Trailing comma is not allowed in import()"):this.unexpected(se)}return this.finishNode(V,"ImportExpression")},ct.parseImportMeta=function(V){this.next();var se=this.containsEsc;return V.property=this.parseIdent(!0),V.property.name!=="meta"&&this.raiseRecoverable(V.property.start,"The only valid meta property for import is 'import.meta'"),se&&this.raiseRecoverable(V.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(V.start,"Cannot use 'import.meta' outside a module"),this.finishNode(V,"MetaProperty")},ct.parseLiteral=function(V){var se=this.startNode();return se.value=V,se.raw=this.input.slice(this.start,this.end),se.raw.charCodeAt(se.raw.length-1)===110&&(se.bigint=se.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(se,"Literal")},ct.parseParenExpression=function(){this.expect(O.parenL);var V=this.parseExpression();return this.expect(O.parenR),V},ct.shouldParseArrow=function(V){return!this.canInsertSemicolon()},ct.parseParenAndDistinguishExpression=function(V,se){var Be=this.start,Fe=this.startLoc,Ke,ut=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var dt=this.start,It=this.startLoc,Dt=[],en=!0,Qt=!1,_n=new gn,zn=this.yieldPos,rr=this.awaitPos,Jn;for(this.yieldPos=0,this.awaitPos=0;this.type!==O.parenR;)if(en?en=!1:this.expect(O.comma),ut&&this.afterTrailingComma(O.parenR,!0)){Qt=!0;break}else if(this.type===O.ellipsis){Jn=this.start,Dt.push(this.parseParenItem(this.parseRestBinding())),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Dt.push(this.parseMaybeAssign(!1,_n,this.parseParenItem));var pr=this.lastTokEnd,Xn=this.lastTokEndLoc;if(this.expect(O.parenR),V&&this.shouldParseArrow(Dt)&&this.eat(O.arrow))return this.checkPatternErrors(_n,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=zn,this.awaitPos=rr,this.parseParenArrowList(Be,Fe,Dt,se);(!Dt.length||Qt)&&this.unexpected(this.lastTokStart),Jn&&this.unexpected(Jn),this.checkExpressionErrors(_n,!0),this.yieldPos=zn||this.yieldPos,this.awaitPos=rr||this.awaitPos,Dt.length>1?(Ke=this.startNodeAt(dt,It),Ke.expressions=Dt,this.finishNodeAt(Ke,"SequenceExpression",pr,Xn)):Ke=Dt[0]}else Ke=this.parseParenExpression();if(this.options.preserveParens){var Qn=this.startNodeAt(Be,Fe);return Qn.expression=Ke,this.finishNode(Qn,"ParenthesizedExpression")}else return Ke},ct.parseParenItem=function(V){return V},ct.parseParenArrowList=function(V,se,Be,Fe){return this.parseArrowExpression(this.startNodeAt(V,se),Be,!1,Fe)};var on=[];ct.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var V=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===O.dot){var se=this.startNodeAt(V.start,V.loc&&V.loc.start);se.name="new",V.meta=this.finishNode(se,"Identifier"),this.next();var Be=this.containsEsc;return V.property=this.parseIdent(!0),V.property.name!=="target"&&this.raiseRecoverable(V.property.start,"The only valid meta property for new is 'new.target'"),Be&&this.raiseRecoverable(V.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(V.start,"'new.target' can only be used in functions and class static block"),this.finishNode(V,"MetaProperty")}var Fe=this.start,Ke=this.startLoc;return V.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Fe,Ke,!0,!1),this.eat(O.parenL)?V.arguments=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1):V.arguments=on,this.finishNode(V,"NewExpression")},ct.parseTemplateElement=function(V){var se=V.isTagged,Be=this.startNode();return this.type===O.invalidTemplate?(se||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),Be.value={raw:this.value.replace(/\r\n?/g,`
|
|
1194
1194
|
`),cooked:null}):Be.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
@@ -1425,4 +1425,4 @@ img.ProseMirror-separator {
|
|
|
1425
1425
|
\`\`\`json
|
|
1426
1426
|
${JSON.stringify(e,null,2)}
|
|
1427
1427
|
\`\`\`
|
|
1428
|
-
`:"",[t,e]);return n?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-center py-24",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t&&e.length===0?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-start pt-16",children:jsxRuntime.jsx(Card,{className:"w-full max-w-lg",children:jsxRuntime.jsxs(CardHeader,{className:"text-center items-center",children:[jsxRuntime.jsx("div",{className:"rounded-full border bg-muted p-3 mb-4",children:jsxRuntime.jsx(SearchX,{className:"h-8 w-8 text-muted-foreground"})}),jsxRuntime.jsx(CardTitle,{children:"No Results Found"}),jsxRuntime.jsxs(CardDescription,{children:['Your search for "',t,'" did not return any results. Please try a different search term.']})]})})}):e.length>0?jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[jsxRuntime.jsx("div",{className:"col-span-3 xl:col-span-2",children:o}),jsxRuntime.jsx("aside",{className:"col-span-1 block bg-white rounded-xl collapse xl:visible",children:jsxRuntime.jsx("div",{className:"sticky top-16",children:jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(AssistantInsight,{prompt:l,thinkingPlaceholderText:"Analyzing search results...",withCard:!1})})})})]}):null},colClasses={base:{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6"},sm:{1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},md:{1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6"},lg:{1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6"},xl:{1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",5:"xl:grid-cols-5",6:"xl:grid-cols-6"}},buildGridClassName=t=>{const e={base:1,md:2,...t};return["grid","gap-4",e.base?colClasses.base[e.base]:"",e.sm?colClasses.sm[e.sm]:"",e.md?colClasses.md[e.md]:"",e.lg?colClasses.lg[e.lg]:"",e.xl?colClasses.xl[e.xl]:""].filter(Boolean).join(" ")},SearchPageGrid=({results:t,groupBy:e,renderItem:n})=>{const o=e(t);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(o).map(([l,d])=>{const{items:f,gridCols:g}=d;if(f.length===0)return null;const b=buildGridClassName(g);return jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-4",children:l}),jsxRuntime.jsx("div",{className:b,children:f.map((S,_)=>n(S,_))})]},l)})})};var COLLAPSIBLE_NAME="Collapsible",[createCollapsibleContext,createCollapsibleScope]=createContextScope(COLLAPSIBLE_NAME),[CollapsibleProvider,useCollapsibleContext]=createCollapsibleContext(COLLAPSIBLE_NAME),Collapsible=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:o,defaultOpen:l,disabled:d,onOpenChange:f,...g}=t,[b,S]=useControllableState({prop:o,defaultProp:l??!1,onChange:f,caller:COLLAPSIBLE_NAME});return jsxRuntime.jsx(CollapsibleProvider,{scope:n,disabled:d,contentId:useId(),open:b,onOpenToggle:React__namespace.useCallback(()=>S(_=>!_),[S]),children:jsxRuntime.jsx(Primitive.div,{"data-state":getState$1(b),"data-disabled":d?"":void 0,...g,ref:e})})});Collapsible.displayName=COLLAPSIBLE_NAME;var TRIGGER_NAME$1="CollapsibleTrigger",CollapsibleTrigger=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,...o}=t,l=useCollapsibleContext(TRIGGER_NAME$1,n);return jsxRuntime.jsx(Primitive.button,{type:"button","aria-controls":l.contentId,"aria-expanded":l.open||!1,"data-state":getState$1(l.open),"data-disabled":l.disabled?"":void 0,disabled:l.disabled,...o,ref:e,onClick:composeEventHandlers(t.onClick,l.onOpenToggle)})});CollapsibleTrigger.displayName=TRIGGER_NAME$1;var CONTENT_NAME$1="CollapsibleContent",CollapsibleContent=React__namespace.forwardRef((t,e)=>{const{forceMount:n,...o}=t,l=useCollapsibleContext(CONTENT_NAME$1,t.__scopeCollapsible);return jsxRuntime.jsx(Presence,{present:n||l.open,children:({present:d})=>jsxRuntime.jsx(CollapsibleContentImpl,{...o,ref:e,present:d})})});CollapsibleContent.displayName=CONTENT_NAME$1;var CollapsibleContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:o,children:l,...d}=t,f=useCollapsibleContext(CONTENT_NAME$1,n),[g,b]=React__namespace.useState(o),S=React__namespace.useRef(null),_=useComposedRefs(e,S),R=React__namespace.useRef(0),C=R.current,E=React__namespace.useRef(0),A=E.current,M=f.open||g,I=React__namespace.useRef(M),j=React__namespace.useRef(void 0);return React__namespace.useEffect(()=>{const q=requestAnimationFrame(()=>I.current=!1);return()=>cancelAnimationFrame(q)},[]),useLayoutEffect2(()=>{const q=S.current;if(q){j.current=j.current||{transitionDuration:q.style.transitionDuration,animationName:q.style.animationName},q.style.transitionDuration="0s",q.style.animationName="none";const z=q.getBoundingClientRect();R.current=z.height,E.current=z.width,I.current||(q.style.transitionDuration=j.current.transitionDuration,q.style.animationName=j.current.animationName),b(o)}},[f.open,o]),jsxRuntime.jsx(Primitive.div,{"data-state":getState$1(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!M,...d,ref:_,style:{"--radix-collapsible-content-height":C?`${C}px`:void 0,"--radix-collapsible-content-width":A?`${A}px`:void 0,...t.style},children:M&&l})});function getState$1(t){return t?"open":"closed"}var Root=Collapsible,Trigger=CollapsibleTrigger,Content=CollapsibleContent,ACCORDION_NAME="Accordion",ACCORDION_KEYS=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Collection,useCollection,createCollectionScope]=createCollection(ACCORDION_NAME),[createAccordionContext,createAccordionScope]=createContextScope(ACCORDION_NAME,[createCollectionScope,createCollapsibleScope]),useCollapsibleScope=createCollapsibleScope(),Accordion$1=React.forwardRef((t,e)=>{const{type:n,...o}=t,l=o,d=o;return jsxRuntime.jsx(Collection.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?jsxRuntime.jsx(AccordionImplMultiple,{...d,ref:e}):jsxRuntime.jsx(AccordionImplSingle,{...l,ref:e})})});Accordion$1.displayName=ACCORDION_NAME;var[AccordionValueProvider,useAccordionValueContext]=createAccordionContext(ACCORDION_NAME),[AccordionCollapsibleProvider,useAccordionCollapsibleContext]=createAccordionContext(ACCORDION_NAME,{collapsible:!1}),AccordionImplSingle=React.forwardRef((t,e)=>{const{value:n,defaultValue:o,onValueChange:l=()=>{},collapsible:d=!1,...f}=t,[g,b]=useControllableState({prop:n,defaultProp:o??"",onChange:l,caller:ACCORDION_NAME});return jsxRuntime.jsx(AccordionValueProvider,{scope:t.__scopeAccordion,value:React.useMemo(()=>g?[g]:[],[g]),onItemOpen:b,onItemClose:React.useCallback(()=>d&&b(""),[d,b]),children:jsxRuntime.jsx(AccordionCollapsibleProvider,{scope:t.__scopeAccordion,collapsible:d,children:jsxRuntime.jsx(AccordionImpl,{...f,ref:e})})})}),AccordionImplMultiple=React.forwardRef((t,e)=>{const{value:n,defaultValue:o,onValueChange:l=()=>{},...d}=t,[f,g]=useControllableState({prop:n,defaultProp:o??[],onChange:l,caller:ACCORDION_NAME}),b=React.useCallback(_=>g((R=[])=>[...R,_]),[g]),S=React.useCallback(_=>g((R=[])=>R.filter(C=>C!==_)),[g]);return jsxRuntime.jsx(AccordionValueProvider,{scope:t.__scopeAccordion,value:f,onItemOpen:b,onItemClose:S,children:jsxRuntime.jsx(AccordionCollapsibleProvider,{scope:t.__scopeAccordion,collapsible:!0,children:jsxRuntime.jsx(AccordionImpl,{...d,ref:e})})})}),[AccordionImplProvider,useAccordionContext]=createAccordionContext(ACCORDION_NAME),AccordionImpl=React.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:o,dir:l,orientation:d="vertical",...f}=t,g=React.useRef(null),b=useComposedRefs(g,e),S=useCollection(n),R=useDirection(l)==="ltr",C=composeEventHandlers(t.onKeyDown,E=>{var ne;if(!ACCORDION_KEYS.includes(E.key))return;const A=E.target,M=S().filter(ae=>{var ge;return!((ge=ae.ref.current)!=null&&ge.disabled)}),I=M.findIndex(ae=>ae.ref.current===A),j=M.length;if(I===-1)return;E.preventDefault();let q=I;const z=0,Q=j-1,F=()=>{q=I+1,q>Q&&(q=z)},O=()=>{q=I-1,q<z&&(q=Q)};switch(E.key){case"Home":q=z;break;case"End":q=Q;break;case"ArrowRight":d==="horizontal"&&(R?F():O());break;case"ArrowDown":d==="vertical"&&F();break;case"ArrowLeft":d==="horizontal"&&(R?O():F());break;case"ArrowUp":d==="vertical"&&O();break}const te=q%j;(ne=M[te].ref.current)==null||ne.focus()});return jsxRuntime.jsx(AccordionImplProvider,{scope:n,disabled:o,direction:l,orientation:d,children:jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{...f,"data-orientation":d,ref:b,onKeyDown:o?void 0:C})})})}),ITEM_NAME="AccordionItem",[AccordionItemProvider,useAccordionItemContext]=createAccordionContext(ITEM_NAME),AccordionItem$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,value:o,...l}=t,d=useAccordionContext(ITEM_NAME,n),f=useAccordionValueContext(ITEM_NAME,n),g=useCollapsibleScope(n),b=useId(),S=o&&f.value.includes(o)||!1,_=d.disabled||t.disabled;return jsxRuntime.jsx(AccordionItemProvider,{scope:n,open:S,disabled:_,triggerId:b,children:jsxRuntime.jsx(Root,{"data-orientation":d.orientation,"data-state":getState(S),...g,...l,ref:e,disabled:_,open:S,onOpenChange:R=>{R?f.onItemOpen(o):f.onItemClose(o)}})})});AccordionItem$1.displayName=ITEM_NAME;var HEADER_NAME="AccordionHeader",AccordionHeader=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(HEADER_NAME,n);return jsxRuntime.jsx(Primitive.h3,{"data-orientation":l.orientation,"data-state":getState(d.open),"data-disabled":d.disabled?"":void 0,...o,ref:e})});AccordionHeader.displayName=HEADER_NAME;var TRIGGER_NAME="AccordionTrigger",AccordionTrigger$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(TRIGGER_NAME,n),f=useAccordionCollapsibleContext(TRIGGER_NAME,n),g=useCollapsibleScope(n);return jsxRuntime.jsx(Collection.ItemSlot,{scope:n,children:jsxRuntime.jsx(Trigger,{"aria-disabled":d.open&&!f.collapsible||void 0,"data-orientation":l.orientation,id:d.triggerId,...g,...o,ref:e})})});AccordionTrigger$1.displayName=TRIGGER_NAME;var CONTENT_NAME="AccordionContent",AccordionContent$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(CONTENT_NAME,n),f=useCollapsibleScope(n);return jsxRuntime.jsx(Content,{role:"region","aria-labelledby":d.triggerId,"data-orientation":l.orientation,...f,...o,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});AccordionContent$1.displayName=CONTENT_NAME;function getState(t){return t?"open":"closed"}var Root2=Accordion$1,Item=AccordionItem$1,Header=AccordionHeader,Trigger2=AccordionTrigger$1,Content2=AccordionContent$1;const Accordion=Root2,AccordionItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Item,{ref:n,className:cn("border-b",t),...e}));AccordionItem.displayName="AccordionItem";const AccordionTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsx(Header,{className:"flex",children:jsxRuntime.jsxs(Trigger2,{ref:o,className:cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",t),...n,children:[e,jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));AccordionTrigger.displayName=Trigger2.displayName;const AccordionContent=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsx(Content2,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:jsxRuntime.jsx("div",{className:cn("pb-4 pt-0",t),children:e})}));AccordionContent.displayName=Content2.displayName,exports.Accordion=Accordion,exports.AccordionContent=AccordionContent,exports.AccordionItem=AccordionItem,exports.AccordionTrigger=AccordionTrigger,exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.AreaChart=AreaChart,exports.AssistantChat=AssistantChat,exports.AssistantInsight=AssistantInsight,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.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,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.ExploreManufacturers=ExploreManufacturers,exports.ExternalProductCard=ExternalProductCard,exports.GeminiApiKeyProvider=GeminiApiKeyProvider,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.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.OpportunitiesTable=OpportunitiesTable,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.ReturnsTable=ReturnsTable,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.SearchPage=SearchPage,exports.SearchPageGrid=SearchPageGrid,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.TopPercentTreemap=TopPercentTreemap,exports.Topbar=Topbar,exports.Treemap=Treemap,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.formatMoney=formatMoney,exports.formatNumber=formatNumber,exports.formatYYYYMMDDIntToDateString=formatYYYYMMDDIntToDateString,exports.toast=toast,exports.useChat=useChat,exports.useGeminiApiKey=useGeminiApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1428
|
+
`:"",[t,e]);return n?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-center py-24",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t&&e.length===0?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-start pt-16",children:jsxRuntime.jsx(Card,{className:"w-full max-w-lg",children:jsxRuntime.jsxs(CardHeader,{className:"text-center items-center",children:[jsxRuntime.jsx("div",{className:"rounded-full border bg-muted p-3 mb-4",children:jsxRuntime.jsx(SearchX,{className:"h-8 w-8 text-muted-foreground"})}),jsxRuntime.jsx(CardTitle,{children:"No Results Found"}),jsxRuntime.jsxs(CardDescription,{children:['Your search for "',t,'" did not return any results. Please try a different search term.']})]})})}):e.length>0?jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[jsxRuntime.jsx("div",{className:"col-span-3 xl:col-span-2",children:o}),jsxRuntime.jsx("aside",{className:"col-span-1 block bg-white rounded-xl collapse xl:visible",children:jsxRuntime.jsx("div",{className:"sticky top-16",children:jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(AssistantInsight,{prompt:l,thinkingPlaceholderText:"Analyzing search results...",withCard:!1})})})})]}):null},colClasses={base:{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6"},sm:{1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},md:{1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6"},lg:{1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6"},xl:{1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",5:"xl:grid-cols-5",6:"xl:grid-cols-6"}},buildGridClassName=t=>{const e={base:1,md:2,...t};return["grid","gap-4",e.base?colClasses.base[e.base]:"",e.sm?colClasses.sm[e.sm]:"",e.md?colClasses.md[e.md]:"",e.lg?colClasses.lg[e.lg]:"",e.xl?colClasses.xl[e.xl]:""].filter(Boolean).join(" ")},SearchPageGrid=({results:t,groupBy:e,renderItem:n})=>{const o=e(t);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(o).map(([l,d])=>{const{items:f,gridCols:g}=d;if(f.length===0)return null;const b=buildGridClassName(g);return jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-4",children:l}),jsxRuntime.jsx("div",{className:b,children:f.map((S,_)=>n(S,_))})]},l)})})};var COLLAPSIBLE_NAME="Collapsible",[createCollapsibleContext,createCollapsibleScope]=createContextScope(COLLAPSIBLE_NAME),[CollapsibleProvider,useCollapsibleContext]=createCollapsibleContext(COLLAPSIBLE_NAME),Collapsible=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:o,defaultOpen:l,disabled:d,onOpenChange:f,...g}=t,[b,S]=useControllableState({prop:o,defaultProp:l??!1,onChange:f,caller:COLLAPSIBLE_NAME});return jsxRuntime.jsx(CollapsibleProvider,{scope:n,disabled:d,contentId:useId(),open:b,onOpenToggle:React__namespace.useCallback(()=>S(_=>!_),[S]),children:jsxRuntime.jsx(Primitive.div,{"data-state":getState$1(b),"data-disabled":d?"":void 0,...g,ref:e})})});Collapsible.displayName=COLLAPSIBLE_NAME;var TRIGGER_NAME$1="CollapsibleTrigger",CollapsibleTrigger=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,...o}=t,l=useCollapsibleContext(TRIGGER_NAME$1,n);return jsxRuntime.jsx(Primitive.button,{type:"button","aria-controls":l.contentId,"aria-expanded":l.open||!1,"data-state":getState$1(l.open),"data-disabled":l.disabled?"":void 0,disabled:l.disabled,...o,ref:e,onClick:composeEventHandlers(t.onClick,l.onOpenToggle)})});CollapsibleTrigger.displayName=TRIGGER_NAME$1;var CONTENT_NAME$1="CollapsibleContent",CollapsibleContent=React__namespace.forwardRef((t,e)=>{const{forceMount:n,...o}=t,l=useCollapsibleContext(CONTENT_NAME$1,t.__scopeCollapsible);return jsxRuntime.jsx(Presence,{present:n||l.open,children:({present:d})=>jsxRuntime.jsx(CollapsibleContentImpl,{...o,ref:e,present:d})})});CollapsibleContent.displayName=CONTENT_NAME$1;var CollapsibleContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:o,children:l,...d}=t,f=useCollapsibleContext(CONTENT_NAME$1,n),[g,b]=React__namespace.useState(o),S=React__namespace.useRef(null),_=useComposedRefs(e,S),R=React__namespace.useRef(0),C=R.current,E=React__namespace.useRef(0),A=E.current,M=f.open||g,I=React__namespace.useRef(M),j=React__namespace.useRef(void 0);return React__namespace.useEffect(()=>{const q=requestAnimationFrame(()=>I.current=!1);return()=>cancelAnimationFrame(q)},[]),useLayoutEffect2(()=>{const q=S.current;if(q){j.current=j.current||{transitionDuration:q.style.transitionDuration,animationName:q.style.animationName},q.style.transitionDuration="0s",q.style.animationName="none";const z=q.getBoundingClientRect();R.current=z.height,E.current=z.width,I.current||(q.style.transitionDuration=j.current.transitionDuration,q.style.animationName=j.current.animationName),b(o)}},[f.open,o]),jsxRuntime.jsx(Primitive.div,{"data-state":getState$1(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!M,...d,ref:_,style:{"--radix-collapsible-content-height":C?`${C}px`:void 0,"--radix-collapsible-content-width":A?`${A}px`:void 0,...t.style},children:M&&l})});function getState$1(t){return t?"open":"closed"}var Root=Collapsible,Trigger=CollapsibleTrigger,Content=CollapsibleContent,ACCORDION_NAME="Accordion",ACCORDION_KEYS=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Collection,useCollection,createCollectionScope]=createCollection(ACCORDION_NAME),[createAccordionContext,createAccordionScope]=createContextScope(ACCORDION_NAME,[createCollectionScope,createCollapsibleScope]),useCollapsibleScope=createCollapsibleScope(),Accordion$1=React.forwardRef((t,e)=>{const{type:n,...o}=t,l=o,d=o;return jsxRuntime.jsx(Collection.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?jsxRuntime.jsx(AccordionImplMultiple,{...d,ref:e}):jsxRuntime.jsx(AccordionImplSingle,{...l,ref:e})})});Accordion$1.displayName=ACCORDION_NAME;var[AccordionValueProvider,useAccordionValueContext]=createAccordionContext(ACCORDION_NAME),[AccordionCollapsibleProvider,useAccordionCollapsibleContext]=createAccordionContext(ACCORDION_NAME,{collapsible:!1}),AccordionImplSingle=React.forwardRef((t,e)=>{const{value:n,defaultValue:o,onValueChange:l=()=>{},collapsible:d=!1,...f}=t,[g,b]=useControllableState({prop:n,defaultProp:o??"",onChange:l,caller:ACCORDION_NAME});return jsxRuntime.jsx(AccordionValueProvider,{scope:t.__scopeAccordion,value:React.useMemo(()=>g?[g]:[],[g]),onItemOpen:b,onItemClose:React.useCallback(()=>d&&b(""),[d,b]),children:jsxRuntime.jsx(AccordionCollapsibleProvider,{scope:t.__scopeAccordion,collapsible:d,children:jsxRuntime.jsx(AccordionImpl,{...f,ref:e})})})}),AccordionImplMultiple=React.forwardRef((t,e)=>{const{value:n,defaultValue:o,onValueChange:l=()=>{},...d}=t,[f,g]=useControllableState({prop:n,defaultProp:o??[],onChange:l,caller:ACCORDION_NAME}),b=React.useCallback(_=>g((R=[])=>[...R,_]),[g]),S=React.useCallback(_=>g((R=[])=>R.filter(C=>C!==_)),[g]);return jsxRuntime.jsx(AccordionValueProvider,{scope:t.__scopeAccordion,value:f,onItemOpen:b,onItemClose:S,children:jsxRuntime.jsx(AccordionCollapsibleProvider,{scope:t.__scopeAccordion,collapsible:!0,children:jsxRuntime.jsx(AccordionImpl,{...d,ref:e})})})}),[AccordionImplProvider,useAccordionContext]=createAccordionContext(ACCORDION_NAME),AccordionImpl=React.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:o,dir:l,orientation:d="vertical",...f}=t,g=React.useRef(null),b=useComposedRefs(g,e),S=useCollection(n),R=useDirection(l)==="ltr",C=composeEventHandlers(t.onKeyDown,E=>{var ne;if(!ACCORDION_KEYS.includes(E.key))return;const A=E.target,M=S().filter(ae=>{var ge;return!((ge=ae.ref.current)!=null&&ge.disabled)}),I=M.findIndex(ae=>ae.ref.current===A),j=M.length;if(I===-1)return;E.preventDefault();let q=I;const z=0,Q=j-1,F=()=>{q=I+1,q>Q&&(q=z)},O=()=>{q=I-1,q<z&&(q=Q)};switch(E.key){case"Home":q=z;break;case"End":q=Q;break;case"ArrowRight":d==="horizontal"&&(R?F():O());break;case"ArrowDown":d==="vertical"&&F();break;case"ArrowLeft":d==="horizontal"&&(R?O():F());break;case"ArrowUp":d==="vertical"&&O();break}const te=q%j;(ne=M[te].ref.current)==null||ne.focus()});return jsxRuntime.jsx(AccordionImplProvider,{scope:n,disabled:o,direction:l,orientation:d,children:jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{...f,"data-orientation":d,ref:b,onKeyDown:o?void 0:C})})})}),ITEM_NAME="AccordionItem",[AccordionItemProvider,useAccordionItemContext]=createAccordionContext(ITEM_NAME),AccordionItem$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,value:o,...l}=t,d=useAccordionContext(ITEM_NAME,n),f=useAccordionValueContext(ITEM_NAME,n),g=useCollapsibleScope(n),b=useId(),S=o&&f.value.includes(o)||!1,_=d.disabled||t.disabled;return jsxRuntime.jsx(AccordionItemProvider,{scope:n,open:S,disabled:_,triggerId:b,children:jsxRuntime.jsx(Root,{"data-orientation":d.orientation,"data-state":getState(S),...g,...l,ref:e,disabled:_,open:S,onOpenChange:R=>{R?f.onItemOpen(o):f.onItemClose(o)}})})});AccordionItem$1.displayName=ITEM_NAME;var HEADER_NAME="AccordionHeader",AccordionHeader=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(HEADER_NAME,n);return jsxRuntime.jsx(Primitive.h3,{"data-orientation":l.orientation,"data-state":getState(d.open),"data-disabled":d.disabled?"":void 0,...o,ref:e})});AccordionHeader.displayName=HEADER_NAME;var TRIGGER_NAME="AccordionTrigger",AccordionTrigger$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(TRIGGER_NAME,n),f=useAccordionCollapsibleContext(TRIGGER_NAME,n),g=useCollapsibleScope(n);return jsxRuntime.jsx(Collection.ItemSlot,{scope:n,children:jsxRuntime.jsx(Trigger,{"aria-disabled":d.open&&!f.collapsible||void 0,"data-orientation":l.orientation,id:d.triggerId,...g,...o,ref:e})})});AccordionTrigger$1.displayName=TRIGGER_NAME;var CONTENT_NAME="AccordionContent",AccordionContent$1=React.forwardRef((t,e)=>{const{__scopeAccordion:n,...o}=t,l=useAccordionContext(ACCORDION_NAME,n),d=useAccordionItemContext(CONTENT_NAME,n),f=useCollapsibleScope(n);return jsxRuntime.jsx(Content,{role:"region","aria-labelledby":d.triggerId,"data-orientation":l.orientation,...f,...o,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});AccordionContent$1.displayName=CONTENT_NAME;function getState(t){return t?"open":"closed"}var Root2=Accordion$1,Item=AccordionItem$1,Header=AccordionHeader,Trigger2=AccordionTrigger$1,Content2=AccordionContent$1;const Accordion=Root2,AccordionItem=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Item,{ref:n,className:cn("border-b",t),...e}));AccordionItem.displayName="AccordionItem";const AccordionTrigger=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsx(Header,{className:"flex",children:jsxRuntime.jsxs(Trigger2,{ref:o,className:cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",t),...n,children:[e,jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));AccordionTrigger.displayName=Trigger2.displayName;const AccordionContent=React__namespace.forwardRef(({className:t,children:e,...n},o)=>jsxRuntime.jsx(Content2,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:jsxRuntime.jsx("div",{className:cn("pb-4 pt-0",t),children:e})}));AccordionContent.displayName=Content2.displayName,exports.Accordion=Accordion,exports.AccordionContent=AccordionContent,exports.AccordionItem=AccordionItem,exports.AccordionTrigger=AccordionTrigger,exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.AreaChart=AreaChart,exports.AssistantChat=AssistantChat,exports.AssistantInsight=AssistantInsight,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.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,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.ExploreManufacturers=ExploreManufacturers,exports.ExternalProductCard=ExternalProductCard,exports.GeminiApiKeyProvider=GeminiApiKeyProvider,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.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.OpportunitiesTable=OpportunitiesTable,exports.OrdersCard=OrdersCard,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.ReturnsTable=ReturnsTable,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.SearchPage=SearchPage,exports.SearchPageGrid=SearchPageGrid,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.TopPercentTreemap=TopPercentTreemap,exports.Topbar=Topbar,exports.Treemap=Treemap,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.formatMoney=formatMoney,exports.formatNumber=formatNumber,exports.formatYYYYMMDDIntToDateString=formatYYYYMMDDIntToDateString,exports.toast=toast,exports.useChat=useChat,exports.useGeminiApiKey=useGeminiApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|