randmarcomps 1.196.0 → 1.198.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.
@@ -370,7 +370,7 @@ declare interface IProps {
370
370
  userEmail: string;
371
371
  isSuperAdmin: boolean;
372
372
  reseller?: Reseller_2;
373
- withoutReports: boolean;
373
+ withoutReports?: boolean;
374
374
  }
375
375
 
376
376
  export declare function Label({ className, ...props }: React_2.ComponentProps<typeof LabelPrimitive.Root>): JSX.Element;
@@ -12924,7 +12924,7 @@ function MonthlySalesChart({
12924
12924
  }
12925
12925
  );
12926
12926
  }
12927
- function Reseller({ appID: e, reseller: t, readonly: n, payInvoicePath: o, userEmail: l, isSuperAdmin: d, withoutReports: f }) {
12927
+ function Reseller({ appID: e, reseller: t, readonly: n, payInvoicePath: o, userEmail: l, isSuperAdmin: d, withoutReports: f = !1 }) {
12928
12928
  var q;
12929
12929
  const {
12930
12930
  data: g,
@@ -63971,7 +63971,7 @@ function ManufacturerGetStartedButton({ applicationId: e, manufacturer: t }) {
63971
63971
  `);
63972
63972
  M(!0), Le({
63973
63973
  applicationId: e,
63974
- partnerId: "2",
63974
+ partnerId: t.ManufactuerId,
63975
63975
  message: st
63976
63976
  }).then((Fe) => {
63977
63977
  var Qe;
@@ -366,7 +366,7 @@ Hook ${g} was either not provided or not a function.`)}return{name:reactHooksMod
366
366
  * LICENSE file in the root directory of this source tree.
367
367
  */var hasRequiredReactIs_development$2;function requireReactIs_development$2(){return hasRequiredReactIs_development$2||(hasRequiredReactIs_development$2=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,l=e?Symbol.for("react.strict_mode"):60108,d=e?Symbol.for("react.profiler"):60114,f=e?Symbol.for("react.provider"):60109,g=e?Symbol.for("react.context"):60110,b=e?Symbol.for("react.async_mode"):60111,_=e?Symbol.for("react.concurrent_mode"):60111,S=e?Symbol.for("react.forward_ref"):60112,R=e?Symbol.for("react.suspense"):60113,C=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,M=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,A=e?Symbol.for("react.fundamental"):60117,V=e?Symbol.for("react.responder"):60118,q=e?Symbol.for("react.scope"):60119;function z(Fe){return typeof Fe=="string"||typeof Fe=="function"||Fe===o||Fe===_||Fe===d||Fe===l||Fe===R||Fe===C||typeof Fe=="object"&&Fe!==null&&(Fe.$$typeof===M||Fe.$$typeof===E||Fe.$$typeof===f||Fe.$$typeof===g||Fe.$$typeof===S||Fe.$$typeof===A||Fe.$$typeof===V||Fe.$$typeof===q||Fe.$$typeof===I)}function Q(Fe){if(typeof Fe=="object"&&Fe!==null){var ct=Fe.$$typeof;switch(ct){case t:var Qe=Fe.type;switch(Qe){case b:case _:case o:case d:case l:case R:return Qe;default:var nt=Qe&&Qe.$$typeof;switch(nt){case g:case S:case M:case E:case f:return nt;default:return ct}}case n:return ct}}}var F=b,O=_,te=g,ae=f,ie=t,oe=S,se=o,Ae=M,Ne=E,ge=n,Oe=d,Le=l,Ge=R,je=!1;function Be(Fe){return je||(je=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),qe(Fe)||Q(Fe)===b}function qe(Fe){return Q(Fe)===_}function ze(Fe){return Q(Fe)===g}function Ue(Fe){return Q(Fe)===f}function Xe(Fe){return typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===t}function Je(Fe){return Q(Fe)===S}function Ye(Fe){return Q(Fe)===o}function it(Fe){return Q(Fe)===M}function Ke(Fe){return Q(Fe)===E}function et(Fe){return Q(Fe)===n}function Ze(Fe){return Q(Fe)===d}function tt(Fe){return Q(Fe)===l}function st(Fe){return Q(Fe)===R}reactIs_development$2.AsyncMode=F,reactIs_development$2.ConcurrentMode=O,reactIs_development$2.ContextConsumer=te,reactIs_development$2.ContextProvider=ae,reactIs_development$2.Element=ie,reactIs_development$2.ForwardRef=oe,reactIs_development$2.Fragment=se,reactIs_development$2.Lazy=Ae,reactIs_development$2.Memo=Ne,reactIs_development$2.Portal=ge,reactIs_development$2.Profiler=Oe,reactIs_development$2.StrictMode=Le,reactIs_development$2.Suspense=Ge,reactIs_development$2.isAsyncMode=Be,reactIs_development$2.isConcurrentMode=qe,reactIs_development$2.isContextConsumer=ze,reactIs_development$2.isContextProvider=Ue,reactIs_development$2.isElement=Xe,reactIs_development$2.isForwardRef=Je,reactIs_development$2.isFragment=Ye,reactIs_development$2.isLazy=it,reactIs_development$2.isMemo=Ke,reactIs_development$2.isPortal=et,reactIs_development$2.isProfiler=Ze,reactIs_development$2.isStrictMode=tt,reactIs_development$2.isSuspense=st,reactIs_development$2.isValidElementType=z,reactIs_development$2.typeOf=Q}()),reactIs_development$2}var hasRequiredReactIs$2;function requireReactIs$2(){return hasRequiredReactIs$2||(hasRequiredReactIs$2=1,process.env.NODE_ENV==="production"?reactIs$2.exports=requireReactIs_production_min$2():reactIs$2.exports=requireReactIs_development$2()),reactIs$2.exports}var hoistNonReactStatics_cjs,hasRequiredHoistNonReactStatics_cjs;function requireHoistNonReactStatics_cjs(){if(hasRequiredHoistNonReactStatics_cjs)return hoistNonReactStatics_cjs;hasRequiredHoistNonReactStatics_cjs=1;var e=requireReactIs$2(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},d={};d[e.ForwardRef]=o,d[e.Memo]=l;function f(M){return e.isMemo(M)?l:d[M.$$typeof]||t}var g=Object.defineProperty,b=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols,S=Object.getOwnPropertyDescriptor,R=Object.getPrototypeOf,C=Object.prototype;function E(M,I,A){if(typeof I!="string"){if(C){var V=R(I);V&&V!==C&&E(M,V,A)}var q=b(I);_&&(q=q.concat(_(I)));for(var z=f(M),Q=f(I),F=0;F<q.length;++F){var O=q[F];if(!n[O]&&!(A&&A[O])&&!(Q&&Q[O])&&!(z&&z[O])){var te=S(I,O);try{g(M,O,te)}catch{}}}}return M}return hoistNonReactStatics_cjs=E,hoistNonReactStatics_cjs}requireHoistNonReactStatics_cjs();var IntlContext=typeof window<"u"&&!window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__?window.__REACT_INTL_CONTEXT__||(window.__REACT_INTL_CONTEXT__=React__namespace.createContext(null)):React__namespace.createContext(null);IntlContext.Consumer,IntlContext.Provider;var Context=IntlContext;function useIntl(){var e=React__namespace.useContext(Context);return invariantIntlContext(e),e}var DisplayName;(function(e){e.formatDate="FormattedDate",e.formatTime="FormattedTime",e.formatNumber="FormattedNumber",e.formatList="FormattedList",e.formatDisplayName="FormattedDisplayName"})(DisplayName||(DisplayName={}));var DisplayNameParts;(function(e){e.formatDate="FormattedDateParts",e.formatTime="FormattedTimeParts",e.formatNumber="FormattedNumberParts",e.formatList="FormattedListParts"})(DisplayNameParts||(DisplayNameParts={}));function createFormattedDateTimePartsComponent(e){var t=function(n){var o=useIntl(),l=n.value,d=n.children,f=__rest(n,["value","children"]),g=typeof l=="string"?new Date(l||0):l,b=e==="formatDate"?o.formatDateToParts(g,f):o.formatTimeToParts(g,f);return d(b)};return t.displayName=DisplayNameParts[e],t}function createFormattedComponent(e){var t=function(n){var o=useIntl(),l=n.value,d=n.children,f=__rest(n,["value","children"]),g=o[e](l,f);if(typeof d=="function")return d(g);var b=o.textComponent||React__namespace.Fragment;return React__namespace.createElement(b,null,g)};return t.displayName=DisplayName[e],t}createFormattedComponent("formatDate"),createFormattedComponent("formatTime");var FormattedNumber=createFormattedComponent("formatNumber");createFormattedComponent("formatList"),createFormattedComponent("formatDisplayName"),createFormattedDateTimePartsComponent("formatDate"),createFormattedDateTimePartsComponent("formatTime");function BillingCard({readonly:e,reseller:t,isLoading:n,payInvoicePath:o}){const l=reactRouterDom.useNavigate(),{Statement:d,CreditLimit:f}=t,g=[{label:"0 - 30 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(d==null?void 0:d.Over0)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:Calendar},{label:"31 - 45 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(d==null?void 0:d.Over30)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarDays},{label:"45+ Days",value:jsxRuntime.jsx(FormattedNumber,{value:(d==null?void 0:d.Over45)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarRange},{label:"Total",value:jsxRuntime.jsx(FormattedNumber,{value:(d==null?void 0:d.Total)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:DollarSign},{label:"Credit Limit",value:jsxRuntime.jsx(FormattedNumber,{value:f||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CreditCard}];return n?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(b=>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"})]},b))}),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(b=>jsxRuntime.jsx("div",{className:b===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"})]})},b))})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-28 mt-6"})})]})]}):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:g.slice(0,3).map((b,_)=>jsxRuntime.jsx(BillingItem,{icon:b.icon,label:b.label,value:b.value},_))}),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:g.slice(3).map((b,_)=>jsxRuntime.jsx("div",{className:_===1?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsx(BillingItem,{icon:b.icon,label:b.label,value:b.value})},_))})]}),jsxRuntime.jsx("div",{className:e?"hidden":"flex justify-end",children:jsxRuntime.jsx(Button,{disabled:e||!o,className:"mt-6",onClick:()=>l(o),children:"Pay Invoices"})})]})]})}function BillingItem({icon:e,label:t,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(e,{className:"size-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t})]}),jsxRuntime.jsx("span",{className:"text-base font-semibold ms-auto",children:n})]})}function ChangePricingTierModal({open:e,setOpen:t,tier:n,onTierChange:o,isLoading:l}){const d=()=>{t(!1)};return jsxRuntime.jsx(Dialog,{open:e,onOpenChange:t,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=e=>e===1?"The Best":e===2?"Fixed 12.5% GP on all items":e===3?"Advantageous":e===4?"Buying Group":e===5?"Cost":e,getShippingText=e=>e==="A"?"Free or Custom":e==="B"?"Fixed $10 anywhere":e==="C"?`Free shipping on $150+ orders to your location,
368
368
  $15 for drop shipped orders under $1,500,
369
- $10 with opportunities under $1,000`:e==="D"?"$15 under $1,500":e==="E"?"Full shipping charges":e,getTermsText=e=>e==="STRIPE"?"Credit card payment":e==="NET30"?"Net 30 days":e,AccountTier=({isSuperAdmin:e,readonly:t,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=ge=>ge&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[ge]||"",E=ge=>ge&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[ge]||"",M=ge=>ge&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[ge]||"",[I,A]=React.useState(C((n==null?void 0:n.Priority)??"")),[V,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(M(n==null?void 0:n.PriceProfile)),F=ge=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[ge]||ge,O=ge=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[ge]||ge,te=ge=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[ge]||ge;React.useEffect(()=>{A(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(M(n==null?void 0:n.PriceProfile))},[n]);const ae=async ge=>{A(ge);const Oe=F(ge);try{(await S({applicationId:o,fieldName:"Priority",newValue:Oe})).error?d({title:"Error",description:"Failed to update priority",variant:"destructive"}):d({title:"Success",description:`Priority updated to ${Oe}`,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},ie=async ge=>{q(ge);const Oe=O(ge);try{(await S({applicationId:o,fieldName:"ShippingProfile",newValue:Oe})).error?d({title:"Error",description:"Failed to update shipping profile",variant:"destructive"}):d({title:"Success",description:`Shipping profile updated to ${Oe}`,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},oe=async ge=>{Q(ge);const Oe=te(ge);try{(await S({applicationId:o,fieldName:"PriceProfile",newValue:Oe})).error?d({title:"Error",description:"Failed to update pricing profile",variant:"destructive"}):d({title:"Success",description:`Pricing profile updated to ${Oe}`,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},se=async()=>{try{const ge=await S({applicationId:o,fieldName:"Tier",newValue:b});ge.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):ge.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),_("")}},Ae=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:e}],Ne=ge=>{_(ge),g(!0)};return l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs(Card,{className:"md:col-span-2 xl:col-span-1 md:max-w-xl xl:max-w-[unset]",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(ge=>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"})]})]},ge))}),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:"md:col-span-2 xl:col-span-1 md:max-w-xl xl:max-w-[unset]",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:[jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs("a",{href:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",rel:"noreferrer",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:t,className:t?"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"}),Ae.map(ge=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!ge.enabled,onClick:()=>Ne(ge.name),children:ge.name},ge.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:se}),e&&!t&&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:I,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(ge=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:ge.value,id:`priority-${ge.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${ge.value}`,className:"cursor-pointer text-xs",children:ge.label})]},ge.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:V,onValueChange:ie,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(ge=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:ge.value,id:`shipping-${ge.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${ge.value}`,className:"cursor-pointer text-xs",children:ge.label})]},ge.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(ge=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:ge.value,id:`pricing-${ge.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${ge.value}`,className:"cursor-pointer text-xs",children:ge.label})]},ge.value))})]})]})})]})]})};function OrderCategories({openOrders:e=[],isLoading:t=!1}){const n=(e==null?void 0:e.filter(I=>I.DocumentType==="Order"))||[],o=(e==null?void 0:e.filter(I=>I.DocumentType==="Shipment"))||[],l=n.filter(I=>I.WarehouseCode!=="3PLE"),d=l.reduce((I,A)=>I+(A.Quantity??0),0),f=l.reduce((I,A)=>I+(A.ExtendedPrice??0),0),g=n.filter(I=>I.WarehouseCode==="3PLE"),b=g.reduce((I,A)=>I+(A.Quantity??0),0),_=g.reduce((I,A)=>I+(A.ExtendedPrice??0),0),S=o.reduce((I,A)=>I+(A.Quantity??0),0),R=o.reduce((I,A)=>I+(A.ExtendedPrice??0),0),C=d+b+S,E=f+_+R,M=[{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:S,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:_}];return t?jsxRuntime.jsxs(Card,{className:"w-full md:col-span-2 xl:col-span-1",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(I=>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"})]})]})]})]})},I))})})]}):jsxRuntime.jsxs(Card,{className:"w-full md:col-span-2 xl:col-span-1",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:M.map(I=>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:`${I.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:I.name}),jsxRuntime.jsx("div",{className:`${I.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(I.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:I.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:I.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},I.name))})})]})}function LongMonthName(e){if(!e)return;const t=["","January","February","March","April","May","June","July","August","September","October","November","December"];return e===void 0&&(e=new Date().getMonth()+1),e<1&&(e=12+e),t[e]}function SalesSummary({fiscalYearMonthStart:e,salesData:t,isLoading:n}){const o=(t==null?void 0:t.SalesLast30Days)??0,l=(t==null?void 0:t.SalesLast3Months)??0,d=(t==null?void 0:t.SalesYearToDay)??0,f=LongMonthName(e);return n?jsxRuntime.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 mb-4",children:[jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]}),jsxRuntime.jsxs(Card,{className:"col-span-2 lg:col-span-1",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-36"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]})]}):jsxRuntime.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 mb-4",children:[jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(CardTitle,{className:"text-sm font-medium",children:"Last 30 Days"}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(TrendingUp,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:o,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(CardTitle,{className:"text-sm font-medium",children:"Last 3 Months"}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(Calendar,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:l,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]}),f&&jsxRuntime.jsxs(Card,{className:"col-span-2 lg:col-span-1",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsxs(CardTitle,{className:"text-sm font-medium",children:["Year to Date (",f,")"]}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(CalendarDays,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:d,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]})]})}function ReportsSection({isLoading:e,userEmail:t,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:_}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[S,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[M,{isLoading:I}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[A,V]=React.useState(null),[q,z]=React.useState(t),[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 oe=>{V(oe),F(!0)},ae=async()=>{if(!(!A||!n))try{switch(A.id){case"Products":await S({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 M({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${A.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(oe){console.error("Error requesting report:",oe),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},ie=_||R||g||d||I||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:e?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(oe=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(se=>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"})]},se))]},oe))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:O.map(oe=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:oe.name}),oe.reports.map(se=>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(se.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:se.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:se.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(se),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},se.id))]},oe.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",A==null?void 0:A.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:oe=>z(oe.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:ae,disabled:!q||ie,children:ie?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function UnsavedChangesDialog({isOpen:e,onClose:t,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:e,onOpenChange:t,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:t,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(e){const[t,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return e()&&_},[e]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(e())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[e]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:t,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[t,d,l]);return{showDialog:t,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}function MonthlySalesChart({salesData:e,chartHeight:t=300,units:n="$",unitsPosition:o="left",className:l,extrapolate:d=!0}){const[f,g]=React.useState([]);return React.useEffect(()=>{if(!e||e.length===0){g([]);return}const b=e.reduce((V,q)=>{const z=q.Day??0,Q=Math.floor(z).toString();if(Q.length!==8||isNaN(parseInt(Q)))return console.warn(`Skipping invalid Day format: ${q.Day}`),V;const F=Q.substring(0,4),O=Q.substring(4,6),te=`${F}-${O}`;return V[te]=(V[te]||0)+(q.ExtendedPrice??0),V},{}),_=Object.keys(b).sort(),S=new Date,R=S.getFullYear(),C=S.getMonth(),E=S.getDate(),M=`${R}-${(C+1).toString().padStart(2,"0")}`,I={...b};if(d&&_.length>0&&_[_.length-1]===M){const V=I[M],q=new Date(R,C+1,0).getDate();if(E<q&&E>0){const Q=V/E*q;I[M]=Q}}const A=_.map(V=>{const q=I[V],[z,Q]=V.split("-").map(Number);return{month:new Date(z,Q-1).toLocaleString("default",{month:"short",year:"numeric"}),sales:q}});g(A)},[e,d]),f.length===0?jsxRuntime.jsx("div",{className:l||"p-4 text-center text-muted-foreground",children:"No monthly sales data to display."}):jsxRuntime.jsx(AreaChart,{data:f,units:n,unitsPosition:o,height:t,className:l})}function Reseller({appID:e,reseller:t,readonly:n,payInvoicePath:o,userEmail:l,isSuperAdmin:d,withoutReports:f}){var q;const{data:g,isLoading:b,isError:_}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:e??"",withSpecification:!0},{skip:!!t}),[S,R]=React.useState(!0),[C,E]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),M=React.useCallback(()=>C.publicInfo.hasUnsavedChanges,[C]),I=React.useCallback((z,Q)=>{E(F=>{var O;return((O=F[z])==null?void 0:O.hasUnsavedChanges)!==Q.hasUnsavedChanges?(console.log(`Updating form state for ${z}:`,Q.hasUnsavedChanges),{...F,[z]:Q}):F})},[]),{NavigationGuardDialog:A}=useRouterNavigationGuard(M),V=t??g;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:_?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:(V==null?void 0:V.FiscalYearMonthStart)||1,salesData:V==null?void 0:V.SalesData,isLoading:b}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsx(OrderCategories,{openOrders:(V==null?void 0:V.ActiveOrderDetails)??[],isLoading:b}),jsxRuntime.jsx(BillingCard,{readonly:n,reseller:V||{},payInvoicePath:o,isLoading:b}),jsxRuntime.jsx(PublicInfo,{reseller:V||{},appID:e??"",isLoading:b,readonly:n,onUnsavedChanges:z=>I("publicInfo",{hasUnsavedChanges:z})})]}),jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Sales"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(MonthlySalesChart,{salesData:(V==null?void 0:V.SalesStatistics)??[],extrapolate:S}),jsxRuntime.jsxs("div",{className:"flex space-x-2 my-1",children:[jsxRuntime.jsx(Switch,{checked:S,onCheckedChange:R,id:"extrapolate-switch"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate"})]}),S?jsxRuntime.jsx("p",{className:"text-sm",children:"*Sales for the current month are projected, not actual."}):jsxRuntime.jsx(jsxRuntime.Fragment,{})]})]}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:d,readonly:n,reseller:V||{},appID:e??"",isLoading:b})]})]}),jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Brands you are qualified for"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("p",{children:"This module is under construction."}),jsxRuntime.jsx("ul",{children:(q=V==null?void 0:V.Qualifications)==null?void 0:q.map(z=>jsxRuntime.jsx("li",{children:z.ManufacturerId}))})]})]}),!f&&jsxRuntime.jsx(ReportsSection,{appID:e,userEmail:l,isLoading:b})]})}),jsxRuntime.jsx(A,{})]})}function composeEventHandlers(e,t,{checkForDefaultPrevented:n=!0}={}){return function(l){if(e==null||e(l),n===!1||!l.defaultPrevented)return t==null?void 0:t(l)}}function setRef(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function composeRefs(...e){return t=>{let n=!1;const o=e.map(l=>{const d=setRef(l,t);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let l=0;l<o.length;l++){const d=o[l];typeof d=="function"?d():setRef(e[l],null)}}}}function useComposedRefs(...e){return React__namespace.useCallback(composeRefs(...e),e)}function createContext2(e,t){const n=React__namespace.createContext(t),o=d=>{const{children:f,...g}=d,b=React__namespace.useMemo(()=>g,Object.values(g));return jsxRuntime.jsx(n.Provider,{value:b,children:f})};o.displayName=e+"Provider";function l(d){const f=React__namespace.useContext(n);if(f)return f;if(t!==void 0)return t;throw new Error(`\`${d}\` must be used within \`${e}\``)}return[o,l]}function createContextScope(e,t=[]){let n=[];function o(d,f){const g=React__namespace.createContext(f),b=n.length;n=[...n,f];const _=R=>{var V;const{scope:C,children:E,...M}=R,I=((V=C==null?void 0:C[e])==null?void 0:V[b])||g,A=React__namespace.useMemo(()=>M,Object.values(M));return jsxRuntime.jsx(I.Provider,{value:A,children:E})};_.displayName=d+"Provider";function S(R,C){var I;const E=((I=C==null?void 0:C[e])==null?void 0:I[b])||g,M=React__namespace.useContext(E);if(M)return M;if(f!==void 0)return f;throw new Error(`\`${R}\` must be used within \`${d}\``)}return[_,S]}const l=()=>{const d=n.map(f=>React__namespace.createContext(f));return function(g){const b=(g==null?void 0:g[e])||d;return React__namespace.useMemo(()=>({[`__scope${e}`]:{...g,[e]:b}}),[g,b])}};return l.scopeName=e,[o,composeContextScopes(l,...t)]}function composeContextScopes(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(d){const f=o.reduce((g,{useScope:b,scopeName:_})=>{const R=b(d)[`__scope${_}`];return{...g,...R}},{});return React__namespace.useMemo(()=>({[`__scope${t.scopeName}`]:f}),[f])}};return n.scopeName=t.scopeName,n}function createSlot$1(e){const t=createSlotClone$1(e),n=React__namespace.forwardRef((o,l)=>{const{children:d,...f}=o,g=React__namespace.Children.toArray(d),b=g.find(isSlottable$1);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(t,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(t,{...f,ref:l,children:d})});return n.displayName=`${e}.Slot`,n}function createSlotClone$1(e){const t=React__namespace.forwardRef((n,o)=>{const{children:l,...d}=n,f=React__namespace.isValidElement(l)?getElementRef$2(l):void 0,g=useComposedRefs(f,o);if(React__namespace.isValidElement(l)){const b=mergeProps$1(d,l.props);return l.type!==React__namespace.Fragment&&(b.ref=g),React__namespace.cloneElement(l,b)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var SLOTTABLE_IDENTIFIER$1=Symbol("radix.slottable");function isSlottable$1(e){return React__namespace.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===SLOTTABLE_IDENTIFIER$1}function mergeProps$1(e,t){const n={...t};for(const o in t){const l=e[o],d=t[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{const b=d(...g);return l(...g),b}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...e,...n}}function getElementRef$2(e){var o,l;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var NODES$1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Primitive$1=NODES$1.reduce((e,t)=>{const n=createSlot$1(`Primitive.${t}`),o=React__namespace.forwardRef((l,d)=>{const{asChild:f,...g}=l,b=f?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntime.jsx(b,{...g,ref:d})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function createCollection$1(e){const t=e+"CollectionProvider",[n,o]=createContextScope(t),[l,d]=n(t,{collectionRef:{current:null},itemMap:new Map}),f=I=>{const{scope:A,children:V}=I,q=React.useRef(null),z=React.useRef(new Map).current;return jsxRuntime.jsx(l,{scope:A,itemMap:z,collectionRef:q,children:V})};f.displayName=t;const g=e+"CollectionSlot",b=createSlot$1(g),_=React.forwardRef((I,A)=>{const{scope:V,children:q}=I,z=d(g,V),Q=useComposedRefs(A,z.collectionRef);return jsxRuntime.jsx(b,{ref:Q,children:q})});_.displayName=g;const S=e+"CollectionItemSlot",R="data-radix-collection-item",C=createSlot$1(S),E=React.forwardRef((I,A)=>{const{scope:V,children:q,...z}=I,Q=React.useRef(null),F=useComposedRefs(A,Q),O=d(S,V);return React.useEffect(()=>(O.itemMap.set(Q,{ref:Q,...z}),()=>void O.itemMap.delete(Q))),jsxRuntime.jsx(C,{[R]:"",ref:F,children:q})});E.displayName=S;function M(I){const A=d(e+"CollectionConsumer",I);return React.useCallback(()=>{const q=A.collectionRef.current;if(!q)return[];const z=Array.from(q.querySelectorAll(`[${R}]`));return Array.from(A.itemMap.values()).sort((O,te)=>z.indexOf(O.ref.current)-z.indexOf(te.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:f,Slot:_,ItemSlot:E},M,o]}var useLayoutEffect2=globalThis!=null&&globalThis.document?React__namespace.useLayoutEffect:()=>{},useReactId=React__namespace[" useId ".trim().toString()]||(()=>{}),count$2=0;function useId(e){const[t,n]=React__namespace.useState(useReactId());return useLayoutEffect2(()=>{n(o=>o??String(count$2++))},[e]),t?`radix-${t}`:""}function useCallbackRef$1(e){const t=React__namespace.useRef(e);return React__namespace.useEffect(()=>{t.current=e}),React__namespace.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}var useInsertionEffect=React__namespace[" useInsertionEffect ".trim().toString()]||useLayoutEffect2;function useControllableState({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[l,d,f]=useUncontrolledState({defaultProp:t,onChange:n}),g=e!==void 0,b=g?e:l;{const S=React__namespace.useRef(e!==void 0);React__namespace.useEffect(()=>{const R=S.current;R!==g&&console.warn(`${o} is changing from ${R?"controlled":"uncontrolled"} to ${g?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),S.current=g},[g,o])}const _=React__namespace.useCallback(S=>{var R;if(g){const C=isFunction$1(S)?S(e):S;C!==e&&((R=f.current)==null||R.call(f,C))}else d(S)},[g,e,d,f]);return[b,_]}function useUncontrolledState({defaultProp:e,onChange:t}){const[n,o]=React__namespace.useState(e),l=React__namespace.useRef(n),d=React__namespace.useRef(t);return useInsertionEffect(()=>{d.current=t},[t]),React__namespace.useEffect(()=>{var f;l.current!==n&&((f=d.current)==null||f.call(d,n),l.current=n)},[n,l]),[n,o,d]}function isFunction$1(e){return typeof e=="function"}var DirectionContext=React__namespace.createContext(void 0);function useDirection(e){const t=React__namespace.useContext(DirectionContext);return e||t||"ltr"}var ENTRY_FOCUS$1="rovingFocusGroup.onEntryFocus",EVENT_OPTIONS$2={bubbles:!1,cancelable:!0},GROUP_NAME$4="RovingFocusGroup",[Collection$4,useCollection$4,createCollectionScope$4]=createCollection$1(GROUP_NAME$4),[createRovingFocusGroupContext$1,createRovingFocusGroupScope$1]=createContextScope(GROUP_NAME$4,[createCollectionScope$4]),[RovingFocusProvider$1,useRovingFocusContext$1]=createRovingFocusGroupContext$1(GROUP_NAME$4),RovingFocusGroup$1=React__namespace.forwardRef((e,t)=>jsxRuntime.jsx(Collection$4.Provider,{scope:e.__scopeRovingFocusGroup,children:jsxRuntime.jsx(Collection$4.Slot,{scope:e.__scopeRovingFocusGroup,children:jsxRuntime.jsx(RovingFocusGroupImpl$1,{...e,ref:t})})}));RovingFocusGroup$1.displayName=GROUP_NAME$4;var RovingFocusGroupImpl$1=React__namespace.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:l=!1,dir:d,currentTabStopId:f,defaultCurrentTabStopId:g,onCurrentTabStopIdChange:b,onEntryFocus:_,preventScrollOnEntryFocus:S=!1,...R}=e,C=React__namespace.useRef(null),E=useComposedRefs(t,C),M=useDirection(d),[I,A]=useControllableState({prop:f,defaultProp:g??null,onChange:b,caller:GROUP_NAME$4}),[V,q]=React__namespace.useState(!1),z=useCallbackRef$1(_),Q=useCollection$4(n),F=React__namespace.useRef(!1),[O,te]=React__namespace.useState(0);return React__namespace.useEffect(()=>{const ae=C.current;if(ae)return ae.addEventListener(ENTRY_FOCUS$1,z),()=>ae.removeEventListener(ENTRY_FOCUS$1,z)},[z]),jsxRuntime.jsx(RovingFocusProvider$1,{scope:n,orientation:o,dir:M,loop:l,currentTabStopId:I,onItemFocus:React__namespace.useCallback(ae=>A(ae),[A]),onItemShiftTab:React__namespace.useCallback(()=>q(!0),[]),onFocusableItemAdd:React__namespace.useCallback(()=>te(ae=>ae+1),[]),onFocusableItemRemove:React__namespace.useCallback(()=>te(ae=>ae-1),[]),children:jsxRuntime.jsx(Primitive$1.div,{tabIndex:V||O===0?-1:0,"data-orientation":o,...R,ref:E,style:{outline:"none",...e.style},onMouseDown:composeEventHandlers(e.onMouseDown,()=>{F.current=!0}),onFocus:composeEventHandlers(e.onFocus,ae=>{const ie=!F.current;if(ae.target===ae.currentTarget&&ie&&!V){const oe=new CustomEvent(ENTRY_FOCUS$1,EVENT_OPTIONS$2);if(ae.currentTarget.dispatchEvent(oe),!oe.defaultPrevented){const se=Q().filter(Le=>Le.focusable),Ae=se.find(Le=>Le.active),Ne=se.find(Le=>Le.id===I),Oe=[Ae,Ne,...se].filter(Boolean).map(Le=>Le.ref.current);focusFirst$4(Oe,S)}}F.current=!1}),onBlur:composeEventHandlers(e.onBlur,()=>q(!1))})})}),ITEM_NAME$5="RovingFocusGroupItem",RovingFocusGroupItem$1=React__namespace.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:l=!1,tabStopId:d,children:f,...g}=e,b=useId(),_=d||b,S=useRovingFocusContext$1(ITEM_NAME$5,n),R=S.currentTabStopId===_,C=useCollection$4(n),{onFocusableItemAdd:E,onFocusableItemRemove:M,currentTabStopId:I}=S;return React__namespace.useEffect(()=>{if(o)return E(),()=>M()},[o,E,M]),jsxRuntime.jsx(Collection$4.ItemSlot,{scope:n,id:_,focusable:o,active:l,children:jsxRuntime.jsx(Primitive$1.span,{tabIndex:R?0:-1,"data-orientation":S.orientation,...g,ref:t,onMouseDown:composeEventHandlers(e.onMouseDown,A=>{o?S.onItemFocus(_):A.preventDefault()}),onFocus:composeEventHandlers(e.onFocus,()=>S.onItemFocus(_)),onKeyDown:composeEventHandlers(e.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){S.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const V=getFocusIntent$1(A,S.orientation,S.dir);if(V!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let z=C().filter(Q=>Q.focusable).map(Q=>Q.ref.current);if(V==="last")z.reverse();else if(V==="prev"||V==="next"){V==="prev"&&z.reverse();const Q=z.indexOf(A.currentTarget);z=S.loop?wrapArray$3(z,Q+1):z.slice(Q+1)}setTimeout(()=>focusFirst$4(z))}}),children:typeof f=="function"?f({isCurrentTabStop:R,hasTabStop:I!=null}):f})})});RovingFocusGroupItem$1.displayName=ITEM_NAME$5;var MAP_KEY_TO_FOCUS_INTENT$1={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function getDirectionAwareKey$1(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function getFocusIntent$1(e,t,n){const o=getDirectionAwareKey$1(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return MAP_KEY_TO_FOCUS_INTENT$1[o]}function focusFirst$4(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function wrapArray$3(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Root$b=RovingFocusGroup$1,Item$2=RovingFocusGroupItem$1;function useSize(e){const[t,n]=React__namespace.useState(void 0);return useLayoutEffect2(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const d=l[0];let f,g;if("borderBoxSize"in d){const b=d.borderBoxSize,_=Array.isArray(b)?b[0]:b;f=_.inlineSize,g=_.blockSize}else f=e.offsetWidth,g=e.offsetHeight;n({width:f,height:g})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}function usePrevious(e){const t=React__namespace.useRef({value:e,previous:e});return React__namespace.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function useStateMachine$1(e,t){return React__namespace.useReducer((n,o)=>t[n][o]??n,e)}var Presence=e=>{const{present:t,children:n}=e,o=usePresence(t),l=typeof n=="function"?n({present:o.isPresent}):React__namespace.Children.only(n),d=useComposedRefs(o.ref,getElementRef$1(l));return typeof n=="function"||o.isPresent?React__namespace.cloneElement(l,{ref:d}):null};Presence.displayName="Presence";function usePresence(e){const[t,n]=React__namespace.useState(),o=React__namespace.useRef(null),l=React__namespace.useRef(e),d=React__namespace.useRef("none"),f=e?"mounted":"unmounted",[g,b]=useStateMachine$1(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return React__namespace.useEffect(()=>{const _=getAnimationName(o.current);d.current=g==="mounted"?_:"none"},[g]),useLayoutEffect2(()=>{const _=o.current,S=l.current;if(S!==e){const C=d.current,E=getAnimationName(_);e?b("MOUNT"):E==="none"||(_==null?void 0:_.display)==="none"?b("UNMOUNT"):b(S&&C!==E?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,b]),useLayoutEffect2(()=>{if(t){let _;const S=t.ownerDocument.defaultView??window,R=E=>{const I=getAnimationName(o.current).includes(E.animationName);if(E.target===t&&I&&(b("ANIMATION_END"),!l.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",_=S.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},C=E=>{E.target===t&&(d.current=getAnimationName(o.current))};return t.addEventListener("animationstart",C),t.addEventListener("animationcancel",R),t.addEventListener("animationend",R),()=>{S.clearTimeout(_),t.removeEventListener("animationstart",C),t.removeEventListener("animationcancel",R),t.removeEventListener("animationend",R)}}else b("ANIMATION_END")},[t,b]),{isPresent:["mounted","unmountSuspended"].includes(g),ref:React__namespace.useCallback(_=>{o.current=_?getComputedStyle(_):null,n(_)},[])}}function getAnimationName(e){return(e==null?void 0:e.animationName)||"none"}function getElementRef$1(e){var o,l;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var RADIO_NAME="Radio",[createRadioContext,createRadioScope]=createContextScope(RADIO_NAME),[RadioProvider,useRadioContext]=createRadioContext(RADIO_NAME),Radio=React__namespace.forwardRef((e,t)=>{const{__scopeRadio:n,name:o,checked:l=!1,required:d,disabled:f,value:g="on",onCheck:b,form:_,...S}=e,[R,C]=React__namespace.useState(null),E=useComposedRefs(t,A=>C(A)),M=React__namespace.useRef(!1),I=R?_||!!R.closest("form"):!0;return jsxRuntime.jsxs(RadioProvider,{scope:n,checked:l,disabled:f,children:[jsxRuntime.jsx(Primitive$1.button,{type:"button",role:"radio","aria-checked":l,"data-state":getState$4(l),"data-disabled":f?"":void 0,disabled:f,value:g,...S,ref:E,onClick:composeEventHandlers(e.onClick,A=>{l||b==null||b(),I&&(M.current=A.isPropagationStopped(),M.current||A.stopPropagation())})}),I&&jsxRuntime.jsx(RadioBubbleInput,{control:R,bubbles:!M.current,name:o,value:g,checked:l,required:d,disabled:f,form:_,style:{transform:"translateX(-100%)"}})]})});Radio.displayName=RADIO_NAME;var INDICATOR_NAME$2="RadioIndicator",RadioIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:o,...l}=e,d=useRadioContext(INDICATOR_NAME$2,n);return jsxRuntime.jsx(Presence,{present:o||d.checked,children:jsxRuntime.jsx(Primitive$1.span,{"data-state":getState$4(d.checked),"data-disabled":d.disabled?"":void 0,...l,ref:t})})});RadioIndicator.displayName=INDICATOR_NAME$2;var BUBBLE_INPUT_NAME$3="RadioBubbleInput",RadioBubbleInput=React__namespace.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(t);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const M=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(M)}},[b,n,o]),jsxRuntime.jsx(Primitive$1.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});RadioBubbleInput.displayName=BUBBLE_INPUT_NAME$3;function getState$4(e){return e?"checked":"unchecked"}var ARROW_KEYS=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],RADIO_GROUP_NAME$2="RadioGroup",[createRadioGroupContext,createRadioGroupScope]=createContextScope(RADIO_GROUP_NAME$2,[createRovingFocusGroupScope$1,createRadioScope]),useRovingFocusGroupScope$2=createRovingFocusGroupScope$1(),useRadioScope=createRadioScope(),[RadioGroupProvider$1,useRadioGroupContext$1]=createRadioGroupContext(RADIO_GROUP_NAME$2),RadioGroup$2=React__namespace.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:o,defaultValue:l,value:d,required:f=!1,disabled:g=!1,orientation:b,dir:_,loop:S=!0,onValueChange:R,...C}=e,E=useRovingFocusGroupScope$2(n),M=useDirection(_),[I,A]=useControllableState({prop:d,defaultProp:l??null,onChange:R,caller:RADIO_GROUP_NAME$2});return jsxRuntime.jsx(RadioGroupProvider$1,{scope:n,name:o,required:f,disabled:g,value:I,onValueChange:A,children:jsxRuntime.jsx(Root$b,{asChild:!0,...E,orientation:b,dir:M,loop:S,children:jsxRuntime.jsx(Primitive$1.div,{role:"radiogroup","aria-required":f,"aria-orientation":b,"data-disabled":g?"":void 0,dir:M,...C,ref:t})})})});RadioGroup$2.displayName=RADIO_GROUP_NAME$2;var ITEM_NAME$4="RadioGroupItem",RadioGroupItem$1=React__namespace.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:o,...l}=e,d=useRadioGroupContext$1(ITEM_NAME$4,n),f=d.disabled||o,g=useRovingFocusGroupScope$2(n),b=useRadioScope(n),_=React__namespace.useRef(null),S=useComposedRefs(t,_),R=d.value===l.value,C=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const E=I=>{ARROW_KEYS.includes(I.key)&&(C.current=!0)},M=()=>C.current=!1;return document.addEventListener("keydown",E),document.addEventListener("keyup",M),()=>{document.removeEventListener("keydown",E),document.removeEventListener("keyup",M)}},[]),jsxRuntime.jsx(Item$2,{asChild:!0,...g,focusable:!f,active:R,children:jsxRuntime.jsx(Radio,{disabled:f,required:d.required,checked:R,...b,...l,name:d.name,ref:S,onCheck:()=>d.onValueChange(l.value),onKeyDown:composeEventHandlers(E=>{E.key==="Enter"&&E.preventDefault()}),onFocus:composeEventHandlers(l.onFocus,()=>{var E;C.current&&((E=_.current)==null||E.click())})})})});RadioGroupItem$1.displayName=ITEM_NAME$4;var INDICATOR_NAME2="RadioGroupIndicator",RadioGroupIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...o}=e,l=useRadioScope(n);return jsxRuntime.jsx(RadioIndicator,{...l,...o,ref:t})});RadioGroupIndicator.displayName=INDICATOR_NAME2;var Root2$6=RadioGroup$2,Item2$2=RadioGroupItem$1,Indicator$1=RadioGroupIndicator;const RadioGroup$1=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root2$6,{className:cn("grid gap-2",e),...t,ref:n}));RadioGroup$1.displayName=Root2$6.displayName;const RadioGroupItem=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Item2$2,{ref:n,className:cn("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow-sm focus:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:jsxRuntime.jsx(Indicator$1,{className:"flex items-center justify-center",children:jsxRuntime.jsx(Circle,{className:"h-3.5 w-3.5 fill-primary"})})}));RadioGroupItem.displayName=Item2$2.displayName;function createSlot(e){const t=createSlotClone(e),n=React__namespace.forwardRef((o,l)=>{const{children:d,...f}=o,g=React__namespace.Children.toArray(d),b=g.find(isSlottable);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(t,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(t,{...f,ref:l,children:d})});return n.displayName=`${e}.Slot`,n}var Slot$4=createSlot("Slot");function createSlotClone(e){const t=React__namespace.forwardRef((n,o)=>{const{children:l,...d}=n;if(React__namespace.isValidElement(l)){const f=getElementRef(l),g=mergeProps(d,l.props);return l.type!==React__namespace.Fragment&&(g.ref=o?composeRefs(o,f):f),React__namespace.cloneElement(l,g)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var SLOTTABLE_IDENTIFIER=Symbol("radix.slottable");function createSlottable(e){const t=({children:n})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=SLOTTABLE_IDENTIFIER,t}function isSlottable(e){return React__namespace.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===SLOTTABLE_IDENTIFIER}function mergeProps(e,t){const n={...t};for(const o in t){const l=e[o],d=t[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{d(...g),l(...g)}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...e,...n}}function getElementRef(e){var o,l;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Primitive=NODES.reduce((e,t)=>{const n=createSlot(`Primitive.${t}`),o=React__namespace.forwardRef((l,d)=>{const{asChild:f,...g}=l,b=f?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntime.jsx(b,{...g,ref:d})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function dispatchDiscreteCustomEvent(e,t){e&&ReactDOM__namespace.flushSync(()=>e.dispatchEvent(t))}function useEscapeKeydown(e,t=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(e);React__namespace.useEffect(()=>{const o=l=>{l.key==="Escape"&&n(l)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=React__namespace.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=React__namespace.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:f,onDismiss:g,...b}=e,_=React__namespace.useContext(DismissableLayerContext),[S,R]=React__namespace.useState(null),C=(S==null?void 0:S.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,E]=React__namespace.useState({}),M=useComposedRefs(t,te=>R(te)),I=Array.from(_.layers),[A]=[..._.layersWithOutsidePointerEventsDisabled].slice(-1),V=I.indexOf(A),q=S?I.indexOf(S):-1,z=_.layersWithOutsidePointerEventsDisabled.size>0,Q=q>=V,F=usePointerDownOutside(te=>{const ae=te.target,ie=[..._.branches].some(oe=>oe.contains(ae));!Q||ie||(l==null||l(te),f==null||f(te),te.defaultPrevented||g==null||g())},C),O=useFocusOutside(te=>{const ae=te.target;[..._.branches].some(oe=>oe.contains(ae))||(d==null||d(te),f==null||f(te),te.defaultPrevented||g==null||g())},C);return useEscapeKeydown(te=>{q===_.layers.size-1&&(o==null||o(te),!te.defaultPrevented&&g&&(te.preventDefault(),g()))},C),React__namespace.useEffect(()=>{if(S)return n&&(_.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=C.body.style.pointerEvents,C.body.style.pointerEvents="none"),_.layersWithOutsidePointerEventsDisabled.add(S)),_.layers.add(S),dispatchUpdate(),()=>{n&&_.layersWithOutsidePointerEventsDisabled.size===1&&(C.body.style.pointerEvents=originalBodyPointerEvents)}},[S,C,n,_]),React__namespace.useEffect(()=>()=>{S&&(_.layers.delete(S),_.layersWithOutsidePointerEventsDisabled.delete(S),dispatchUpdate())},[S,_]),React__namespace.useEffect(()=>{const te=()=>E({});return document.addEventListener(CONTEXT_UPDATE,te),()=>document.removeEventListener(CONTEXT_UPDATE,te)},[]),jsxRuntime.jsx(Primitive.div,{...b,ref:M,style:{pointerEvents:z?Q?"auto":"none":void 0,...e.style},onFocusCapture:composeEventHandlers(e.onFocusCapture,O.onFocusCapture),onBlurCapture:composeEventHandlers(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:composeEventHandlers(e.onPointerDownCapture,F.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=React__namespace.forwardRef((e,t)=>{const n=React__namespace.useContext(DismissableLayerContext),o=React__namespace.useRef(null),l=useComposedRefs(t,o);return React__namespace.useEffect(()=>{const d=o.current;if(d)return n.branches.add(d),()=>{n.branches.delete(d)}},[n.branches]),jsxRuntime.jsx(Primitive.div,{...e,ref:l})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(e,t=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(e),o=React__namespace.useRef(!1),l=React__namespace.useRef(()=>{});return React__namespace.useEffect(()=>{const d=g=>{if(g.target&&!o.current){let b=function(){handleAndDispatchCustomEvent$1(POINTER_DOWN_OUTSIDE,n,_,{discrete:!0})};const _={originalEvent:g};g.pointerType==="touch"?(t.removeEventListener("click",l.current),l.current=b,t.addEventListener("click",l.current,{once:!0})):b()}else t.removeEventListener("click",l.current);o.current=!1},f=window.setTimeout(()=>{t.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(f),t.removeEventListener("pointerdown",d),t.removeEventListener("click",l.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function useFocusOutside(e,t=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(e),o=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const l=d=>{d.target&&!o.current&&handleAndDispatchCustomEvent$1(FOCUS_OUTSIDE,n,{originalEvent:d},{discrete:!1})};return t.addEventListener("focusin",l),()=>t.removeEventListener("focusin",l)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function dispatchUpdate(){const e=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(e)}function handleAndDispatchCustomEvent$1(e,t,n,{discrete:o}){const l=n.originalEvent.target,d=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),o?dispatchDiscreteCustomEvent(l,d):l.dispatchEvent(d)}var Root$a=DismissableLayer,Branch=DismissableLayerBranch,AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS$1={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=React__namespace.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:l,onUnmountAutoFocus:d,...f}=e,[g,b]=React__namespace.useState(null),_=useCallbackRef$1(l),S=useCallbackRef$1(d),R=React__namespace.useRef(null),C=useComposedRefs(t,I=>b(I)),E=React__namespace.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;React__namespace.useEffect(()=>{if(o){let I=function(z){if(E.paused||!g)return;const Q=z.target;g.contains(Q)?R.current=Q:focus(R.current,{select:!0})},A=function(z){if(E.paused||!g)return;const Q=z.relatedTarget;Q!==null&&(g.contains(Q)||focus(R.current,{select:!0}))},V=function(z){if(document.activeElement===document.body)for(const F of z)F.removedNodes.length>0&&focus(g)};document.addEventListener("focusin",I),document.addEventListener("focusout",A);const q=new MutationObserver(V);return g&&q.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",I),document.removeEventListener("focusout",A),q.disconnect()}}},[o,g,E.paused]),React__namespace.useEffect(()=>{if(g){focusScopesStack.add(E);const I=document.activeElement;if(!g.contains(I)){const V=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS$1);g.addEventListener(AUTOFOCUS_ON_MOUNT,_),g.dispatchEvent(V),V.defaultPrevented||(focusFirst$3(removeLinks(getTabbableCandidates$1(g)),{select:!0}),document.activeElement===I&&focus(g))}return()=>{g.removeEventListener(AUTOFOCUS_ON_MOUNT,_),setTimeout(()=>{const V=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS$1);g.addEventListener(AUTOFOCUS_ON_UNMOUNT,S),g.dispatchEvent(V),V.defaultPrevented||focus(I??document.body,{select:!0}),g.removeEventListener(AUTOFOCUS_ON_UNMOUNT,S),focusScopesStack.remove(E)},0)}}},[g,_,S,E]);const M=React__namespace.useCallback(I=>{if(!n&&!o||E.paused)return;const A=I.key==="Tab"&&!I.altKey&&!I.ctrlKey&&!I.metaKey,V=document.activeElement;if(A&&V){const q=I.currentTarget,[z,Q]=getTabbableEdges(q);z&&Q?!I.shiftKey&&V===Q?(I.preventDefault(),n&&focus(z,{select:!0})):I.shiftKey&&V===z&&(I.preventDefault(),n&&focus(Q,{select:!0})):V===q&&I.preventDefault()}},[n,o,E.paused]);return jsxRuntime.jsx(Primitive.div,{tabIndex:-1,...f,ref:C,onKeyDown:M})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst$3(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(focus(o,{select:t}),document.activeElement!==n)return}function getTabbableEdges(e){const t=getTabbableCandidates$1(e),n=findVisible(t,e),o=findVisible(t.reverse(),e);return[n,o]}function getTabbableCandidates$1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const l=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||l?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function findVisible(e,t){for(const n of e)if(!isHidden(n,{upTo:t}))return n}function isHidden(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function isSelectableInput(e){return e instanceof HTMLInputElement&&"select"in e}function focus(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&isSelectableInput(e)&&t&&e.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=arrayRemove(e,t),e.unshift(t)},remove(t){var n;e=arrayRemove(e,t),(n=e[0])==null||n.resume()}}}function arrayRemove(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function removeLinks(e){return e.filter(t=>t.tagName!=="A")}var PORTAL_NAME$6="Portal",Portal$5=React__namespace.forwardRef((e,t)=>{var g;const{container:n,...o}=e,[l,d]=React__namespace.useState(!1);useLayoutEffect2(()=>d(!0),[]);const f=n||l&&((g=globalThis==null?void 0:globalThis.document)==null?void 0:g.body);return f?ReactDOM.createPortal(jsxRuntime.jsx(Primitive.div,{...o,ref:t}),f):null});Portal$5.displayName=PORTAL_NAME$6;var count$1=0;function useFocusGuards(){React__namespace.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",e[1]??createFocusGuard()),count$1++,()=>{count$1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),count$1--}},[])}function createFocusGuard(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function useCallbackRef(e,t){var n=React.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(o){var l=n.value;l!==o&&(n.value=o,n.callback(o,l))}}}})[0];return n.callback=t,n.facade}var useIsomorphicLayoutEffect=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect,currentValues=new WeakMap;function useMergeRefs(e,t){var n=useCallbackRef(null,function(o){return e.forEach(function(l){return assignRef(l,o)})});return useIsomorphicLayoutEffect(function(){var o=currentValues.get(n);if(o){var l=new Set(o),d=new Set(e),f=n.current;l.forEach(function(g){d.has(g)||assignRef(g,null)}),d.forEach(function(g){l.has(g)||assignRef(g,f)})}currentValues.set(n,e)},[e]),n}function ItoI(e){return e}function innerCreateMedium(e,t){t===void 0&&(t=ItoI);var n=[],o=!1,l={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(d){var f=t(d,o);return n.push(f),function(){n=n.filter(function(g){return g!==f})}},assignSyncMedium:function(d){for(o=!0;n.length;){var f=n;n=[],f.forEach(d)}n={push:function(g){return d(g)},filter:function(){return n}}},assignMedium:function(d){o=!0;var f=[];if(n.length){var g=n;n=[],g.forEach(d),f=n}var b=function(){var S=f;f=[],S.forEach(d)},_=function(){return Promise.resolve().then(b)};_(),n={push:function(S){f.push(S),_()},filter:function(S){return f=f.filter(S),n}}}};return l}function createSidecarMedium(e){e===void 0&&(e={});var t=innerCreateMedium(null);return t.options=__assign$1({async:!0,ssr:!1},e),t}var SideCar$1=function(e){var t=e.sideCar,n=__rest(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return React__namespace.createElement(o,__assign$1({},n))};SideCar$1.isSideCarExport=!0;function exportSidecar(e,t){return e.useMedium(t),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=React__namespace.forwardRef(function(e,t){var n=React__namespace.useRef(null),o=React__namespace.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),l=o[0],d=o[1],f=e.forwardProps,g=e.children,b=e.className,_=e.removeScrollBar,S=e.enabled,R=e.shards,C=e.sideCar,E=e.noIsolation,M=e.inert,I=e.allowPinchZoom,A=e.as,V=A===void 0?"div":A,q=e.gapMode,z=__rest(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),Q=C,F=useMergeRefs([n,t]),O=__assign$1(__assign$1({},z),l);return React__namespace.createElement(React__namespace.Fragment,null,S&&React__namespace.createElement(Q,{sideCar:effectCar,removeScrollBar:_,shards:R,noIsolation:E,inert:M,setCallbacks:d,allowPinchZoom:!!I,lockRef:n,gapMode:q}),f?React__namespace.cloneElement(React__namespace.Children.only(g),__assign$1(__assign$1({},O),{ref:F})):React__namespace.createElement(V,__assign$1({},O,{className:b,ref:F}),g))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var getNonce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=getNonce();return t&&e.setAttribute("nonce",t),e}function injectStyles(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function insertStyleTag(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var stylesheetSingleton=function(){var e=0,t=null;return{add:function(n){e==0&&(t=makeStyleTag())&&(injectStyles(t,n),insertStyleTag(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},styleHookSingleton=function(){var e=stylesheetSingleton();return function(t,n){React__namespace.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},styleSingleton=function(){var e=styleHookSingleton(),t=function(n){var o=n.styles,l=n.dynamic;return e(o,l),null};return t},zeroGap={left:0,top:0,right:0,gap:0},parse=function(e){return parseInt(e||"",10)||0},getOffset$1=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],l=t[e==="padding"?"paddingRight":"marginRight"];return[parse(n),parse(o),parse(l)]},getGapWidth=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zeroGap;var t=getOffset$1(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(e,t,n,o){var l=e.left,d=e.top,f=e.right,g=e.gap;return n===void 0&&(n="margin"),`
369
+ $10 with opportunities under $1,000`:e==="D"?"$15 under $1,500":e==="E"?"Full shipping charges":e,getTermsText=e=>e==="STRIPE"?"Credit card payment":e==="NET30"?"Net 30 days":e,AccountTier=({isSuperAdmin:e,readonly:t,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=ge=>ge&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[ge]||"",E=ge=>ge&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[ge]||"",M=ge=>ge&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[ge]||"",[I,A]=React.useState(C((n==null?void 0:n.Priority)??"")),[V,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(M(n==null?void 0:n.PriceProfile)),F=ge=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[ge]||ge,O=ge=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[ge]||ge,te=ge=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[ge]||ge;React.useEffect(()=>{A(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(M(n==null?void 0:n.PriceProfile))},[n]);const ae=async ge=>{A(ge);const Oe=F(ge);try{(await S({applicationId:o,fieldName:"Priority",newValue:Oe})).error?d({title:"Error",description:"Failed to update priority",variant:"destructive"}):d({title:"Success",description:`Priority updated to ${Oe}`,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},ie=async ge=>{q(ge);const Oe=O(ge);try{(await S({applicationId:o,fieldName:"ShippingProfile",newValue:Oe})).error?d({title:"Error",description:"Failed to update shipping profile",variant:"destructive"}):d({title:"Success",description:`Shipping profile updated to ${Oe}`,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},oe=async ge=>{Q(ge);const Oe=te(ge);try{(await S({applicationId:o,fieldName:"PriceProfile",newValue:Oe})).error?d({title:"Error",description:"Failed to update pricing profile",variant:"destructive"}):d({title:"Success",description:`Pricing profile updated to ${Oe}`,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},se=async()=>{try{const ge=await S({applicationId:o,fieldName:"Tier",newValue:b});ge.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):ge.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),_("")}},Ae=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:e}],Ne=ge=>{_(ge),g(!0)};return l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs(Card,{className:"md:col-span-2 xl:col-span-1 md:max-w-xl xl:max-w-[unset]",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(ge=>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"})]})]},ge))}),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:"md:col-span-2 xl:col-span-1 md:max-w-xl xl:max-w-[unset]",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:[jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs("a",{href:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",rel:"noreferrer",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:t,className:t?"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"}),Ae.map(ge=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!ge.enabled,onClick:()=>Ne(ge.name),children:ge.name},ge.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:se}),e&&!t&&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:I,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(ge=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:ge.value,id:`priority-${ge.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${ge.value}`,className:"cursor-pointer text-xs",children:ge.label})]},ge.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:V,onValueChange:ie,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(ge=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:ge.value,id:`shipping-${ge.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${ge.value}`,className:"cursor-pointer text-xs",children:ge.label})]},ge.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(ge=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:ge.value,id:`pricing-${ge.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${ge.value}`,className:"cursor-pointer text-xs",children:ge.label})]},ge.value))})]})]})})]})]})};function OrderCategories({openOrders:e=[],isLoading:t=!1}){const n=(e==null?void 0:e.filter(I=>I.DocumentType==="Order"))||[],o=(e==null?void 0:e.filter(I=>I.DocumentType==="Shipment"))||[],l=n.filter(I=>I.WarehouseCode!=="3PLE"),d=l.reduce((I,A)=>I+(A.Quantity??0),0),f=l.reduce((I,A)=>I+(A.ExtendedPrice??0),0),g=n.filter(I=>I.WarehouseCode==="3PLE"),b=g.reduce((I,A)=>I+(A.Quantity??0),0),_=g.reduce((I,A)=>I+(A.ExtendedPrice??0),0),S=o.reduce((I,A)=>I+(A.Quantity??0),0),R=o.reduce((I,A)=>I+(A.ExtendedPrice??0),0),C=d+b+S,E=f+_+R,M=[{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:S,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:_}];return t?jsxRuntime.jsxs(Card,{className:"w-full md:col-span-2 xl:col-span-1",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(I=>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"})]})]})]})]})},I))})})]}):jsxRuntime.jsxs(Card,{className:"w-full md:col-span-2 xl:col-span-1",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:M.map(I=>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:`${I.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:I.name}),jsxRuntime.jsx("div",{className:`${I.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(I.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:I.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:I.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},I.name))})})]})}function LongMonthName(e){if(!e)return;const t=["","January","February","March","April","May","June","July","August","September","October","November","December"];return e===void 0&&(e=new Date().getMonth()+1),e<1&&(e=12+e),t[e]}function SalesSummary({fiscalYearMonthStart:e,salesData:t,isLoading:n}){const o=(t==null?void 0:t.SalesLast30Days)??0,l=(t==null?void 0:t.SalesLast3Months)??0,d=(t==null?void 0:t.SalesYearToDay)??0,f=LongMonthName(e);return n?jsxRuntime.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 mb-4",children:[jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]}),jsxRuntime.jsxs(Card,{className:"col-span-2 lg:col-span-1",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-36"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]})]}):jsxRuntime.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 mb-4",children:[jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(CardTitle,{className:"text-sm font-medium",children:"Last 30 Days"}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(TrendingUp,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:o,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(CardTitle,{className:"text-sm font-medium",children:"Last 3 Months"}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(Calendar,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:l,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]}),f&&jsxRuntime.jsxs(Card,{className:"col-span-2 lg:col-span-1",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsxs(CardTitle,{className:"text-sm font-medium",children:["Year to Date (",f,")"]}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(CalendarDays,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:d,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]})]})}function ReportsSection({isLoading:e,userEmail:t,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:_}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[S,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[M,{isLoading:I}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[A,V]=React.useState(null),[q,z]=React.useState(t),[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 oe=>{V(oe),F(!0)},ae=async()=>{if(!(!A||!n))try{switch(A.id){case"Products":await S({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 M({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${A.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(oe){console.error("Error requesting report:",oe),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},ie=_||R||g||d||I||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:e?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(oe=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(se=>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"})]},se))]},oe))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:O.map(oe=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:oe.name}),oe.reports.map(se=>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(se.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:se.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:se.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(se),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},se.id))]},oe.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",A==null?void 0:A.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:oe=>z(oe.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:ae,disabled:!q||ie,children:ie?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function UnsavedChangesDialog({isOpen:e,onClose:t,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:e,onOpenChange:t,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:t,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(e){const[t,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return e()&&_},[e]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(e())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[e]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:t,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[t,d,l]);return{showDialog:t,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}function MonthlySalesChart({salesData:e,chartHeight:t=300,units:n="$",unitsPosition:o="left",className:l,extrapolate:d=!0}){const[f,g]=React.useState([]);return React.useEffect(()=>{if(!e||e.length===0){g([]);return}const b=e.reduce((V,q)=>{const z=q.Day??0,Q=Math.floor(z).toString();if(Q.length!==8||isNaN(parseInt(Q)))return console.warn(`Skipping invalid Day format: ${q.Day}`),V;const F=Q.substring(0,4),O=Q.substring(4,6),te=`${F}-${O}`;return V[te]=(V[te]||0)+(q.ExtendedPrice??0),V},{}),_=Object.keys(b).sort(),S=new Date,R=S.getFullYear(),C=S.getMonth(),E=S.getDate(),M=`${R}-${(C+1).toString().padStart(2,"0")}`,I={...b};if(d&&_.length>0&&_[_.length-1]===M){const V=I[M],q=new Date(R,C+1,0).getDate();if(E<q&&E>0){const Q=V/E*q;I[M]=Q}}const A=_.map(V=>{const q=I[V],[z,Q]=V.split("-").map(Number);return{month:new Date(z,Q-1).toLocaleString("default",{month:"short",year:"numeric"}),sales:q}});g(A)},[e,d]),f.length===0?jsxRuntime.jsx("div",{className:l||"p-4 text-center text-muted-foreground",children:"No monthly sales data to display."}):jsxRuntime.jsx(AreaChart,{data:f,units:n,unitsPosition:o,height:t,className:l})}function Reseller({appID:e,reseller:t,readonly:n,payInvoicePath:o,userEmail:l,isSuperAdmin:d,withoutReports:f=!1}){var q;const{data:g,isLoading:b,isError:_}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:e??"",withSpecification:!0},{skip:!!t}),[S,R]=React.useState(!0),[C,E]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),M=React.useCallback(()=>C.publicInfo.hasUnsavedChanges,[C]),I=React.useCallback((z,Q)=>{E(F=>{var O;return((O=F[z])==null?void 0:O.hasUnsavedChanges)!==Q.hasUnsavedChanges?(console.log(`Updating form state for ${z}:`,Q.hasUnsavedChanges),{...F,[z]:Q}):F})},[]),{NavigationGuardDialog:A}=useRouterNavigationGuard(M),V=t??g;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:_?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:(V==null?void 0:V.FiscalYearMonthStart)||1,salesData:V==null?void 0:V.SalesData,isLoading:b}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsx(OrderCategories,{openOrders:(V==null?void 0:V.ActiveOrderDetails)??[],isLoading:b}),jsxRuntime.jsx(BillingCard,{readonly:n,reseller:V||{},payInvoicePath:o,isLoading:b}),jsxRuntime.jsx(PublicInfo,{reseller:V||{},appID:e??"",isLoading:b,readonly:n,onUnsavedChanges:z=>I("publicInfo",{hasUnsavedChanges:z})})]}),jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Sales"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(MonthlySalesChart,{salesData:(V==null?void 0:V.SalesStatistics)??[],extrapolate:S}),jsxRuntime.jsxs("div",{className:"flex space-x-2 my-1",children:[jsxRuntime.jsx(Switch,{checked:S,onCheckedChange:R,id:"extrapolate-switch"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate"})]}),S?jsxRuntime.jsx("p",{className:"text-sm",children:"*Sales for the current month are projected, not actual."}):jsxRuntime.jsx(jsxRuntime.Fragment,{})]})]}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:d,readonly:n,reseller:V||{},appID:e??"",isLoading:b})]})]}),jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Brands you are qualified for"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("p",{children:"This module is under construction."}),jsxRuntime.jsx("ul",{children:(q=V==null?void 0:V.Qualifications)==null?void 0:q.map(z=>jsxRuntime.jsx("li",{children:z.ManufacturerId}))})]})]}),!f&&jsxRuntime.jsx(ReportsSection,{appID:e,userEmail:l,isLoading:b})]})}),jsxRuntime.jsx(A,{})]})}function composeEventHandlers(e,t,{checkForDefaultPrevented:n=!0}={}){return function(l){if(e==null||e(l),n===!1||!l.defaultPrevented)return t==null?void 0:t(l)}}function setRef(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function composeRefs(...e){return t=>{let n=!1;const o=e.map(l=>{const d=setRef(l,t);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let l=0;l<o.length;l++){const d=o[l];typeof d=="function"?d():setRef(e[l],null)}}}}function useComposedRefs(...e){return React__namespace.useCallback(composeRefs(...e),e)}function createContext2(e,t){const n=React__namespace.createContext(t),o=d=>{const{children:f,...g}=d,b=React__namespace.useMemo(()=>g,Object.values(g));return jsxRuntime.jsx(n.Provider,{value:b,children:f})};o.displayName=e+"Provider";function l(d){const f=React__namespace.useContext(n);if(f)return f;if(t!==void 0)return t;throw new Error(`\`${d}\` must be used within \`${e}\``)}return[o,l]}function createContextScope(e,t=[]){let n=[];function o(d,f){const g=React__namespace.createContext(f),b=n.length;n=[...n,f];const _=R=>{var V;const{scope:C,children:E,...M}=R,I=((V=C==null?void 0:C[e])==null?void 0:V[b])||g,A=React__namespace.useMemo(()=>M,Object.values(M));return jsxRuntime.jsx(I.Provider,{value:A,children:E})};_.displayName=d+"Provider";function S(R,C){var I;const E=((I=C==null?void 0:C[e])==null?void 0:I[b])||g,M=React__namespace.useContext(E);if(M)return M;if(f!==void 0)return f;throw new Error(`\`${R}\` must be used within \`${d}\``)}return[_,S]}const l=()=>{const d=n.map(f=>React__namespace.createContext(f));return function(g){const b=(g==null?void 0:g[e])||d;return React__namespace.useMemo(()=>({[`__scope${e}`]:{...g,[e]:b}}),[g,b])}};return l.scopeName=e,[o,composeContextScopes(l,...t)]}function composeContextScopes(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(d){const f=o.reduce((g,{useScope:b,scopeName:_})=>{const R=b(d)[`__scope${_}`];return{...g,...R}},{});return React__namespace.useMemo(()=>({[`__scope${t.scopeName}`]:f}),[f])}};return n.scopeName=t.scopeName,n}function createSlot$1(e){const t=createSlotClone$1(e),n=React__namespace.forwardRef((o,l)=>{const{children:d,...f}=o,g=React__namespace.Children.toArray(d),b=g.find(isSlottable$1);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(t,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(t,{...f,ref:l,children:d})});return n.displayName=`${e}.Slot`,n}function createSlotClone$1(e){const t=React__namespace.forwardRef((n,o)=>{const{children:l,...d}=n,f=React__namespace.isValidElement(l)?getElementRef$2(l):void 0,g=useComposedRefs(f,o);if(React__namespace.isValidElement(l)){const b=mergeProps$1(d,l.props);return l.type!==React__namespace.Fragment&&(b.ref=g),React__namespace.cloneElement(l,b)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var SLOTTABLE_IDENTIFIER$1=Symbol("radix.slottable");function isSlottable$1(e){return React__namespace.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===SLOTTABLE_IDENTIFIER$1}function mergeProps$1(e,t){const n={...t};for(const o in t){const l=e[o],d=t[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{const b=d(...g);return l(...g),b}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...e,...n}}function getElementRef$2(e){var o,l;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var NODES$1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Primitive$1=NODES$1.reduce((e,t)=>{const n=createSlot$1(`Primitive.${t}`),o=React__namespace.forwardRef((l,d)=>{const{asChild:f,...g}=l,b=f?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntime.jsx(b,{...g,ref:d})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function createCollection$1(e){const t=e+"CollectionProvider",[n,o]=createContextScope(t),[l,d]=n(t,{collectionRef:{current:null},itemMap:new Map}),f=I=>{const{scope:A,children:V}=I,q=React.useRef(null),z=React.useRef(new Map).current;return jsxRuntime.jsx(l,{scope:A,itemMap:z,collectionRef:q,children:V})};f.displayName=t;const g=e+"CollectionSlot",b=createSlot$1(g),_=React.forwardRef((I,A)=>{const{scope:V,children:q}=I,z=d(g,V),Q=useComposedRefs(A,z.collectionRef);return jsxRuntime.jsx(b,{ref:Q,children:q})});_.displayName=g;const S=e+"CollectionItemSlot",R="data-radix-collection-item",C=createSlot$1(S),E=React.forwardRef((I,A)=>{const{scope:V,children:q,...z}=I,Q=React.useRef(null),F=useComposedRefs(A,Q),O=d(S,V);return React.useEffect(()=>(O.itemMap.set(Q,{ref:Q,...z}),()=>void O.itemMap.delete(Q))),jsxRuntime.jsx(C,{[R]:"",ref:F,children:q})});E.displayName=S;function M(I){const A=d(e+"CollectionConsumer",I);return React.useCallback(()=>{const q=A.collectionRef.current;if(!q)return[];const z=Array.from(q.querySelectorAll(`[${R}]`));return Array.from(A.itemMap.values()).sort((O,te)=>z.indexOf(O.ref.current)-z.indexOf(te.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:f,Slot:_,ItemSlot:E},M,o]}var useLayoutEffect2=globalThis!=null&&globalThis.document?React__namespace.useLayoutEffect:()=>{},useReactId=React__namespace[" useId ".trim().toString()]||(()=>{}),count$2=0;function useId(e){const[t,n]=React__namespace.useState(useReactId());return useLayoutEffect2(()=>{n(o=>o??String(count$2++))},[e]),t?`radix-${t}`:""}function useCallbackRef$1(e){const t=React__namespace.useRef(e);return React__namespace.useEffect(()=>{t.current=e}),React__namespace.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}var useInsertionEffect=React__namespace[" useInsertionEffect ".trim().toString()]||useLayoutEffect2;function useControllableState({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[l,d,f]=useUncontrolledState({defaultProp:t,onChange:n}),g=e!==void 0,b=g?e:l;{const S=React__namespace.useRef(e!==void 0);React__namespace.useEffect(()=>{const R=S.current;R!==g&&console.warn(`${o} is changing from ${R?"controlled":"uncontrolled"} to ${g?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),S.current=g},[g,o])}const _=React__namespace.useCallback(S=>{var R;if(g){const C=isFunction$1(S)?S(e):S;C!==e&&((R=f.current)==null||R.call(f,C))}else d(S)},[g,e,d,f]);return[b,_]}function useUncontrolledState({defaultProp:e,onChange:t}){const[n,o]=React__namespace.useState(e),l=React__namespace.useRef(n),d=React__namespace.useRef(t);return useInsertionEffect(()=>{d.current=t},[t]),React__namespace.useEffect(()=>{var f;l.current!==n&&((f=d.current)==null||f.call(d,n),l.current=n)},[n,l]),[n,o,d]}function isFunction$1(e){return typeof e=="function"}var DirectionContext=React__namespace.createContext(void 0);function useDirection(e){const t=React__namespace.useContext(DirectionContext);return e||t||"ltr"}var ENTRY_FOCUS$1="rovingFocusGroup.onEntryFocus",EVENT_OPTIONS$2={bubbles:!1,cancelable:!0},GROUP_NAME$4="RovingFocusGroup",[Collection$4,useCollection$4,createCollectionScope$4]=createCollection$1(GROUP_NAME$4),[createRovingFocusGroupContext$1,createRovingFocusGroupScope$1]=createContextScope(GROUP_NAME$4,[createCollectionScope$4]),[RovingFocusProvider$1,useRovingFocusContext$1]=createRovingFocusGroupContext$1(GROUP_NAME$4),RovingFocusGroup$1=React__namespace.forwardRef((e,t)=>jsxRuntime.jsx(Collection$4.Provider,{scope:e.__scopeRovingFocusGroup,children:jsxRuntime.jsx(Collection$4.Slot,{scope:e.__scopeRovingFocusGroup,children:jsxRuntime.jsx(RovingFocusGroupImpl$1,{...e,ref:t})})}));RovingFocusGroup$1.displayName=GROUP_NAME$4;var RovingFocusGroupImpl$1=React__namespace.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:l=!1,dir:d,currentTabStopId:f,defaultCurrentTabStopId:g,onCurrentTabStopIdChange:b,onEntryFocus:_,preventScrollOnEntryFocus:S=!1,...R}=e,C=React__namespace.useRef(null),E=useComposedRefs(t,C),M=useDirection(d),[I,A]=useControllableState({prop:f,defaultProp:g??null,onChange:b,caller:GROUP_NAME$4}),[V,q]=React__namespace.useState(!1),z=useCallbackRef$1(_),Q=useCollection$4(n),F=React__namespace.useRef(!1),[O,te]=React__namespace.useState(0);return React__namespace.useEffect(()=>{const ae=C.current;if(ae)return ae.addEventListener(ENTRY_FOCUS$1,z),()=>ae.removeEventListener(ENTRY_FOCUS$1,z)},[z]),jsxRuntime.jsx(RovingFocusProvider$1,{scope:n,orientation:o,dir:M,loop:l,currentTabStopId:I,onItemFocus:React__namespace.useCallback(ae=>A(ae),[A]),onItemShiftTab:React__namespace.useCallback(()=>q(!0),[]),onFocusableItemAdd:React__namespace.useCallback(()=>te(ae=>ae+1),[]),onFocusableItemRemove:React__namespace.useCallback(()=>te(ae=>ae-1),[]),children:jsxRuntime.jsx(Primitive$1.div,{tabIndex:V||O===0?-1:0,"data-orientation":o,...R,ref:E,style:{outline:"none",...e.style},onMouseDown:composeEventHandlers(e.onMouseDown,()=>{F.current=!0}),onFocus:composeEventHandlers(e.onFocus,ae=>{const ie=!F.current;if(ae.target===ae.currentTarget&&ie&&!V){const oe=new CustomEvent(ENTRY_FOCUS$1,EVENT_OPTIONS$2);if(ae.currentTarget.dispatchEvent(oe),!oe.defaultPrevented){const se=Q().filter(Le=>Le.focusable),Ae=se.find(Le=>Le.active),Ne=se.find(Le=>Le.id===I),Oe=[Ae,Ne,...se].filter(Boolean).map(Le=>Le.ref.current);focusFirst$4(Oe,S)}}F.current=!1}),onBlur:composeEventHandlers(e.onBlur,()=>q(!1))})})}),ITEM_NAME$5="RovingFocusGroupItem",RovingFocusGroupItem$1=React__namespace.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:l=!1,tabStopId:d,children:f,...g}=e,b=useId(),_=d||b,S=useRovingFocusContext$1(ITEM_NAME$5,n),R=S.currentTabStopId===_,C=useCollection$4(n),{onFocusableItemAdd:E,onFocusableItemRemove:M,currentTabStopId:I}=S;return React__namespace.useEffect(()=>{if(o)return E(),()=>M()},[o,E,M]),jsxRuntime.jsx(Collection$4.ItemSlot,{scope:n,id:_,focusable:o,active:l,children:jsxRuntime.jsx(Primitive$1.span,{tabIndex:R?0:-1,"data-orientation":S.orientation,...g,ref:t,onMouseDown:composeEventHandlers(e.onMouseDown,A=>{o?S.onItemFocus(_):A.preventDefault()}),onFocus:composeEventHandlers(e.onFocus,()=>S.onItemFocus(_)),onKeyDown:composeEventHandlers(e.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){S.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const V=getFocusIntent$1(A,S.orientation,S.dir);if(V!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let z=C().filter(Q=>Q.focusable).map(Q=>Q.ref.current);if(V==="last")z.reverse();else if(V==="prev"||V==="next"){V==="prev"&&z.reverse();const Q=z.indexOf(A.currentTarget);z=S.loop?wrapArray$3(z,Q+1):z.slice(Q+1)}setTimeout(()=>focusFirst$4(z))}}),children:typeof f=="function"?f({isCurrentTabStop:R,hasTabStop:I!=null}):f})})});RovingFocusGroupItem$1.displayName=ITEM_NAME$5;var MAP_KEY_TO_FOCUS_INTENT$1={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function getDirectionAwareKey$1(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function getFocusIntent$1(e,t,n){const o=getDirectionAwareKey$1(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return MAP_KEY_TO_FOCUS_INTENT$1[o]}function focusFirst$4(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function wrapArray$3(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Root$b=RovingFocusGroup$1,Item$2=RovingFocusGroupItem$1;function useSize(e){const[t,n]=React__namespace.useState(void 0);return useLayoutEffect2(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const d=l[0];let f,g;if("borderBoxSize"in d){const b=d.borderBoxSize,_=Array.isArray(b)?b[0]:b;f=_.inlineSize,g=_.blockSize}else f=e.offsetWidth,g=e.offsetHeight;n({width:f,height:g})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}function usePrevious(e){const t=React__namespace.useRef({value:e,previous:e});return React__namespace.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function useStateMachine$1(e,t){return React__namespace.useReducer((n,o)=>t[n][o]??n,e)}var Presence=e=>{const{present:t,children:n}=e,o=usePresence(t),l=typeof n=="function"?n({present:o.isPresent}):React__namespace.Children.only(n),d=useComposedRefs(o.ref,getElementRef$1(l));return typeof n=="function"||o.isPresent?React__namespace.cloneElement(l,{ref:d}):null};Presence.displayName="Presence";function usePresence(e){const[t,n]=React__namespace.useState(),o=React__namespace.useRef(null),l=React__namespace.useRef(e),d=React__namespace.useRef("none"),f=e?"mounted":"unmounted",[g,b]=useStateMachine$1(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return React__namespace.useEffect(()=>{const _=getAnimationName(o.current);d.current=g==="mounted"?_:"none"},[g]),useLayoutEffect2(()=>{const _=o.current,S=l.current;if(S!==e){const C=d.current,E=getAnimationName(_);e?b("MOUNT"):E==="none"||(_==null?void 0:_.display)==="none"?b("UNMOUNT"):b(S&&C!==E?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,b]),useLayoutEffect2(()=>{if(t){let _;const S=t.ownerDocument.defaultView??window,R=E=>{const I=getAnimationName(o.current).includes(E.animationName);if(E.target===t&&I&&(b("ANIMATION_END"),!l.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",_=S.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},C=E=>{E.target===t&&(d.current=getAnimationName(o.current))};return t.addEventListener("animationstart",C),t.addEventListener("animationcancel",R),t.addEventListener("animationend",R),()=>{S.clearTimeout(_),t.removeEventListener("animationstart",C),t.removeEventListener("animationcancel",R),t.removeEventListener("animationend",R)}}else b("ANIMATION_END")},[t,b]),{isPresent:["mounted","unmountSuspended"].includes(g),ref:React__namespace.useCallback(_=>{o.current=_?getComputedStyle(_):null,n(_)},[])}}function getAnimationName(e){return(e==null?void 0:e.animationName)||"none"}function getElementRef$1(e){var o,l;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var RADIO_NAME="Radio",[createRadioContext,createRadioScope]=createContextScope(RADIO_NAME),[RadioProvider,useRadioContext]=createRadioContext(RADIO_NAME),Radio=React__namespace.forwardRef((e,t)=>{const{__scopeRadio:n,name:o,checked:l=!1,required:d,disabled:f,value:g="on",onCheck:b,form:_,...S}=e,[R,C]=React__namespace.useState(null),E=useComposedRefs(t,A=>C(A)),M=React__namespace.useRef(!1),I=R?_||!!R.closest("form"):!0;return jsxRuntime.jsxs(RadioProvider,{scope:n,checked:l,disabled:f,children:[jsxRuntime.jsx(Primitive$1.button,{type:"button",role:"radio","aria-checked":l,"data-state":getState$4(l),"data-disabled":f?"":void 0,disabled:f,value:g,...S,ref:E,onClick:composeEventHandlers(e.onClick,A=>{l||b==null||b(),I&&(M.current=A.isPropagationStopped(),M.current||A.stopPropagation())})}),I&&jsxRuntime.jsx(RadioBubbleInput,{control:R,bubbles:!M.current,name:o,value:g,checked:l,required:d,disabled:f,form:_,style:{transform:"translateX(-100%)"}})]})});Radio.displayName=RADIO_NAME;var INDICATOR_NAME$2="RadioIndicator",RadioIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:o,...l}=e,d=useRadioContext(INDICATOR_NAME$2,n);return jsxRuntime.jsx(Presence,{present:o||d.checked,children:jsxRuntime.jsx(Primitive$1.span,{"data-state":getState$4(d.checked),"data-disabled":d.disabled?"":void 0,...l,ref:t})})});RadioIndicator.displayName=INDICATOR_NAME$2;var BUBBLE_INPUT_NAME$3="RadioBubbleInput",RadioBubbleInput=React__namespace.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(t);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const M=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(M)}},[b,n,o]),jsxRuntime.jsx(Primitive$1.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});RadioBubbleInput.displayName=BUBBLE_INPUT_NAME$3;function getState$4(e){return e?"checked":"unchecked"}var ARROW_KEYS=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],RADIO_GROUP_NAME$2="RadioGroup",[createRadioGroupContext,createRadioGroupScope]=createContextScope(RADIO_GROUP_NAME$2,[createRovingFocusGroupScope$1,createRadioScope]),useRovingFocusGroupScope$2=createRovingFocusGroupScope$1(),useRadioScope=createRadioScope(),[RadioGroupProvider$1,useRadioGroupContext$1]=createRadioGroupContext(RADIO_GROUP_NAME$2),RadioGroup$2=React__namespace.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:o,defaultValue:l,value:d,required:f=!1,disabled:g=!1,orientation:b,dir:_,loop:S=!0,onValueChange:R,...C}=e,E=useRovingFocusGroupScope$2(n),M=useDirection(_),[I,A]=useControllableState({prop:d,defaultProp:l??null,onChange:R,caller:RADIO_GROUP_NAME$2});return jsxRuntime.jsx(RadioGroupProvider$1,{scope:n,name:o,required:f,disabled:g,value:I,onValueChange:A,children:jsxRuntime.jsx(Root$b,{asChild:!0,...E,orientation:b,dir:M,loop:S,children:jsxRuntime.jsx(Primitive$1.div,{role:"radiogroup","aria-required":f,"aria-orientation":b,"data-disabled":g?"":void 0,dir:M,...C,ref:t})})})});RadioGroup$2.displayName=RADIO_GROUP_NAME$2;var ITEM_NAME$4="RadioGroupItem",RadioGroupItem$1=React__namespace.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:o,...l}=e,d=useRadioGroupContext$1(ITEM_NAME$4,n),f=d.disabled||o,g=useRovingFocusGroupScope$2(n),b=useRadioScope(n),_=React__namespace.useRef(null),S=useComposedRefs(t,_),R=d.value===l.value,C=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const E=I=>{ARROW_KEYS.includes(I.key)&&(C.current=!0)},M=()=>C.current=!1;return document.addEventListener("keydown",E),document.addEventListener("keyup",M),()=>{document.removeEventListener("keydown",E),document.removeEventListener("keyup",M)}},[]),jsxRuntime.jsx(Item$2,{asChild:!0,...g,focusable:!f,active:R,children:jsxRuntime.jsx(Radio,{disabled:f,required:d.required,checked:R,...b,...l,name:d.name,ref:S,onCheck:()=>d.onValueChange(l.value),onKeyDown:composeEventHandlers(E=>{E.key==="Enter"&&E.preventDefault()}),onFocus:composeEventHandlers(l.onFocus,()=>{var E;C.current&&((E=_.current)==null||E.click())})})})});RadioGroupItem$1.displayName=ITEM_NAME$4;var INDICATOR_NAME2="RadioGroupIndicator",RadioGroupIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...o}=e,l=useRadioScope(n);return jsxRuntime.jsx(RadioIndicator,{...l,...o,ref:t})});RadioGroupIndicator.displayName=INDICATOR_NAME2;var Root2$6=RadioGroup$2,Item2$2=RadioGroupItem$1,Indicator$1=RadioGroupIndicator;const RadioGroup$1=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root2$6,{className:cn("grid gap-2",e),...t,ref:n}));RadioGroup$1.displayName=Root2$6.displayName;const RadioGroupItem=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Item2$2,{ref:n,className:cn("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow-sm focus:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:jsxRuntime.jsx(Indicator$1,{className:"flex items-center justify-center",children:jsxRuntime.jsx(Circle,{className:"h-3.5 w-3.5 fill-primary"})})}));RadioGroupItem.displayName=Item2$2.displayName;function createSlot(e){const t=createSlotClone(e),n=React__namespace.forwardRef((o,l)=>{const{children:d,...f}=o,g=React__namespace.Children.toArray(d),b=g.find(isSlottable);if(b){const _=b.props.children,S=g.map(R=>R===b?React__namespace.Children.count(_)>1?React__namespace.Children.only(null):React__namespace.isValidElement(_)?_.props.children:null:R);return jsxRuntime.jsx(t,{...f,ref:l,children:React__namespace.isValidElement(_)?React__namespace.cloneElement(_,void 0,S):null})}return jsxRuntime.jsx(t,{...f,ref:l,children:d})});return n.displayName=`${e}.Slot`,n}var Slot$4=createSlot("Slot");function createSlotClone(e){const t=React__namespace.forwardRef((n,o)=>{const{children:l,...d}=n;if(React__namespace.isValidElement(l)){const f=getElementRef(l),g=mergeProps(d,l.props);return l.type!==React__namespace.Fragment&&(g.ref=o?composeRefs(o,f):f),React__namespace.cloneElement(l,g)}return React__namespace.Children.count(l)>1?React__namespace.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var SLOTTABLE_IDENTIFIER=Symbol("radix.slottable");function createSlottable(e){const t=({children:n})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=SLOTTABLE_IDENTIFIER,t}function isSlottable(e){return React__namespace.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===SLOTTABLE_IDENTIFIER}function mergeProps(e,t){const n={...t};for(const o in t){const l=e[o],d=t[o];/^on[A-Z]/.test(o)?l&&d?n[o]=(...g)=>{d(...g),l(...g)}:l&&(n[o]=l):o==="style"?n[o]={...l,...d}:o==="className"&&(n[o]=[l,d].filter(Boolean).join(" "))}return{...e,...n}}function getElementRef(e){var o,l;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Primitive=NODES.reduce((e,t)=>{const n=createSlot(`Primitive.${t}`),o=React__namespace.forwardRef((l,d)=>{const{asChild:f,...g}=l,b=f?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntime.jsx(b,{...g,ref:d})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function dispatchDiscreteCustomEvent(e,t){e&&ReactDOM__namespace.flushSync(()=>e.dispatchEvent(t))}function useEscapeKeydown(e,t=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(e);React__namespace.useEffect(()=>{const o=l=>{l.key==="Escape"&&n(l)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=React__namespace.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=React__namespace.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:f,onDismiss:g,...b}=e,_=React__namespace.useContext(DismissableLayerContext),[S,R]=React__namespace.useState(null),C=(S==null?void 0:S.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,E]=React__namespace.useState({}),M=useComposedRefs(t,te=>R(te)),I=Array.from(_.layers),[A]=[..._.layersWithOutsidePointerEventsDisabled].slice(-1),V=I.indexOf(A),q=S?I.indexOf(S):-1,z=_.layersWithOutsidePointerEventsDisabled.size>0,Q=q>=V,F=usePointerDownOutside(te=>{const ae=te.target,ie=[..._.branches].some(oe=>oe.contains(ae));!Q||ie||(l==null||l(te),f==null||f(te),te.defaultPrevented||g==null||g())},C),O=useFocusOutside(te=>{const ae=te.target;[..._.branches].some(oe=>oe.contains(ae))||(d==null||d(te),f==null||f(te),te.defaultPrevented||g==null||g())},C);return useEscapeKeydown(te=>{q===_.layers.size-1&&(o==null||o(te),!te.defaultPrevented&&g&&(te.preventDefault(),g()))},C),React__namespace.useEffect(()=>{if(S)return n&&(_.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=C.body.style.pointerEvents,C.body.style.pointerEvents="none"),_.layersWithOutsidePointerEventsDisabled.add(S)),_.layers.add(S),dispatchUpdate(),()=>{n&&_.layersWithOutsidePointerEventsDisabled.size===1&&(C.body.style.pointerEvents=originalBodyPointerEvents)}},[S,C,n,_]),React__namespace.useEffect(()=>()=>{S&&(_.layers.delete(S),_.layersWithOutsidePointerEventsDisabled.delete(S),dispatchUpdate())},[S,_]),React__namespace.useEffect(()=>{const te=()=>E({});return document.addEventListener(CONTEXT_UPDATE,te),()=>document.removeEventListener(CONTEXT_UPDATE,te)},[]),jsxRuntime.jsx(Primitive.div,{...b,ref:M,style:{pointerEvents:z?Q?"auto":"none":void 0,...e.style},onFocusCapture:composeEventHandlers(e.onFocusCapture,O.onFocusCapture),onBlurCapture:composeEventHandlers(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:composeEventHandlers(e.onPointerDownCapture,F.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=React__namespace.forwardRef((e,t)=>{const n=React__namespace.useContext(DismissableLayerContext),o=React__namespace.useRef(null),l=useComposedRefs(t,o);return React__namespace.useEffect(()=>{const d=o.current;if(d)return n.branches.add(d),()=>{n.branches.delete(d)}},[n.branches]),jsxRuntime.jsx(Primitive.div,{...e,ref:l})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(e,t=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(e),o=React__namespace.useRef(!1),l=React__namespace.useRef(()=>{});return React__namespace.useEffect(()=>{const d=g=>{if(g.target&&!o.current){let b=function(){handleAndDispatchCustomEvent$1(POINTER_DOWN_OUTSIDE,n,_,{discrete:!0})};const _={originalEvent:g};g.pointerType==="touch"?(t.removeEventListener("click",l.current),l.current=b,t.addEventListener("click",l.current,{once:!0})):b()}else t.removeEventListener("click",l.current);o.current=!1},f=window.setTimeout(()=>{t.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(f),t.removeEventListener("pointerdown",d),t.removeEventListener("click",l.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function useFocusOutside(e,t=globalThis==null?void 0:globalThis.document){const n=useCallbackRef$1(e),o=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const l=d=>{d.target&&!o.current&&handleAndDispatchCustomEvent$1(FOCUS_OUTSIDE,n,{originalEvent:d},{discrete:!1})};return t.addEventListener("focusin",l),()=>t.removeEventListener("focusin",l)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function dispatchUpdate(){const e=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(e)}function handleAndDispatchCustomEvent$1(e,t,n,{discrete:o}){const l=n.originalEvent.target,d=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),o?dispatchDiscreteCustomEvent(l,d):l.dispatchEvent(d)}var Root$a=DismissableLayer,Branch=DismissableLayerBranch,AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS$1={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=React__namespace.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:l,onUnmountAutoFocus:d,...f}=e,[g,b]=React__namespace.useState(null),_=useCallbackRef$1(l),S=useCallbackRef$1(d),R=React__namespace.useRef(null),C=useComposedRefs(t,I=>b(I)),E=React__namespace.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;React__namespace.useEffect(()=>{if(o){let I=function(z){if(E.paused||!g)return;const Q=z.target;g.contains(Q)?R.current=Q:focus(R.current,{select:!0})},A=function(z){if(E.paused||!g)return;const Q=z.relatedTarget;Q!==null&&(g.contains(Q)||focus(R.current,{select:!0}))},V=function(z){if(document.activeElement===document.body)for(const F of z)F.removedNodes.length>0&&focus(g)};document.addEventListener("focusin",I),document.addEventListener("focusout",A);const q=new MutationObserver(V);return g&&q.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",I),document.removeEventListener("focusout",A),q.disconnect()}}},[o,g,E.paused]),React__namespace.useEffect(()=>{if(g){focusScopesStack.add(E);const I=document.activeElement;if(!g.contains(I)){const V=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS$1);g.addEventListener(AUTOFOCUS_ON_MOUNT,_),g.dispatchEvent(V),V.defaultPrevented||(focusFirst$3(removeLinks(getTabbableCandidates$1(g)),{select:!0}),document.activeElement===I&&focus(g))}return()=>{g.removeEventListener(AUTOFOCUS_ON_MOUNT,_),setTimeout(()=>{const V=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS$1);g.addEventListener(AUTOFOCUS_ON_UNMOUNT,S),g.dispatchEvent(V),V.defaultPrevented||focus(I??document.body,{select:!0}),g.removeEventListener(AUTOFOCUS_ON_UNMOUNT,S),focusScopesStack.remove(E)},0)}}},[g,_,S,E]);const M=React__namespace.useCallback(I=>{if(!n&&!o||E.paused)return;const A=I.key==="Tab"&&!I.altKey&&!I.ctrlKey&&!I.metaKey,V=document.activeElement;if(A&&V){const q=I.currentTarget,[z,Q]=getTabbableEdges(q);z&&Q?!I.shiftKey&&V===Q?(I.preventDefault(),n&&focus(z,{select:!0})):I.shiftKey&&V===z&&(I.preventDefault(),n&&focus(Q,{select:!0})):V===q&&I.preventDefault()}},[n,o,E.paused]);return jsxRuntime.jsx(Primitive.div,{tabIndex:-1,...f,ref:C,onKeyDown:M})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst$3(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(focus(o,{select:t}),document.activeElement!==n)return}function getTabbableEdges(e){const t=getTabbableCandidates$1(e),n=findVisible(t,e),o=findVisible(t.reverse(),e);return[n,o]}function getTabbableCandidates$1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const l=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||l?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function findVisible(e,t){for(const n of e)if(!isHidden(n,{upTo:t}))return n}function isHidden(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function isSelectableInput(e){return e instanceof HTMLInputElement&&"select"in e}function focus(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&isSelectableInput(e)&&t&&e.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=arrayRemove(e,t),e.unshift(t)},remove(t){var n;e=arrayRemove(e,t),(n=e[0])==null||n.resume()}}}function arrayRemove(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function removeLinks(e){return e.filter(t=>t.tagName!=="A")}var PORTAL_NAME$6="Portal",Portal$5=React__namespace.forwardRef((e,t)=>{var g;const{container:n,...o}=e,[l,d]=React__namespace.useState(!1);useLayoutEffect2(()=>d(!0),[]);const f=n||l&&((g=globalThis==null?void 0:globalThis.document)==null?void 0:g.body);return f?ReactDOM.createPortal(jsxRuntime.jsx(Primitive.div,{...o,ref:t}),f):null});Portal$5.displayName=PORTAL_NAME$6;var count$1=0;function useFocusGuards(){React__namespace.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",e[1]??createFocusGuard()),count$1++,()=>{count$1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),count$1--}},[])}function createFocusGuard(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function useCallbackRef(e,t){var n=React.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(o){var l=n.value;l!==o&&(n.value=o,n.callback(o,l))}}}})[0];return n.callback=t,n.facade}var useIsomorphicLayoutEffect=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect,currentValues=new WeakMap;function useMergeRefs(e,t){var n=useCallbackRef(null,function(o){return e.forEach(function(l){return assignRef(l,o)})});return useIsomorphicLayoutEffect(function(){var o=currentValues.get(n);if(o){var l=new Set(o),d=new Set(e),f=n.current;l.forEach(function(g){d.has(g)||assignRef(g,null)}),d.forEach(function(g){l.has(g)||assignRef(g,f)})}currentValues.set(n,e)},[e]),n}function ItoI(e){return e}function innerCreateMedium(e,t){t===void 0&&(t=ItoI);var n=[],o=!1,l={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(d){var f=t(d,o);return n.push(f),function(){n=n.filter(function(g){return g!==f})}},assignSyncMedium:function(d){for(o=!0;n.length;){var f=n;n=[],f.forEach(d)}n={push:function(g){return d(g)},filter:function(){return n}}},assignMedium:function(d){o=!0;var f=[];if(n.length){var g=n;n=[],g.forEach(d),f=n}var b=function(){var S=f;f=[],S.forEach(d)},_=function(){return Promise.resolve().then(b)};_(),n={push:function(S){f.push(S),_()},filter:function(S){return f=f.filter(S),n}}}};return l}function createSidecarMedium(e){e===void 0&&(e={});var t=innerCreateMedium(null);return t.options=__assign$1({async:!0,ssr:!1},e),t}var SideCar$1=function(e){var t=e.sideCar,n=__rest(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return React__namespace.createElement(o,__assign$1({},n))};SideCar$1.isSideCarExport=!0;function exportSidecar(e,t){return e.useMedium(t),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=React__namespace.forwardRef(function(e,t){var n=React__namespace.useRef(null),o=React__namespace.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),l=o[0],d=o[1],f=e.forwardProps,g=e.children,b=e.className,_=e.removeScrollBar,S=e.enabled,R=e.shards,C=e.sideCar,E=e.noIsolation,M=e.inert,I=e.allowPinchZoom,A=e.as,V=A===void 0?"div":A,q=e.gapMode,z=__rest(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),Q=C,F=useMergeRefs([n,t]),O=__assign$1(__assign$1({},z),l);return React__namespace.createElement(React__namespace.Fragment,null,S&&React__namespace.createElement(Q,{sideCar:effectCar,removeScrollBar:_,shards:R,noIsolation:E,inert:M,setCallbacks:d,allowPinchZoom:!!I,lockRef:n,gapMode:q}),f?React__namespace.cloneElement(React__namespace.Children.only(g),__assign$1(__assign$1({},O),{ref:F})):React__namespace.createElement(V,__assign$1({},O,{className:b,ref:F}),g))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var getNonce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=getNonce();return t&&e.setAttribute("nonce",t),e}function injectStyles(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function insertStyleTag(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var stylesheetSingleton=function(){var e=0,t=null;return{add:function(n){e==0&&(t=makeStyleTag())&&(injectStyles(t,n),insertStyleTag(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},styleHookSingleton=function(){var e=stylesheetSingleton();return function(t,n){React__namespace.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},styleSingleton=function(){var e=styleHookSingleton(),t=function(n){var o=n.styles,l=n.dynamic;return e(o,l),null};return t},zeroGap={left:0,top:0,right:0,gap:0},parse=function(e){return parseInt(e||"",10)||0},getOffset$1=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],l=t[e==="padding"?"paddingRight":"marginRight"];return[parse(n),parse(o),parse(l)]},getGapWidth=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zeroGap;var t=getOffset$1(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(e,t,n,o){var l=e.left,d=e.top,f=e.right,g=e.gap;return n===void 0&&(n="margin"),`
370
370
  .`.concat(noScrollbarsClassName,` {
371
371
  overflow: hidden `).concat(o,`;
372
372
  padding-right: `).concat(g,"px ").concat(o,`;
@@ -966,4 +966,4 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
966
966
  Use <ProductCard item={data}>`],basicComponents=["<Card> <CardHeader> <CardTitle>...</CardTitle> <CardDescription>...</CardDescription> </CardHeader> <CardContent> ... </CardContent> </Card>","<Badge>...</Badge>",'<Tabs defaultValue="eg1"> <TabsList> <TabsTrigger value="eg1">Example1</TabsTrigger> <TabsTrigger value="eg2">Example2</TabsTrigger> </TabsList> <TabsContent value="eg1"> ... </TabsContent> <TabsContent value="eg2"> ... </TabsContent> </Tabs>',"<ScrollArea>...</ScrollArea>","<ScrollArea orientation='horizontal'>...</ScrollArea>"],GetJSXFromAI=async(e,t,n,o,l=3)=>{const d="In addition to basic html tags, You have access to these beautiful Handmade Components. Try to use them even when you get an array of search results. For example, use ProductCard when ContentType is Product:",f="You also have access to these few Shadcn UI components:",g='Here is the data to display to the user (If a Handmade Component is a good fit for the data, use it. Otherwise, use regular html tags) (You have access to this data object in React via the data variable. Do not use JSON.parse, it is already parsed. For example, if data is an array, you can use {data.map(item, idx => <>...</>)} directly. CAUTION: when using map, you must use implicit return rather than a block body, as shown before. AGAIN: never use JSON.parse - data is already parsed and never a block body with arrow functions such as: (item => { return "EXAMPLE - DO NOT DO THIS" }):',b="Only output a single JSX code snippet. Start with <> and end with </>. All other code will be ignored, so make sure to place all CSS styles inline. Use CSS flex layouts when there is a lot of stuff to display.",_=JSON.stringify(n),S=[t,d,...complexComponents,f,...basicComponents,b,g,_,b].join(`\r
967
967
  `),E=await new GoogleGenAI({apiKey:e}).chats.create({model:o?"gemini-2.5-pro-preview-03-25":"gemini-2.0-flash-lite"}).sendMessage({message:S}),M=trimJSXString(E.text??"");return M&&!containsBlockArrowFunc(M)?M:l==0?"<p>Could not generate visuals for this data.</p>":await GetJSXFromAI(e,t,n,o,l-1)};function containsBlockArrowFunc(e){return e.replace(/\s+/g,"").indexOf("=>{")>=0}function trimJSXString(e){const t=e.indexOf("<"),n=e.lastIndexOf("</");return t===-1||n===-1?"":e.slice(t,e.indexOf(">",n)+1)}function AiGeneratedContent(e){const[t,n]=React.useState(""),{apiKey:o}=useApiKey();return React.useEffect(()=>{if(!o||!e.prompt||!e.data)return;n("");let l=!1;return GetJSXFromAI(o,e.prompt,e.data,e.smartAndSlow===!0).then(d=>{l||n(d)}),()=>{l=!0}},[e.prompt,e.data,n,o,e.smartAndSlow]),t?jsxRuntime.jsx(source_default,{bindings:{data:e.data},components:{ResellerCard,ManufacturerCard,PartnerCard,ProductCard,Card,CardHeader,CardTitle,CardContent,CardDescription,Badge,Tabs,TabsList,TabsContent,TabsTrigger,ScrollArea},jsx:t}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(Skeleton,{className:"h-32 w-32",children:jsxRuntime.jsx(Bot,{className:"m-auto align-middle h-full"})})})}var CHECKBOX_NAME="Checkbox",[createCheckboxContext,createCheckboxScope]=createContextScope(CHECKBOX_NAME),[CheckboxProvider,useCheckboxContext]=createCheckboxContext(CHECKBOX_NAME),Checkbox$1=React__namespace.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=e,[C,E]=React__namespace.useState(null),M=useComposedRefs(t,Q=>E(Q)),I=React__namespace.useRef(!1),A=C?S||!!C.closest("form"):!0,[V,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:CHECKBOX_NAME}),z=React__namespace.useRef(V);return React__namespace.useEffect(()=>{const Q=C==null?void 0:C.form;if(Q){const F=()=>q(z.current);return Q.addEventListener("reset",F),()=>Q.removeEventListener("reset",F)}},[C,q]),jsxRuntime.jsxs(CheckboxProvider,{scope:n,state:V,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"checkbox","aria-checked":isIndeterminate(V)?"mixed":V,"aria-required":f,"data-state":getState$1(V),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:M,onKeyDown:composeEventHandlers(e.onKeyDown,Q=>{Q.key==="Enter"&&Q.preventDefault()}),onClick:composeEventHandlers(e.onClick,Q=>{q(F=>isIndeterminate(F)?!0:!F),A&&(I.current=Q.isPropagationStopped(),I.current||Q.stopPropagation())})}),A&&jsxRuntime.jsx(CheckboxBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:V,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"},defaultChecked:isIndeterminate(d)?!1:d})]})});Checkbox$1.displayName=CHECKBOX_NAME;var INDICATOR_NAME="CheckboxIndicator",CheckboxIndicator=React__namespace.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...l}=e,d=useCheckboxContext(INDICATOR_NAME,n);return jsxRuntime.jsx(Presence,{present:o||isIndeterminate(d.state)||d.state===!0,children:jsxRuntime.jsx(Primitive.span,{"data-state":getState$1(d.state),"data-disabled":d.disabled?"":void 0,...l,ref:t,style:{pointerEvents:"none",...e.style}})})});CheckboxIndicator.displayName=INDICATOR_NAME;var BUBBLE_INPUT_NAME$1="CheckboxBubbleInput",CheckboxBubbleInput=React__namespace.forwardRef(({__scopeCheckbox:e,control:t,checked:n,bubbles:o=!0,defaultChecked:l,...d},f)=>{const g=React__namespace.useRef(null),b=useComposedRefs(g,f),_=usePrevious(n),S=useSize(t);React__namespace.useEffect(()=>{const C=g.current;if(!C)return;const E=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(E,"checked").set;if(_!==n&&I){const A=new Event("click",{bubbles:o});C.indeterminate=isIndeterminate(n),I.call(C,isIndeterminate(n)?!1:n),C.dispatchEvent(A)}},[_,n,o]);const R=React__namespace.useRef(isIndeterminate(n)?!1:n);return jsxRuntime.jsx(Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??R.current,...d,tabIndex:-1,ref:b,style:{...d.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});CheckboxBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function isIndeterminate(e){return e==="indeterminate"}function getState$1(e){return isIndeterminate(e)?"indeterminate":e?"checked":"unchecked"}var Root=Checkbox$1,Indicator=CheckboxIndicator;const Checkbox=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root,{ref:n,className:cn("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:jsxRuntime.jsx(Indicator,{className:cn("flex items-center justify-center text-current"),children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}));Checkbox.displayName=Root.displayName;var U=1,Y$1=.9,H=.8,J=.17,p=.1,u=.999,$=.9999,k$1=.99,m=/[\\\/_+.#"@\[\(\{&]/,B$1=/[\\\/_+.#"@\[\(\{&]/g,K$1=/[\s-]/,X=/[\s-]/g;function G(e,t,n,o,l,d,f){if(d===t.length)return l===e.length?U:k$1;var g=`${l},${d}`;if(f[g]!==void 0)return f[g];for(var b=o.charAt(d),_=n.indexOf(b,l),S=0,R,C,E,M;_>=0;)R=G(e,t,n,o,_+1,d+1,f),R>S&&(_===l?R*=U:m.test(e.charAt(_-1))?(R*=H,E=e.slice(l,_-1).match(B$1),E&&l>0&&(R*=Math.pow(u,E.length))):K$1.test(e.charAt(_-1))?(R*=Y$1,M=e.slice(l,_-1).match(X),M&&l>0&&(R*=Math.pow(u,M.length))):(R*=J,l>0&&(R*=Math.pow(u,_-l))),e.charAt(_)!==t.charAt(d)&&(R*=$)),(R<p&&n.charAt(_-1)===o.charAt(d+1)||o.charAt(d+1)===o.charAt(d)&&n.charAt(_-1)!==o.charAt(d))&&(C=G(e,t,n,o,_+1,d+2,f),C*p>R&&(R=C*p)),R>S&&(S=R),_=n.indexOf(b,_+1);return f[g]=S,S}function D(e){return e.toLowerCase().replace(X," ")}function W(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,G(e,t,D(e),D(t),0,0,{})}var N='[cmdk-group=""]',Y='[cmdk-group-items=""]',be='[cmdk-group-heading=""]',le='[cmdk-item=""]',ce=`${le}:not([aria-disabled="true"])`,Z="cmdk-item-select",T="data-value",Re=(e,t,n)=>W(e,t,n),ue=React__namespace.createContext(void 0),K=()=>React__namespace.useContext(ue),de=React__namespace.createContext(void 0),ee=()=>React__namespace.useContext(de),fe=React__namespace.createContext(void 0),me=React__namespace.forwardRef((e,t)=>{let n=L(()=>{var Ue,Xe;return{search:"",value:(Xe=(Ue=e.value)!=null?Ue:e.defaultValue)!=null?Xe:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=L(()=>new Set),l=L(()=>new Map),d=L(()=>new Map),f=L(()=>new Set),g=pe(e),{label:b,children:_,value:S,onValueChange:R,filter:C,shouldFilter:E,loop:M,disablePointerSelection:I=!1,vimBindings:A=!0,...V}=e,q=useId(),z=useId(),Q=useId(),F=React__namespace.useRef(null),O=ke();k(()=>{if(S!==void 0){let Ue=S.trim();n.current.value=Ue,te.emit()}},[S]),k(()=>{O(6,Ne)},[]);let te=React__namespace.useMemo(()=>({subscribe:Ue=>(f.current.add(Ue),()=>f.current.delete(Ue)),snapshot:()=>n.current,setState:(Ue,Xe,Je)=>{var Ye,it,Ke,et;if(!Object.is(n.current[Ue],Xe)){if(n.current[Ue]=Xe,Ue==="search")Ae(),oe(),O(1,se);else if(Ue==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ze=document.getElementById(Q);Ze?Ze.focus():(Ye=document.getElementById(q))==null||Ye.focus()}if(O(7,()=>{var Ze;n.current.selectedItemId=(Ze=ge())==null?void 0:Ze.id,te.emit()}),Je||O(5,Ne),((it=g.current)==null?void 0:it.value)!==void 0){let Ze=Xe??"";(et=(Ke=g.current).onValueChange)==null||et.call(Ke,Ze);return}}te.emit()}},emit:()=>{f.current.forEach(Ue=>Ue())}}),[]),ae=React__namespace.useMemo(()=>({value:(Ue,Xe,Je)=>{var Ye;Xe!==((Ye=d.current.get(Ue))==null?void 0:Ye.value)&&(d.current.set(Ue,{value:Xe,keywords:Je}),n.current.filtered.items.set(Ue,ie(Xe,Je)),O(2,()=>{oe(),te.emit()}))},item:(Ue,Xe)=>(o.current.add(Ue),Xe&&(l.current.has(Xe)?l.current.get(Xe).add(Ue):l.current.set(Xe,new Set([Ue]))),O(3,()=>{Ae(),oe(),n.current.value||se(),te.emit()}),()=>{d.current.delete(Ue),o.current.delete(Ue),n.current.filtered.items.delete(Ue);let Je=ge();O(4,()=>{Ae(),(Je==null?void 0:Je.getAttribute("id"))===Ue&&se(),te.emit()})}),group:Ue=>(l.current.has(Ue)||l.current.set(Ue,new Set),()=>{d.current.delete(Ue),l.current.delete(Ue)}),filter:()=>g.current.shouldFilter,label:b||e["aria-label"],getDisablePointerSelection:()=>g.current.disablePointerSelection,listId:q,inputId:Q,labelId:z,listInnerRef:F}),[]);function ie(Ue,Xe){var Je,Ye;let it=(Ye=(Je=g.current)==null?void 0:Je.filter)!=null?Ye:Re;return Ue?it(Ue,n.current.search,Xe):0}function oe(){if(!n.current.search||g.current.shouldFilter===!1)return;let Ue=n.current.filtered.items,Xe=[];n.current.filtered.groups.forEach(Ye=>{let it=l.current.get(Ye),Ke=0;it.forEach(et=>{let Ze=Ue.get(et);Ke=Math.max(Ze,Ke)}),Xe.push([Ye,Ke])});let Je=F.current;Oe().sort((Ye,it)=>{var Ke,et;let Ze=Ye.getAttribute("id"),tt=it.getAttribute("id");return((Ke=Ue.get(tt))!=null?Ke:0)-((et=Ue.get(Ze))!=null?et:0)}).forEach(Ye=>{let it=Ye.closest(Y);it?it.appendChild(Ye.parentElement===it?Ye:Ye.closest(`${Y} > *`)):Je.appendChild(Ye.parentElement===Je?Ye:Ye.closest(`${Y} > *`))}),Xe.sort((Ye,it)=>it[1]-Ye[1]).forEach(Ye=>{var it;let Ke=(it=F.current)==null?void 0:it.querySelector(`${N}[${T}="${encodeURIComponent(Ye[0])}"]`);Ke==null||Ke.parentElement.appendChild(Ke)})}function se(){let Ue=Oe().find(Je=>Je.getAttribute("aria-disabled")!=="true"),Xe=Ue==null?void 0:Ue.getAttribute(T);te.setState("value",Xe||void 0)}function Ae(){var Ue,Xe,Je,Ye;if(!n.current.search||g.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let it=0;for(let Ke of o.current){let et=(Xe=(Ue=d.current.get(Ke))==null?void 0:Ue.value)!=null?Xe:"",Ze=(Ye=(Je=d.current.get(Ke))==null?void 0:Je.keywords)!=null?Ye:[],tt=ie(et,Ze);n.current.filtered.items.set(Ke,tt),tt>0&&it++}for(let[Ke,et]of l.current)for(let Ze of et)if(n.current.filtered.items.get(Ze)>0){n.current.filtered.groups.add(Ke);break}n.current.filtered.count=it}function Ne(){var Ue,Xe,Je;let Ye=ge();Ye&&(((Ue=Ye.parentElement)==null?void 0:Ue.firstChild)===Ye&&((Je=(Xe=Ye.closest(N))==null?void 0:Xe.querySelector(be))==null||Je.scrollIntoView({block:"nearest"})),Ye.scrollIntoView({block:"nearest"}))}function ge(){var Ue;return(Ue=F.current)==null?void 0:Ue.querySelector(`${le}[aria-selected="true"]`)}function Oe(){var Ue;return Array.from(((Ue=F.current)==null?void 0:Ue.querySelectorAll(ce))||[])}function Le(Ue){let Xe=Oe()[Ue];Xe&&te.setState("value",Xe.getAttribute(T))}function Ge(Ue){var Xe;let Je=ge(),Ye=Oe(),it=Ye.findIndex(et=>et===Je),Ke=Ye[it+Ue];(Xe=g.current)!=null&&Xe.loop&&(Ke=it+Ue<0?Ye[Ye.length-1]:it+Ue===Ye.length?Ye[0]:Ye[it+Ue]),Ke&&te.setState("value",Ke.getAttribute(T))}function je(Ue){let Xe=ge(),Je=Xe==null?void 0:Xe.closest(N),Ye;for(;Je&&!Ye;)Je=Ue>0?we(Je,N):De(Je,N),Ye=Je==null?void 0:Je.querySelector(ce);Ye?te.setState("value",Ye.getAttribute(T)):Ge(Ue)}let Be=()=>Le(Oe().length-1),qe=Ue=>{Ue.preventDefault(),Ue.metaKey?Be():Ue.altKey?je(1):Ge(1)},ze=Ue=>{Ue.preventDefault(),Ue.metaKey?Le(0):Ue.altKey?je(-1):Ge(-1)};return React__namespace.createElement(Primitive.div,{ref:t,tabIndex:-1,...V,"cmdk-root":"",onKeyDown:Ue=>{var Xe;(Xe=V.onKeyDown)==null||Xe.call(V,Ue);let Je=Ue.nativeEvent.isComposing||Ue.keyCode===229;if(!(Ue.defaultPrevented||Je))switch(Ue.key){case"n":case"j":{A&&Ue.ctrlKey&&qe(Ue);break}case"ArrowDown":{qe(Ue);break}case"p":case"k":{A&&Ue.ctrlKey&&ze(Ue);break}case"ArrowUp":{ze(Ue);break}case"Home":{Ue.preventDefault(),Le(0);break}case"End":{Ue.preventDefault(),Be();break}case"Enter":{Ue.preventDefault();let Ye=ge();if(Ye){let it=new Event(Z);Ye.dispatchEvent(it)}}}}},React__namespace.createElement("label",{"cmdk-label":"",htmlFor:ae.inputId,id:ae.labelId,style:Te},b),B(e,Ue=>React__namespace.createElement(de.Provider,{value:te},React__namespace.createElement(ue.Provider,{value:ae},Ue))))}),he=React__namespace.forwardRef((e,t)=>{var n,o;let l=useId(),d=React__namespace.useRef(null),f=React__namespace.useContext(fe),g=K(),b=pe(e),_=(o=(n=b.current)==null?void 0:n.forceMount)!=null?o:f==null?void 0:f.forceMount;k(()=>{if(!_)return g.item(l,f==null?void 0:f.id)},[_]);let S=ve(l,d,[e.value,e.children,d],e.keywords),R=ee(),C=P(O=>O.value&&O.value===S.current),E=P(O=>_||g.filter()===!1?!0:O.search?O.filtered.items.get(l)>0:!0);React__namespace.useEffect(()=>{let O=d.current;if(!(!O||e.disabled))return O.addEventListener(Z,M),()=>O.removeEventListener(Z,M)},[E,e.onSelect,e.disabled]);function M(){var O,te;I(),(te=(O=b.current).onSelect)==null||te.call(O,S.current)}function I(){R.setState("value",S.current,!0)}if(!E)return null;let{disabled:A,value:V,onSelect:q,forceMount:z,keywords:Q,...F}=e;return React__namespace.createElement(Primitive.div,{ref:composeRefs(d,t),...F,id:l,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!C,"data-disabled":!!A,"data-selected":!!C,onPointerMove:A||g.getDisablePointerSelection()?void 0:I,onClick:A?void 0:M},e.children)}),Ee=React__namespace.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:l,...d}=e,f=useId(),g=React__namespace.useRef(null),b=React__namespace.useRef(null),_=useId(),S=K(),R=P(E=>l||S.filter()===!1?!0:E.search?E.filtered.groups.has(f):!0);k(()=>S.group(f),[]),ve(f,g,[e.value,e.heading,b]);let C=React__namespace.useMemo(()=>({id:f,forceMount:l}),[l]);return React__namespace.createElement(Primitive.div,{ref:composeRefs(g,t),...d,"cmdk-group":"",role:"presentation",hidden:R?void 0:!0},n&&React__namespace.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:_},n),B(e,E=>React__namespace.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?_:void 0},React__namespace.createElement(fe.Provider,{value:C},E))))}),ye=React__namespace.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,l=React__namespace.useRef(null),d=P(f=>!f.search);return!n&&!d?null:React__namespace.createElement(Primitive.div,{ref:composeRefs(l,t),...o,"cmdk-separator":"",role:"separator"})}),Se=React__namespace.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,l=e.value!=null,d=ee(),f=P(_=>_.search),g=P(_=>_.selectedItemId),b=K();return React__namespace.useEffect(()=>{e.value!=null&&d.setState("search",e.value)},[e.value]),React__namespace.createElement(Primitive.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":g,id:b.inputId,type:"text",value:l?e.value:f,onChange:_=>{l||d.setState("search",_.target.value),n==null||n(_.target.value)}})}),Ce=React__namespace.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...l}=e,d=React__namespace.useRef(null),f=React__namespace.useRef(null),g=P(_=>_.selectedItemId),b=K();return React__namespace.useEffect(()=>{if(f.current&&d.current){let _=f.current,S=d.current,R,C=new ResizeObserver(()=>{R=requestAnimationFrame(()=>{let E=_.offsetHeight;S.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return C.observe(_),()=>{cancelAnimationFrame(R),C.unobserve(_)}}},[]),React__namespace.createElement(Primitive.div,{ref:composeRefs(d,t),...l,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":g,"aria-label":o,id:b.listId},B(e,_=>React__namespace.createElement("div",{ref:composeRefs(f,b.listInnerRef),"cmdk-list-sizer":""},_)))}),xe=React__namespace.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:l,contentClassName:d,container:f,...g}=e;return React__namespace.createElement(Root$9,{open:n,onOpenChange:o},React__namespace.createElement(Portal$4,{container:f},React__namespace.createElement(Overlay,{"cmdk-overlay":"",className:l}),React__namespace.createElement(Content$2,{"aria-label":e.label,"cmdk-dialog":"",className:d},React__namespace.createElement(me,{ref:t,...g}))))}),Ie=React__namespace.forwardRef((e,t)=>P(n=>n.filtered.count===0)?React__namespace.createElement(Primitive.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Pe=React__namespace.forwardRef((e,t)=>{let{progress:n,children:o,label:l="Loading...",...d}=e;return React__namespace.createElement(Primitive.div,{ref:t,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":l},B(e,f=>React__namespace.createElement("div",{"aria-hidden":!0},f)))}),_e=Object.assign(me,{List:Ce,Item:he,Input:Se,Group:Ee,Separator:ye,Dialog:xe,Empty:Ie,Loading:Pe});function we(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function De(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function pe(e){let t=React__namespace.useRef(e);return k(()=>{t.current=e}),t}var k=typeof window>"u"?React__namespace.useEffect:React__namespace.useLayoutEffect;function L(e){let t=React__namespace.useRef();return t.current===void 0&&(t.current=e()),t}function P(e){let t=ee(),n=()=>e(t.snapshot());return React__namespace.useSyncExternalStore(t.subscribe,n,n)}function ve(e,t,n,o=[]){let l=React__namespace.useRef(),d=K();return k(()=>{var f;let g=(()=>{var _;for(let S of n){if(typeof S=="string")return S.trim();if(typeof S=="object"&&"current"in S)return S.current?(_=S.current.textContent)==null?void 0:_.trim():l.current}})(),b=o.map(_=>_.trim());d.value(e,g,b),(f=t.current)==null||f.setAttribute(T,g),l.current=g}),l}var ke=()=>{let[e,t]=React__namespace.useState(),n=L(()=>new Map);return k(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,l)=>{n.current.set(o,l),t({})}};function Me(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function B({asChild:e,children:t},n){return e&&React__namespace.isValidElement(t)?React__namespace.cloneElement(Me(t),{ref:t.ref},n(t.props.children)):n(t)}var Te={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Command=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(_e,{ref:n,className:cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Command.displayName=_e.displayName;const CommandDialog=({children:e,...t})=>jsxRuntime.jsx(Dialog,{...t,children:jsxRuntime.jsx(DialogContent,{className:"overflow-hidden p-0",children:jsxRuntime.jsx(Command,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),CommandInput=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[jsxRuntime.jsx(Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),jsxRuntime.jsx(_e.Input,{ref:n,className:cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));CommandInput.displayName=_e.Input.displayName;const CommandList=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(_e.List,{ref:n,className:cn("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));CommandList.displayName=_e.List.displayName;const CommandEmpty=React__namespace.forwardRef((e,t)=>jsxRuntime.jsx(_e.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));CommandEmpty.displayName=_e.Empty.displayName;const CommandGroup=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(_e.Group,{ref:n,className:cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));CommandGroup.displayName=_e.Group.displayName;const CommandSeparator=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(_e.Separator,{ref:n,className:cn("-mx-1 h-px bg-border",e),...t}));CommandSeparator.displayName=_e.Separator.displayName;const CommandItem=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(_e.Item,{ref:n,className:cn("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));CommandItem.displayName=_e.Item.displayName;const CommandShortcut=({className:e,...t})=>jsxRuntime.jsx("span",{className:cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});CommandShortcut.displayName="CommandShortcut";function GeneralDocumentCard({document:e,loading:t=!1}){return t?jsxRuntime.jsx("div",{children:"loading..."}):jsxRuntime.jsxs("div",{children:["GENERAL DOCUMENT CARD - ",e==null?void 0:e.OrderNumber," for P.O. ",e==null?void 0:e.PONumber]})}const Navbar=React.forwardRef(({routes:e,footer:t,dashboardTitle:n,withRandmarAssistant:o,chatUserName:l,chatApiKey:d},f)=>{const{appID:g}=reactRouterDom.useParams(),b=e.filter(C=>C.showInNav),_=React.useRef(null),S=React.useRef(null),R=React.useRef(null);return React.useImperativeHandle(f,()=>({setActiveChatAndSendMessage:(C,E)=>{var M;return(M=R.current)==null||M.click(),setTimeout(()=>{var I;(I=_.current)==null||I.focus(),S.current&&S.current.setActiveChatAndSendMessage(C,E)},100),!0}})),jsxRuntime.jsxs(Sidebar,{className:"border-r border-sidebar-border",children:[jsxRuntime.jsx(SidebarHeader,{className:"border-b border-sidebar-border px-6 h-16 justify-center bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center",children:jsxRuntime.jsx("img",{src:"https://api.randmar.io/images/RandmarIcon.svg",alt:"Randmar Icon",className:"h-4 w-4 filter brightness-0 saturate-100 invert"})}),jsxRuntime.jsx("span",{className:"font-semibold text-lg",children:n})]})}),jsxRuntime.jsx(SidebarContent,{className:"py-4 bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsx(SidebarMenu,{children:b.map(C=>{const E=C.icon,M=`/${C.path.replace(":appID",g??"")}`;return jsxRuntime.jsx(SidebarMenuItem,{children:jsxRuntime.jsx(SidebarMenuButton,{asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:M,className:"transition-colors hover:bg-muted px-6",children:[E&&jsxRuntime.jsx(E,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:C.label})]})})},C.key)})})}),jsxRuntime.jsxs(SidebarFooter,{className:"border-t border-sidebar-border p-4 bg-sidebar-background text-sidebar-foreground",children:[o===!0&&jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:R,size:"lg",className:"collapse md:visible",onClick:()=>setTimeout(()=>{var C;return(C=_.current)==null?void 0:C.focus()},50),children:[jsxRuntime.jsx(Bot,{}),"Assistant"]})}),jsxRuntime.jsx(DialogContent,{className:"max-w-[85vw] p-0 data-[state=open]:visible data-[state=closed]:invisible",forceMount:!0,animateExit:!1,children:jsxRuntime.jsx(ChatLayout,{ref:S,inputRef:_,userId:g??"2",userName:l??"Unknown user",apiKey:d??""})})]}),t]})]})}),Layout=React.forwardRef(({children:e,rightMenu:t,routes:n,footer:o,handleValidSearch:l,dashboardTitle:d,onSignOut:f,searchPlaceholder:g,withRandmarAssistant:b,chatUserName:_,chatApiKey:S,chatRef:R},C)=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(SidebarProvider,{children:jsxRuntime.jsxs("div",{className:"flex grow",children:[jsxRuntime.jsx(Navbar,{routes:n,footer:o,dashboardTitle:d,withRandmarAssistant:b,chatUserName:_,chatApiKey:S,ref:R}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[jsxRuntime.jsx(Topbar,{ref:C,onSignOut:f,rightMenu:t,handleValidSearch:l,searchPlaceholder:g}),jsxRuntime.jsx("main",{className:"flex-1 overflow-auto mt-16",children:e}),jsxRuntime.jsx(Toaster,{})]})]})})}));Layout.displayName="Layout";const salesChannels=[{id:"online-store",label:"Online store (Shopify, Amazon, etc.)"},{id:"brick-and-mortar",label:"Brick-and-mortar (Physical Store)"},{id:"marketplace",label:"Marketplace seller (eBay, Walmart, etc.)"},{id:"b2b",label:"B2B wholesale"},{id:"other-channel",label:"Other (please specify)"}],markets=[{id:"canada",label:"Canada - Nationwide"},{id:"ontario",label:"Ontario & Quebec"},{id:"atlantic",label:"Atlantic Provinces (NS, NB, PEI, NL)"},{id:"prairie",label:"Prairie (Saskatchewan, Manitoba)"},{id:"western",label:"Western Provinces (BC, Alberta, etc.)"},{id:"united-states",label:"United States"},{id:"other-market",label:"Other (please specify)"}];function ManufacturerGetStartedButton({applicationId:e,manufacturer:t}){const{toast:n}=useToast(),[o,l]=React.useState(!1),[d,f]=React.useState(!1),[g,b]=React.useState(!1),[_,S]=React.useState(""),[R,C]=React.useState(""),[E,M]=React.useState(!1),[I,A]=React.useState(""),[V,q]=React.useState(""),[z,Q]=React.useState([]),[F,O]=React.useState(""),[te,ae]=React.useState(""),[ie,oe]=React.useState([]),[se,Ae]=React.useState(""),[Ne,ge]=React.useState(""),[Oe]=usePutV4ResellerByRouteResellerIdCommunicationMutation(),[Le]=usePostV4PartnerByApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),{sendMessage:Ge}=useChat(),je=()=>{S(""),C("")},Be=()=>{A(""),q(""),Q([]),O(""),ae(""),oe([]),Ae(""),ge("")},qe=()=>{t.PartnerRegistrationLink?l(!0):t.OpenToWork&&f(!0)},ze=Ke=>{if(Ke.preventDefault(),!g){if(!_.trim()){C("Qualification ID is required");return}b(!0),Oe({routeResellerId:e,body:JSON.stringify({ManufactuerId:t.ManufacturerId??"",Message:`Qualification Id: ${_}`,Subject:"Qualification"})}).then(et=>{if(et.error){console.error(et.error),n({title:"Error",description:"Error submitting your qualification.",variant:"destructive"});return}n({title:"Success",description:"Qualification successfully submitted.",variant:"success"}),l(!1),je()}).catch(et=>{console.error(et),n({title:"Error",description:"Error submitting your qualification.",variant:"destructive"})}).finally(()=>{b(!1)})}},Ue=Ke=>{if(Ke.preventDefault(),E)return;q(""),O(""),Ae("");let et=!1;if(I.trim().length<10&&(q("Please provide a brief description of your business (minimum 10 characters)"),et=!0),z.length===0&&(O("Please select at least one sales channel"),et=!0),ie.length===0&&(Ae("Please select at least one market"),et=!0),et)return;const Ze=salesChannels.filter(Fe=>z.includes(Fe.id)).map(Fe=>Fe.label);te&&Ze.push(`Other: ${te}`);const tt=markets.filter(Fe=>ie.includes(Fe.id)).map(Fe=>Fe.label);Ne&&tt.push(`Other: ${Ne}`);const st=["Hello! I'd like to introduce my business:",`Business Description: ${I}`,`Sales Channels: ${Ze.join(", ")}`,`Markets: ${tt.join(", ")}`].join(`
968
968
 
969
- `);M(!0),Le({applicationId:e,partnerId:"2",message:st}).then(Fe=>{var Qe;if(Fe.error){console.error(Fe.error),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}const ct=(Qe=Fe.data)==null?void 0:Qe.ConversationId;ct&&Ge(ct)?(f(!1),Be()):n({title:"Could not send message",description:"Try again later.",variant:"destructive"})}).catch(Fe=>{console.error(Fe),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{M(!1)})},Xe=(Ke,et)=>{Q(Ze=>et?[...Ze,Ke]:Ze.filter(tt=>tt!==Ke)),O("")},Je=(Ke,et)=>{oe(Ze=>et?[...Ze,Ke]:Ze.filter(tt=>tt!==Ke)),Ae("")},Ye=z.includes("other-channel"),it=ie.includes("other-market");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!t.Qualification&&jsxRuntime.jsxs(Button,{onClick:qe,disabled:!t.PartnerRegistrationLink&&!t.OpenToWork,children:[jsxRuntime.jsx(Check,{className:"mr-2 h-4 w-4"}),"Get Started"]}),t.PartnerRegistrationLink&&jsxRuntime.jsx(Dialog,{open:o,onOpenChange:Ke=>{l(Ke)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[400px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:t.PublicName}),jsxRuntime.jsxs(DialogDescription,{children:[jsxRuntime.jsx("span",{className:"font-bold",children:"Already qualified?"})," Provide your Qualification ID."]})]}),jsxRuntime.jsxs("form",{onSubmit:ze,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"qualificationId",children:"Qualification ID"}),jsxRuntime.jsx(Input,{id:"qualificationId",placeholder:"Enter your qualification ID",value:_,onChange:Ke=>{S(Ke.target.value),C("")}}),R&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:R})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",className:"w-full",disabled:g,children:g?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Applying..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Check,{className:"mr-2 h-4 w-4"}),"Apply for Qualification"]})})})]}),jsxRuntime.jsx(Separator$1,{className:"my-4"}),jsxRuntime.jsxs("div",{className:"text-center space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Don't have a qualification ID?"}),jsxRuntime.jsx("a",{href:t.PartnerRegistrationLink,target:"_blank",rel:"noopener noreferrer",children:jsxRuntime.jsxs(Button,{variant:"outline",className:"w-full",disabled:!t.PartnerRegistrationLink,children:[jsxRuntime.jsx(ExternalLink,{className:"mr-2 h-4 w-4"}),"Register here"]})})]})]})}),jsxRuntime.jsx(Dialog,{open:d,onOpenChange:Ke=>{f(Ke)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[768px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Introduce Yourself"})}),jsxRuntime.jsxs("form",{onSubmit:Ue,className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{htmlFor:"businessDescription",children:["Tell Us About Your Business ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Briefly describe your business)"})]}),jsxRuntime.jsx(Textarea,{id:"businessDescription",placeholder:"We are an online retailer specializing in office supplies, serving businesses since 2018...",className:"min-h-[100px]",value:I,onChange:Ke=>{A(Ke.target.value),q("")}}),V&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:V})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{children:["Sales Channel(s) ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select where you currently sell your products)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:salesChannels.map(Ke=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`channel-${Ke.id}`,checked:z.includes(Ke.id),onCheckedChange:et=>Xe(Ke.id,et===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`channel-${Ke.id}`,className:"text-sm font-normal",children:Ke.label})]},Ke.id))}),Ye&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:te,onChange:Ke=>ae(Ke.target.value)}),F&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:F})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{children:["Your Primary Market(s) ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select which regions you sell to)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:markets.map(Ke=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`market-${Ke.id}`,checked:ie.includes(Ke.id),onCheckedChange:et=>Je(Ke.id,et===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`market-${Ke.id}`,className:"text-sm font-normal",children:Ke.label})]},Ke.id))}),it&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:Ne,onChange:Ke=>ge(Ke.target.value)}),se&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:se})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",disabled:E,children:E?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit"})})]})]})})]})}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection,useCollection,createCollectionScope]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope,createPopperScope]),usePopperScope$1=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:l,onOpenChange:d,value:f,defaultValue:g,onValueChange:b,dir:_,name:S,autoComplete:R,disabled:C,required:E,form:M}=e,I=usePopperScope$1(t),[A,V]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),O=useDirection(_),[te,ae]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[ie,oe]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),se=React__namespace.useRef(null),Ae=A?M||!!A.closest("form"):!0,[Ne,ge]=React__namespace.useState(new Set),Oe=Array.from(Ne).map(Le=>Le.props.value).join(";");return jsxRuntime.jsx(Root2$5,{...I,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:t,trigger:A,onTriggerChange:V,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:ie,onValueChange:oe,open:te,onOpenChange:ae,dir:O,triggerPointerDownPosRef:se,disabled:C,children:[jsxRuntime.jsx(Collection.Provider,{scope:t,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:e.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Le=>{ge(Ge=>new Set(Ge).add(Le))},[]),onNativeOptionRemove:React__namespace.useCallback(Le=>{ge(Ge=>{const je=new Set(Ge);return je.delete(Le),je})},[]),children:n})}),Ae?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:S,autoComplete:R,value:ie,onChange:Le=>oe(Le.target.value),disabled:C,form:M,children:[ie===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(Ne)]},Oe):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME$1="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...l}=e,d=usePopperScope$1(n),f=useSelectContext(TRIGGER_NAME$1,n),g=f.disabled||o,b=useComposedRefs(t,f.onTriggerChange),_=useCollection(n),S=React__namespace.useRef("touch"),[R,C,E]=useTypeaheadSearch(I=>{const A=_().filter(z=>!z.disabled),V=A.find(z=>z.value===f.value),q=findNextItem(A,I,V);q!==void 0&&f.onValueChange(q.value)}),M=I=>{g||(f.onOpenChange(!0),E()),I&&(f.triggerPointerDownPosRef.current={x:Math.round(I.pageX),y:Math.round(I.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,I=>{I.currentTarget.focus(),S.current!=="mouse"&&M(I)}),onPointerDown:composeEventHandlers(l.onPointerDown,I=>{S.current=I.pointerType;const A=I.target;A.hasPointerCapture(I.pointerId)&&A.releasePointerCapture(I.pointerId),I.button===0&&I.ctrlKey===!1&&I.pointerType==="mouse"&&(M(I),I.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,I=>{const A=R.current!=="";!(I.ctrlKey||I.altKey||I.metaKey)&&I.key.length===1&&C(I.key),!(A&&I.key===" ")&&OPEN_KEYS.includes(I.key)&&(M(),I.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME$1;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:l,children:d,placeholder:f="",...g}=e,b=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:_}=b,S=d!==void 0,R=useComposedRefs(t,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((e,t)=>{const{__scopeSelect:n,children:o,...l}=e;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:t,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME$1="SelectPortal",SelectPortal=e=>jsxRuntime.jsx(Portal$5,{asChild:!0,...e});SelectPortal.displayName=PORTAL_NAME$1;var CONTENT_NAME$1="SelectContent",SelectContent$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContext(CONTENT_NAME$1,e.__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:e.__scopeSelect,children:jsxRuntime.jsx(Collection.Slot,{scope:e.__scopeSelect,children:jsxRuntime.jsx("div",{children:e.children})})}),d):null}return jsxRuntime.jsx(SelectContentImpl,{...e,ref:t})});SelectContent$1.displayName=CONTENT_NAME$1;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME$1),CONTENT_IMPL_NAME="SelectContentImpl",Slot$1=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:M,hideWhenDetached:I,avoidCollisions:A,...V}=e,q=useSelectContext(CONTENT_NAME$1,n),[z,Q]=React__namespace.useState(null),[F,O]=React__namespace.useState(null),te=useComposedRefs(t,Ke=>Q(Ke)),[ae,ie]=React__namespace.useState(null),[oe,se]=React__namespace.useState(null),Ae=useCollection(n),[Ne,ge]=React__namespace.useState(!1),Oe=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Le=React__namespace.useCallback(Ke=>{const[et,...Ze]=Ae().map(Fe=>Fe.ref.current),[tt]=Ze.slice(-1),st=document.activeElement;for(const Fe of Ke)if(Fe===st||(Fe==null||Fe.scrollIntoView({block:"nearest"}),Fe===et&&F&&(F.scrollTop=0),Fe===tt&&F&&(F.scrollTop=F.scrollHeight),Fe==null||Fe.focus(),document.activeElement!==st))return},[Ae,F]),Ge=React__namespace.useCallback(()=>Le([ae,z]),[Le,ae,z]);React__namespace.useEffect(()=>{Ne&&Ge()},[Ne,Ge]);const{onOpenChange:je,triggerPointerDownPosRef:Be}=q;React__namespace.useEffect(()=>{if(z){let Ke={x:0,y:0};const et=tt=>{var st,Fe;Ke={x:Math.abs(Math.round(tt.pageX)-(((st=Be.current)==null?void 0:st.x)??0)),y:Math.abs(Math.round(tt.pageY)-(((Fe=Be.current)==null?void 0:Fe.y)??0))}},Ze=tt=>{Ke.x<=10&&Ke.y<=10?tt.preventDefault():z.contains(tt.target)||je(!1),document.removeEventListener("pointermove",et),Be.current=null};return Be.current!==null&&(document.addEventListener("pointermove",et),document.addEventListener("pointerup",Ze,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",et),document.removeEventListener("pointerup",Ze,{capture:!0})}}},[z,je,Be]),React__namespace.useEffect(()=>{const Ke=()=>je(!1);return window.addEventListener("blur",Ke),window.addEventListener("resize",Ke),()=>{window.removeEventListener("blur",Ke),window.removeEventListener("resize",Ke)}},[je]);const[qe,ze]=useTypeaheadSearch(Ke=>{const et=Ae().filter(st=>!st.disabled),Ze=et.find(st=>st.ref.current===document.activeElement),tt=findNextItem(et,Ke,Ze);tt&&setTimeout(()=>tt.ref.current.focus())}),Ue=React__namespace.useCallback((Ke,et,Ze)=>{const tt=!Oe.current&&!Ze;(q.value!==void 0&&q.value===et||tt)&&(ie(Ke),tt&&(Oe.current=!0))},[q.value]),Xe=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),Je=React__namespace.useCallback((Ke,et,Ze)=>{const tt=!Oe.current&&!Ze;(q.value!==void 0&&q.value===et||tt)&&se(Ke)},[q.value]),Ye=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,it=Ye===SelectPopperPosition?{side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:M,hideWhenDetached:I,avoidCollisions:A}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:O,itemRefCallback:Ue,selectedItem:ae,onItemLeave:Xe,itemTextRefCallback:Je,focusSelectedItem:Ge,selectedItemText:oe,position:o,isPositioned:Ne,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Ke=>{Ke.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Ke=>{var et;(et=q.trigger)==null||et.focus({preventScroll:!0}),Ke.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Ke=>Ke.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(Ye,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Ke=>Ke.preventDefault(),...V,...it,onPlaced:()=>ge(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...V.style},onKeyDown:composeEventHandlers(V.onKeyDown,Ke=>{const et=Ke.ctrlKey||Ke.altKey||Ke.metaKey;if(Ke.key==="Tab"&&Ke.preventDefault(),!et&&Ke.key.length===1&&ze(Ke.key),["ArrowUp","ArrowDown","Home","End"].includes(Ke.key)){let tt=Ae().filter(st=>!st.disabled).map(st=>st.ref.current);if(["ArrowUp","End"].includes(Ke.key)&&(tt=tt.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ke.key)){const st=Ke.target,Fe=tt.indexOf(st);tt=tt.slice(Fe+1)}setTimeout(()=>Le(tt)),Ke.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...l}=e,d=useSelectContext(CONTENT_NAME$1,n),f=useSelectContentContext(CONTENT_NAME$1,n),[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(null),R=useComposedRefs(t,te=>S(te)),C=useCollection(n),E=React__namespace.useRef(!1),M=React__namespace.useRef(!0),{viewport:I,selectedItem:A,selectedItemText:V,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&_&&I&&A&&V){const te=d.trigger.getBoundingClientRect(),ae=_.getBoundingClientRect(),ie=d.valueNode.getBoundingClientRect(),oe=V.getBoundingClientRect();if(d.dir!=="rtl"){const st=oe.left-ae.left,Fe=ie.left-st,ct=te.left-Fe,Qe=te.width+ct,nt=Math.max(Qe,ae.width),ut=window.innerWidth-CONTENT_MARGIN,ft=clamp(Fe,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,ut-nt)]);g.style.minWidth=Qe+"px",g.style.left=ft+"px"}else{const st=ae.right-oe.right,Fe=window.innerWidth-ie.right-st,ct=window.innerWidth-te.right-Fe,Qe=te.width+ct,nt=Math.max(Qe,ae.width),ut=window.innerWidth-CONTENT_MARGIN,ft=clamp(Fe,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,ut-nt)]);g.style.minWidth=Qe+"px",g.style.right=ft+"px"}const se=C(),Ae=window.innerHeight-CONTENT_MARGIN*2,Ne=I.scrollHeight,ge=window.getComputedStyle(_),Oe=parseInt(ge.borderTopWidth,10),Le=parseInt(ge.paddingTop,10),Ge=parseInt(ge.borderBottomWidth,10),je=parseInt(ge.paddingBottom,10),Be=Oe+Le+Ne+je+Ge,qe=Math.min(A.offsetHeight*5,Be),ze=window.getComputedStyle(I),Ue=parseInt(ze.paddingTop,10),Xe=parseInt(ze.paddingBottom,10),Je=te.top+te.height/2-CONTENT_MARGIN,Ye=Ae-Je,it=A.offsetHeight/2,Ke=A.offsetTop+it,et=Oe+Le+Ke,Ze=Be-et;if(et<=Je){const st=se.length>0&&A===se[se.length-1].ref.current;g.style.bottom="0px";const Fe=_.clientHeight-I.offsetTop-I.offsetHeight,ct=Math.max(Ye,it+(st?Xe:0)+Fe+Ge),Qe=et+ct;g.style.height=Qe+"px"}else{const st=se.length>0&&A===se[0].ref.current;g.style.top="0px";const ct=Math.max(Je,Oe+I.offsetTop+(st?Ue:0)+it)+Ze;g.style.height=ct+"px",I.scrollTop=et-Je+I.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,_,I,A,V,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{_&&F(window.getComputedStyle(_).zIndex)},[_]);const O=React__namespace.useCallback(te=>{te&&M.current===!0&&(z(),q==null||q(),M.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((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...d}=e,f=usePopperScope$1(n);return jsxRuntime.jsx(Content$1,{...f,...d,ref:t,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$1,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...l}=e,d=useSelectContentContext(VIEWPORT_NAME,n),f=useSelectViewportContext(VIEWPORT_NAME,n),g=useComposedRefs(t,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.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,_=>{const S=_.currentTarget,{contentWrapper:R,shouldExpandOnScrollRef:C}=f;if(C!=null&&C.current&&R){const E=Math.abs(b.current-S.scrollTop);if(E>0){const M=window.innerHeight-CONTENT_MARGIN*2,I=parseFloat(R.style.minHeight),A=parseFloat(R.style.height),V=Math.max(I,A);if(V<M){const q=V+E,z=Math.min(M,q),Q=q-z;R.style.height=z+"px",R.style.bottom==="0px"&&(S.scrollTop=Q>0?Q:0,R.style.justifyContent="flex-end")}}}b.current=S.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:t})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,ref:t})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME),SelectItem$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:l=!1,textValue:d,...f}=e,g=useSelectContext(ITEM_NAME,n),b=useSelectContentContext(ITEM_NAME,n),_=g.value===o,[S,R]=React__namespace.useState(d??""),[C,E]=React__namespace.useState(!1),M=useComposedRefs(t,q=>{var z;return(z=b.itemRefCallback)==null?void 0:z.call(b,q,o,l)}),I=useId(),A=React__namespace.useRef("touch"),V=()=>{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:I,isSelected:_,onItemTextChange:React__namespace.useCallback(q=>{R(z=>z||((q==null?void 0:q.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection.ItemSlot,{scope:n,value:o,disabled:l,textValue:S,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":I,"data-highlighted":C?"":void 0,"aria-selected":_&&C,"data-state":_?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...f,ref:M,onFocus:composeEventHandlers(f.onFocus,()=>E(!0)),onBlur:composeEventHandlers(f.onBlur,()=>E(!1)),onClick:composeEventHandlers(f.onClick,()=>{A.current!=="mouse"&&V()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{A.current==="mouse"&&V()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{A.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;A.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):A.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)&&V(),q.key===" "&&q.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:l,...d}=e,f=useSelectContext(ITEM_TEXT_NAME,n),g=useSelectContentContext(ITEM_TEXT_NAME,n),b=useSelectItemContext(ITEM_TEXT_NAME,n),_=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[S,R]=React__namespace.useState(null),C=useComposedRefs(t,V=>R(V),b.onItemTextChange,V=>{var q;return(q=g.itemTextRefCallback)==null?void 0:q.call(g,V,b.value,b.disabled)}),E=S==null?void 0:S.textContent,M=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:b.value,disabled:b.disabled,children:E},b.value),[b.disabled,b.value,E]),{onNativeOptionAdd:I,onNativeOptionRemove:A}=_;return useLayoutEffect2(()=>(I(M),()=>A(M)),[I,A,M]),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((e,t)=>{const{__scopeSelect:n,...o}=e;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:t}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,e.__scopeSelect),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,e.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(t,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const _=b.scrollTop>0;d(_)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...e,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((e,t)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,e.__scopeSelect),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,e.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(t,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const _=b.scrollHeight-b.clientHeight,S=Math.ceil(b.scrollTop)<_;d(S)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...e,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((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=e,d=useSelectContentContext("SelectScrollButton",n),f=React__namespace.useRef(null),g=useCollection(n),b=React__namespace.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return React__namespace.useEffect(()=>()=>b(),[b]),useLayoutEffect2(()=>{var S;const _=g().find(R=>R.ref.current===document.activeElement);(S=_==null?void 0:_.ref.current)==null||S.scrollIntoView({block:"nearest"})},[g]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:t,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var _;(_=d.onItemLeave)==null||_.call(d),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{b()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:t})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME$1="SelectArrow",SelectArrow=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,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:t}):null});SelectArrow.displayName=ARROW_NAME$1;var BUBBLE_INPUT_NAME="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const l=React__namespace.useRef(null),d=useComposedRefs(o,l),f=usePrevious(t);return React__namespace.useEffect(()=>{const g=l.current;if(!g)return;const b=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(b,"value").set;if(f!==t&&S){const R=new Event("change",{bubbles:!0});S.call(g,t),g.dispatchEvent(R)}},[f,t]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:d,defaultValue:t})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME;function shouldShowPlaceholder(e){return e===""||e===void 0}function useTypeaheadSearch(e){const t=useCallbackRef$1(e),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(f=>{const g=n.current+f;t(g),function b(_){n.current=_,window.clearTimeout(o.current),_!==""&&(o.current=window.setTimeout(()=>b(""),1e3))}(g)},[t]),d=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,d]}function findNextItem(e,t,n){const l=t.length>1&&Array.from(t).every(_=>_===t[0])?t[0]:t,d=n?e.indexOf(n):-1;let f=wrapArray(e,Math.max(d,0));l.length===1&&(f=f.filter(_=>_!==n));const b=f.find(_=>_.textValue.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function wrapArray(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Root2$1=Select$1,Trigger$1=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal$1=SelectPortal,Content2$1=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2$1,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(Trigger$1,{ref:o,className:cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger$1.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:e,children:t,position:n="popper",...o},l)=>jsxRuntime.jsx(Portal$1,{children:jsxRuntime.jsxs(Content2$1,{ref:l,className:cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[jsxRuntime.jsx(SelectScrollUpButton,{}),jsxRuntime.jsx(Viewport,{className:cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2$1.displayName;const SelectLabel=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",e),...t}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(Item,{ref:o,className:cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),jsxRuntime.jsx(ItemText,{children:t})]}));SelectItem.displayName=Item.displayName;const SelectSeparator=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",e),...t}));SelectSeparator.displayName=Separator.displayName;const DAYS_OF_WEEK=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ManufacturerReorderingCard({manufacturer:e,onSave:t,loading:n=!1,saving:o=!1}){const[l,d]=React.useState({...e}),f=(C,E)=>{d(M=>({...M,[C]:E}))},g=(C,E)=>{d(M=>({...M,[C]:E}))},b=(C,E)=>{d(M=>({...M,[C]:E}))},_=()=>{o||t(l)},S=C=>C===-1?"ASAP":C===void 0||C<0||C>6?"Sunday":DAYS_OF_WEEK[C],R=C=>C==="ASAP"?-1:DAYS_OF_WEEK.indexOf(C);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[n?jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}):jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Reordering"}),n?jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}):jsxRuntime.jsx(CardDescription,{className:"text-sm",children:"Adjust your reordering settings to control lead times, stocking weeks, minimum orders, and reorder dates, enhancing efficiency in restocking processes."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"automatic-reordering",checked:l.AutoUpdate,onCheckedChange:C=>f("AutoUpdate",C),disabled:o}),jsxRuntime.jsx(Label$2,{htmlFor:"automatic-reordering",children:"Automatic Reordering"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"reorder-date",children:"Automatic Reorder Date"}),jsxRuntime.jsxs(Select,{value:S(l.AutoReorderDate),onValueChange:C=>g("AutoReorderDate",R(C)),disabled:o,children:[jsxRuntime.jsx(SelectTrigger,{id:"reorder-date",children:jsxRuntime.jsx(SelectValue,{placeholder:"Select day"})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"ASAP",children:"ASAP"}),DAYS_OF_WEEK.map(C=>jsxRuntime.jsx(SelectItem,{value:C,children:C},C))]})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"weeks-stocking",children:"Default Weeks of Stocking"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"weeks-stocking",type:"number",value:l.DefaultWeeksOfStocking||"",onChange:C=>g("DefaultWeeksOfStocking",Number(C.target.value)),disabled:o}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"weeks"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"minimum-order",children:"Default Minimum Order"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"minimum-order",type:"number",className:"pl-6",value:l.DefaultMinimumOrder||"",onChange:C=>g("DefaultMinimumOrder",Number(C.target.value)),disabled:o})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"lead-time",children:"Default Lead Time"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"lead-time",type:"number",value:l.DefaultLeadTime||"",onChange:C=>g("DefaultLeadTime",Number(C.target.value)),disabled:o}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"days"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"maximum-inventory-value",children:"Default Maximum Inventory Value"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"maximum-inventory-value",type:"number",className:"pl-6",value:l.DefaultMaxInventoryValue||"",onChange:C=>g("DefaultMaxInventoryValue",Number(C.target.value)),disabled:o})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"order-confirmations",children:"Send Order Confirmations To"}),jsxRuntime.jsx(Input,{id:"order-confirmations",type:"email",value:l.POEmail||"",onChange:C=>b("POEmail",C.target.value),placeholder:"email@example.com",disabled:o})]})]})]})}),jsxRuntime.jsx(CardFooter,{className:"flex justify-end",children:n?jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"}):jsxRuntime.jsxs(Button,{onClick:_,disabled:o,children:[o&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}var POPOVER_NAME="Popover",[createPopoverContext,createPopoverScope]=createContextScope(POPOVER_NAME,[createPopperScope]),usePopperScope=createPopperScope(),[PopoverProvider,usePopoverContext]=createPopoverContext(POPOVER_NAME),Popover$1=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:l,onOpenChange:d,modal:f=!1}=e,g=usePopperScope(t),b=React__namespace.useRef(null),[_,S]=React__namespace.useState(!1),[R,C]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:POPOVER_NAME});return jsxRuntime.jsx(Root2$5,{...g,children:jsxRuntime.jsx(PopoverProvider,{scope:t,contentId:useId(),triggerRef:b,open:R,onOpenChange:C,onOpenToggle:React__namespace.useCallback(()=>C(E=>!E),[C]),hasCustomAnchor:_,onCustomAnchorAdd:React__namespace.useCallback(()=>S(!0),[]),onCustomAnchorRemove:React__namespace.useCallback(()=>S(!1),[]),modal:f,children:n})})};Popover$1.displayName=POPOVER_NAME;var ANCHOR_NAME="PopoverAnchor",PopoverAnchor$1=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,l=usePopoverContext(ANCHOR_NAME,n),d=usePopperScope(n),{onCustomAnchorAdd:f,onCustomAnchorRemove:g}=l;return React__namespace.useEffect(()=>(f(),()=>g()),[f,g]),jsxRuntime.jsx(Anchor,{...d,...o,ref:t})});PopoverAnchor$1.displayName=ANCHOR_NAME;var TRIGGER_NAME="PopoverTrigger",PopoverTrigger$1=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,l=usePopoverContext(TRIGGER_NAME,n),d=usePopperScope(n),f=useComposedRefs(t,l.triggerRef),g=jsxRuntime.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":getState(l.open),...o,ref:f,onClick:composeEventHandlers(e.onClick,l.onOpenToggle)});return l.hasCustomAnchor?g:jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:g})});PopoverTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="PopoverPortal",[PortalProvider,usePortalContext]=createPopoverContext(PORTAL_NAME,{forceMount:void 0}),PopoverPortal=e=>{const{__scopePopover:t,forceMount:n,children:o,container:l}=e,d=usePopoverContext(PORTAL_NAME,t);return jsxRuntime.jsx(PortalProvider,{scope:t,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};PopoverPortal.displayName=PORTAL_NAME;var CONTENT_NAME="PopoverContent",PopoverContent$1=React__namespace.forwardRef((e,t)=>{const n=usePortalContext(CONTENT_NAME,e.__scopePopover),{forceMount:o=n.forceMount,...l}=e,d=usePopoverContext(CONTENT_NAME,e.__scopePopover);return jsxRuntime.jsx(Presence,{present:o||d.open,children:d.modal?jsxRuntime.jsx(PopoverContentModal,{...l,ref:t}):jsxRuntime.jsx(PopoverContentNonModal,{...l,ref:t})})});PopoverContent$1.displayName=CONTENT_NAME;var Slot=createSlot("PopoverContent.RemoveScroll"),PopoverContentModal=React__namespace.forwardRef((e,t)=>{const n=usePopoverContext(CONTENT_NAME,e.__scopePopover),o=React__namespace.useRef(null),l=useComposedRefs(t,o),d=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const f=o.current;if(f)return hideOthers(f)},[]),jsxRuntime.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,children:jsxRuntime.jsx(PopoverContentImpl,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(e.onCloseAutoFocus,f=>{var g;f.preventDefault(),d.current||(g=n.triggerRef.current)==null||g.focus()}),onPointerDownOutside:composeEventHandlers(e.onPointerDownOutside,f=>{const g=f.detail.originalEvent,b=g.button===0&&g.ctrlKey===!0,_=g.button===2||b;d.current=_},{checkForDefaultPrevented:!1}),onFocusOutside:composeEventHandlers(e.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1})})})}),PopoverContentNonModal=React__namespace.forwardRef((e,t)=>{const n=usePopoverContext(CONTENT_NAME,e.__scopePopover),o=React__namespace.useRef(!1),l=React__namespace.useRef(!1);return jsxRuntime.jsx(PopoverContentImpl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{var f,g;(f=e.onCloseAutoFocus)==null||f.call(e,d),d.defaultPrevented||(o.current||(g=n.triggerRef.current)==null||g.focus(),d.preventDefault()),o.current=!1,l.current=!1},onInteractOutside:d=>{var b,_;(b=e.onInteractOutside)==null||b.call(e,d),d.defaultPrevented||(o.current=!0,d.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const f=d.target;((_=n.triggerRef.current)==null?void 0:_.contains(f))&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&l.current&&d.preventDefault()}})}),PopoverContentImpl=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:_,onInteractOutside:S,...R}=e,C=usePopoverContext(CONTENT_NAME,n),E=usePopperScope(n);return useFocusGuards(),jsxRuntime.jsx(FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:l,onUnmountAutoFocus:d,children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:f,onInteractOutside:S,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:_,onDismiss:()=>C.onOpenChange(!1),children:jsxRuntime.jsx(Content$1,{"data-state":getState(C.open),role:"dialog",id:C.contentId,...E,...R,ref:t,style:{...R.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),CLOSE_NAME="PopoverClose",PopoverClose=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,l=usePopoverContext(CLOSE_NAME,n);return jsxRuntime.jsx(Primitive.button,{type:"button",...o,ref:t,onClick:composeEventHandlers(e.onClick,()=>l.onOpenChange(!1))})});PopoverClose.displayName=CLOSE_NAME;var ARROW_NAME="PopoverArrow",PopoverArrow=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,l=usePopperScope(n);return jsxRuntime.jsx(Arrow,{...l,...o,ref:t})});PopoverArrow.displayName=ARROW_NAME;function getState(e){return e?"open":"closed"}var Root2=Popover$1,Anchor2=PopoverAnchor$1,Trigger=PopoverTrigger$1,Portal=PopoverPortal,Content2=PopoverContent$1;const Popover=Root2,PopoverTrigger=Trigger,PopoverAnchor=Anchor2,PopoverContent=React__namespace.forwardRef(({className:e,align:t="center",sideOffset:n=4,...o},l)=>jsxRuntime.jsx(Portal,{children:jsxRuntime.jsx(Content2,{ref:l,align:t,sideOffset:n,className:cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-popover-content-transform-origin]",e),...o})}));PopoverContent.displayName=Content2.displayName;function MultiSelect({options:e,selected:t,onChange:n,placeholder:o="Select items..."}){const[l,d]=React__namespace.useState(!1),[f,g]=React__namespace.useState(""),b=React__namespace.useRef(null),[_,S]=React__namespace.useState(void 0),R=React__namespace.useCallback(()=>{b.current&&S(b.current.offsetWidth)},[]);React__namespace.useLayoutEffect(()=>{R()},[R]),React__namespace.useEffect(()=>(window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)),[R]);const C=I=>{n(t.filter(A=>A!==I))},E=I=>{d(!1),t.includes(I)?n(t.filter(A=>A!==I)):n([...t,I])},M=I=>{I.key==="Enter"&&f&&!e.includes(f)&&!t.includes(f)&&(I.preventDefault(),E(f),g(""))};return jsxRuntime.jsxs(Popover,{open:l,onOpenChange:d,children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:b,variant:"outline",role:"combobox","aria-expanded":l,className:"w-full justify-between h-auto min-h-[40px] py-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 items-center",children:t.length>0?t.map(I=>jsxRuntime.jsxs(Badge,{variant:"outline",className:"mr-1 mb-1",children:[I,jsxRuntime.jsx("span",{className:"ml-1 cursor-pointer ring-offset-background rounded-full outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:A=>{A.preventDefault(),A.stopPropagation(),C(I)},children:jsxRuntime.jsx(X$1,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},I)):jsxRuntime.jsx("span",{className:"text-muted-foreground",children:o})}),jsxRuntime.jsx(ChevronsUpDown,{className:"h-4 w-4 shrink-0 opacity-50 ml-2"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-full p-0",style:{width:_},children:jsxRuntime.jsxs(Command,{onKeyDown:M,children:[jsxRuntime.jsx(CommandInput,{placeholder:"Search or add custom item...",value:f,onValueChange:g}),jsxRuntime.jsxs(CommandList,{children:[jsxRuntime.jsx(CommandEmpty,{children:"No item found."}),jsxRuntime.jsxs(CommandGroup,{children:[e.filter(I=>!t.includes(I)).map(I=>jsxRuntime.jsxs(CommandItem,{onSelect:()=>E(I),children:[jsxRuntime.jsx(Check,{className:cn("mr-2 h-4 w-4",t.includes(I)?"opacity-100":"opacity-0")}),I]},I)),f&&!e.includes(f)&&!t.includes(f)&&jsxRuntime.jsxs(CommandItem,{onSelect:()=>E(f),children:['Add "',f,'"']})]})]})]})})]})}function ResellerBillingOverviewCard({reseller:e,actions:t,loading:n=!1}){return n||!e?jsxRuntime.jsx(ResellerBillingOverviewSkeleton,{}):jsxRuntime.jsx(ResellerBillingOverviewData,{reseller:e,actions:t})}function ResellerBillingOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-40"})})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:Array(3).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))}),jsxRuntime.jsx("div",{className:"space-y-4",children:Array(2).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))})]}),jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-28 rounded-md"})})]})]})}function ResellerBillingOverviewData({reseller:e,actions:t}){const n=f=>f===void 0?"$0.00":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(f),o=e.Statement||{},l=[{title:"0 - 30 Days",amount:o.Over0||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"31 - 45 Days",amount:o.Over30||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"45+ Days",amount:o.Over45||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"}],d=[{title:"Total",amount:o.Total||0,icon:jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-white"}),color:"bg-green-500"},{title:"Credit Limit",amount:e.CreditLimit||0,icon:jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"}];return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:l.map((f,g)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:f.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${f.color}`,children:f.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(f.amount)})})]},g))}),jsxRuntime.jsx("div",{className:"space-y-4",children:d.map((f,g)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:f.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${f.color}`,children:f.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(f.amount)})})]},g))})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:t})]})]})}function ResellerQualificationsCard({qualifications:e=[],loading:t=!1}){return t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:Array.from({length:10}).map((n,o)=>jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]},o))})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:e.map((n,o)=>jsxRuntime.jsx(ManufacturerLogo,{manufacturerId:n.ManufacturerId,opportunityNumber:n.DefaultOpportunityNumber},`${n.ManufacturerId}-${o}`))})})]})}function ManufacturerLogo({manufacturerId:e,opportunityNumber:t}){const[n,o]=React.useState(null),[l,d]=React.useState(!0),[f,g]=React.useState(!1),[b,_]=React.useState(null),S=React.useMemo(()=>e?{logoUrl:`https://api.randmar.io/V4/Partner/${e}/Account/Logo?width=96&height=48`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${e}/Account/Logo/Exists`}:null,[e]);return React.useEffect(()=>{if(!S)return;let R=!0;_(null);const C=async()=>{try{const I=await fetch(S.logoExistsUrl);if(I.ok){const V=(await I.text()).toLowerCase()==="true";return R&&g(V),V}return!1}catch(I){return console.error("Failed to check if logo exists:",I),R&&g(!1),!1}},E=async()=>{R&&d(!0);try{const I=await fetch(S.logoUrl);if(I.ok){const A=await I.blob();R&&(n&&URL.revokeObjectURL(n),o(URL.createObjectURL(A)))}else throw new Error(`Failed to load logo: ${I.status}`)}catch(I){console.error("Failed to load logo:",I),R&&_("Failed to load manufacturer logo")}finally{R&&d(!1)}};return(async()=>{await C()?E():d(!1)})(),()=>{R=!1,n&&URL.revokeObjectURL(n)}},[S]),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"h-12 flex items-center justify-center mb-2",children:l?jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md"}):f&&n?jsxRuntime.jsx("img",{src:n,alt:"Manufacturer logo",className:"max-h-12 max-w-24 object-contain",onError:()=>_("Failed to load logo")}):jsxRuntime.jsx("div",{className:"h-12 w-24 flex items-center justify-center bg-slate-100 rounded-md text-xs text-slate-500",children:e?e.substring(0,8):"No ID"})}),t&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs",children:t}),b&&jsxRuntime.jsx("div",{className:"text-red-500 text-xs mt-1",role:"alert",children:b})]})}function SalesOverviewCard({salesData:e,salesStatistics:t=[],loading:n=!1}){return n||!e?jsxRuntime.jsx(SalesOverviewSkeleton,{}):jsxRuntime.jsx(SalesOverviewData,{salesData:e,salesStatistics:t})}function SalesOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array(3).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-[250px] w-full rounded-lg"})]})})]})]})}function SalesOverviewData({salesData:e,salesStatistics:t=[]}){const n=d=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(d),o=[{title:"Last 30 days",amount:e.SalesLast30Days||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"},{title:"Last 3 months",amount:e.SalesLast3Months||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-amber-500"},{title:"Year to date",amount:e.SalesYearToDay||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-emerald-500"}],l=React.useMemo(()=>{const d=new Map;return t.forEach(f=>{var b;const g=((b=f.Day)==null?void 0:b.toString())||"";if(g.length===8){const _=parseInt(g.substring(0,4),10),S=parseInt(g.substring(4,6),10)-1,R=parseInt(g.substring(6,8),10),C=new Date(_,S,R),E=new Date(C),M=C.getDay();E.setDate(C.getDate()-M);const I=`${E.getFullYear()}-${String(E.getMonth()+1).padStart(2,"0")}-${String(E.getDate()).padStart(2,"0")}`,A=f.ExtendedPrice||0;d.has(I)?d.set(I,d.get(I)+A):d.set(I,A)}}),Array.from(d).sort(([f],[g])=>f.localeCompare(g)).map(([f,g])=>({date:`${f.substring(5,7)}/${f.substring(8,10)}`,amount:g}))},[t]);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:"Sales Overview"})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map((d,f)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:d.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${d.color}`,children:d.icon})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(d.amount)})]})]},f))}),jsxRuntime.jsx("div",{className:"mt-6",children:t&&t.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h3",{className:"text-sm font-medium mb-4",children:"Sales Trend"}),jsxRuntime.jsx("div",{className:"space-y-6",children:jsxRuntime.jsx(AreaChart,{data:l,units:"$",unitsPosition:"left",height:200})})]})})]})]})}exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertTitle=AlertTitle,exports.ApiKeyProvider=ApiKeyProvider,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.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.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.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.PartnerCard=PartnerCard,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.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.Reseller=Reseller,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useApiKey=useApiKey,exports.useChat=useChat,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
969
+ `);M(!0),Le({applicationId:e,partnerId:t.ManufactuerId,message:st}).then(Fe=>{var Qe;if(Fe.error){console.error(Fe.error),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}const ct=(Qe=Fe.data)==null?void 0:Qe.ConversationId;ct&&Ge(ct)?(f(!1),Be()):n({title:"Could not send message",description:"Try again later.",variant:"destructive"})}).catch(Fe=>{console.error(Fe),n({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{M(!1)})},Xe=(Ke,et)=>{Q(Ze=>et?[...Ze,Ke]:Ze.filter(tt=>tt!==Ke)),O("")},Je=(Ke,et)=>{oe(Ze=>et?[...Ze,Ke]:Ze.filter(tt=>tt!==Ke)),Ae("")},Ye=z.includes("other-channel"),it=ie.includes("other-market");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!t.Qualification&&jsxRuntime.jsxs(Button,{onClick:qe,disabled:!t.PartnerRegistrationLink&&!t.OpenToWork,children:[jsxRuntime.jsx(Check,{className:"mr-2 h-4 w-4"}),"Get Started"]}),t.PartnerRegistrationLink&&jsxRuntime.jsx(Dialog,{open:o,onOpenChange:Ke=>{l(Ke)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[400px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:t.PublicName}),jsxRuntime.jsxs(DialogDescription,{children:[jsxRuntime.jsx("span",{className:"font-bold",children:"Already qualified?"})," Provide your Qualification ID."]})]}),jsxRuntime.jsxs("form",{onSubmit:ze,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"qualificationId",children:"Qualification ID"}),jsxRuntime.jsx(Input,{id:"qualificationId",placeholder:"Enter your qualification ID",value:_,onChange:Ke=>{S(Ke.target.value),C("")}}),R&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:R})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",className:"w-full",disabled:g,children:g?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Applying..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Check,{className:"mr-2 h-4 w-4"}),"Apply for Qualification"]})})})]}),jsxRuntime.jsx(Separator$1,{className:"my-4"}),jsxRuntime.jsxs("div",{className:"text-center space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Don't have a qualification ID?"}),jsxRuntime.jsx("a",{href:t.PartnerRegistrationLink,target:"_blank",rel:"noopener noreferrer",children:jsxRuntime.jsxs(Button,{variant:"outline",className:"w-full",disabled:!t.PartnerRegistrationLink,children:[jsxRuntime.jsx(ExternalLink,{className:"mr-2 h-4 w-4"}),"Register here"]})})]})]})}),jsxRuntime.jsx(Dialog,{open:d,onOpenChange:Ke=>{f(Ke)},children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[768px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Introduce Yourself"})}),jsxRuntime.jsxs("form",{onSubmit:Ue,className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{htmlFor:"businessDescription",children:["Tell Us About Your Business ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Briefly describe your business)"})]}),jsxRuntime.jsx(Textarea,{id:"businessDescription",placeholder:"We are an online retailer specializing in office supplies, serving businesses since 2018...",className:"min-h-[100px]",value:I,onChange:Ke=>{A(Ke.target.value),q("")}}),V&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:V})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{children:["Sales Channel(s) ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select where you currently sell your products)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:salesChannels.map(Ke=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`channel-${Ke.id}`,checked:z.includes(Ke.id),onCheckedChange:et=>Xe(Ke.id,et===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`channel-${Ke.id}`,className:"text-sm font-normal",children:Ke.label})]},Ke.id))}),Ye&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:te,onChange:Ke=>ae(Ke.target.value)}),F&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:F})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs(Label$2,{children:["Your Primary Market(s) ",jsxRuntime.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select which regions you sell to)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:markets.map(Ke=>jsxRuntime.jsxs("div",{className:"flex items-start space-x-2",children:[jsxRuntime.jsx(Checkbox,{id:`market-${Ke.id}`,checked:ie.includes(Ke.id),onCheckedChange:et=>Je(Ke.id,et===!0)}),jsxRuntime.jsx(Label$2,{htmlFor:`market-${Ke.id}`,className:"text-sm font-normal",children:Ke.label})]},Ke.id))}),it&&jsxRuntime.jsx(Input,{placeholder:"Please specify",value:Ne,onChange:Ke=>ge(Ke.target.value)}),se&&jsxRuntime.jsx("p",{className:"text-sm font-medium text-destructive",children:se})]}),jsxRuntime.jsx(DialogFooter,{children:jsxRuntime.jsx(Button,{type:"submit",disabled:E,children:E?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit"})})]})]})})]})}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection,useCollection,createCollectionScope]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope,createPopperScope]),usePopperScope$1=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:l,onOpenChange:d,value:f,defaultValue:g,onValueChange:b,dir:_,name:S,autoComplete:R,disabled:C,required:E,form:M}=e,I=usePopperScope$1(t),[A,V]=React__namespace.useState(null),[q,z]=React__namespace.useState(null),[Q,F]=React__namespace.useState(!1),O=useDirection(_),[te,ae]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:SELECT_NAME}),[ie,oe]=useControllableState({prop:f,defaultProp:g,onChange:b,caller:SELECT_NAME}),se=React__namespace.useRef(null),Ae=A?M||!!A.closest("form"):!0,[Ne,ge]=React__namespace.useState(new Set),Oe=Array.from(Ne).map(Le=>Le.props.value).join(";");return jsxRuntime.jsx(Root2$5,{...I,children:jsxRuntime.jsxs(SelectProvider,{required:E,scope:t,trigger:A,onTriggerChange:V,valueNode:q,onValueNodeChange:z,valueNodeHasChildren:Q,onValueNodeHasChildrenChange:F,contentId:useId(),value:ie,onValueChange:oe,open:te,onOpenChange:ae,dir:O,triggerPointerDownPosRef:se,disabled:C,children:[jsxRuntime.jsx(Collection.Provider,{scope:t,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:e.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(Le=>{ge(Ge=>new Set(Ge).add(Le))},[]),onNativeOptionRemove:React__namespace.useCallback(Le=>{ge(Ge=>{const je=new Set(Ge);return je.delete(Le),je})},[]),children:n})}),Ae?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:E,tabIndex:-1,name:S,autoComplete:R,value:ie,onChange:Le=>oe(Le.target.value),disabled:C,form:M,children:[ie===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(Ne)]},Oe):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME$1="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...l}=e,d=usePopperScope$1(n),f=useSelectContext(TRIGGER_NAME$1,n),g=f.disabled||o,b=useComposedRefs(t,f.onTriggerChange),_=useCollection(n),S=React__namespace.useRef("touch"),[R,C,E]=useTypeaheadSearch(I=>{const A=_().filter(z=>!z.disabled),V=A.find(z=>z.value===f.value),q=findNextItem(A,I,V);q!==void 0&&f.onValueChange(q.value)}),M=I=>{g||(f.onOpenChange(!0),E()),I&&(f.triggerPointerDownPosRef.current={x:Math.round(I.pageX),y:Math.round(I.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,I=>{I.currentTarget.focus(),S.current!=="mouse"&&M(I)}),onPointerDown:composeEventHandlers(l.onPointerDown,I=>{S.current=I.pointerType;const A=I.target;A.hasPointerCapture(I.pointerId)&&A.releasePointerCapture(I.pointerId),I.button===0&&I.ctrlKey===!1&&I.pointerType==="mouse"&&(M(I),I.preventDefault())}),onKeyDown:composeEventHandlers(l.onKeyDown,I=>{const A=R.current!=="";!(I.ctrlKey||I.altKey||I.metaKey)&&I.key.length===1&&C(I.key),!(A&&I.key===" ")&&OPEN_KEYS.includes(I.key)&&(M(),I.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME$1;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:l,children:d,placeholder:f="",...g}=e,b=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:_}=b,S=d!==void 0,R=useComposedRefs(t,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((e,t)=>{const{__scopeSelect:n,children:o,...l}=e;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...l,ref:t,children:o||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME$1="SelectPortal",SelectPortal=e=>jsxRuntime.jsx(Portal$5,{asChild:!0,...e});SelectPortal.displayName=PORTAL_NAME$1;var CONTENT_NAME$1="SelectContent",SelectContent$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContext(CONTENT_NAME$1,e.__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:e.__scopeSelect,children:jsxRuntime.jsx(Collection.Slot,{scope:e.__scopeSelect,children:jsxRuntime.jsx("div",{children:e.children})})}),d):null}return jsxRuntime.jsx(SelectContentImpl,{...e,ref:t})});SelectContent$1.displayName=CONTENT_NAME$1;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME$1),CONTENT_IMPL_NAME="SelectContentImpl",Slot$1=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:M,hideWhenDetached:I,avoidCollisions:A,...V}=e,q=useSelectContext(CONTENT_NAME$1,n),[z,Q]=React__namespace.useState(null),[F,O]=React__namespace.useState(null),te=useComposedRefs(t,Ke=>Q(Ke)),[ae,ie]=React__namespace.useState(null),[oe,se]=React__namespace.useState(null),Ae=useCollection(n),[Ne,ge]=React__namespace.useState(!1),Oe=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(z)return hideOthers(z)},[z]),useFocusGuards();const Le=React__namespace.useCallback(Ke=>{const[et,...Ze]=Ae().map(Fe=>Fe.ref.current),[tt]=Ze.slice(-1),st=document.activeElement;for(const Fe of Ke)if(Fe===st||(Fe==null||Fe.scrollIntoView({block:"nearest"}),Fe===et&&F&&(F.scrollTop=0),Fe===tt&&F&&(F.scrollTop=F.scrollHeight),Fe==null||Fe.focus(),document.activeElement!==st))return},[Ae,F]),Ge=React__namespace.useCallback(()=>Le([ae,z]),[Le,ae,z]);React__namespace.useEffect(()=>{Ne&&Ge()},[Ne,Ge]);const{onOpenChange:je,triggerPointerDownPosRef:Be}=q;React__namespace.useEffect(()=>{if(z){let Ke={x:0,y:0};const et=tt=>{var st,Fe;Ke={x:Math.abs(Math.round(tt.pageX)-(((st=Be.current)==null?void 0:st.x)??0)),y:Math.abs(Math.round(tt.pageY)-(((Fe=Be.current)==null?void 0:Fe.y)??0))}},Ze=tt=>{Ke.x<=10&&Ke.y<=10?tt.preventDefault():z.contains(tt.target)||je(!1),document.removeEventListener("pointermove",et),Be.current=null};return Be.current!==null&&(document.addEventListener("pointermove",et),document.addEventListener("pointerup",Ze,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",et),document.removeEventListener("pointerup",Ze,{capture:!0})}}},[z,je,Be]),React__namespace.useEffect(()=>{const Ke=()=>je(!1);return window.addEventListener("blur",Ke),window.addEventListener("resize",Ke),()=>{window.removeEventListener("blur",Ke),window.removeEventListener("resize",Ke)}},[je]);const[qe,ze]=useTypeaheadSearch(Ke=>{const et=Ae().filter(st=>!st.disabled),Ze=et.find(st=>st.ref.current===document.activeElement),tt=findNextItem(et,Ke,Ze);tt&&setTimeout(()=>tt.ref.current.focus())}),Ue=React__namespace.useCallback((Ke,et,Ze)=>{const tt=!Oe.current&&!Ze;(q.value!==void 0&&q.value===et||tt)&&(ie(Ke),tt&&(Oe.current=!0))},[q.value]),Xe=React__namespace.useCallback(()=>z==null?void 0:z.focus(),[z]),Je=React__namespace.useCallback((Ke,et,Ze)=>{const tt=!Oe.current&&!Ze;(q.value!==void 0&&q.value===et||tt)&&se(Ke)},[q.value]),Ye=o==="popper"?SelectPopperPosition:SelectItemAlignedPosition,it=Ye===SelectPopperPosition?{side:g,sideOffset:b,align:_,alignOffset:S,arrowPadding:R,collisionBoundary:C,collisionPadding:E,sticky:M,hideWhenDetached:I,avoidCollisions:A}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:z,viewport:F,onViewportChange:O,itemRefCallback:Ue,selectedItem:ae,onItemLeave:Xe,itemTextRefCallback:Je,focusSelectedItem:Ge,selectedItemText:oe,position:o,isPositioned:Ne,searchRef:qe,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot$1,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:q.open,onMountAutoFocus:Ke=>{Ke.preventDefault()},onUnmountAutoFocus:composeEventHandlers(l,Ke=>{var et;(et=q.trigger)==null||et.focus({preventScroll:!0}),Ke.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:Ke=>Ke.preventDefault(),onDismiss:()=>q.onOpenChange(!1),children:jsxRuntime.jsx(Ye,{role:"listbox",id:q.contentId,"data-state":q.open?"open":"closed",dir:q.dir,onContextMenu:Ke=>Ke.preventDefault(),...V,...it,onPlaced:()=>ge(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...V.style},onKeyDown:composeEventHandlers(V.onKeyDown,Ke=>{const et=Ke.ctrlKey||Ke.altKey||Ke.metaKey;if(Ke.key==="Tab"&&Ke.preventDefault(),!et&&Ke.key.length===1&&ze(Ke.key),["ArrowUp","ArrowDown","Home","End"].includes(Ke.key)){let tt=Ae().filter(st=>!st.disabled).map(st=>st.ref.current);if(["ArrowUp","End"].includes(Ke.key)&&(tt=tt.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ke.key)){const st=Ke.target,Fe=tt.indexOf(st);tt=tt.slice(Fe+1)}setTimeout(()=>Le(tt)),Ke.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...l}=e,d=useSelectContext(CONTENT_NAME$1,n),f=useSelectContentContext(CONTENT_NAME$1,n),[g,b]=React__namespace.useState(null),[_,S]=React__namespace.useState(null),R=useComposedRefs(t,te=>S(te)),C=useCollection(n),E=React__namespace.useRef(!1),M=React__namespace.useRef(!0),{viewport:I,selectedItem:A,selectedItemText:V,focusSelectedItem:q}=f,z=React__namespace.useCallback(()=>{if(d.trigger&&d.valueNode&&g&&_&&I&&A&&V){const te=d.trigger.getBoundingClientRect(),ae=_.getBoundingClientRect(),ie=d.valueNode.getBoundingClientRect(),oe=V.getBoundingClientRect();if(d.dir!=="rtl"){const st=oe.left-ae.left,Fe=ie.left-st,ct=te.left-Fe,Qe=te.width+ct,nt=Math.max(Qe,ae.width),ut=window.innerWidth-CONTENT_MARGIN,ft=clamp(Fe,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,ut-nt)]);g.style.minWidth=Qe+"px",g.style.left=ft+"px"}else{const st=ae.right-oe.right,Fe=window.innerWidth-ie.right-st,ct=window.innerWidth-te.right-Fe,Qe=te.width+ct,nt=Math.max(Qe,ae.width),ut=window.innerWidth-CONTENT_MARGIN,ft=clamp(Fe,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,ut-nt)]);g.style.minWidth=Qe+"px",g.style.right=ft+"px"}const se=C(),Ae=window.innerHeight-CONTENT_MARGIN*2,Ne=I.scrollHeight,ge=window.getComputedStyle(_),Oe=parseInt(ge.borderTopWidth,10),Le=parseInt(ge.paddingTop,10),Ge=parseInt(ge.borderBottomWidth,10),je=parseInt(ge.paddingBottom,10),Be=Oe+Le+Ne+je+Ge,qe=Math.min(A.offsetHeight*5,Be),ze=window.getComputedStyle(I),Ue=parseInt(ze.paddingTop,10),Xe=parseInt(ze.paddingBottom,10),Je=te.top+te.height/2-CONTENT_MARGIN,Ye=Ae-Je,it=A.offsetHeight/2,Ke=A.offsetTop+it,et=Oe+Le+Ke,Ze=Be-et;if(et<=Je){const st=se.length>0&&A===se[se.length-1].ref.current;g.style.bottom="0px";const Fe=_.clientHeight-I.offsetTop-I.offsetHeight,ct=Math.max(Ye,it+(st?Xe:0)+Fe+Ge),Qe=et+ct;g.style.height=Qe+"px"}else{const st=se.length>0&&A===se[0].ref.current;g.style.top="0px";const ct=Math.max(Je,Oe+I.offsetTop+(st?Ue:0)+it)+Ze;g.style.height=ct+"px",I.scrollTop=et-Je+I.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,_,I,A,V,d.dir,o]);useLayoutEffect2(()=>z(),[z]);const[Q,F]=React__namespace.useState();useLayoutEffect2(()=>{_&&F(window.getComputedStyle(_).zIndex)},[_]);const O=React__namespace.useCallback(te=>{te&&M.current===!0&&(z(),q==null||q(),M.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((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:l=CONTENT_MARGIN,...d}=e,f=usePopperScope$1(n);return jsxRuntime.jsx(Content$1,{...f,...d,ref:t,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$1,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...l}=e,d=useSelectContentContext(VIEWPORT_NAME,n),f=useSelectViewportContext(VIEWPORT_NAME,n),g=useComposedRefs(t,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.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,_=>{const S=_.currentTarget,{contentWrapper:R,shouldExpandOnScrollRef:C}=f;if(C!=null&&C.current&&R){const E=Math.abs(b.current-S.scrollTop);if(E>0){const M=window.innerHeight-CONTENT_MARGIN*2,I=parseFloat(R.style.minHeight),A=parseFloat(R.style.height),V=Math.max(I,A);if(V<M){const q=V+E,z=Math.min(M,q),Q=q-z;R.style.height=z+"px",R.style.bottom==="0px"&&(S.scrollTop=Q>0?Q:0,R.style.justifyContent="flex-end")}}}b.current=S.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:l,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":l,...o,ref:t})})});SelectGroup$1.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,l=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:l.id,...o,ref:t})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME),SelectItem$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:l=!1,textValue:d,...f}=e,g=useSelectContext(ITEM_NAME,n),b=useSelectContentContext(ITEM_NAME,n),_=g.value===o,[S,R]=React__namespace.useState(d??""),[C,E]=React__namespace.useState(!1),M=useComposedRefs(t,q=>{var z;return(z=b.itemRefCallback)==null?void 0:z.call(b,q,o,l)}),I=useId(),A=React__namespace.useRef("touch"),V=()=>{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:I,isSelected:_,onItemTextChange:React__namespace.useCallback(q=>{R(z=>z||((q==null?void 0:q.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection.ItemSlot,{scope:n,value:o,disabled:l,textValue:S,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":I,"data-highlighted":C?"":void 0,"aria-selected":_&&C,"data-state":_?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...f,ref:M,onFocus:composeEventHandlers(f.onFocus,()=>E(!0)),onBlur:composeEventHandlers(f.onBlur,()=>E(!1)),onClick:composeEventHandlers(f.onClick,()=>{A.current!=="mouse"&&V()}),onPointerUp:composeEventHandlers(f.onPointerUp,()=>{A.current==="mouse"&&V()}),onPointerDown:composeEventHandlers(f.onPointerDown,q=>{A.current=q.pointerType}),onPointerMove:composeEventHandlers(f.onPointerMove,q=>{var z;A.current=q.pointerType,l?(z=b.onItemLeave)==null||z.call(b):A.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)&&V(),q.key===" "&&q.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:l,...d}=e,f=useSelectContext(ITEM_TEXT_NAME,n),g=useSelectContentContext(ITEM_TEXT_NAME,n),b=useSelectItemContext(ITEM_TEXT_NAME,n),_=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[S,R]=React__namespace.useState(null),C=useComposedRefs(t,V=>R(V),b.onItemTextChange,V=>{var q;return(q=g.itemTextRefCallback)==null?void 0:q.call(g,V,b.value,b.disabled)}),E=S==null?void 0:S.textContent,M=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:b.value,disabled:b.disabled,children:E},b.value),[b.disabled,b.value,E]),{onNativeOptionAdd:I,onNativeOptionRemove:A}=_;return useLayoutEffect2(()=>(I(M),()=>A(M)),[I,A,M]),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((e,t)=>{const{__scopeSelect:n,...o}=e;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:t}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((e,t)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,e.__scopeSelect),o=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,e.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(t,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const _=b.scrollTop>0;d(_)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...e,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((e,t)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,e.__scopeSelect),o=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,e.__scopeSelect),[l,d]=React__namespace.useState(!1),f=useComposedRefs(t,o.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let g=function(){const _=b.scrollHeight-b.clientHeight,S=Math.ceil(b.scrollTop)<_;d(S)};const b=n.viewport;return g(),b.addEventListener("scroll",g),()=>b.removeEventListener("scroll",g)}},[n.viewport,n.isPositioned]),l?jsxRuntime.jsx(SelectScrollButtonImpl,{...e,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((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...l}=e,d=useSelectContentContext("SelectScrollButton",n),f=React__namespace.useRef(null),g=useCollection(n),b=React__namespace.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return React__namespace.useEffect(()=>()=>b(),[b]),useLayoutEffect2(()=>{var S;const _=g().find(R=>R.ref.current===document.activeElement);(S=_==null?void 0:_.ref.current)==null||S.scrollIntoView({block:"nearest"})},[g]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...l,ref:t,style:{flexShrink:0,...l.style},onPointerDown:composeEventHandlers(l.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:composeEventHandlers(l.onPointerMove,()=>{var _;(_=d.onItemLeave)==null||_.call(d),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:composeEventHandlers(l.onPointerLeave,()=>{b()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:t})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME$1="SelectArrow",SelectArrow=React__namespace.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,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:t}):null});SelectArrow.displayName=ARROW_NAME$1;var BUBBLE_INPUT_NAME="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const l=React__namespace.useRef(null),d=useComposedRefs(o,l),f=usePrevious(t);return React__namespace.useEffect(()=>{const g=l.current;if(!g)return;const b=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(b,"value").set;if(f!==t&&S){const R=new Event("change",{bubbles:!0});S.call(g,t),g.dispatchEvent(R)}},[f,t]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:d,defaultValue:t})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME;function shouldShowPlaceholder(e){return e===""||e===void 0}function useTypeaheadSearch(e){const t=useCallbackRef$1(e),n=React__namespace.useRef(""),o=React__namespace.useRef(0),l=React__namespace.useCallback(f=>{const g=n.current+f;t(g),function b(_){n.current=_,window.clearTimeout(o.current),_!==""&&(o.current=window.setTimeout(()=>b(""),1e3))}(g)},[t]),d=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,l,d]}function findNextItem(e,t,n){const l=t.length>1&&Array.from(t).every(_=>_===t[0])?t[0]:t,d=n?e.indexOf(n):-1;let f=wrapArray(e,Math.max(d,0));l.length===1&&(f=f.filter(_=>_!==n));const b=f.find(_=>_.textValue.toLowerCase().startsWith(l.toLowerCase()));return b!==n?b:void 0}function wrapArray(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Root2$1=Select$1,Trigger$1=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal$1=SelectPortal,Content2$1=SelectContent$1,Viewport=SelectViewport,Group=SelectGroup$1,Label=SelectLabel$1,Item=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2$1,SelectGroup=Group,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(Trigger$1,{ref:o,className:cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger$1.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:e,children:t,position:n="popper",...o},l)=>jsxRuntime.jsx(Portal$1,{children:jsxRuntime.jsxs(Content2$1,{ref:l,className:cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[jsxRuntime.jsx(SelectScrollUpButton,{}),jsxRuntime.jsx(Viewport,{className:cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2$1.displayName;const SelectLabel=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",e),...t}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(Item,{ref:o,className:cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),jsxRuntime.jsx(ItemText,{children:t})]}));SelectItem.displayName=Item.displayName;const SelectSeparator=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",e),...t}));SelectSeparator.displayName=Separator.displayName;const DAYS_OF_WEEK=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ManufacturerReorderingCard({manufacturer:e,onSave:t,loading:n=!1,saving:o=!1}){const[l,d]=React.useState({...e}),f=(C,E)=>{d(M=>({...M,[C]:E}))},g=(C,E)=>{d(M=>({...M,[C]:E}))},b=(C,E)=>{d(M=>({...M,[C]:E}))},_=()=>{o||t(l)},S=C=>C===-1?"ASAP":C===void 0||C<0||C>6?"Sunday":DAYS_OF_WEEK[C],R=C=>C==="ASAP"?-1:DAYS_OF_WEEK.indexOf(C);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[n?jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}):jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Reordering"}),n?jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}):jsxRuntime.jsx(CardDescription,{className:"text-sm",children:"Adjust your reordering settings to control lead times, stocking weeks, minimum orders, and reorder dates, enhancing efficiency in restocking processes."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"automatic-reordering",checked:l.AutoUpdate,onCheckedChange:C=>f("AutoUpdate",C),disabled:o}),jsxRuntime.jsx(Label$2,{htmlFor:"automatic-reordering",children:"Automatic Reordering"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"reorder-date",children:"Automatic Reorder Date"}),jsxRuntime.jsxs(Select,{value:S(l.AutoReorderDate),onValueChange:C=>g("AutoReorderDate",R(C)),disabled:o,children:[jsxRuntime.jsx(SelectTrigger,{id:"reorder-date",children:jsxRuntime.jsx(SelectValue,{placeholder:"Select day"})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"ASAP",children:"ASAP"}),DAYS_OF_WEEK.map(C=>jsxRuntime.jsx(SelectItem,{value:C,children:C},C))]})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"weeks-stocking",children:"Default Weeks of Stocking"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"weeks-stocking",type:"number",value:l.DefaultWeeksOfStocking||"",onChange:C=>g("DefaultWeeksOfStocking",Number(C.target.value)),disabled:o}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"weeks"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"minimum-order",children:"Default Minimum Order"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"minimum-order",type:"number",className:"pl-6",value:l.DefaultMinimumOrder||"",onChange:C=>g("DefaultMinimumOrder",Number(C.target.value)),disabled:o})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"lead-time",children:"Default Lead Time"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"lead-time",type:"number",value:l.DefaultLeadTime||"",onChange:C=>g("DefaultLeadTime",Number(C.target.value)),disabled:o}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"days"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"maximum-inventory-value",children:"Default Maximum Inventory Value"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"maximum-inventory-value",type:"number",className:"pl-6",value:l.DefaultMaxInventoryValue||"",onChange:C=>g("DefaultMaxInventoryValue",Number(C.target.value)),disabled:o})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"order-confirmations",children:"Send Order Confirmations To"}),jsxRuntime.jsx(Input,{id:"order-confirmations",type:"email",value:l.POEmail||"",onChange:C=>b("POEmail",C.target.value),placeholder:"email@example.com",disabled:o})]})]})]})}),jsxRuntime.jsx(CardFooter,{className:"flex justify-end",children:n?jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"}):jsxRuntime.jsxs(Button,{onClick:_,disabled:o,children:[o&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}var POPOVER_NAME="Popover",[createPopoverContext,createPopoverScope]=createContextScope(POPOVER_NAME,[createPopperScope]),usePopperScope=createPopperScope(),[PopoverProvider,usePopoverContext]=createPopoverContext(POPOVER_NAME),Popover$1=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:l,onOpenChange:d,modal:f=!1}=e,g=usePopperScope(t),b=React__namespace.useRef(null),[_,S]=React__namespace.useState(!1),[R,C]=useControllableState({prop:o,defaultProp:l??!1,onChange:d,caller:POPOVER_NAME});return jsxRuntime.jsx(Root2$5,{...g,children:jsxRuntime.jsx(PopoverProvider,{scope:t,contentId:useId(),triggerRef:b,open:R,onOpenChange:C,onOpenToggle:React__namespace.useCallback(()=>C(E=>!E),[C]),hasCustomAnchor:_,onCustomAnchorAdd:React__namespace.useCallback(()=>S(!0),[]),onCustomAnchorRemove:React__namespace.useCallback(()=>S(!1),[]),modal:f,children:n})})};Popover$1.displayName=POPOVER_NAME;var ANCHOR_NAME="PopoverAnchor",PopoverAnchor$1=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,l=usePopoverContext(ANCHOR_NAME,n),d=usePopperScope(n),{onCustomAnchorAdd:f,onCustomAnchorRemove:g}=l;return React__namespace.useEffect(()=>(f(),()=>g()),[f,g]),jsxRuntime.jsx(Anchor,{...d,...o,ref:t})});PopoverAnchor$1.displayName=ANCHOR_NAME;var TRIGGER_NAME="PopoverTrigger",PopoverTrigger$1=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,l=usePopoverContext(TRIGGER_NAME,n),d=usePopperScope(n),f=useComposedRefs(t,l.triggerRef),g=jsxRuntime.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":getState(l.open),...o,ref:f,onClick:composeEventHandlers(e.onClick,l.onOpenToggle)});return l.hasCustomAnchor?g:jsxRuntime.jsx(Anchor,{asChild:!0,...d,children:g})});PopoverTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="PopoverPortal",[PortalProvider,usePortalContext]=createPopoverContext(PORTAL_NAME,{forceMount:void 0}),PopoverPortal=e=>{const{__scopePopover:t,forceMount:n,children:o,container:l}=e,d=usePopoverContext(PORTAL_NAME,t);return jsxRuntime.jsx(PortalProvider,{scope:t,forceMount:n,children:jsxRuntime.jsx(Presence,{present:n||d.open,children:jsxRuntime.jsx(Portal$5,{asChild:!0,container:l,children:o})})})};PopoverPortal.displayName=PORTAL_NAME;var CONTENT_NAME="PopoverContent",PopoverContent$1=React__namespace.forwardRef((e,t)=>{const n=usePortalContext(CONTENT_NAME,e.__scopePopover),{forceMount:o=n.forceMount,...l}=e,d=usePopoverContext(CONTENT_NAME,e.__scopePopover);return jsxRuntime.jsx(Presence,{present:o||d.open,children:d.modal?jsxRuntime.jsx(PopoverContentModal,{...l,ref:t}):jsxRuntime.jsx(PopoverContentNonModal,{...l,ref:t})})});PopoverContent$1.displayName=CONTENT_NAME;var Slot=createSlot("PopoverContent.RemoveScroll"),PopoverContentModal=React__namespace.forwardRef((e,t)=>{const n=usePopoverContext(CONTENT_NAME,e.__scopePopover),o=React__namespace.useRef(null),l=useComposedRefs(t,o),d=React__namespace.useRef(!1);return React__namespace.useEffect(()=>{const f=o.current;if(f)return hideOthers(f)},[]),jsxRuntime.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,children:jsxRuntime.jsx(PopoverContentImpl,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(e.onCloseAutoFocus,f=>{var g;f.preventDefault(),d.current||(g=n.triggerRef.current)==null||g.focus()}),onPointerDownOutside:composeEventHandlers(e.onPointerDownOutside,f=>{const g=f.detail.originalEvent,b=g.button===0&&g.ctrlKey===!0,_=g.button===2||b;d.current=_},{checkForDefaultPrevented:!1}),onFocusOutside:composeEventHandlers(e.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1})})})}),PopoverContentNonModal=React__namespace.forwardRef((e,t)=>{const n=usePopoverContext(CONTENT_NAME,e.__scopePopover),o=React__namespace.useRef(!1),l=React__namespace.useRef(!1);return jsxRuntime.jsx(PopoverContentImpl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{var f,g;(f=e.onCloseAutoFocus)==null||f.call(e,d),d.defaultPrevented||(o.current||(g=n.triggerRef.current)==null||g.focus(),d.preventDefault()),o.current=!1,l.current=!1},onInteractOutside:d=>{var b,_;(b=e.onInteractOutside)==null||b.call(e,d),d.defaultPrevented||(o.current=!0,d.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const f=d.target;((_=n.triggerRef.current)==null?void 0:_.contains(f))&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&l.current&&d.preventDefault()}})}),PopoverContentImpl=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:_,onInteractOutside:S,...R}=e,C=usePopoverContext(CONTENT_NAME,n),E=usePopperScope(n);return useFocusGuards(),jsxRuntime.jsx(FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:l,onUnmountAutoFocus:d,children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:f,onInteractOutside:S,onEscapeKeyDown:g,onPointerDownOutside:b,onFocusOutside:_,onDismiss:()=>C.onOpenChange(!1),children:jsxRuntime.jsx(Content$1,{"data-state":getState(C.open),role:"dialog",id:C.contentId,...E,...R,ref:t,style:{...R.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),CLOSE_NAME="PopoverClose",PopoverClose=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,l=usePopoverContext(CLOSE_NAME,n);return jsxRuntime.jsx(Primitive.button,{type:"button",...o,ref:t,onClick:composeEventHandlers(e.onClick,()=>l.onOpenChange(!1))})});PopoverClose.displayName=CLOSE_NAME;var ARROW_NAME="PopoverArrow",PopoverArrow=React__namespace.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,l=usePopperScope(n);return jsxRuntime.jsx(Arrow,{...l,...o,ref:t})});PopoverArrow.displayName=ARROW_NAME;function getState(e){return e?"open":"closed"}var Root2=Popover$1,Anchor2=PopoverAnchor$1,Trigger=PopoverTrigger$1,Portal=PopoverPortal,Content2=PopoverContent$1;const Popover=Root2,PopoverTrigger=Trigger,PopoverAnchor=Anchor2,PopoverContent=React__namespace.forwardRef(({className:e,align:t="center",sideOffset:n=4,...o},l)=>jsxRuntime.jsx(Portal,{children:jsxRuntime.jsx(Content2,{ref:l,align:t,sideOffset:n,className:cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-popover-content-transform-origin]",e),...o})}));PopoverContent.displayName=Content2.displayName;function MultiSelect({options:e,selected:t,onChange:n,placeholder:o="Select items..."}){const[l,d]=React__namespace.useState(!1),[f,g]=React__namespace.useState(""),b=React__namespace.useRef(null),[_,S]=React__namespace.useState(void 0),R=React__namespace.useCallback(()=>{b.current&&S(b.current.offsetWidth)},[]);React__namespace.useLayoutEffect(()=>{R()},[R]),React__namespace.useEffect(()=>(window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)),[R]);const C=I=>{n(t.filter(A=>A!==I))},E=I=>{d(!1),t.includes(I)?n(t.filter(A=>A!==I)):n([...t,I])},M=I=>{I.key==="Enter"&&f&&!e.includes(f)&&!t.includes(f)&&(I.preventDefault(),E(f),g(""))};return jsxRuntime.jsxs(Popover,{open:l,onOpenChange:d,children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:b,variant:"outline",role:"combobox","aria-expanded":l,className:"w-full justify-between h-auto min-h-[40px] py-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 items-center",children:t.length>0?t.map(I=>jsxRuntime.jsxs(Badge,{variant:"outline",className:"mr-1 mb-1",children:[I,jsxRuntime.jsx("span",{className:"ml-1 cursor-pointer ring-offset-background rounded-full outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:A=>{A.preventDefault(),A.stopPropagation(),C(I)},children:jsxRuntime.jsx(X$1,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},I)):jsxRuntime.jsx("span",{className:"text-muted-foreground",children:o})}),jsxRuntime.jsx(ChevronsUpDown,{className:"h-4 w-4 shrink-0 opacity-50 ml-2"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-full p-0",style:{width:_},children:jsxRuntime.jsxs(Command,{onKeyDown:M,children:[jsxRuntime.jsx(CommandInput,{placeholder:"Search or add custom item...",value:f,onValueChange:g}),jsxRuntime.jsxs(CommandList,{children:[jsxRuntime.jsx(CommandEmpty,{children:"No item found."}),jsxRuntime.jsxs(CommandGroup,{children:[e.filter(I=>!t.includes(I)).map(I=>jsxRuntime.jsxs(CommandItem,{onSelect:()=>E(I),children:[jsxRuntime.jsx(Check,{className:cn("mr-2 h-4 w-4",t.includes(I)?"opacity-100":"opacity-0")}),I]},I)),f&&!e.includes(f)&&!t.includes(f)&&jsxRuntime.jsxs(CommandItem,{onSelect:()=>E(f),children:['Add "',f,'"']})]})]})]})})]})}function ResellerBillingOverviewCard({reseller:e,actions:t,loading:n=!1}){return n||!e?jsxRuntime.jsx(ResellerBillingOverviewSkeleton,{}):jsxRuntime.jsx(ResellerBillingOverviewData,{reseller:e,actions:t})}function ResellerBillingOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-40"})})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:Array(3).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))}),jsxRuntime.jsx("div",{className:"space-y-4",children:Array(2).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))})]}),jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-28 rounded-md"})})]})]})}function ResellerBillingOverviewData({reseller:e,actions:t}){const n=f=>f===void 0?"$0.00":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(f),o=e.Statement||{},l=[{title:"0 - 30 Days",amount:o.Over0||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"31 - 45 Days",amount:o.Over30||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"},{title:"45+ Days",amount:o.Over45||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-primary"}],d=[{title:"Total",amount:o.Total||0,icon:jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-white"}),color:"bg-green-500"},{title:"Credit Limit",amount:e.CreditLimit||0,icon:jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"}];return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsx("div",{className:"space-y-4",children:l.map((f,g)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:f.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${f.color}`,children:f.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(f.amount)})})]},g))}),jsxRuntime.jsx("div",{className:"space-y-4",children:d.map((f,g)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:f.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${f.color}`,children:f.icon})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(f.amount)})})]},g))})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end mt-4",children:t})]})]})}function ResellerQualificationsCard({qualifications:e=[],loading:t=!1}){return t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:Array.from({length:10}).map((n,o)=>jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]},o))})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:e.map((n,o)=>jsxRuntime.jsx(ManufacturerLogo,{manufacturerId:n.ManufacturerId,opportunityNumber:n.DefaultOpportunityNumber},`${n.ManufacturerId}-${o}`))})})]})}function ManufacturerLogo({manufacturerId:e,opportunityNumber:t}){const[n,o]=React.useState(null),[l,d]=React.useState(!0),[f,g]=React.useState(!1),[b,_]=React.useState(null),S=React.useMemo(()=>e?{logoUrl:`https://api.randmar.io/V4/Partner/${e}/Account/Logo?width=96&height=48`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${e}/Account/Logo/Exists`}:null,[e]);return React.useEffect(()=>{if(!S)return;let R=!0;_(null);const C=async()=>{try{const I=await fetch(S.logoExistsUrl);if(I.ok){const V=(await I.text()).toLowerCase()==="true";return R&&g(V),V}return!1}catch(I){return console.error("Failed to check if logo exists:",I),R&&g(!1),!1}},E=async()=>{R&&d(!0);try{const I=await fetch(S.logoUrl);if(I.ok){const A=await I.blob();R&&(n&&URL.revokeObjectURL(n),o(URL.createObjectURL(A)))}else throw new Error(`Failed to load logo: ${I.status}`)}catch(I){console.error("Failed to load logo:",I),R&&_("Failed to load manufacturer logo")}finally{R&&d(!1)}};return(async()=>{await C()?E():d(!1)})(),()=>{R=!1,n&&URL.revokeObjectURL(n)}},[S]),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"h-12 flex items-center justify-center mb-2",children:l?jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md"}):f&&n?jsxRuntime.jsx("img",{src:n,alt:"Manufacturer logo",className:"max-h-12 max-w-24 object-contain",onError:()=>_("Failed to load logo")}):jsxRuntime.jsx("div",{className:"h-12 w-24 flex items-center justify-center bg-slate-100 rounded-md text-xs text-slate-500",children:e?e.substring(0,8):"No ID"})}),t&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs",children:t}),b&&jsxRuntime.jsx("div",{className:"text-red-500 text-xs mt-1",role:"alert",children:b})]})}function SalesOverviewCard({salesData:e,salesStatistics:t=[],loading:n=!1}){return n||!e?jsxRuntime.jsx(SalesOverviewSkeleton,{}):jsxRuntime.jsx(SalesOverviewData,{salesData:e,salesStatistics:t})}function SalesOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array(3).fill(0).map((e,t)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},t))}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-[250px] w-full rounded-lg"})]})})]})]})}function SalesOverviewData({salesData:e,salesStatistics:t=[]}){const n=d=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(d),o=[{title:"Last 30 days",amount:e.SalesLast30Days||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"},{title:"Last 3 months",amount:e.SalesLast3Months||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-amber-500"},{title:"Year to date",amount:e.SalesYearToDay||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-emerald-500"}],l=React.useMemo(()=>{const d=new Map;return t.forEach(f=>{var b;const g=((b=f.Day)==null?void 0:b.toString())||"";if(g.length===8){const _=parseInt(g.substring(0,4),10),S=parseInt(g.substring(4,6),10)-1,R=parseInt(g.substring(6,8),10),C=new Date(_,S,R),E=new Date(C),M=C.getDay();E.setDate(C.getDate()-M);const I=`${E.getFullYear()}-${String(E.getMonth()+1).padStart(2,"0")}-${String(E.getDate()).padStart(2,"0")}`,A=f.ExtendedPrice||0;d.has(I)?d.set(I,d.get(I)+A):d.set(I,A)}}),Array.from(d).sort(([f],[g])=>f.localeCompare(g)).map(([f,g])=>({date:`${f.substring(5,7)}/${f.substring(8,10)}`,amount:g}))},[t]);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:"Sales Overview"})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map((d,f)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:d.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${d.color}`,children:d.icon})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(d.amount)})]})]},f))}),jsxRuntime.jsx("div",{className:"mt-6",children:t&&t.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h3",{className:"text-sm font-medium mb-4",children:"Sales Trend"}),jsxRuntime.jsx("div",{className:"space-y-6",children:jsxRuntime.jsx(AreaChart,{data:l,units:"$",unitsPosition:"left",height:200})})]})})]})]})}exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertTitle=AlertTitle,exports.ApiKeyProvider=ApiKeyProvider,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.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.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.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.PartnerCard=PartnerCard,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.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.Reseller=Reseller,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useApiKey=useApiKey,exports.useChat=useChat,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "randmarcomps",
3
3
  "private": false,
4
- "version": "1.196.0",
4
+ "version": "1.198.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [