randmarcomps 1.196.0 → 1.197.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,
@@ -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,`;
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.197.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [