randmarcomps 1.164.0 → 1.166.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.
@@ -48573,25 +48573,16 @@ function findClosingBracket(e, t) {
48573
48573
  }
48574
48574
  function outputLink(e, t, n, o, l) {
48575
48575
  const u = t.href, d = t.title || null, f = e[1].replace(l.other.outputLinkReplace, "$1");
48576
- if (e[0].charAt(0) !== "!") {
48577
- o.state.inLink = !0;
48578
- const p = {
48579
- type: "link",
48580
- raw: n,
48581
- href: u,
48582
- title: d,
48583
- text: f,
48584
- tokens: o.inlineTokens(f)
48585
- };
48586
- return o.state.inLink = !1, p;
48587
- }
48588
- return {
48589
- type: "image",
48576
+ o.state.inLink = !0;
48577
+ const p = {
48578
+ type: e[0].charAt(0) === "!" ? "image" : "link",
48590
48579
  raw: n,
48591
48580
  href: u,
48592
48581
  title: d,
48593
- text: f
48582
+ text: f,
48583
+ tokens: o.inlineTokens(f)
48594
48584
  };
48585
+ return o.state.inLink = !1, p;
48595
48586
  }
48596
48587
  function indentCodeCompensation(e, t, n) {
48597
48588
  const o = e.match(n.other.indentCodeCompensation);
@@ -49462,13 +49453,14 @@ ${t}</tr>
49462
49453
  let d = '<a href="' + t + '"';
49463
49454
  return n && (d += ' title="' + escape$2(n) + '"'), d += ">" + l + "</a>", d;
49464
49455
  }
49465
- image({ href: t, title: n, text: o }) {
49466
- const l = cleanUrl(t);
49467
- if (l === null)
49456
+ image({ href: t, title: n, text: o, tokens: l }) {
49457
+ l && (o = this.parser.parseInline(l, this.parser.textRenderer));
49458
+ const u = cleanUrl(t);
49459
+ if (u === null)
49468
49460
  return escape$2(o);
49469
- t = l;
49470
- let u = `<img src="${t}" alt="${o}"`;
49471
- return n && (u += ` title="${escape$2(n)}"`), u += ">", u;
49461
+ t = u;
49462
+ let d = `<img src="${t}" alt="${o}"`;
49463
+ return n && (d += ` title="${escape$2(n)}"`), d += ">", d;
49472
49464
  }
49473
49465
  text(t) {
49474
49466
  return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : escape$2(t.text);
@@ -52613,11 +52605,18 @@ function QualificationBadge({ qualification: e }) {
52613
52605
  ] }) }),
52614
52606
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Qualification" }) })
52615
52607
  ] }) }) : /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [
52616
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Badge, { variant: "info", className: "pr-1", children: [
52617
- /* @__PURE__ */ jsx(BadgeCheck, { className: "h-3 w-3 mr-1" }),
52618
- e.QualificationId,
52619
- e.DefaultOpportunityNumber && /* @__PURE__ */ jsx(Badge, { variant: "secondary", size: "sm", className: "ml-1", children: e.DefaultOpportunityNumber })
52620
- ] }) }),
52608
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
52609
+ Badge,
52610
+ {
52611
+ variant: "info",
52612
+ className: e.DefaultOpportunityNumber ? "pr-1" : "",
52613
+ children: [
52614
+ /* @__PURE__ */ jsx(BadgeCheck, { className: "h-3 w-3 mr-1" }),
52615
+ e.QualificationId,
52616
+ e.DefaultOpportunityNumber && /* @__PURE__ */ jsx(Badge, { variant: "secondary", size: "sm", className: "ml-1", children: e.DefaultOpportunityNumber })
52617
+ ]
52618
+ }
52619
+ ) }),
52621
52620
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Qualification" }) })
52622
52621
  ] }) });
52623
52622
  }
@@ -797,7 +797,7 @@ Selectors that return the entire state are almost certainly a mistake, as they w
797
797
  You must add the middleware for RTK-Query to function correctly!`);J.current=pe}const ee=useStableQueryArgs(L?skipToken:M,defaultSerializeQueryArgs,f.endpointDefinitions[V],V),ae=useShallowStableValue({refetchOnReconnect:I,refetchOnFocus:j,pollingInterval:q,skipPollingIfUnfocused:F}),W=H.initialPageParam,Q=useShallowStableValue(W),Z=React.useRef(void 0);let{queryCacheKey:ie,requestId:ce}=Z.current||{},ue=!1;ie&&ce&&(ue=J.current.isRequestSubscribed(ie,ce));const fe=!ue&&Z.current!==void 0;return m(()=>{fe&&(Z.current=void 0)},[fe]),m(()=>{var he;const pe=Z.current;if(typeof process<"u"&&process.env.NODE_ENV==="removeMeOnCompilation"&&console.log(fe),ee===skipToken){pe==null||pe.unsubscribe(),Z.current=void 0;return}const ve=(he=Z.current)==null?void 0:he.subscriptionOptions;if(!pe||pe.arg!==ee){pe==null||pe.unsubscribe();const ye=G(U(ee,{subscriptionOptions:ae,forceRefetch:B,...isInfiniteQueryDefinition(f.endpointDefinitions[V])?{initialPageParam:Q}:{}}));Z.current=ye}else ae!==ve&&pe.updateSubscriptionOptions(ae)},[G,U,B,ee,ae,fe,Q,V]),[Z,G,U,ae]}function E(V,M){return(j,{skip:B=!1,selectFromResult:L}={})=>{const{select:q}=e.endpoints[V],F=useStableQueryArgs(B?skipToken:j,d,f.endpointDefinitions[V],V),H=React.useRef(void 0),U=React.useMemo(()=>p([q(F),(W,Q)=>Q,W=>F],M,{memoizeOptions:{resultEqualityCheck:shallowEqual}}),[q,F]),G=React.useMemo(()=>L?p([U],L,{devModeChecks:{identityFunctionCheck:"never"}}):U,[U,L]),J=o(W=>G(W,H.current),shallowEqual),ee=l(),ae=U(ee.getState(),H.current);return useIsomorphicLayoutEffect(()=>{H.current=ae},[ae]),J}}function C(V){React.useEffect(()=>()=>{var M,I;(I=(M=V.current)==null?void 0:M.unsubscribe)==null||I.call(M),V.current=void 0},[V])}function R(V){if(!V.current)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(38):"Cannot refetch a query that has not been started yet.");return V.current.refetch()}function A(V){const M=(B,L={})=>{const[q]=S(V,B,L);return C(q),React.useMemo(()=>({refetch:()=>R(q)}),[q])},I=({refetchOnReconnect:B,refetchOnFocus:L,pollingInterval:q=0,skipPollingIfUnfocused:F=!1}={})=>{const{initiate:H}=e.endpoints[V],U=n(),[G,J]=React.useState(UNINITIALIZED_VALUE),ee=React.useRef(void 0),ae=useShallowStableValue({refetchOnReconnect:B,refetchOnFocus:L,pollingInterval:q,skipPollingIfUnfocused:F});m(()=>{var ce,ue;const ie=(ce=ee.current)==null?void 0:ce.subscriptionOptions;ae!==ie&&((ue=ee.current)==null||ue.updateSubscriptionOptions(ae))},[ae]);const W=React.useRef(ae);m(()=>{W.current=ae},[ae]);const Q=React.useCallback(function(ie,ce=!1){let ue;return t(()=>{var fe;(fe=ee.current)==null||fe.unsubscribe(),ee.current=ue=U(H(ie,{subscriptionOptions:W.current,forceRefetch:!ce})),J(ie)}),ue},[U,H]),Z=React.useCallback(()=>{var ie,ce;(ie=ee.current)!=null&&ie.queryCacheKey&&U(e.internalActions.removeQueryResult({queryCacheKey:(ce=ee.current)==null?void 0:ce.queryCacheKey}))},[U]);return React.useEffect(()=>()=>{var ie;(ie=ee==null?void 0:ee.current)==null||ie.unsubscribe()},[]),React.useEffect(()=>{G!==UNINITIALIZED_VALUE&&!ee.current&&Q(G,!0)},[G,Q]),React.useMemo(()=>[Q,G,{reset:Z}],[Q,G,Z])},j=E(V,g);return{useQueryState:j,useQuerySubscription:M,useLazyQuerySubscription:I,useLazyQuery(B){const[L,q,{reset:F}]=I(B),H=j(q,{...B,skip:q===UNINITIALIZED_VALUE}),U=React.useMemo(()=>({lastArg:q}),[q]);return React.useMemo(()=>[L,{...H,reset:F},U],[L,H,F,U])},useQuery(B,L){const q=M(B,L),F=j(B,{selectFromResult:B===skipToken||L!=null&&L.skip?void 0:noPendingQueryStateSelector,...L}),H=pick(F,...COMMON_HOOK_DEBUG_FIELDS);return React.useDebugValue(H),React.useMemo(()=>({...F,...q}),[F,q])}}}function N(V){const M=(j,B={})=>{const[L,q,F,H]=S(V,j,B),U=React.useRef(H);m(()=>{U.current=H},[H]);const G=React.useCallback(function(ae,W){let Q;return t(()=>{var Z;(Z=L.current)==null||Z.unsubscribe(),L.current=Q=q(F(ae,{subscriptionOptions:U.current,direction:W}))}),Q},[L,q,F]);C(L);const J=useStableQueryArgs(B.skip?skipToken:j,defaultSerializeQueryArgs,f.endpointDefinitions[V],V),ee=React.useCallback(()=>R(L),[L]);return React.useMemo(()=>({trigger:G,refetch:ee,fetchNextPage:()=>G(J,"forward"),fetchPreviousPage:()=>G(J,"backward")}),[ee,G,J])},I=E(V,b);return{useInfiniteQueryState:I,useInfiniteQuerySubscription:M,useInfiniteQuery(j,B){const{refetch:L,fetchNextPage:q,fetchPreviousPage:F}=M(j,B),H=I(j,{selectFromResult:j===skipToken||B!=null&&B.skip?void 0:noPendingQueryStateSelector,...B}),U=pick(H,...COMMON_HOOK_DEBUG_FIELDS,"hasNextPage","hasPreviousPage");return React.useDebugValue(U),React.useMemo(()=>({...H,fetchNextPage:q,fetchPreviousPage:F,refetch:L}),[H,q,F,L])}}}function O(V){return({selectFromResult:M,fixedCacheKey:I}={})=>{const{select:j,initiate:B}=e.endpoints[V],L=n(),[q,F]=React.useState();React.useEffect(()=>()=>{q!=null&&q.arg.fixedCacheKey||q==null||q.reset()},[q]);const H=React.useCallback(function(ie){const ce=L(B(ie,{fixedCacheKey:I}));return F(ce),ce},[L,B,I]),{requestId:U}=q||{},G=React.useMemo(()=>j({fixedCacheKey:I,requestId:q==null?void 0:q.requestId}),[I,q,j]),J=React.useMemo(()=>M?p([G],M):G,[M,G]),ee=o(J,shallowEqual),ae=I==null?q==null?void 0:q.arg.originalArgs:void 0,W=React.useCallback(()=>{t(()=>{q&&F(void 0),I&&L(e.internalActions.removeMutationResult({requestId:U,fixedCacheKey:I}))})},[L,I,q,U]),Q=pick(ee,...COMMON_HOOK_DEBUG_FIELDS,"endpointName");React.useDebugValue(Q);const Z=React.useMemo(()=>({...ee,originalArgs:ae,reset:W}),[ee,ae,W]);return React.useMemo(()=>[H,Z],[H,Z])}}}var reactHooksModuleName=Symbol(),reactHooksModule=({batch:e=batch,hooks:t={useDispatch,useSelector,useStore},createSelector:n=createSelector,unstable__sideEffectsInRender:o=!1,...l}={})=>{if(process.env.NODE_ENV!=="production"){const u=["useDispatch","useSelector","useStore"];let p=!1;for(const d of u)if(countObjectKeys(l)>0&&(l[d]&&(p||(console.warn("As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`"),p=!0)),t[d]=l[d]),typeof t[d]!="function")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(36):`When using custom hooks for context, all ${u.length} hooks need to be provided: ${u.join(", ")}.
798
798
  Hook ${d} was either not provided or not a function.`)}return{name:reactHooksModuleName,init(u,{serializeQueryArgs:p},d){const f=u,{buildQueryHooks:m,buildInfiniteQueryHooks:g,buildMutationHook:b,usePrefetch:_}=buildHooks({api:u,moduleOptions:{batch:e,hooks:t,unstable__sideEffectsInRender:o,createSelector:n},serializeQueryArgs:p,context:d});return safeAssign(f,{usePrefetch:_}),safeAssign(d,{batch:e}),{injectEndpoint(S,E){if(isQueryDefinition(E)){const{useQuery:C,useLazyQuery:R,useLazyQuerySubscription:A,useQueryState:N,useQuerySubscription:O}=m(S);safeAssign(f.endpoints[S],{useQuery:C,useLazyQuery:R,useLazyQuerySubscription:A,useQueryState:N,useQuerySubscription:O}),u[`use${capitalize(S)}Query`]=C,u[`useLazy${capitalize(S)}Query`]=R}if(isMutationDefinition(E)){const C=b(S);safeAssign(f.endpoints[S],{useMutation:C}),u[`use${capitalize(S)}Mutation`]=C}else if(isInfiniteQueryDefinition(E)){const{useInfiniteQuery:C,useInfiniteQuerySubscription:R,useInfiniteQueryState:A}=g(S);safeAssign(f.endpoints[S],{useInfiniteQuery:C,useInfiniteQuerySubscription:R,useInfiniteQueryState:A}),u[`use${capitalize(S)}InfiniteQuery`]=C}}}}}},createApi=buildCreateApi(coreModule(),reactHooksModule());const emptySplitApi=createApi({reducerPath:"randmarApi",baseQuery:fetchBaseQuery({baseUrl:"https://api.randmar.io",prepareHeaders:e=>{const t=localStorage.getItem("access_token");return t&&e.set("Authorization",`Bearer ${t}`),e}}),endpoints:()=>({})}),injectedRtkApi=emptySplitApi.injectEndpoints({endpoints:e=>({getV4ShopifyByShopifyHostNameAccount:e.query({query:t=>({url:`/V4/Shopify/${t.shopifyHostName}/Account`})}),postV4ShopifyByShopifyHostNameAccountSynchronizationAndSynchronizationType:e.mutation({query:t=>({url:`/V4/Shopify/${t.shopifyHostName}/Account/Synchronization/${t.synchronizationType}`,method:"POST",params:{newValue:t.newValue}})}),postV4ShopifyByShopifyHostNameAccountAndPropertyName:e.mutation({query:t=>({url:`/V4/Shopify/${t.shopifyHostName}/Account/${t.propertyName}`,method:"POST",params:{newValue:t.newValue}})}),postV4ShopifyByShopifyHostNameAccountDefaultShippingSlipComment:e.mutation({query:t=>({url:`/V4/Shopify/${t.shopifyHostName}/Account/DefaultShippingSlipComment`,method:"POST",params:{newValue:t.newValue}})}),putV4ShopifyByShopifyHostNameAccountLink:e.mutation({query:t=>({url:`/V4/Shopify/${t.shopifyHostName}/Account/Link`,method:"PUT",params:{applicationId:t.applicationId,postalCode:t.postalCode}})}),getV4ResellerByRouteResellerIdAccountGeneral:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Account/General`,params:{withSpecification:t.withSpecification}})}),getV4PartnerByApplicationIdAccount:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Account`})}),postV4PartnerByApplicationIdAccountAndFieldName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/${t.fieldName}`,method:"POST",params:{newValue:t.newValue}})}),postV4PartnerByApplicationIdAccountAbout:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/About`,method:"POST",body:t.body})}),getV4PartnerByApplicationIdAccountLogo:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Logo`,params:{width:t.width,height:t.height,align:t.align}})}),postV4PartnerByApplicationIdAccountLogo:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Logo`,method:"POST",body:t.body})}),getV4PartnerByApplicationIdAccountLogoExists:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Logo/Exists`})}),getV4PartnerByApplicationIdAccountVideo:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Video`})}),postV4PartnerByApplicationIdAccountVideo:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Video`,method:"POST",body:t.body})}),putV4PartnerByApplicationIdAccountVideo:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Video`,method:"PUT"})}),getV4PartnerByApplicationIdAccountVideoExists:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Video/Exists`})}),getV4PartnerByApplicationIdAccountManufacturer:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Manufacturer`,params:{withSpecification:t.withSpecification}})}),putV4PartnerByApplicationIdAccountManufacturer:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Manufacturer`,method:"PUT"})}),getV4PartnerByApplicationIdAccountReseller:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Reseller`,params:{withSpecification:t.withSpecification}})}),putV4PartnerByApplicationIdAccountReseller:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Reseller`,method:"PUT"})}),putV4PartnerByApplicationIdAccountBilling:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Billing`,method:"PUT",body:t.newBillingInformation})}),putV4PartnerByApplicationIdAccountSalesAgency:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/SalesAgency`,method:"PUT"})}),postV4PartnerByApplicationIdAccountFeedback:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Feedback`,method:"POST",params:{emailAddress:t.emailAddress,comment:t.comment}})}),postV4PartnerByApplicationIdAccountDebugFeedback:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/DebugFeedback`,method:"POST",body:t.body,params:{emailAddress:t.emailAddress}})}),postV4PartnerByApplicationIdAccountManufacturerAndFieldName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Manufacturer/${t.fieldName}`,method:"POST",params:{newValue:t.newValue}})}),postV4PartnerByApplicationIdAccountManufacturerAbout:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Manufacturer/About`,method:"POST",body:t.body})}),postV4PartnerByApplicationIdAccountResellerAndFieldName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Reseller/${t.fieldName}`,method:"POST",params:{newValue:t.newValue}})}),postV4PartnerByApplicationIdAccountResellerCreditLimit:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Reseller/CreditLimit`,method:"POST",params:{newValue:t.newValue}})}),postV4PartnerByApplicationIdAccountResellerPriority:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Reseller/Priority`,method:"POST",params:{newValue:t.newValue}})}),postV4PartnerByApplicationIdAccountResellerTier:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Reseller/Tier`,method:"POST",params:{newValue:t.newValue}})}),putV4PartnerByApplicationIdAccountSocialAndSocialNetwork:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Social/${t.socialNetwork}`,method:"PUT",params:{tag:t.tag}})}),deleteV4PartnerByApplicationIdAccountSocialAndSocialNetwork:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Account/Social/${t.socialNetwork}`,method:"DELETE"})}),getV4ManufacturerByRouteManufacturerIdAccount:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Account`,params:{withSpecification:t.withSpecification}})}),getV4AgencyByRouteAgencyId:e.query({query:t=>({url:`/V4/Agency/${t.routeAgencyId}`})}),putV4ResellerByRouteResellerIdAutoPoExtract:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Auto/POExtract`,method:"PUT",body:t.body})}),getV4ResellerByRouteResellerIdBilling:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Billing`})}),getV4ResellerByRouteResellerIdBillingInvoices:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Billing/Invoices`})}),getV4ResellerByRouteResellerIdBillingPayments:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Billing/Payments`})}),getV4ResellerByRouteResellerIdBillingCredits:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Billing/Credits`})}),getV4ResellerByRouteResellerIdBillingLastPayment:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Billing/LastPayment`})}),getV4ResellerByRouteResellerIdBillingStatementDetails:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Billing/StatementDetails`})}),putV4PartnerByApplicationIdBusinessDevelopment:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/BusinessDevelopment`,method:"PUT"})}),getV4PartnerByApplicationIdBusinessDevelopmentConversations:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/BusinessDevelopment/Conversations`})}),getV4PartnerByApplicationIdBusinessDevelopmentConversationAndConversationIdMessages:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/BusinessDevelopment/Conversation/${t.conversationId}/Messages`})}),getV4ResellerByRouteResellerIdCartAndCartName:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Cart/${t.cartName}`})}),deleteV4ResellerByRouteResellerIdCartAndCartName:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Cart/${t.cartName}`,method:"DELETE"})}),postV4ResellerByRouteResellerIdCartGenerateAndPostalCode:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Cart/Generate/${t.postalCode}`,method:"POST"})}),postV4ResellerByRouteResellerIdCartAddItemAndCartNameRandmarSku:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Cart/AddItem/${t.cartName}/${t.randmarSku}`,method:"POST",params:{quantity:t.quantity,bidNumber:t.bidNumber}})}),postV4ResellerByRouteResellerIdCartAddItemAndCartNameRandmarSkuDefaultOpportunity:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Cart/AddItem/${t.cartName}/${t.randmarSku}/DefaultOpportunity`,method:"POST",params:{quantity:t.quantity}})}),postV4ResellerByRouteResellerIdCartShippingMethodsAndCartName:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Cart/ShippingMethods/${t.cartName}`,method:"POST",body:t.shipToDetails})}),postV4ResellerByRouteResellerIdCartProcessAndCartName:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Cart/Process/${t.cartName}`,method:"POST",body:t.shipToLocation})}),getV4ResellerByRouteResellerIdCarts:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Carts`})}),deleteV4ResellerByRouteResellerIdCarts:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Carts`,method:"DELETE"})}),getV4ManufacturerByRouteManufacturerIdCategories:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Categories`})}),getV4ManufacturerByRouteManufacturerIdCategoriesNiches:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Categories/Niches`,params:{routeResellerId:t.routeResellerId}})}),getV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCode:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}`})}),putV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCode:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}`,method:"PUT"})}),deleteV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCode:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}`,method:"DELETE"})}),postV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeFieldName:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/${t.fieldName}`,method:"POST",params:{newValue:t.newValue}})}),postV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeAGp:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/A_GP`,method:"POST",params:{newValue:t.newValue}})}),postV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeBGp:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/B_GP`,method:"POST",params:{newValue:t.newValue}})}),postV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeCGp:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/C_GP`,method:"POST",params:{newValue:t.newValue}})}),postV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeDGp:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/D_GP`,method:"POST",params:{newValue:t.newValue}})}),postV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeCostGp:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/Cost_GP`,method:"POST",params:{newValue:t.newValue}})}),postV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeReset:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/Reset`,method:"POST"})}),putV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeStarred:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/Starred`,method:"PUT"})}),postV4ManufacturerByRouteManufacturerIdCategoryAndCategoryCodeImage:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Category/${t.categoryCode}/Image`,method:"POST",body:t.body})}),getV4ResellerByRouteResellerIdCommunication:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Communication`})}),putV4ResellerByRouteResellerIdCommunication:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Communication`,method:"PUT",body:t.body})}),getV4ResellerByRouteResellerIdCommunications:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Communications`})}),putV4ResellerByRouteResellerIdCommunications:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Communications`,method:"PUT",body:t.body})}),putV4ResellerByRouteResellerIdCommunicationAndSubjectManufacturerId:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Communication/${t.subject}/${t.manufacturerId}`,method:"PUT",params:{emoji:t.emoji,dateTime:t.dateTime}})}),putV4ResellerByRouteResellerIdCommunicationsAndSubjectManufacturerId:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Communications/${t.subject}/${t.manufacturerId}`,method:"PUT",params:{emoji:t.emoji,dateTime:t.dateTime}})}),deleteV4ResellerByRouteResellerIdCommunicationAndSubjectResellerId:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Communication/${t.subject}/${t.resellerId}`,method:"DELETE",params:{manufacturerId:t.manufacturerId,dateTime:t.dateTime}})}),deleteV4ResellerByRouteResellerIdCommunicationsAndSubjectResellerId:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Communications/${t.subject}/${t.resellerId}`,method:"DELETE",params:{manufacturerId:t.manufacturerId,dateTime:t.dateTime}})}),putV4ManufacturerByRouteManufacturerIdCommunication:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Communication`,method:"PUT",body:t.body})}),putV4ManufacturerByRouteManufacturerIdCommunicationAndSubjectResellerId:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Communication/${t.subject}/${t.resellerId}`,method:"PUT",params:{emoji:t.emoji,dateTime:t.dateTime}})}),deleteV4ManufacturerByRouteManufacturerIdCommunicationAndSubjectResellerId:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Communication/${t.subject}/${t.resellerId}`,method:"DELETE",params:{dateTime:t.dateTime}})}),getV4ManufacturerByRouteManufacturerIdCommunications:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Communications`})}),getV4ResellerByRouteResellerIdCustomer:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Customer`,params:{customerName:t.customerName}})}),getV4ResellerByRouteResellerIdDocumentAndDocumentNumber:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Document/${t.documentNumber}`})}),getV4ResellerByRouteResellerIdDocumentFormalNotice:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Document/FormalNotice`,params:{amount:t.amount}})}),getV4ResellerByRouteResellerIdDocumentAndDocumentNumberWarehouse:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Document/${t.documentNumber}/Warehouse`})}),getV4ResellerByRouteResellerIdDocumentAndDocumentNumberPdf:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Document/${t.documentNumber}/PDF`})}),postV4ResellerByRouteResellerIdDocumentAndDocumentNumberEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Document/${t.documentNumber}/Email`,method:"POST",params:{emailAddress:t.emailAddress,comment:t.comment}})}),postV4ResellerByRouteResellerIdDocumentStatementEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Document/Statement/Email`,method:"POST",params:{emailAddress:t.emailAddress,comment:t.comment}})}),getV4ManufacturerByRouteManufacturerIdDocumentAndDocumentNumber:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/${t.documentNumber}`})}),getV4ManufacturerByRouteManufacturerIdDocumentAndDocumentNumberPdf:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/${t.documentNumber}/PDF`})}),postV4ManufacturerByRouteManufacturerIdDocumentAndDocumentNumberEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/${t.documentNumber}/Email`,method:"POST",params:{emailAddress:t.emailAddress,comment:t.comment}})}),putV4ManufacturerByRouteManufacturerIdDocumentSalesOrderAndOrderNumberExecute:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/SalesOrder/${t.orderNumber}/Execute`,method:"PUT"})}),getV4ManufacturerByRouteManufacturerIdDocumentSalesOrderAndOrderNumber:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/SalesOrder/${t.orderNumber}`})}),getV4ResellerByRouteResellerIdDocumentsActiveOrderDetails:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Documents/ActiveOrderDetails`})}),getV4ResellerByRouteResellerIdDocumentsGeneralDocuments:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Documents/GeneralDocuments`})}),getV4ManufacturerByRouteManufacturerIdDocumentsRequisitions:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Documents/Requisitions`})}),getV4ManufacturerByRouteManufacturerIdDocumentRequisitions:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/Requisitions`})}),getV4ManufacturerByRouteManufacturerIdDocumentsPurchaseOrders:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Documents/PurchaseOrders`})}),getV4ManufacturerByRouteManufacturerIdDocumentPurchaseOrders:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/PurchaseOrders`})}),getV4ManufacturerByRouteManufacturerIdDocumentsReceipts:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Documents/Receipts`})}),getV4ManufacturerByRouteManufacturerIdDocumentReceipts:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/Receipts`})}),getV4ManufacturerByRouteManufacturerIdDocumentsInvoices:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Documents/Invoices`})}),getV4ManufacturerByRouteManufacturerIdDocumentInvoices:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/Invoices`})}),getV4ManufacturerByRouteManufacturerIdDocumentsActiveOrderDetails:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Documents/ActiveOrderDetails`})}),getV4ManufacturerByRouteManufacturerIdDocumentActiveOrderDetails:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/ActiveOrderDetails`})}),getV4ManufacturerByRouteManufacturerIdDocumentsCompletedOrderDetails:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Documents/CompletedOrderDetails`})}),getV4ManufacturerByRouteManufacturerIdDocumentCompletedOrderDetails:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Document/CompletedOrderDetails`})}),putV4ManufacturerByRouteManufacturerIdDraftPurchases:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/DraftPurchases`,method:"PUT"})}),putV4PartnerByApplicationIdIntegrationKeyAndKeyName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/IntegrationKey/${t.keyName}`,method:"PUT"})}),postV4PartnerByApplicationIdIntegrationKeyAndKeyName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/IntegrationKey/${t.keyName}`,method:"POST"})}),deleteV4PartnerByApplicationIdIntegrationKeyAndKeyName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/IntegrationKey/${t.keyName}`,method:"DELETE"})}),getV4PartnerByApplicationIdIntegrationKeys:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/IntegrationKeys`})}),getV4ManufacturerByRouteManufacturerIdInventoryValue:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Inventory/Value`})}),putV4ManufacturerByRouteManufacturerIdInvoiceAndReceiptNumber:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Invoice/${t.receiptNumber}`,method:"PUT",body:t.body})}),putV4ManufacturerByRouteManufacturerIdInvoiceMiscellaneous:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Invoice/Miscellaneous`,method:"PUT",body:t.body})}),getV4PartnerByApplicationIdJobs:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Jobs`})}),getV4PartnerByApplicationIdLogs:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Logs`})}),getV4ResellerByRouteResellerIdManufacturerAndManufacturerId:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Manufacturer/${t.manufacturerId}`,params:{withSpecification:t.withSpecification}})}),postV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopify:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Manufacturer/${t.manufacturerId}/Shopify`,method:"POST",params:{shopifyHostName:t.shopifyHostName}})}),getV4ResellerByRouteResellerIdManufacturerAndManufacturerIdSalesStatistics:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Manufacturer/${t.manufacturerId}/SalesStatistics`,params:{startDate:t.startDate,endDate:t.endDate}})}),getV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCode:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Manufacturer/${t.manufacturerId}/${t.categoryCode}`})}),postV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopify:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Manufacturer/${t.manufacturerId}/${t.categoryCode}/Shopify`,method:"POST",params:{shopifyHostName:t.shopifyHostName}})}),getV4ResellerByRouteResellerIdManufacturers:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Manufacturers`,params:{withSpecification:t.withSpecification}})}),getV4PartnerByApplicationIdManufacturers:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Manufacturers`,params:{withSpecification:t.withSpecification}})}),getV4AgencyByRouteAgencyIdManufacturers:e.query({query:t=>({url:`/V4/Agency/${t.routeAgencyId}/Manufacturers`,params:{withSpecification:t.withSpecification}})}),getV4ResellerByRouteResellerIdMediaAndDocumentNumberSubfolder:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Media/${t.documentNumber}/${t.subfolder}`})}),putV4ResellerByRouteResellerIdMediaAndDocumentNumberSubfolderShort:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Media/${t.documentNumber}/${t.subfolder}/Short`,method:"PUT",body:t.convertToShortModel})}),getV4PartnerByApplicationIdMediaShorts:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Media/Shorts`})}),getV4PartnerByApplicationIdMediaShortAndFileName:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Media/Short/${t.fileName}`})}),postV4PartnerByApplicationIdMediaShortAndFileName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Media/Short/${t.fileName}`,method:"POST",params:{newValue:t.newValue}})}),deleteV4PartnerByApplicationIdMediaShortAndFileName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Media/Short/${t.fileName}`,method:"DELETE"})}),putV4PartnerByApplicationIdMediaTextToSpeech:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Media/TextToSpeech`,method:"PUT",body:t.textToSpeechModel})}),putV4PartnerByApplicationIdMediaShortsFromLong:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Media/ShortsFromLong`,method:"PUT",body:t.shortsFromLongModel})}),getV4ResellerByRouteResellerIdNicheAndNicheNameManufacturers:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Niche/${t.nicheName}/Manufacturers`})}),getV4ResellerByRouteResellerIdOpportunities:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Opportunities`})}),getV4ManufacturerByRouteManufacturerIdOpportunities:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunities`})}),getV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumber:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Opportunity/${t.manufacturerId}/${t.bidNumber}`,params:{withSpecification:t.withSpecification}})}),postV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Opportunity/${t.manufacturerId}/${t.bidNumber}/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),putV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefault:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Opportunity/${t.manufacturerId}/Default`,method:"PUT",params:{opportunityNumber:t.opportunityNumber}})}),postV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberFile:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Opportunity/${t.manufacturerId}/${t.bidNumber}/File`,method:"POST"})}),postV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberShopify:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Opportunity/${t.manufacturerId}/${t.bidNumber}/Shopify`,method:"POST",params:{shopifyHostName:t.shopifyHostName}})}),putV4ManufacturerByRouteManufacturerIdOpportunity:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity`,method:"PUT",body:t.body})}),putV4ManufacturerByRouteManufacturerIdOpportunityAndBidNumber:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity/${t.bidNumber}`,method:"PUT",body:t.body})}),getV4ManufacturerByRouteManufacturerIdOpportunityAndBidNumber:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity/${t.bidNumber}`,params:{withSpecification:t.withSpecification}})}),deleteV4ManufacturerByRouteManufacturerIdOpportunityAndBidNumber:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity/${t.bidNumber}`,method:"DELETE"})}),postV4ManufacturerByRouteManufacturerIdOpportunityAndBidNumberFieldName:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity/${t.bidNumber}/${t.fieldName}`,method:"POST",params:{newValue:t.newValue}})}),putV4ManufacturerByRouteManufacturerIdOpportunityAndBidNumberResellerResellerId:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity/${t.bidNumber}/Reseller/${t.resellerId}`,method:"PUT"})}),deleteV4ManufacturerByRouteManufacturerIdOpportunityAndBidNumberResellerResellerId:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity/${t.bidNumber}/Reseller/${t.resellerId}`,method:"DELETE"})}),postV4ManufacturerByRouteManufacturerIdOpportunityAndBidNumberPartNumberRandmarSku:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity/${t.bidNumber}/PartNumber/${t.randmarSku}`,method:"POST",params:{bidPrice:t.bidPrice,bidPriceType:t.bidPriceType}})}),deleteV4ManufacturerByRouteManufacturerIdOpportunityAndBidNumberPartNumberRandmarSku:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Opportunity/${t.bidNumber}/PartNumber/${t.randmarSku}`,method:"DELETE"})}),getV4ResellerByRouteResellerIdOrderAndOrderNumber:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}`,params:{withSpecification:t.withSpecification}})}),putV4ResellerByRouteResellerIdOrderAndOrderNumberComment:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/Comment`,method:"PUT",params:{comment:t.comment}})}),postV4ResellerByRouteResellerIdOrderAndDocumentNumberShippingSlip:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.documentNumber}/ShippingSlip`,method:"POST",body:t.body})}),getV4ResellerByRouteResellerIdOrderPoNumberAndResellerPoNumber:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/PONumber/${t.resellerPoNumber}`})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/Email`,method:"POST",params:{emailAddress:t.emailAddress,comment:t.comment}})}),deleteV4ResellerByRouteResellerIdOrderAndOrderNumberCancel:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/Cancel`,method:"DELETE",params:{comment:t.comment}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberChangeLocation:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/ChangeLocation`,method:"POST",params:{location:t.location}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberOnHold:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/OnHold`,method:"POST",params:{newValue:t.newValue}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberShipViaChange:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/ShipVia/Change`,method:"POST",params:{shipVia:t.shipVia}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberChangeShipVia:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/ChangeShipVia`,method:"POST",params:{shipVia:t.shipVia}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberShipViaEstimate:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/ShipVia/Estimate`,method:"POST"})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberEditInformation:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/EditInformation`,method:"POST",params:{endUserPONumber:t.endUserPoNumber,shippingDate:t.shippingDate,shipToName:t.shipToName,shipToAddress1:t.shipToAddress1,shipToAddress2:t.shipToAddress2,shipToCity:t.shipToCity,shipToProvince:t.shipToProvince,shipToPostalCode:t.shipToPostalCode,shipToContactName:t.shipToContactName,shipToContactPhone:t.shipToContactPhone}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberEditItemRandmarSku:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/EditItem/${t.randmarSku}`,method:"POST",params:{quantity:t.quantity,unitPrice:t.unitPrice}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberOrderDate:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/OrderDate`,method:"POST",params:{newvalue:t.newvalue}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberShippingDate:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/ShippingDate`,method:"POST",params:{newvalue:t.newvalue}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberExpeditionLine:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/ExpeditionLine`,method:"POST",params:{newValue:t.newValue}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberPoNumber:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/PONumber`,method:"POST",params:{newValue:t.newValue}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberEndUserPoNumber:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/EndUserPONumber`,method:"POST",params:{newValue:t.newValue}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberToday:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/Today`,method:"POST"})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberEditChargeMiscellaneousCharge:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/EditCharge/${t.miscellaneousCharge}`,method:"POST",params:{price:t.price}})}),postV4ResellerByRouteResellerIdOrderAndOrderNumberEditMiscellaneousChargeMiscellaneousCharge:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Order/${t.orderNumber}/EditMiscellaneousCharge/${t.miscellaneousCharge}`,method:"POST",params:{price:t.price}})}),getV4ResellerByRouteResellerIdOrders:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Orders`})}),getV4ResellerByRouteResellerIdOrdersShipments:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Orders/Shipments`})}),getV4PartnerByApplicationIdPartnerAndPartnerId:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Partner/${t.partnerId}`,params:{withSpecification:t.withSpecification}})}),putV4AgencyByRouteAgencyIdPartnerAndNewUserEmailAddress:e.mutation({query:t=>({url:`/V4/Agency/${t.routeAgencyId}/Partner/${t.newUserEmailAddress}`,method:"PUT"})}),getV4ShopifyByShopifyHostNameProductAndRandmarSku:e.query({query:t=>({url:`/V4/Shopify/${t.shopifyHostName}/Product/${t.randmarSku}`})}),getV4ResellerByRouteResellerIdProductAndRandmarSku:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Product/${t.randmarSku}`,params:{withSpecification:t.withSpecification,shopifyHostName:t.shopifyHostName}})}),getV4ResellerByRouteResellerIdProductAndRandmarSkuSalesStatistics:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Product/${t.randmarSku}/SalesStatistics`,params:{startDate:t.startDate,endDate:t.endDate}})}),postV4ResellerByRouteResellerIdProductAndRandmarSkuShopify:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Product/${t.randmarSku}/Shopify`,method:"POST",params:{shopifyHostName:t.shopifyHostName,opportunityNumber:t.opportunityNumber}})}),postV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyInventory:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Product/${t.randmarSku}/Shopify/Inventory`,method:"POST",params:{shopifyHostName:t.shopifyHostName}})}),putV4ResellerByRouteResellerIdProductAndRandmarSkuRequisition:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Product/${t.randmarSku}/Requisition`,method:"PUT",params:{location:t.location,quantity:t.quantity}})}),putV4ResellerByRouteResellerIdProductAndRandmarSkuSerialize:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Product/${t.randmarSku}/Serialize`,method:"PUT"})}),getV4PartnerByApplicationIdProductAndRandmarSku:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Product/${t.randmarSku}`,params:{withSpecification:t.withSpecification,shopifyHostName:t.shopifyHostName}})}),putV4PartnerByApplicationIdProductAndRandmarSkuShort:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Product/${t.randmarSku}/Short`,method:"PUT",body:t.productConvertToShortModel})}),getV4ManufacturerByRouteManufacturerIdProductAndProductNumber:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}`,params:{withSpecification:t.withSpecification}})}),getV4ManufacturerByRouteManufacturerIdProductAndProductNumberSalesStatistics:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/SalesStatistics`,params:{startDate:t.startDate,endDate:t.endDate}})}),putV4ManufacturerByRouteManufacturerIdProduct:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product`,method:"PUT"})}),postV4ManufacturerByRouteManufacturerIdProductAndProductNumberFieldName:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/${t.fieldName}`,method:"POST",params:{newValue:t.newValue}})}),postV4ManufacturerByRouteManufacturerIdProductAndProductNumberBodyHtml:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/BodyHTML`,method:"POST",body:t.body})}),postV4ManufacturerByRouteManufacturerIdProductAndProductNumberRandmarTitle:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/RandmarTitle`,method:"POST"})}),postV4ManufacturerByRouteManufacturerIdProductAndProductNumberDiscontinue:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/Discontinue`,method:"POST"})}),deleteV4ManufacturerByRouteManufacturerIdProductAndProductNumberOrderNumber:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/${t.orderNumber}`,method:"DELETE",params:{comment:t.comment}})}),postV4ManufacturerByRouteManufacturerIdProductAndProductNumberUpc:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/UPC`,method:"POST",params:{newValue:t.newValue}})}),putV4ManufacturerByRouteManufacturerIdProductAndRandmarSkuInstantRebate:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.randmarSku}/InstantRebate`,method:"PUT",body:t.body})}),putV4ManufacturerByRouteManufacturerIdProductAndRandmarSkuRequisition:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.randmarSku}/Requisition`,method:"PUT",params:{location:t.location,quantity:t.quantity}})}),postV4ManufacturerByRouteManufacturerIdProductAndRandmarSkuImage:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.randmarSku}/Image`,method:"POST",body:t.body})}),putV4ManufacturerByRouteManufacturerIdProductAndRandmarSkuImage:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.randmarSku}/Image`,method:"PUT"})}),getV4ManufacturerByRouteManufacturerIdProductAndProductNumber3DModel:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/3DModel`})}),getV4ManufacturerByRouteManufacturerIdProductAndProductNumber3DModelExists:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.productNumber}/3DModel/Exists`})}),postV4ManufacturerByRouteManufacturerIdProductAndRandmarSku3DModel:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.randmarSku}/3DModel`,method:"POST",body:t.body})}),putV4ManufacturerByRouteManufacturerIdProductAndRandmarSkuVideo:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.randmarSku}/Video`,method:"PUT"})}),postV4ManufacturerByRouteManufacturerIdProductAndRandmarSkuVideo:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Product/${t.randmarSku}/Video`,method:"POST",body:t.body})}),getV4ResellerByRouteResellerIdProductsNiches:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Products/Niches`})}),getV4ResellerByRouteResellerIdProductsReceivings:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Products/Receivings`})}),getV4ResellerByRouteResellerIdProductsInstantRebates:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Products/InstantRebates`})}),getV4ResellerByRouteResellerIdProductsNewest:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Products/Newest`})}),getRandmar:e.query({query:()=>({url:"/Randmar"})}),getRandmarVideo:e.query({query:()=>({url:"/Randmar/Video"})}),getWarehouses:e.query({query:()=>({url:"/Warehouses"})}),getV4Warehouses:e.query({query:()=>({url:"/V4/Warehouses"})}),getManufacturers:e.query({query:()=>({url:"/Manufacturers"})}),getManufacturerByPublicName:e.query({query:t=>({url:`/Manufacturer/${t.publicName}`})}),getManufacturerByPublicNameAndCategoryName:e.query({query:t=>({url:`/Manufacturer/${t.publicName}/${t.categoryName}`})}),getManufacturerByPublicNameLogo:e.query({query:t=>({url:`/Manufacturer/${t.publicName}/Logo`,params:{width:t.width,height:t.height}})}),getManufacturerByPublicNameVideo:e.query({query:t=>({url:`/Manufacturer/${t.publicName}/Video`})}),getManufacturerByPublicNameAndCategoryNameImage:e.query({query:t=>({url:`/Manufacturer/${t.publicName}/${t.categoryName}/Image`,params:{width:t.width,height:t.height}})}),getProductsVideosMostRecent:e.query({query:()=>({url:"/Products/Videos/MostRecent"})}),getProductsVideos:e.query({query:()=>({url:"/Products/Videos"})}),getProductByProductNumber:e.query({query:t=>({url:`/Product/${t.productNumber}`})}),getProductByProductNumberImage:e.query({query:t=>({url:`/Product/${t.productNumber}/Image`,params:{width:t.width,height:t.height}})}),getProductByProductNumberImageExists:e.query({query:t=>({url:`/Product/${t.productNumber}/Image/Exists`})}),getProductByProductNumber3DModelExists:e.query({query:t=>({url:`/Product/${t.productNumber}/3DModel/Exists`})}),getProductByProductNumberVideo:e.query({query:t=>({url:`/Product/${t.productNumber}/Video`})}),getProductByProductNumberVideoExists:e.query({query:t=>({url:`/Product/${t.productNumber}/Video/Exists`})}),getShortsGenerationContentScenes:e.query({query:()=>({url:"/ShortsGenerationContent/Scenes"})}),getShortsGenerationContentSceneBySceneName:e.query({query:t=>({url:`/ShortsGenerationContent/Scene/${t.sceneName}`})}),getShortsGenerationContentSceneBySceneNameThumbnail:e.query({query:t=>({url:`/ShortsGenerationContent/Scene/${t.sceneName}/Thumbnail`})}),getShortsGenerationContentSceneBySceneNamePreview:e.query({query:t=>({url:`/ShortsGenerationContent/Scene/${t.sceneName}/Preview`})}),getShortsGenerationContentSceneBySceneNameCameraScript:e.query({query:t=>({url:`/ShortsGenerationContent/Scene/${t.sceneName}/CameraScript`})}),getShortsGenerationContentSceneDefaultAmbientSound:e.query({query:()=>({url:"/ShortsGenerationContent/Scene/Default/AmbientSound"})}),getShortsGenerationContentSceneBySceneNameAmbientSound:e.query({query:t=>({url:`/ShortsGenerationContent/Scene/${t.sceneName}/AmbientSound`})}),putV4ManufacturerByRouteManufacturerIdPurchaseOrder:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/PurchaseOrder`,method:"PUT",body:t.body,params:{sendToManufacturer:t.sendToManufacturer}})}),postV4ManufacturerByRouteManufacturerIdPurchaseOrderCreditCheck:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/PurchaseOrder/CreditCheck`,method:"POST",body:t.body})}),postV4ManufacturerByRouteManufacturerIdPurchaseOrderAndPurchaseOrderNumberEditExpectedDate:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/PurchaseOrder/${t.purchaseOrderNumber}/EditExpectedDate`,method:"POST",params:{newValue:t.newValue}})}),deleteV4ManufacturerByRouteManufacturerIdPurchaseOrderAndPurchaseOrderNumber:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/PurchaseOrder/${t.purchaseOrderNumber}`,method:"DELETE"})}),putV4ManufacturerByRouteManufacturerIdPurchaseOrderAndPurchaseOrderNumberSend:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/PurchaseOrder/${t.purchaseOrderNumber}/Send`,method:"PUT"})}),postV4ManufacturerByRouteManufacturerIdPurchaseOrderAndPurchaseOrderNumberEditItemRandmarSku:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/PurchaseOrder/${t.purchaseOrderNumber}/EditItem/${t.randmarSku}`,method:"POST",params:{quantity:t.quantity,unitPrice:t.unitPrice,editStandardCost:t.editStandardCost}})}),postV4ResellerByRouteResellerIdReportHpAmplifiedEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/HP Amplified/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportUniversalEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Universal/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportProductsEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Products/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportUniversalFile:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Universal/File`,method:"POST"})}),postV4ResellerByRouteResellerIdReportProductsFile:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Products/File`,method:"POST"})}),postV4ResellerByRouteResellerIdReportUniversalJson:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Universal/JSON`,method:"POST"})}),postV4ResellerByRouteResellerIdReportProductsJson:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Products/JSON`,method:"POST"})}),postV4ResellerByRouteResellerIdReportShipmentsEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Shipments/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportInvoicesEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Invoices/Email`,method:"POST",params:{emailAddress:t.emailAddress,startDate:t.startDate,endDate:t.endDate}})}),postV4ResellerByRouteResellerIdReportOpenOrdersEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/OpenOrders/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportReturnsEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Returns/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportOpportunitiesEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/Opportunities/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportAmazonTrackingFileEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/AmazonTrackingFile/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportAmazonTrackingFileFile:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/AmazonTrackingFile/File`,method:"POST"})}),postV4ResellerByRouteResellerIdReportWalmartTrackingFileEmail:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/WalmartTrackingFile/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ResellerByRouteResellerIdReportWalmartTrackingFileFile:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Report/WalmartTrackingFile/File`,method:"POST"})}),postV4ManufacturerByRouteManufacturerIdReportReorderEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Reorder/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ManufacturerByRouteManufacturerIdReportResellersEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Resellers/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ManufacturerByRouteManufacturerIdReportReorderFile:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Reorder/File`,method:"POST"})}),postV4ManufacturerByRouteManufacturerIdReportReorderAndWarehouseLocationJson:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Reorder/${t.warehouseLocation}/JSON`,method:"POST"})}),postV4ManufacturerByRouteManufacturerIdReportSalesEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Sales/Email`,method:"POST",params:{emailAddress:t.emailAddress,startDate:t.startDate,endDate:t.endDate}})}),postV4ManufacturerByRouteManufacturerIdReportSalesAndResellerIdEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Sales/${t.resellerId}/Email`,method:"POST",params:{emailAddress:t.emailAddress,startDate:t.startDate,endDate:t.endDate}})}),postV4ManufacturerByRouteManufacturerIdReportSalesFile:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Sales/File`,method:"POST",params:{startDate:t.startDate,endDate:t.endDate}})}),postV4ManufacturerByRouteManufacturerIdReportSalesJson:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Sales/JSON`,method:"POST",params:{startDate:t.startDate,endDate:t.endDate}})}),postV4ManufacturerByRouteManufacturerIdReportBestCanadianFulfillmentCenters:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/BestCanadianFulfillmentCenters`,method:"POST",body:t.body})}),postV4ManufacturerByRouteManufacturerIdReportInventoryEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Inventory/Email`,method:"POST",params:{emailAddress:t.emailAddress,inventoryDate:t.inventoryDate}})}),postV4ManufacturerByRouteManufacturerIdReportInventoryFile:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Inventory/File`,method:"POST",params:{inventoryDate:t.inventoryDate}})}),postV4ManufacturerByRouteManufacturerIdReportInventoryJson:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Inventory/JSON`,method:"POST",params:{inventoryDate:t.inventoryDate}})}),postV4ManufacturerByRouteManufacturerIdReportClaimEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Claim/Email`,method:"POST",params:{emailAddress:t.emailAddress,startDate:t.startDate,endDate:t.endDate}})}),postV4ManufacturerByRouteManufacturerIdReportOpenOrdersEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/OpenOrders/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ManufacturerByRouteManufacturerIdReportOpenOrdersJson:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/OpenOrders/JSON`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ManufacturerByRouteManufacturerIdReportProductsEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Products/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ManufacturerByRouteManufacturerIdReportProductsFile:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Products/File`,method:"POST"})}),postV4ManufacturerByRouteManufacturerIdReportProductsTsv:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Products/TSV`,method:"POST"})}),postV4ManufacturerByRouteManufacturerIdReportProductsJson:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/Products/JSON`,method:"POST"})}),postV4ManufacturerByRouteManufacturerIdReportPurchasedOrdersEmail:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/PurchasedOrders/Email`,method:"POST",params:{emailAddress:t.emailAddress}})}),postV4ManufacturerByRouteManufacturerIdReportPurchasedOrdersFile:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Report/PurchasedOrders/File`,method:"POST"})}),deleteV4ManufacturerByRouteManufacturerIdRequisitionAndRequisitionNumber:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Requisition/${t.requisitionNumber}`,method:"DELETE"})}),postV4ManufacturerByRouteManufacturerIdRequisitionAndRequisitionNumberEditItemRandmarSku:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Requisition/${t.requisitionNumber}/EditItem/${t.randmarSku}`,method:"POST",params:{quantity:t.quantity}})}),putV4ManufacturerByRouteManufacturerIdRequisition:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Requisition`,method:"PUT",body:t.body})}),getV4ManufacturerByRouteManufacturerIdResellerAndResellerId:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Reseller/${t.resellerId}`,params:{withSpecification:t.withSpecification}})}),getV4ManufacturerByRouteManufacturerIdResellerAndResellerIdSalesStatistics:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Reseller/${t.resellerId}/SalesStatistics`,params:{startDate:t.startDate,endDate:t.endDate}})}),getV4ManufacturerByRouteManufacturerIdResellerQualificationAndQualificationId:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Reseller/Qualification/${t.qualificationId}`,params:{withSpecification:t.withSpecification}})}),putV4ManufacturerByRouteManufacturerIdResellerAndResellerIdQualification:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Reseller/${t.resellerId}/Qualification`,method:"PUT",params:{newValue:t.newValue}})}),deleteV4ManufacturerByRouteManufacturerIdResellerAndResellerIdQualification:e.mutation({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Reseller/${t.resellerId}/Qualification`,method:"DELETE"})}),getV4ManufacturerByRouteManufacturerIdResellers:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Resellers`})}),getV4AgencyByRouteAgencyIdResellers:e.query({query:t=>({url:`/V4/Agency/${t.routeAgencyId}/Resellers`,params:{withSpecification:t.withSpecification}})}),getV4ResellerByRouteResellerIdReturnAndReturnNumber:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}`})}),postV4ResellerByRouteResellerIdReturnCreate:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/Create`,method:"POST",body:t.returnRequest})}),putV4ResellerByRouteResellerIdReturnAndReturnNumberClaim:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/Claim`,method:"PUT"})}),putV4ResellerByRouteResellerIdReturnAndReturnNumberManufacturerRma:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/ManufacturerRMA`,method:"PUT",body:t.manufacturerRma})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberAddComment:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/AddComment`,method:"POST",params:{comment:t.comment}})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberRandmarSkuEditReason:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/${t.randmarSku}/EditReason`,method:"POST",params:{newValue:t.newValue}})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberRandmarSkuEditQuantity:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/${t.randmarSku}/EditQuantity`,method:"POST",params:{newValue:t.newValue}})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberAccept:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/Accept`,method:"POST"})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberReceive:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/Receive`,method:"POST"})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberWarehouseLocation:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/WarehouseLocation`,method:"POST",params:{newValue:t.newValue}})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberEligible:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/Eligible`,method:"POST"})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberCredit:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/Credit`,method:"POST",params:{creditNumber:t.creditNumber}})}),postV4ResellerByRouteResellerIdReturnAndReturnNumberDecline:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Return/${t.returnNumber}/Decline`,method:"POST"})}),getV4ResellerByRouteResellerIdReturns:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Returns`})}),getV4ManufacturerByRouteManufacturerIdReturns:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Returns`})}),getV4ShopifyByShopifyHostNameSearch:e.query({query:t=>({url:`/V4/Shopify/${t.shopifyHostName}/Search`,params:{q:t.q}})}),getV4ResellerByRouteResellerIdSearch:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Search`,params:{s:t.s}})}),getV4PartnerByRouteApplicationIdSearch:e.query({query:t=>({url:`/V4/Partner/${t.routeApplicationId}/Search`,params:{q:t.q}})}),getV4ManufacturerByRouteManufacturerIdSearch:e.query({query:t=>({url:`/V4/Manufacturer/${t.routeManufacturerId}/Search`,params:{s:t.s}})}),putV4ResellerByRouteResellerIdShippingLabelGenerate:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/ShippingLabel/Generate`,method:"PUT",body:t.shipmentDetails})}),putV4ResellerByRouteResellerIdShippingLabelLogistics:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/ShippingLabel/Logistics`,method:"PUT",body:t.shipmentDetails})}),postV4ResellerByRouteResellerIdShippingLabelEstimate:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/ShippingLabel/Estimate`,method:"POST",body:t.shipmentDetails})}),getV4ResellerByRouteResellerIdShopifyAccounts:e.query({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Shopify/Accounts`})}),putV4ResellerByRouteResellerIdShopifyAndShopifyhostNameFulfillmentShopifyFulfillmentOrderIrderIdRequest:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Shopify/${t.shopifyhostName}/Fulfillment/${t.shopifyFulfillmentOrderIrderId}/Request`,method:"PUT"})}),deleteV4ResellerByRouteResellerIdShopifyAndShopifyhostNameFulfillmentShopifyFulfillmentOrderIrderId:e.mutation({query:t=>({url:`/V4/Reseller/${t.routeResellerId}/Shopify/${t.shopifyhostName}/Fulfillment/${t.shopifyFulfillmentOrderIrderId}`,method:"DELETE"})}),getV4PartnerByApplicationIdShopify:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Shopify`})}),postV4PartnerByApplicationIdShopifyValidate:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Shopify/Validate`,method:"POST",params:{shopifyHostName:t.shopifyHostName}})}),postV4PartnerByApplicationIdShopifySynchronizationAndSynchronizationType:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Shopify/Synchronization/${t.synchronizationType}`,method:"POST",params:{shopifyHostName:t.shopifyHostName,newValue:t.newValue}})}),postV4PartnerByApplicationIdShopifyAndPropertyName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Shopify/${t.propertyName}`,method:"POST",params:{shopifyHostName:t.shopifyHostName,newValue:t.newValue}})}),postV4PartnerByApplicationIdShopifyDefaultShippingSlipComment:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Shopify/DefaultShippingSlipComment`,method:"POST",params:{shopifyHostName:t.shopifyHostName,newValue:t.newValue}})}),putV4PartnerByApplicationIdShopifyWebhookAndModuleStatus:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Shopify/Webhook/${t.module}/${t.status}`,method:"PUT",params:{shopifyHostName:t.shopifyHostName}})}),deleteV4PartnerByApplicationIdShopifyWebhookAndModuleStatus:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Shopify/Webhook/${t.module}/${t.status}`,method:"DELETE",params:{shopifyHostName:t.shopifyHostName}})}),putV4PartnerByApplicationIdUserAndEmailAddress:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/User/${t.emailAddress}`,method:"PUT"})}),deleteV4PartnerByApplicationIdUserAndEmailAddress:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/User/${t.emailAddress}`,method:"DELETE"})}),postV4PartnerByApplicationIdUserAndEmailAddressActive:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/User/${t.emailAddress}/Active`,method:"POST",params:{newValue:t.newValue}})}),putV4PartnerByApplicationIdUserAndEmailAddressNotificationNotificationType:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/User/${t.emailAddress}/Notification/${t.notificationType}`,method:"PUT"})}),deleteV4PartnerByApplicationIdUserAndEmailAddressNotificationNotificationType:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/User/${t.emailAddress}/Notification/${t.notificationType}`,method:"DELETE"})}),getV4PartnerByApplicationIdUsers:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Users`})}),getV4PartnerByApplicationIdWarehouseAndWarehouseId:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}`})}),getV4PartnerByApplicationIdWarehouseAndWarehouseIdPurchaseOrders:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/PurchaseOrders`})}),getV4PartnerByApplicationIdWarehouseAndWarehouseIdReturns:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/Returns`})}),getV4PartnerByApplicationIdWarehouseAndWarehouseIdOrders:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/Orders`})}),getV4PartnerByApplicationIdWarehouseAndWarehouseIdShipments:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/Shipments`})}),getV4PartnerByApplicationIdWarehouseAndWarehouseIdRequisitions:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/Requisitions`})}),postV4PartnerByApplicationIdWarehouseAndWarehouseIdFieldName:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/${t.fieldName}`,method:"POST",params:{newValue:t.newValue}})}),putV4PartnerByApplicationIdWarehouseAndWarehouseIdCarrierIntegration:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/CarrierIntegration`,method:"PUT",body:t.body})}),deleteV4PartnerByApplicationIdWarehouseAndWarehouseIdCarrierIntegrationCarrierCode:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/CarrierIntegration/${t.carrierCode}`,method:"DELETE"})}),postV4PartnerByApplicationIdWarehouseAndWarehouseIdCarrierIntegrationCarrierCode:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse/${t.warehouseId}/CarrierIntegration/${t.carrierCode}`,method:"POST",params:{isActive:t.isActive}})}),putV4PartnerByApplicationIdWarehouse:e.mutation({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouse`,method:"PUT",body:t.body})}),getV4PartnerByApplicationIdWarehouses:e.query({query:t=>({url:`/V4/Partner/${t.applicationId}/Warehouses`})})}),overrideExisting:!1}),{useLazyGetV4PartnerByApplicationIdAccountQuery,usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation,useGetV4PartnerByApplicationIdBusinessDevelopmentConversationsQuery,useLazyGetV4PartnerByApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery}=injectedRtkApi;injectedRtkApi.enhanceEndpoints({addTagTypes:["Conversations"],endpoints:{getV4PartnerByApplicationIdBusinessDevelopmentConversations:{providesTags:["Conversations"]},putV4PartnerByApplicationIdBusinessDevelopment:{invalidatesTags:["Conversations"]}}});function useAIAssistant({userId:e,apiKey:t}){const[n,o]=React.useState(""),[l,u]=React.useState(null),[p,d]=React.useState([]),[f,m]=React.useState([]),[g,b]=React.useState([]),[_,S]=React.useState(""),E=new GoogleGenAI({apiKey:t}),[C]=useLazyGetV4PartnerByApplicationIdAccountQuery();React.useEffect(()=>{_&&m(M=>[...M,"System instructions updated."])},[_]),React.useEffect(()=>{l&&m(M=>[...M,"Gemini 2.5 session initialized."])},[l]),React.useEffect(()=>{(async()=>{try{const j=await(await fetch("https://docs.google.com/document/d/e/2PACX-1vT-f5SWSJ2BcRUcyiumzT1aPUeC8kyyV7ryJTTymWJWOcRbDRgV5nX6Wyh7HaSPf8rxTY9w63Q2C8rG/pub")).text(),F=new DOMParser().parseFromString(j,"text/html").querySelector(".doc-content").innerHTML.replace(/__user_id__/g,e).replace(/__today__/g,""+new Date);S(F)}catch(I){console.error("Error fetching system instructions:",I),S("You are a helpful assistant, but cannot help the user right now. They should come back another time.")}})()},[]),React.useEffect(()=>{const M=async()=>{try{const I=E.chats.create({model:"gemini-2.5-flash-preview-04-17",config:{systemInstruction:_,maxOutputTokens:4096,tools:g.length>0?[{functionDeclarations:g.map(({declaration:j})=>j)}]:[]}});u(I)}catch(I){console.error("Error initializing chat:",I)}};l||g.length!==0&&_!==""&&M()},[g,l,_]),React.useEffect(()=>{(async()=>{try{const I=await fetchApiFunctions(),j={declaration:{name:"set_on_behalf_id",description:"Call this function when the user wants to act on behalf of another one. It will return to you important flags such as: is user specified by the user ID a reseller, manufacturer or an agency?",parameters:{type:Type.OBJECT,properties:{user_id:{type:Type.STRING,description:"The user ID to use going forward."}},required:["user_id"]}},handler:async function(B){const q=B["user_id"],F=await C({applicationId:q});return JSON.stringify(F.data)}};b([...I,j])}catch(I){console.error("Error loading API functions:",I)}})()},[]);const R=async M=>{var q;const I=M.name??"",j=g.find(F=>F.declaration.name===I);if(j===void 0)return console.error(`Function ${I} not found`),"";const B=M.args||{};if(!((q=g.find(F=>F.declaration.name===I))==null?void 0:q.declaration))return console.error(`[Function Call] Could not find declaration for ${I}`),"";try{m(U=>[...U,`Calling ${I} with:
799
799
  ${JSON.stringify(B,null,2)}`]);const F=await j.handler(B);m(U=>[...U,`${I} returned ${F.length} character(s).`]);const H={role:"assistant",content:jsxRuntime.jsx(AiGeneratedContent,{data:JSON.parse(F),prompt:"You are a UX master. Display the data in a compact way. Viewport is phone sized. Don't use vertical scroll areas."}),timestamp:new Date,isComponent:!0};return N(H),F}catch{return m(F=>[...F,`${I} failed.`]),""}},A=async M=>{if(M.trim()&&!n&&l){N({role:"user",content:M,timestamp:new Date}),o("Thinking...");try{const j=await l.sendMessage({message:M.trim()}),B=j.functionCalls;if(B&&B.length>0){m(H=>[...H,`${B.length} function(s) need to be called.`]),o("Using Randmar API...");const L=[];for(const H of B){const U=await R(H),G={functionResponse:{name:H.name,response:{content:U}}};L.push(G)}o("Composing response...");const F={role:"assistant",content:(await l.sendMessage({message:L})).text,timestamp:new Date};N(F)}else{const L={role:"assistant",content:j.text,timestamp:new Date};N(L)}}catch(j){console.error("Error sending message:",j),N({role:"assistant",content:"I'm sorry, I encountered an error processing your request. Please try again later.",timestamp:new Date})}finally{o("")}}},N=M=>{d(I=>[...I,M])};return{handleSubmitToBot:A,botMessages:p,clearBotMessages:()=>{d([])},botReady:!!l,botStatus:n,debugMessages:f,reset:()=>{u(null)}}}class HttpError extends Error{constructor(t,n){const o=new.target.prototype;super(`${t}: Status code '${n}'`),this.statusCode=n,this.__proto__=o}}class TimeoutError extends Error{constructor(t="A timeout occurred."){const n=new.target.prototype;super(t),this.__proto__=n}}class AbortError extends Error{constructor(t="An abort occurred."){const n=new.target.prototype;super(t),this.__proto__=n}}class UnsupportedTransportError extends Error{constructor(t,n){const o=new.target.prototype;super(t),this.transport=n,this.errorType="UnsupportedTransportError",this.__proto__=o}}class DisabledTransportError extends Error{constructor(t,n){const o=new.target.prototype;super(t),this.transport=n,this.errorType="DisabledTransportError",this.__proto__=o}}class FailedToStartTransportError extends Error{constructor(t,n){const o=new.target.prototype;super(t),this.transport=n,this.errorType="FailedToStartTransportError",this.__proto__=o}}class FailedToNegotiateWithServerError extends Error{constructor(t){const n=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=n}}class AggregateErrors extends Error{constructor(t,n){const o=new.target.prototype;super(t),this.innerErrors=n,this.__proto__=o}}class HttpResponse{constructor(t,n,o){this.statusCode=t,this.statusText=n,this.content=o}}class HttpClient{get(t,n){return this.send({...n,method:"GET",url:t})}post(t,n){return this.send({...n,method:"POST",url:t})}delete(t,n){return this.send({...n,method:"DELETE",url:t})}getCookieString(t){return""}}var LogLevel;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(LogLevel||(LogLevel={}));class NullLogger{constructor(){}log(t,n){}}NullLogger.instance=new NullLogger;const VERSION="8.0.7";class Arg{static isRequired(t,n){if(t==null)throw new Error(`The '${n}' argument is required.`)}static isNotEmpty(t,n){if(!t||t.match(/^\s*$/))throw new Error(`The '${n}' argument should not be empty.`)}static isIn(t,n,o){if(!(t in n))throw new Error(`Unknown ${o} value: ${t}.`)}}class Platform{static get isBrowser(){return!Platform.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Platform.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Platform.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function getDataDetail(e,t){let n="";return isArrayBuffer(e)?(n=`Binary data of length ${e.byteLength}`,t&&(n+=`. Content: '${formatArrayBuffer(e)}'`)):typeof e=="string"&&(n=`String data of length ${e.length}`,t&&(n+=`. Content: '${e}'`)),n}function formatArrayBuffer(e){const t=new Uint8Array(e);let n="";return t.forEach(o=>{const l=o<16?"0":"";n+=`0x${l}${o.toString(16)} `}),n.substr(0,n.length-1)}function isArrayBuffer(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function sendMessage(e,t,n,o,l,u){const p={},[d,f]=getUserAgentHeader();p[d]=f,e.log(LogLevel.Trace,`(${t} transport) sending data. ${getDataDetail(l,u.logMessageContent)}.`);const m=isArrayBuffer(l)?"arraybuffer":"text",g=await n.post(o,{content:l,headers:{...p,...u.headers},responseType:m,timeout:u.timeout,withCredentials:u.withCredentials});e.log(LogLevel.Trace,`(${t} transport) request complete. Response status: ${g.statusCode}.`)}function createLogger(e){return e===void 0?new ConsoleLogger(LogLevel.Information):e===null?NullLogger.instance:e.log!==void 0?e:new ConsoleLogger(e)}class SubjectSubscription{constructor(t,n){this._subject=t,this._observer=n}dispose(){const t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(n=>{})}}class ConsoleLogger{constructor(t){this._minLevel=t,this.out=console}log(t,n){if(t>=this._minLevel){const o=`[${new Date().toISOString()}] ${LogLevel[t]}: ${n}`;switch(t){case LogLevel.Critical:case LogLevel.Error:this.out.error(o);break;case LogLevel.Warning:this.out.warn(o);break;case LogLevel.Information:this.out.info(o);break;default:this.out.log(o);break}}}}function getUserAgentHeader(){let e="X-SignalR-User-Agent";return Platform.isNode&&(e="User-Agent"),[e,constructUserAgent(VERSION,getOsName(),getRuntime(),getRuntimeVersion())]}function constructUserAgent(e,t,n,o){let l="Microsoft SignalR/";const u=e.split(".");return l+=`${u[0]}.${u[1]}`,l+=` (${e}; `,t&&t!==""?l+=`${t}; `:l+="Unknown OS; ",l+=`${n}`,o?l+=`; ${o}`:l+="; Unknown Runtime Version",l+=")",l}function getOsName(){if(Platform.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function getRuntimeVersion(){if(Platform.isNode)return process.versions.node}function getRuntime(){return Platform.isNode?"NodeJS":"Browser"}function getErrorString(e){return e.stack?e.stack:e.message?e.message:`${e}`}function getGlobalThis(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class FetchHttpClient extends HttpClient{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||Platform.isNode){const n=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(n("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=n("node-fetch"):this._fetchType=fetch,this._fetchType=n("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(getGlobalThis());if(typeof AbortController>"u"){const n=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=n("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new AbortError;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");const n=new this._abortControllerType;let o;t.abortSignal&&(t.abortSignal.onabort=()=>{n.abort(),o=new AbortError});let l=null;if(t.timeout){const f=t.timeout;l=setTimeout(()=>{n.abort(),this._logger.log(LogLevel.Warning,"Timeout from HTTP request."),o=new TimeoutError},f)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},isArrayBuffer(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let u;try{u=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:n.signal})}catch(f){throw o||(this._logger.log(LogLevel.Warning,`Error from HTTP request. ${f}.`),f)}finally{l&&clearTimeout(l),t.abortSignal&&(t.abortSignal.onabort=null)}if(!u.ok){const f=await deserializeContent(u,"text");throw new HttpError(f||u.statusText,u.status)}const d=await deserializeContent(u,t.responseType);return new HttpResponse(u.status,u.statusText,d)}getCookieString(t){let n="";return Platform.isNode&&this._jar&&this._jar.getCookies(t,(o,l)=>n=l.join("; ")),n}}function deserializeContent(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:n=e.text();break}return n}class XhrHttpClient extends HttpClient{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new AbortError):t.method?t.url?new Promise((n,o)=>{const l=new XMLHttpRequest;l.open(t.method,t.url,!0),l.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,l.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(isArrayBuffer(t.content)?l.setRequestHeader("Content-Type","application/octet-stream"):l.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const u=t.headers;u&&Object.keys(u).forEach(p=>{l.setRequestHeader(p,u[p])}),t.responseType&&(l.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{l.abort(),o(new AbortError)}),t.timeout&&(l.timeout=t.timeout),l.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),l.status>=200&&l.status<300?n(new HttpResponse(l.status,l.statusText,l.response||l.responseText)):o(new HttpError(l.response||l.responseText||l.statusText,l.status))},l.onerror=()=>{this._logger.log(LogLevel.Warning,`Error from HTTP request. ${l.status}: ${l.statusText}.`),o(new HttpError(l.statusText,l.status))},l.ontimeout=()=>{this._logger.log(LogLevel.Warning,"Timeout from HTTP request."),o(new TimeoutError)},l.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class DefaultHttpClient extends HttpClient{constructor(t){if(super(),typeof fetch<"u"||Platform.isNode)this._httpClient=new FetchHttpClient(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new XhrHttpClient(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new AbortError):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}}class TextMessageFormat{static write(t){return`${t}${TextMessageFormat.RecordSeparator}`}static parse(t){if(t[t.length-1]!==TextMessageFormat.RecordSeparator)throw new Error("Message is incomplete.");const n=t.split(TextMessageFormat.RecordSeparator);return n.pop(),n}}TextMessageFormat.RecordSeparatorCode=30,TextMessageFormat.RecordSeparator=String.fromCharCode(TextMessageFormat.RecordSeparatorCode);class HandshakeProtocol{writeHandshakeRequest(t){return TextMessageFormat.write(JSON.stringify(t))}parseHandshakeResponse(t){let n,o;if(isArrayBuffer(t)){const d=new Uint8Array(t),f=d.indexOf(TextMessageFormat.RecordSeparatorCode);if(f===-1)throw new Error("Message is incomplete.");const m=f+1;n=String.fromCharCode.apply(null,Array.prototype.slice.call(d.slice(0,m))),o=d.byteLength>m?d.slice(m).buffer:null}else{const d=t,f=d.indexOf(TextMessageFormat.RecordSeparator);if(f===-1)throw new Error("Message is incomplete.");const m=f+1;n=d.substring(0,m),o=d.length>m?d.substring(m):null}const l=TextMessageFormat.parse(n),u=JSON.parse(l[0]);if(u.type)throw new Error("Expected a handshake response from the server.");return[o,u]}}var MessageType;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})(MessageType||(MessageType={}));class Subject{constructor(){this.observers=[]}next(t){for(const n of this.observers)n.next(t)}error(t){for(const n of this.observers)n.error&&n.error(t)}complete(){for(const t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new SubjectSubscription(this,t)}}class MessageBuffer{constructor(t,n,o){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=n,this._bufferSize=o}async _send(t){const n=this._protocol.writeMessage(t);let o=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let l=()=>{},u=()=>{};isArrayBuffer(n)?this._bufferedByteCount+=n.byteLength:this._bufferedByteCount+=n.length,this._bufferedByteCount>=this._bufferSize&&(o=new Promise((p,d)=>{l=p,u=d})),this._messages.push(new BufferedItem(n,this._totalMessageCount,l,u))}try{this._reconnectInProgress||await this._connection.send(n)}catch{this._disconnected()}await o}_ack(t){let n=-1;for(let o=0;o<this._messages.length;o++){const l=this._messages[o];if(l._id<=t.sequenceId)n=o,isArrayBuffer(l._message)?this._bufferedByteCount-=l._message.byteLength:this._bufferedByteCount-=l._message.length,l._resolver();else if(this._bufferedByteCount<this._bufferSize)l._resolver();else break}n!==-1&&(this._messages=this._messages.slice(n+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==MessageType.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;const n=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,n<=this._latestReceivedSequenceId?(n===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=n,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:MessageType.Sequence,sequenceId:t}));const n=this._messages;for(const o of n)await this._connection.send(o._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(const n of this._messages)n._rejector(t)}_isInvocationMessage(t){switch(t.type){case MessageType.Invocation:case MessageType.StreamItem:case MessageType.Completion:case MessageType.StreamInvocation:case MessageType.CancelInvocation:return!0;case MessageType.Close:case MessageType.Sequence:case MessageType.Ping:case MessageType.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:MessageType.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class BufferedItem{constructor(t,n,o,l){this._message=t,this._id=n,this._resolver=o,this._rejector=l}}const DEFAULT_TIMEOUT_IN_MS=30*1e3,DEFAULT_PING_INTERVAL_IN_MS=15*1e3,DEFAULT_STATEFUL_RECONNECT_BUFFER_SIZE=1e5;var HubConnectionState;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(HubConnectionState||(HubConnectionState={}));class HubConnection{static create(t,n,o,l,u,p,d){return new HubConnection(t,n,o,l,u,p,d)}constructor(t,n,o,l,u,p,d){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(LogLevel.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Arg.isRequired(t,"connection"),Arg.isRequired(n,"logger"),Arg.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=u??DEFAULT_TIMEOUT_IN_MS,this.keepAliveIntervalInMilliseconds=p??DEFAULT_PING_INTERVAL_IN_MS,this._statefulReconnectBufferSize=d??DEFAULT_STATEFUL_RECONNECT_BUFFER_SIZE,this._logger=n,this._protocol=o,this.connection=t,this._reconnectPolicy=l,this._handshakeProtocol=new HandshakeProtocol,this.connection.onreceive=f=>this._processIncomingData(f),this.connection.onclose=f=>this._connectionClosed(f),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=HubConnectionState.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:MessageType.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==HubConnectionState.Disconnected&&this._connectionState!==HubConnectionState.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==HubConnectionState.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=HubConnectionState.Connecting,this._logger.log(LogLevel.Debug,"Starting HubConnection.");try{await this._startInternal(),Platform.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=HubConnectionState.Connected,this._connectionStarted=!0,this._logger.log(LogLevel.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=HubConnectionState.Disconnected,this._logger.log(LogLevel.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const t=new Promise((n,o)=>{this._handshakeResolver=n,this._handshakeRejecter=o});await this.connection.start(this._protocol.transferFormat);try{let n=this._protocol.version;this.connection.features.reconnect||(n=1);const o={protocol:this._protocol.name,version:n};if(this._logger.log(LogLevel.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(o)),this._logger.log(LogLevel.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new MessageBuffer(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(n){throw this._logger.log(LogLevel.Debug,`Hub handshake failed with error '${n}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(n),n}}async stop(){const t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch{}}_stopInternal(t){if(this._connectionState===HubConnectionState.Disconnected)return this._logger.log(LogLevel.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===HubConnectionState.Disconnecting)return this._logger.log(LogLevel.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const n=this._connectionState;return this._connectionState=HubConnectionState.Disconnecting,this._logger.log(LogLevel.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(LogLevel.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(n===HubConnectionState.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new AbortError("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...n){const[o,l]=this._replaceStreamingParams(n),u=this._createStreamInvocation(t,n,l);let p;const d=new Subject;return d.cancelCallback=()=>{const f=this._createCancelInvocation(u.invocationId);return delete this._callbacks[u.invocationId],p.then(()=>this._sendWithProtocol(f))},this._callbacks[u.invocationId]=(f,m)=>{if(m){d.error(m);return}else f&&(f.type===MessageType.Completion?f.error?d.error(new Error(f.error)):d.complete():d.next(f.item))},p=this._sendWithProtocol(u).catch(f=>{d.error(f),delete this._callbacks[u.invocationId]}),this._launchStreams(o,p),d}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...n){const[o,l]=this._replaceStreamingParams(n),u=this._sendWithProtocol(this._createInvocation(t,n,!0,l));return this._launchStreams(o,u),u}invoke(t,...n){const[o,l]=this._replaceStreamingParams(n),u=this._createInvocation(t,n,!1,l);return new Promise((d,f)=>{this._callbacks[u.invocationId]=(g,b)=>{if(b){f(b);return}else g&&(g.type===MessageType.Completion?g.error?f(new Error(g.error)):d(g.result):f(new Error(`Unexpected message type: ${g.type}`)))};const m=this._sendWithProtocol(u).catch(g=>{f(g),delete this._callbacks[u.invocationId]});this._launchStreams(o,m)})}on(t,n){!t||!n||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(n)===-1&&this._methods[t].push(n))}off(t,n){if(!t)return;t=t.toLowerCase();const o=this._methods[t];if(o)if(n){const l=o.indexOf(n);l!==-1&&(o.splice(l,1),o.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){const n=this._protocol.parseMessages(t,this._logger);for(const o of n)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(o)))switch(o.type){case MessageType.Invocation:this._invokeClientMethod(o).catch(l=>{this._logger.log(LogLevel.Error,`Invoke client method threw error: ${getErrorString(l)}`)});break;case MessageType.StreamItem:case MessageType.Completion:{const l=this._callbacks[o.invocationId];if(l){o.type===MessageType.Completion&&delete this._callbacks[o.invocationId];try{l(o)}catch(u){this._logger.log(LogLevel.Error,`Stream callback threw error: ${getErrorString(u)}`)}}break}case MessageType.Ping:break;case MessageType.Close:{this._logger.log(LogLevel.Information,"Close message received from server.");const l=o.error?new Error("Server returned an error on close: "+o.error):void 0;o.allowReconnect===!0?this.connection.stop(l):this._stopPromise=this._stopInternal(l);break}case MessageType.Ack:this._messageBuffer&&this._messageBuffer._ack(o);break;case MessageType.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(o);break;default:this._logger.log(LogLevel.Warning,`Invalid message type: ${o.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let n,o;try{[o,n]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(l){const u="Error parsing handshake response: "+l;this._logger.log(LogLevel.Error,u);const p=new Error(u);throw this._handshakeRejecter(p),p}if(n.error){const l="Server returned handshake error: "+n.error;this._logger.log(LogLevel.Error,l);const u=new Error(l);throw this._handshakeRejecter(u),u}else this._logger.log(LogLevel.Debug,"Server handshake complete.");return this._handshakeResolver(),o}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let t=this._nextKeepAlive-new Date().getTime();t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===HubConnectionState.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},t)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){const n=t.target.toLowerCase(),o=this._methods[n];if(!o){this._logger.log(LogLevel.Warning,`No client method with the name '${n}' found.`),t.invocationId&&(this._logger.log(LogLevel.Warning,`No result given for '${n}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}const l=o.slice(),u=!!t.invocationId;let p,d,f;for(const m of l)try{const g=p;p=await m.apply(this,t.arguments),u&&p&&g&&(this._logger.log(LogLevel.Error,`Multiple results provided for '${n}'. Sending error to server.`),f=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),d=void 0}catch(g){d=g,this._logger.log(LogLevel.Error,`A callback for the method '${n}' threw error '${g}'.`)}f?await this._sendWithProtocol(f):u?(d?f=this._createCompletionMessage(t.invocationId,`${d}`,null):p!==void 0?f=this._createCompletionMessage(t.invocationId,null,p):(this._logger.log(LogLevel.Warning,`No result given for '${n}' method and invocation ID '${t.invocationId}'.`),f=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(f)):p&&this._logger.log(LogLevel.Error,`Result given for '${n}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(LogLevel.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new AbortError("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===HubConnectionState.Disconnecting?this._completeClose(t):this._connectionState===HubConnectionState.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===HubConnectionState.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=HubConnectionState.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),Platform.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(n=>n.apply(this,[t]))}catch(n){this._logger.log(LogLevel.Error,`An onclose callback called with error '${t}' threw error '${n}'.`)}}}async _reconnect(t){const n=Date.now();let o=0,l=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),u=this._getNextRetryDelay(o++,0,l);if(u===null){this._logger.log(LogLevel.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=HubConnectionState.Reconnecting,t?this._logger.log(LogLevel.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(LogLevel.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(p=>p.apply(this,[t]))}catch(p){this._logger.log(LogLevel.Error,`An onreconnecting callback called with error '${t}' threw error '${p}'.`)}if(this._connectionState!==HubConnectionState.Reconnecting){this._logger.log(LogLevel.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;u!==null;){if(this._logger.log(LogLevel.Information,`Reconnect attempt number ${o} will start in ${u} ms.`),await new Promise(p=>{this._reconnectDelayHandle=setTimeout(p,u)}),this._reconnectDelayHandle=void 0,this._connectionState!==HubConnectionState.Reconnecting){this._logger.log(LogLevel.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=HubConnectionState.Connected,this._logger.log(LogLevel.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(p=>p.apply(this,[this.connection.connectionId]))}catch(p){this._logger.log(LogLevel.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${p}'.`)}return}catch(p){if(this._logger.log(LogLevel.Information,`Reconnect attempt failed because of error '${p}'.`),this._connectionState!==HubConnectionState.Reconnecting){this._logger.log(LogLevel.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===HubConnectionState.Disconnecting&&this._completeClose();return}l=p instanceof Error?p:new Error(p.toString()),u=this._getNextRetryDelay(o++,Date.now()-n,l)}}this._logger.log(LogLevel.Information,`Reconnect retries have been exhausted after ${Date.now()-n} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,n,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:n,previousRetryCount:t,retryReason:o})}catch(l){return this._logger.log(LogLevel.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${n}) threw error '${l}'.`),null}}_cancelCallbacksWithError(t){const n=this._callbacks;this._callbacks={},Object.keys(n).forEach(o=>{const l=n[o];try{l(null,t)}catch(u){this._logger.log(LogLevel.Error,`Stream 'error' callback called with '${t}' threw error: ${getErrorString(u)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,n,o,l){if(o)return l.length!==0?{arguments:n,streamIds:l,target:t,type:MessageType.Invocation}:{arguments:n,target:t,type:MessageType.Invocation};{const u=this._invocationId;return this._invocationId++,l.length!==0?{arguments:n,invocationId:u.toString(),streamIds:l,target:t,type:MessageType.Invocation}:{arguments:n,invocationId:u.toString(),target:t,type:MessageType.Invocation}}}_launchStreams(t,n){if(t.length!==0){n||(n=Promise.resolve());for(const o in t)t[o].subscribe({complete:()=>{n=n.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:l=>{let u;l instanceof Error?u=l.message:l&&l.toString?u=l.toString():u="Unknown error",n=n.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,u)))},next:l=>{n=n.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,l)))}})}}_replaceStreamingParams(t){const n=[],o=[];for(let l=0;l<t.length;l++){const u=t[l];if(this._isObservable(u)){const p=this._invocationId;this._invocationId++,n[p]=u,o.push(p.toString()),t.splice(l,1)}}return[n,o]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,n,o){const l=this._invocationId;return this._invocationId++,o.length!==0?{arguments:n,invocationId:l.toString(),streamIds:o,target:t,type:MessageType.StreamInvocation}:{arguments:n,invocationId:l.toString(),target:t,type:MessageType.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:MessageType.CancelInvocation}}_createStreamItemMessage(t,n){return{invocationId:t,item:n,type:MessageType.StreamItem}}_createCompletionMessage(t,n,o){return n?{error:n,invocationId:t,type:MessageType.Completion}:{invocationId:t,result:o,type:MessageType.Completion}}_createCloseMessage(){return{type:MessageType.Close}}}const DEFAULT_RETRY_DELAYS_IN_MILLISECONDS=[0,2e3,1e4,3e4,null];class DefaultReconnectPolicy{constructor(t){this._retryDelays=t!==void 0?[...t,null]:DEFAULT_RETRY_DELAYS_IN_MILLISECONDS}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}}class HeaderNames{}HeaderNames.Authorization="Authorization",HeaderNames.Cookie="Cookie";class AccessTokenHttpClient extends HttpClient{constructor(t,n){super(),this._innerClient=t,this._accessTokenFactory=n}async send(t){let n=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(n=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);const o=await this._innerClient.send(t);return n&&o.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):o}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[HeaderNames.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[HeaderNames.Authorization]&&delete t.headers[HeaderNames.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}}var HttpTransportType;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(HttpTransportType||(HttpTransportType={}));var TransferFormat;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(TransferFormat||(TransferFormat={}));let AbortController$1=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class LongPollingTransport{get pollAborted(){return this._pollAbort.aborted}constructor(t,n,o){this._httpClient=t,this._logger=n,this._pollAbort=new AbortController$1,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,n){if(Arg.isRequired(t,"url"),Arg.isRequired(n,"transferFormat"),Arg.isIn(n,TransferFormat,"transferFormat"),this._url=t,this._logger.log(LogLevel.Trace,"(LongPolling transport) Connecting."),n===TransferFormat.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[o,l]=getUserAgentHeader(),u={[o]:l,...this._options.headers},p={abortSignal:this._pollAbort.signal,headers:u,timeout:1e5,withCredentials:this._options.withCredentials};n===TransferFormat.Binary&&(p.responseType="arraybuffer");const d=`${t}&_=${Date.now()}`;this._logger.log(LogLevel.Trace,`(LongPolling transport) polling: ${d}.`);const f=await this._httpClient.get(d,p);f.statusCode!==200?(this._logger.log(LogLevel.Error,`(LongPolling transport) Unexpected response code: ${f.statusCode}.`),this._closeError=new HttpError(f.statusText||"",f.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,p)}async _poll(t,n){try{for(;this._running;)try{const o=`${t}&_=${Date.now()}`;this._logger.log(LogLevel.Trace,`(LongPolling transport) polling: ${o}.`);const l=await this._httpClient.get(o,n);l.statusCode===204?(this._logger.log(LogLevel.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):l.statusCode!==200?(this._logger.log(LogLevel.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new HttpError(l.statusText||"",l.statusCode),this._running=!1):l.content?(this._logger.log(LogLevel.Trace,`(LongPolling transport) data received. ${getDataDetail(l.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(l.content)):this._logger.log(LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(o){this._running?o instanceof TimeoutError?this._logger.log(LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=o,this._running=!1):this._logger.log(LogLevel.Trace,`(LongPolling transport) Poll errored after shutdown: ${o.message}`)}}finally{this._logger.log(LogLevel.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?sendMessage(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(LogLevel.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(LogLevel.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const t={},[n,o]=getUserAgentHeader();t[n]=o;const l={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let u;try{await this._httpClient.delete(this._url,l)}catch(p){u=p}u?u instanceof HttpError&&(u.statusCode===404?this._logger.log(LogLevel.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(LogLevel.Trace,`(LongPolling transport) Error sending a DELETE request: ${u}`)):this._logger.log(LogLevel.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(LogLevel.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(LogLevel.Trace,t),this.onclose(this._closeError)}}}class ServerSentEventsTransport{constructor(t,n,o,l){this._httpClient=t,this._accessToken=n,this._logger=o,this._options=l,this.onreceive=null,this.onclose=null}async connect(t,n){return Arg.isRequired(t,"url"),Arg.isRequired(n,"transferFormat"),Arg.isIn(n,TransferFormat,"transferFormat"),this._logger.log(LogLevel.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,l)=>{let u=!1;if(n!==TransferFormat.Text){l(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let p;if(Platform.isBrowser||Platform.isWebWorker)p=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{const d=this._httpClient.getCookieString(t),f={};f.Cookie=d;const[m,g]=getUserAgentHeader();f[m]=g,p=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...f,...this._options.headers}})}try{p.onmessage=d=>{if(this.onreceive)try{this._logger.log(LogLevel.Trace,`(SSE transport) data received. ${getDataDetail(d.data,this._options.logMessageContent)}.`),this.onreceive(d.data)}catch(f){this._close(f);return}},p.onerror=d=>{u?this._close():l(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},p.onopen=()=>{this._logger.log(LogLevel.Information,`SSE connected to ${this._url}`),this._eventSource=p,u=!0,o()}}catch(d){l(d);return}})}async send(t){return this._eventSource?sendMessage(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}}class WebSocketTransport{constructor(t,n,o,l,u,p){this._logger=o,this._accessTokenFactory=n,this._logMessageContent=l,this._webSocketConstructor=u,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=p}async connect(t,n){Arg.isRequired(t,"url"),Arg.isRequired(n,"transferFormat"),Arg.isIn(n,TransferFormat,"transferFormat"),this._logger.log(LogLevel.Trace,"(WebSockets transport) Connecting.");let o;return this._accessTokenFactory&&(o=await this._accessTokenFactory()),new Promise((l,u)=>{t=t.replace(/^http/,"ws");let p;const d=this._httpClient.getCookieString(t);let f=!1;if(Platform.isNode||Platform.isReactNative){const m={},[g,b]=getUserAgentHeader();m[g]=b,o&&(m[HeaderNames.Authorization]=`Bearer ${o}`),d&&(m[HeaderNames.Cookie]=d),p=new this._webSocketConstructor(t,void 0,{headers:{...m,...this._headers}})}else o&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(o)}`);p||(p=new this._webSocketConstructor(t)),n===TransferFormat.Binary&&(p.binaryType="arraybuffer"),p.onopen=m=>{this._logger.log(LogLevel.Information,`WebSocket connected to ${t}.`),this._webSocket=p,f=!0,l()},p.onerror=m=>{let g=null;typeof ErrorEvent<"u"&&m instanceof ErrorEvent?g=m.error:g="There was an error with the transport",this._logger.log(LogLevel.Information,`(WebSockets transport) ${g}.`)},p.onmessage=m=>{if(this._logger.log(LogLevel.Trace,`(WebSockets transport) data received. ${getDataDetail(m.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(m.data)}catch(g){this._close(g);return}},p.onclose=m=>{if(f)this._close(m);else{let g=null;typeof ErrorEvent<"u"&&m instanceof ErrorEvent?g=m.error:g="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",u(new Error(g))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(LogLevel.Trace,`(WebSockets transport) sending data. ${getDataDetail(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(LogLevel.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}}const MAX_REDIRECTS=100;class HttpConnection{constructor(t,n={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Arg.isRequired(t,"url"),this._logger=createLogger(n.logger),this.baseUrl=this._resolveUrl(t),n=n||{},n.logMessageContent=n.logMessageContent===void 0?!1:n.logMessageContent,typeof n.withCredentials=="boolean"||n.withCredentials===void 0)n.withCredentials=n.withCredentials===void 0?!0:n.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");n.timeout=n.timeout===void 0?100*1e3:n.timeout;let o=null,l=null;if(Platform.isNode&&typeof require<"u"){const u=typeof __webpack_require__=="function"?__non_webpack_require__:require;o=u("ws"),l=u("eventsource")}!Platform.isNode&&typeof WebSocket<"u"&&!n.WebSocket?n.WebSocket=WebSocket:Platform.isNode&&!n.WebSocket&&o&&(n.WebSocket=o),!Platform.isNode&&typeof EventSource<"u"&&!n.EventSource?n.EventSource=EventSource:Platform.isNode&&!n.EventSource&&typeof l<"u"&&(n.EventSource=l),this._httpClient=new AccessTokenHttpClient(n.httpClient||new DefaultHttpClient(this._logger),n.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=n,this.onreceive=null,this.onclose=null}async start(t){if(t=t||TransferFormat.Binary,Arg.isIn(t,TransferFormat,"transferFormat"),this._logger.log(LogLevel.Debug,`Starting connection with transfer format '${TransferFormat[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){const n="Failed to start the HttpConnection before stop() was called.";return this._logger.log(LogLevel.Error,n),await this._stopPromise,Promise.reject(new AbortError(n))}else if(this._connectionState!=="Connected"){const n="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(LogLevel.Error,n),Promise.reject(new AbortError(n))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new TransportSendQueue(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(LogLevel.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(LogLevel.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(n=>{this._stopPromiseResolver=n}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(n){this._logger.log(LogLevel.Error,`HttpConnection.transport.stop() threw error '${n}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(LogLevel.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let n=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===HttpTransportType.WebSockets)this.transport=this._constructTransport(HttpTransportType.WebSockets),await this._startTransport(n,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let o=null,l=0;do{if(o=await this._getNegotiationResponse(n),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new AbortError("The connection was stopped during negotiation.");if(o.error)throw new Error(o.error);if(o.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(o.url&&(n=o.url),o.accessToken){const u=o.accessToken;this._accessTokenFactory=()=>u,this._httpClient._accessToken=u,this._httpClient._accessTokenFactory=void 0}l++}while(o.url&&l<MAX_REDIRECTS);if(l===MAX_REDIRECTS&&o.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(n,this._options.transport,o,t)}this.transport instanceof LongPollingTransport&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(LogLevel.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(o){return this._logger.log(LogLevel.Error,"Failed to start the connection: "+o),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(o)}}async _getNegotiationResponse(t){const n={},[o,l]=getUserAgentHeader();n[o]=l;const u=this._resolveNegotiateUrl(t);this._logger.log(LogLevel.Debug,`Sending negotiation request: ${u}.`);try{const p=await this._httpClient.post(u,{content:"",headers:{...n,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(p.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${p.statusCode}'`));const d=JSON.parse(p.content);return(!d.negotiateVersion||d.negotiateVersion<1)&&(d.connectionToken=d.connectionId),d.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new FailedToNegotiateWithServerError("Client didn't negotiate Stateful Reconnect but the server did.")):d}catch(p){let d="Failed to complete negotiation with the server: "+p;return p instanceof HttpError&&p.statusCode===404&&(d=d+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(LogLevel.Error,d),Promise.reject(new FailedToNegotiateWithServerError(d))}}_createConnectUrl(t,n){return n?t+(t.indexOf("?")===-1?"?":"&")+`id=${n}`:t}async _createTransport(t,n,o,l){let u=this._createConnectUrl(t,o.connectionToken);if(this._isITransport(n)){this._logger.log(LogLevel.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=n,await this._startTransport(u,l),this.connectionId=o.connectionId;return}const p=[],d=o.availableTransports||[];let f=o;for(const m of d){const g=this._resolveTransportOrError(m,n,l,(f==null?void 0:f.useStatefulReconnect)===!0);if(g instanceof Error)p.push(`${m.transport} failed:`),p.push(g);else if(this._isITransport(g)){if(this.transport=g,!f){try{f=await this._getNegotiationResponse(t)}catch(b){return Promise.reject(b)}u=this._createConnectUrl(t,f.connectionToken)}try{await this._startTransport(u,l),this.connectionId=f.connectionId;return}catch(b){if(this._logger.log(LogLevel.Error,`Failed to start the transport '${m.transport}': ${b}`),f=void 0,p.push(new FailedToStartTransportError(`${m.transport} failed: ${b}`,HttpTransportType[m.transport])),this._connectionState!=="Connecting"){const _="Failed to select transport before stop() was called.";return this._logger.log(LogLevel.Debug,_),Promise.reject(new AbortError(_))}}}}return p.length>0?Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${p.join(" ")}`,p)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case HttpTransportType.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new WebSocketTransport(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case HttpTransportType.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new ServerSentEventsTransport(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case HttpTransportType.LongPolling:return new LongPollingTransport(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,n){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async o=>{let l=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,n),await this.features.resend()}catch{l=!0}else{this._stopConnection(o);return}l&&this._stopConnection(o)}:this.transport.onclose=o=>this._stopConnection(o),this.transport.connect(t,n)}_resolveTransportOrError(t,n,o,l){const u=HttpTransportType[t.transport];if(u==null)return this._logger.log(LogLevel.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(transportMatches(n,u))if(t.transferFormats.map(d=>TransferFormat[d]).indexOf(o)>=0){if(u===HttpTransportType.WebSockets&&!this._options.WebSocket||u===HttpTransportType.ServerSentEvents&&!this._options.EventSource)return this._logger.log(LogLevel.Debug,`Skipping transport '${HttpTransportType[u]}' because it is not supported in your environment.'`),new UnsupportedTransportError(`'${HttpTransportType[u]}' is not supported in your environment.`,u);this._logger.log(LogLevel.Debug,`Selecting transport '${HttpTransportType[u]}'.`);try{return this.features.reconnect=u===HttpTransportType.WebSockets?l:void 0,this._constructTransport(u)}catch(d){return d}}else return this._logger.log(LogLevel.Debug,`Skipping transport '${HttpTransportType[u]}' because it does not support the requested transfer format '${TransferFormat[o]}'.`),new Error(`'${HttpTransportType[u]}' does not support ${TransferFormat[o]}.`);else return this._logger.log(LogLevel.Debug,`Skipping transport '${HttpTransportType[u]}' because it was disabled by the client.`),new DisabledTransportError(`'${HttpTransportType[u]}' is disabled by the client.`,u)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(LogLevel.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(LogLevel.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(LogLevel.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(LogLevel.Error,`Connection disconnected with error '${t}'.`):this._logger.log(LogLevel.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(n=>{this._logger.log(LogLevel.Error,`TransportSendQueue.stop() threw error '${n}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(n){this._logger.log(LogLevel.Error,`HttpConnection.onclose(${t}) threw error '${n}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!Platform.isBrowser)throw new Error(`Cannot resolve '${t}'.`);const n=window.document.createElement("a");return n.href=t,this._logger.log(LogLevel.Information,`Normalizing '${t}' to '${n.href}'.`),n.href}_resolveNegotiateUrl(t){const n=new URL(t);n.pathname.endsWith("/")?n.pathname+="negotiate":n.pathname+="/negotiate";const o=new URLSearchParams(n.searchParams);return o.has("negotiateVersion")||o.append("negotiateVersion",this._negotiateVersion.toString()),o.has("useStatefulReconnect")?o.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&o.append("useStatefulReconnect","true"),n.search=o.toString(),n.toString()}}function transportMatches(e,t){return!e||(t&e)!==0}class TransportSendQueue{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new PromiseSource,this._transportResult=new PromiseSource,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new PromiseSource),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new PromiseSource;const t=this._transportResult;this._transportResult=void 0;const n=typeof this._buffer[0]=="string"?this._buffer.join(""):TransportSendQueue._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(n),t.resolve()}catch(o){t.reject(o)}}}static _concatBuffers(t){const n=t.map(u=>u.byteLength).reduce((u,p)=>u+p),o=new Uint8Array(n);let l=0;for(const u of t)o.set(new Uint8Array(u),l),l+=u.byteLength;return o.buffer}}class PromiseSource{constructor(){this.promise=new Promise((t,n)=>[this._resolver,this._rejecter]=[t,n])}resolve(){this._resolver()}reject(t){this._rejecter(t)}}const JSON_HUB_PROTOCOL_NAME="json";class JsonHubProtocol{constructor(){this.name=JSON_HUB_PROTOCOL_NAME,this.version=2,this.transferFormat=TransferFormat.Text}parseMessages(t,n){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];n===null&&(n=NullLogger.instance);const o=TextMessageFormat.parse(t),l=[];for(const u of o){const p=JSON.parse(u);if(typeof p.type!="number")throw new Error("Invalid payload.");switch(p.type){case MessageType.Invocation:this._isInvocationMessage(p);break;case MessageType.StreamItem:this._isStreamItemMessage(p);break;case MessageType.Completion:this._isCompletionMessage(p);break;case MessageType.Ping:break;case MessageType.Close:break;case MessageType.Ack:this._isAckMessage(p);break;case MessageType.Sequence:this._isSequenceMessage(p);break;default:n.log(LogLevel.Information,"Unknown message type '"+p.type+"' ignored.");continue}l.push(p)}return l}writeMessage(t){return TextMessageFormat.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,n){if(typeof t!="string"||t==="")throw new Error(n)}}const LogLevelNameMapping={trace:LogLevel.Trace,debug:LogLevel.Debug,info:LogLevel.Information,information:LogLevel.Information,warn:LogLevel.Warning,warning:LogLevel.Warning,error:LogLevel.Error,critical:LogLevel.Critical,none:LogLevel.None};function parseLogLevel(e){const t=LogLevelNameMapping[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}class HubConnectionBuilder{configureLogging(t){if(Arg.isRequired(t,"logging"),isLogger(t))this.logger=t;else if(typeof t=="string"){const n=parseLogLevel(t);this.logger=new ConsoleLogger(n)}else this.logger=new ConsoleLogger(t);return this}withUrl(t,n){return Arg.isRequired(t,"url"),Arg.isNotEmpty(t,"url"),this.url=t,typeof n=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...n}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:n},this}withHubProtocol(t){return Arg.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new DefaultReconnectPolicy(t):this.reconnectPolicy=t:this.reconnectPolicy=new DefaultReconnectPolicy,this}withServerTimeout(t){return Arg.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return Arg.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t==null?void 0:t.bufferSize,this}build(){const t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const n=new HttpConnection(this.url,t);return HubConnection.create(n,this.logger||NullLogger.instance,this.protocol||new JsonHubProtocol,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function isLogger(e){return e.log!==void 0}function _getDefaults(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let _defaults=_getDefaults();function changeDefaults(e){_defaults=e}const noopTest={exec:()=>null};function edit(e,t=""){let n=typeof e=="string"?e:e.source;const o={replace:(l,u)=>{let p=typeof u=="string"?u:u.source;return p=p.replace(other.caret,"$1"),n=n.replace(l,p),o},getRegex:()=>new RegExp(n,t)};return o}const other={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},newline=/^(?:[ \t]*(?:\n|$))+/,blockCode=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fences=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bullet=/(?:[*+-]|\d{1,9}[.)])/,lheadingCore=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lheading=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),lheadingGfm=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),_paragraph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,blockText=/^[^\n]+/,_blockLabel=/(?!\s*\])(?:\\.|[^\[\]\\])+/,def=edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_blockLabel).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),list$1=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bullet).getRegex(),_tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_comment=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,html=edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",_comment).replace("tag",_tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),paragraph=edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockquote=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",paragraph).getRegex(),blockNormal={blockquote,code:blockCode,def,fences,heading,hr,html,lheading,list:list$1,newline,paragraph,table:noopTest,text:blockText},gfmTable=edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockGfm={...blockNormal,lheading:lheadingGfm,table:gfmTable,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gfmTable).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex()},blockPedantic={...blockNormal,html:edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:noopTest,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(_paragraph).replace("hr",hr).replace("heading",` *#{1,6} *[^
800
- ]`).replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape$1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_punctuation=/[\p{P}\p{S}]/u,_punctuationOrSpace=/[\s\p{P}\p{S}]/u,_notPunctuationOrSpace=/[^\s\p{P}\p{S}]/u,punctuation=edit(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_punctuationOrSpace).getRegex(),_punctuationGfmStrongEm=/(?!~)[\p{P}\p{S}]/u,_punctuationOrSpaceGfmStrongEm=/(?!~)[\s\p{P}\p{S}]/u,_notPunctuationOrSpaceGfmStrongEm=/(?:[^\s\p{P}\p{S}]|~)/u,blockSkip=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,emStrongLDelimCore=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,emStrongLDelim=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuation).getRegex(),emStrongLDelimGfm=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimAstCore="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",emStrongRDelimAst=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAstGfm=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g,_punctuationOrSpaceGfmStrongEm).replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\(punct)/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:-->|$)","-->").getRegex(),tag=edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation,autolink,blockSkip,br,code:inlineCode,del:noopTest,emStrongLDelim,emStrongRDelimAst,emStrongRDelimUnd,escape:escape$1,link,nolink,punctuation,reflink,reflinkSearch,tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,emStrongRDelimAst:emStrongRDelimAstGfm,emStrongLDelim:emStrongLDelimGfm,url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},inlineBreaks={...inlineGfm,br:edit(br).replace("{2,}","*").getRegex(),text:edit(inlineGfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},block={normal:blockNormal,gfm:blockGfm,pedantic:blockPedantic},inline={normal:inlineNormal,gfm:inlineGfm,breaks:inlineBreaks,pedantic:inlinePedantic},escapeReplacements={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},getEscapeReplacement=e=>escapeReplacements[e];function escape$2(e,t){if(t){if(other.escapeTest.test(e))return e.replace(other.escapeReplace,getEscapeReplacement)}else if(other.escapeTestNoEncode.test(e))return e.replace(other.escapeReplaceNoEncode,getEscapeReplacement);return e}function cleanUrl(e){try{e=encodeURI(e).replace(other.percentDecode,"%")}catch{return null}return e}function splitCells(e,t){var u;const n=e.replace(other.findPipe,(p,d,f)=>{let m=!1,g=d;for(;--g>=0&&f[g]==="\\";)m=!m;return m?"|":" |"}),o=n.split(other.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((u=o.at(-1))!=null&&u.trim())&&o.pop(),t)if(o.length>t)o.splice(t);else for(;o.length<t;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(other.slashPipe,"|");return o}function rtrim(e,t,n){const o=e.length;if(o===0)return"";let l=0;for(;l<o&&e.charAt(o-l-1)===t;)l++;return e.slice(0,o-l)}function findClosingBracket(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===t[0])n++;else if(e[o]===t[1]&&(n--,n<0))return o;return n>0?-2:-1}function outputLink(e,t,n,o,l){const u=t.href,p=t.title||null,d=e[1].replace(l.other.outputLinkReplace,"$1");if(e[0].charAt(0)!=="!"){o.state.inLink=!0;const f={type:"link",raw:n,href:u,title:p,text:d,tokens:o.inlineTokens(d)};return o.state.inLink=!1,f}return{type:"image",raw:n,href:u,title:p,text:d}}function indentCodeCompensation(e,t,n){const o=e.match(n.other.indentCodeCompensation);if(o===null)return t;const l=o[1];return t.split(`
800
+ ]`).replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape$1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_punctuation=/[\p{P}\p{S}]/u,_punctuationOrSpace=/[\s\p{P}\p{S}]/u,_notPunctuationOrSpace=/[^\s\p{P}\p{S}]/u,punctuation=edit(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_punctuationOrSpace).getRegex(),_punctuationGfmStrongEm=/(?!~)[\p{P}\p{S}]/u,_punctuationOrSpaceGfmStrongEm=/(?!~)[\s\p{P}\p{S}]/u,_notPunctuationOrSpaceGfmStrongEm=/(?:[^\s\p{P}\p{S}]|~)/u,blockSkip=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,emStrongLDelimCore=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,emStrongLDelim=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuation).getRegex(),emStrongLDelimGfm=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimAstCore="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",emStrongRDelimAst=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAstGfm=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g,_punctuationOrSpaceGfmStrongEm).replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\(punct)/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:-->|$)","-->").getRegex(),tag=edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation,autolink,blockSkip,br,code:inlineCode,del:noopTest,emStrongLDelim,emStrongRDelimAst,emStrongRDelimUnd,escape:escape$1,link,nolink,punctuation,reflink,reflinkSearch,tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,emStrongRDelimAst:emStrongRDelimAstGfm,emStrongLDelim:emStrongLDelimGfm,url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},inlineBreaks={...inlineGfm,br:edit(br).replace("{2,}","*").getRegex(),text:edit(inlineGfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},block={normal:blockNormal,gfm:blockGfm,pedantic:blockPedantic},inline={normal:inlineNormal,gfm:inlineGfm,breaks:inlineBreaks,pedantic:inlinePedantic},escapeReplacements={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},getEscapeReplacement=e=>escapeReplacements[e];function escape$2(e,t){if(t){if(other.escapeTest.test(e))return e.replace(other.escapeReplace,getEscapeReplacement)}else if(other.escapeTestNoEncode.test(e))return e.replace(other.escapeReplaceNoEncode,getEscapeReplacement);return e}function cleanUrl(e){try{e=encodeURI(e).replace(other.percentDecode,"%")}catch{return null}return e}function splitCells(e,t){var u;const n=e.replace(other.findPipe,(p,d,f)=>{let m=!1,g=d;for(;--g>=0&&f[g]==="\\";)m=!m;return m?"|":" |"}),o=n.split(other.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((u=o.at(-1))!=null&&u.trim())&&o.pop(),t)if(o.length>t)o.splice(t);else for(;o.length<t;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(other.slashPipe,"|");return o}function rtrim(e,t,n){const o=e.length;if(o===0)return"";let l=0;for(;l<o&&e.charAt(o-l-1)===t;)l++;return e.slice(0,o-l)}function findClosingBracket(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===t[0])n++;else if(e[o]===t[1]&&(n--,n<0))return o;return n>0?-2:-1}function outputLink(e,t,n,o,l){const u=t.href,p=t.title||null,d=e[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const f={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:u,title:p,text:d,tokens:o.inlineTokens(d)};return o.state.inLink=!1,f}function indentCodeCompensation(e,t,n){const o=e.match(n.other.indentCodeCompensation);if(o===null)return t;const l=o[1];return t.split(`
801
801
  `).map(u=>{const p=u.match(n.other.beginningSpace);if(p===null)return u;const[d]=p;return d.length>=l.length?u.slice(l.length):u}).join(`
802
802
  `)}class _Tokenizer{constructor(t){je(this,"options");je(this,"rules");je(this,"lexer");this.options=t||_defaults}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const o=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?o:rtrim(o,`
803
803
  `)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const o=n[0],l=indentCodeCompensation(o,n[3]||"",this.rules);return{type:"code",raw:o,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:l}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let o=n[2].trim();if(this.rules.other.endingHash.test(o)){const l=rtrim(o,"#");(this.options.pedantic||!l||this.rules.other.endingSpaceChar.test(l))&&(o=l.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:rtrim(n[0],`
@@ -849,7 +849,7 @@ ${this.parser.parse(t)}</blockquote>
849
849
  `}tablerow({text:t}){return`<tr>
850
850
  ${t}</tr>
851
851
  `}tablecell(t){const n=this.parser.parseInline(t.tokens),o=t.header?"th":"td";return(t.align?`<${o} align="${t.align}">`:`<${o}>`)+n+`</${o}>
852
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${escape$2(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,tokens:o}){const l=this.parser.parseInline(o),u=cleanUrl(t);if(u===null)return l;t=u;let p='<a href="'+t+'"';return n&&(p+=' title="'+escape$2(n)+'"'),p+=">"+l+"</a>",p}image({href:t,title:n,text:o}){const l=cleanUrl(t);if(l===null)return escape$2(o);t=l;let u=`<img src="${t}" alt="${o}"`;return n&&(u+=` title="${escape$2(n)}"`),u+=">",u}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:escape$2(t.text)}}class _TextRenderer{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}}class _Parser{constructor(t){je(this,"options");je(this,"renderer");je(this,"textRenderer");this.options=t||_defaults,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(t,n){return new _Parser(n).parse(t)}static parseInline(t,n){return new _Parser(n).parseInline(t)}parse(t,n=!0){var l,u;let o="";for(let p=0;p<t.length;p++){const d=t[p];if((u=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&u[d.type]){const m=d,g=this.options.extensions.renderers[m.type].call({parser:this},m);if(g!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){o+=g||"";continue}}const f=d;switch(f.type){case"space":{o+=this.renderer.space(f);continue}case"hr":{o+=this.renderer.hr(f);continue}case"heading":{o+=this.renderer.heading(f);continue}case"code":{o+=this.renderer.code(f);continue}case"table":{o+=this.renderer.table(f);continue}case"blockquote":{o+=this.renderer.blockquote(f);continue}case"list":{o+=this.renderer.list(f);continue}case"html":{o+=this.renderer.html(f);continue}case"paragraph":{o+=this.renderer.paragraph(f);continue}case"text":{let m=f,g=this.renderer.text(m);for(;p+1<t.length&&t[p+1].type==="text";)m=t[++p],g+=`
852
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${escape$2(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,tokens:o}){const l=this.parser.parseInline(o),u=cleanUrl(t);if(u===null)return l;t=u;let p='<a href="'+t+'"';return n&&(p+=' title="'+escape$2(n)+'"'),p+=">"+l+"</a>",p}image({href:t,title:n,text:o,tokens:l}){l&&(o=this.parser.parseInline(l,this.parser.textRenderer));const u=cleanUrl(t);if(u===null)return escape$2(o);t=u;let p=`<img src="${t}" alt="${o}"`;return n&&(p+=` title="${escape$2(n)}"`),p+=">",p}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:escape$2(t.text)}}class _TextRenderer{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}}class _Parser{constructor(t){je(this,"options");je(this,"renderer");je(this,"textRenderer");this.options=t||_defaults,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(t,n){return new _Parser(n).parse(t)}static parseInline(t,n){return new _Parser(n).parseInline(t)}parse(t,n=!0){var l,u;let o="";for(let p=0;p<t.length;p++){const d=t[p];if((u=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&u[d.type]){const m=d,g=this.options.extensions.renderers[m.type].call({parser:this},m);if(g!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){o+=g||"";continue}}const f=d;switch(f.type){case"space":{o+=this.renderer.space(f);continue}case"hr":{o+=this.renderer.hr(f);continue}case"heading":{o+=this.renderer.heading(f);continue}case"code":{o+=this.renderer.code(f);continue}case"table":{o+=this.renderer.table(f);continue}case"blockquote":{o+=this.renderer.blockquote(f);continue}case"list":{o+=this.renderer.list(f);continue}case"html":{o+=this.renderer.html(f);continue}case"paragraph":{o+=this.renderer.paragraph(f);continue}case"text":{let m=f,g=this.renderer.text(m);for(;p+1<t.length&&t[p+1].type==="text";)m=t[++p],g+=`
853
853
  `+this.renderer.text(m);n?o+=this.renderer.paragraph({type:"paragraph",raw:g,text:g,tokens:[{type:"text",raw:g,text:g,escaped:!0}]}):o+=g;continue}default:{const m='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(t,n=this.renderer){var l,u;let o="";for(let p=0;p<t.length;p++){const d=t[p];if((u=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&u[d.type]){const m=this.options.extensions.renderers[d.type].call({parser:this},d);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){o+=m||"";continue}}const f=d;switch(f.type){case"escape":{o+=n.text(f);break}case"html":{o+=n.html(f);break}case"link":{o+=n.link(f);break}case"image":{o+=n.image(f);break}case"strong":{o+=n.strong(f);break}case"em":{o+=n.em(f);break}case"codespan":{o+=n.codespan(f);break}case"br":{o+=n.br(f);break}case"del":{o+=n.del(f);break}case"text":{o+=n.text(f);break}default:{const m='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}}class _Hooks{constructor(t){je(this,"options");je(this,"block");this.options=t||_defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?_Lexer.lex:_Lexer.lexInline}provideParser(){return this.block?_Parser.parse:_Parser.parseInline}}je(_Hooks,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Marked{constructor(...t){je(this,"defaults",_getDefaults());je(this,"options",this.setOptions);je(this,"parse",this.parseMarkdown(!0));je(this,"parseInline",this.parseMarkdown(!1));je(this,"Parser",_Parser);je(this,"Renderer",_Renderer);je(this,"TextRenderer",_TextRenderer);je(this,"Lexer",_Lexer);je(this,"Tokenizer",_Tokenizer);je(this,"Hooks",_Hooks);this.use(...t)}walkTokens(t,n){var l,u;let o=[];for(const p of t)switch(o=o.concat(n.call(this,p)),p.type){case"table":{const d=p;for(const f of d.header)o=o.concat(this.walkTokens(f.tokens,n));for(const f of d.rows)for(const m of f)o=o.concat(this.walkTokens(m.tokens,n));break}case"list":{const d=p;o=o.concat(this.walkTokens(d.items,n));break}default:{const d=p;(u=(l=this.defaults.extensions)==null?void 0:l.childTokens)!=null&&u[d.type]?this.defaults.extensions.childTokens[d.type].forEach(f=>{const m=d[f].flat(1/0);o=o.concat(this.walkTokens(m,n))}):d.tokens&&(o=o.concat(this.walkTokens(d.tokens,n)))}}return o}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(o=>{const l={...o};if(l.async=this.defaults.async||l.async||!1,o.extensions&&(o.extensions.forEach(u=>{if(!u.name)throw new Error("extension name required");if("renderer"in u){const p=n.renderers[u.name];p?n.renderers[u.name]=function(...d){let f=u.renderer.apply(this,d);return f===!1&&(f=p.apply(this,d)),f}:n.renderers[u.name]=u.renderer}if("tokenizer"in u){if(!u.level||u.level!=="block"&&u.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const p=n[u.level];p?p.unshift(u.tokenizer):n[u.level]=[u.tokenizer],u.start&&(u.level==="block"?n.startBlock?n.startBlock.push(u.start):n.startBlock=[u.start]:u.level==="inline"&&(n.startInline?n.startInline.push(u.start):n.startInline=[u.start]))}"childTokens"in u&&u.childTokens&&(n.childTokens[u.name]=u.childTokens)}),l.extensions=n),o.renderer){const u=this.defaults.renderer||new _Renderer(this.defaults);for(const p in o.renderer){if(!(p in u))throw new Error(`renderer '${p}' does not exist`);if(["options","parser"].includes(p))continue;const d=p,f=o.renderer[d],m=u[d];u[d]=(...g)=>{let b=f.apply(u,g);return b===!1&&(b=m.apply(u,g)),b||""}}l.renderer=u}if(o.tokenizer){const u=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const p in o.tokenizer){if(!(p in u))throw new Error(`tokenizer '${p}' does not exist`);if(["options","rules","lexer"].includes(p))continue;const d=p,f=o.tokenizer[d],m=u[d];u[d]=(...g)=>{let b=f.apply(u,g);return b===!1&&(b=m.apply(u,g)),b}}l.tokenizer=u}if(o.hooks){const u=this.defaults.hooks||new _Hooks;for(const p in o.hooks){if(!(p in u))throw new Error(`hook '${p}' does not exist`);if(["options","block"].includes(p))continue;const d=p,f=o.hooks[d],m=u[d];_Hooks.passThroughHooks.has(p)?u[d]=g=>{if(this.defaults.async)return Promise.resolve(f.call(u,g)).then(_=>m.call(u,_));const b=f.call(u,g);return m.call(u,b)}:u[d]=(...g)=>{let b=f.apply(u,g);return b===!1&&(b=m.apply(u,g)),b}}l.hooks=u}if(o.walkTokens){const u=this.defaults.walkTokens,p=o.walkTokens;l.walkTokens=function(d){let f=[];return f.push(p.call(this,d)),u&&(f=f.concat(u.call(this,d))),f}}this.defaults={...this.defaults,...l}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return _Lexer.lex(t,n??this.defaults)}parser(t,n){return _Parser.parse(t,n??this.defaults)}parseMarkdown(t){return(o,l)=>{const u={...l},p={...this.defaults,...u},d=this.onError(!!p.silent,!!p.async);if(this.defaults.async===!0&&u.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof o>"u"||o===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));p.hooks&&(p.hooks.options=p,p.hooks.block=t);const f=p.hooks?p.hooks.provideLexer():t?_Lexer.lex:_Lexer.lexInline,m=p.hooks?p.hooks.provideParser():t?_Parser.parse:_Parser.parseInline;if(p.async)return Promise.resolve(p.hooks?p.hooks.preprocess(o):o).then(g=>f(g,p)).then(g=>p.hooks?p.hooks.processAllTokens(g):g).then(g=>p.walkTokens?Promise.all(this.walkTokens(g,p.walkTokens)).then(()=>g):g).then(g=>m(g,p)).then(g=>p.hooks?p.hooks.postprocess(g):g).catch(d);try{p.hooks&&(o=p.hooks.preprocess(o));let g=f(o,p);p.hooks&&(g=p.hooks.processAllTokens(g)),p.walkTokens&&this.walkTokens(g,p.walkTokens);let b=m(g,p);return p.hooks&&(b=p.hooks.postprocess(b)),b}catch(g){return d(g)}}}onError(t,n){return o=>{if(o.message+=`
854
854
  Please report this to https://github.com/markedjs/marked.`,t){const l="<p>An error occurred:</p><pre>"+escape$2(o.message+"",!0)+"</pre>";return n?Promise.resolve(l):l}if(n)return Promise.reject(o);throw o}}}const markedInstance=new Marked;function marked(e,t){return markedInstance.parse(e,t)}marked.options=marked.setOptions=function(e){return markedInstance.setOptions(e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...e){return markedInstance.use(...e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(e,t){return markedInstance.walkTokens(e,t)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;const Card=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("rounded-md border bg-card text-card-foreground shadow-sm",e),...t}));Card.displayName="Card";const CardHeader=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("flex flex-col space-y-1.5 p-6",e),...t}));CardHeader.displayName="CardHeader";const CardTitle=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("font-semibold leading-none tracking-tight",e),...t}));CardTitle.displayName="CardTitle";const CardDescription=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm text-muted-foreground",e),...t}));CardDescription.displayName="CardDescription";const CardContent=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("p-6 pt-0",e),...t}));CardContent.displayName="CardContent";const CardFooter=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("flex items-center p-6 pt-0",e),...t}));CardFooter.displayName="CardFooter";const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:e,variant:t,size:n,icon:o,children:l,...u},p)=>jsxRuntime.jsxs("div",{ref:p,className:cn(badgeVariants({variant:t,size:n}),e),...u,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function PartnerCard({account:e,action:t,loading:n=!1,withVoice:o=!0}){const[l,u]=React.useState(null),[p,d]=React.useState(!1),[f,m]=React.useState(!1),[g,b]=React.useState(!1),[_,S]=React.useState(!0),[E,C]=React.useState(null),[R,A]=React.useState(!1),N=React.useMemo(()=>e!=null&&e.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video/Exists`,logoUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo?width=64&height=64`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo/Exists`}:null,[e==null?void 0:e.ApplicationId]);React.useEffect(()=>{if(!N||n)return;let V=!0;C(null);const M=async()=>{try{const L=await fetch(N.logoExistsUrl);if(L.ok){const F=(await L.text()).toLowerCase()==="true";return V&&m(F),F}return!1}catch(L){return console.error("Failed to check if logo exists:",L),V&&m(!1),!1}},I=async()=>{V&&d(!0);try{const L=await fetch(N.logoUrl);if(L.ok){const q=await L.blob();V&&(l&&URL.revokeObjectURL(l),u(URL.createObjectURL(q)))}else throw new Error(`Failed to load logo: ${L.status}`)}catch(L){console.error("Failed to load logo:",L),V&&C("Failed to load partner logo")}finally{V&&d(!1)}},j=async()=>{try{const L=await fetch(N.videoExistsUrl);if(L.ok){const q=await L.text();V&&b(q.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${L.status}`)}catch(L){console.error("Failed to check if video exists:",L),V&&b(!1)}};return(async()=>{await M()&&I(),j()})(),()=>{V=!1,l&&URL.revokeObjectURL(l)}},[N,n]);const O=()=>{S(!1)};return n||!e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),o&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:p?jsxRuntime.jsx(Skeleton,{className:"h-10 w-10 rounded-md"}):l&&jsxRuntime.jsx("img",{src:l||"/placeholder.svg",alt:`${e.PublicName}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:e.ApplicationId})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"pb-2",children:[E&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:E}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(e.IsManufacturer||e.IsReseller||e.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),e.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),e.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),o&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2",children:[g&&N?jsxRuntime.jsxs(Dialog,{open:R,onOpenChange:A,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[e.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[_&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:N.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${e.PublicName}`,className:`w-full h-full object-cover ${_?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:O,onError:()=>S(!1)})]})]})]}):jsxRuntime.jsx("div",{}),t||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}const Textarea=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("textarea",{className:cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Textarea.displayName="Textarea";function ChatList({userId:e,chats:t,activeChat:n,onSelectChat:o,assistantChat:l}){return jsxRuntime.jsxs("div",{className:"space-y-1 flex flex-col min-h-full",children:[jsxRuntime.jsx("div",{className:"flex-grow",children:t.map(u=>{const p=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${u.partner1===e?u.partner2:u.partner1}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]});return display(u,n,o,p)})}),jsxRuntime.jsxs("div",{className:"mt-auto",children:[jsxRuntime.jsx(Separator$1,{className:"mb-1"}),display(l,n,o,jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"}))]})]})}function display(e,t,n,o){var l;return jsxRuntime.jsxs("button",{className:cn("w-full flex items-center p-2 rounded-md hover:bg-slate-100 transition-colors",(t==null?void 0:t.partner1)===e.partner1&&(t==null?void 0:t.partner2)===e.partner2&&"bg-slate-100"),onClick:()=>n([e.partner1,e.partner2]),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:e.pending?jsxRuntime.jsx(MessageSquareLock,{}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:o})}),jsxRuntime.jsxs("div",{className:"ml-2 text-left overflow-hidden",children:[jsxRuntime.jsx("div",{className:"font-medium text-sm truncate",children:e.name}),jsxRuntime.jsx("div",{className:"text-xs text-muted-foreground truncate text-ellipsis",children:((l=e.messages.at(-1))==null?void 0:l.content)??""})]}),e.unread>0&&jsxRuntime.jsx("div",{className:"ml-auto bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center",children:e.unread})]},e.partner1+" and "+e.partner2)}var md5$1={exports:{}},crypt={exports:{}},hasRequiredCrypt;function requireCrypt(){return hasRequiredCrypt||(hasRequiredCrypt=1,function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t={rotl:function(n,o){return n<<o|n>>>32-o},rotr:function(n,o){return n<<32-o|n>>>o},endian:function(n){if(n.constructor==Number)return t.rotl(n,8)&16711935|t.rotl(n,24)&4278255360;for(var o=0;o<n.length;o++)n[o]=t.endian(n[o]);return n},randomBytes:function(n){for(var o=[];n>0;n--)o.push(Math.floor(Math.random()*256));return o},bytesToWords:function(n){for(var o=[],l=0,u=0;l<n.length;l++,u+=8)o[u>>>5]|=n[l]<<24-u%32;return o},wordsToBytes:function(n){for(var o=[],l=0;l<n.length*32;l+=8)o.push(n[l>>>5]>>>24-l%32&255);return o},bytesToHex:function(n){for(var o=[],l=0;l<n.length;l++)o.push((n[l]>>>4).toString(16)),o.push((n[l]&15).toString(16));return o.join("")},hexToBytes:function(n){for(var o=[],l=0;l<n.length;l+=2)o.push(parseInt(n.substr(l,2),16));return o},bytesToBase64:function(n){for(var o=[],l=0;l<n.length;l+=3)for(var u=n[l]<<16|n[l+1]<<8|n[l+2],p=0;p<4;p++)l*8+p*6<=n.length*8?o.push(e.charAt(u>>>6*(3-p)&63)):o.push("=");return o.join("")},base64ToBytes:function(n){n=n.replace(/[^A-Z0-9+\/]/ig,"");for(var o=[],l=0,u=0;l<n.length;u=++l%4)u!=0&&o.push((e.indexOf(n.charAt(l-1))&Math.pow(2,-2*u+8)-1)<<u*2|e.indexOf(n.charAt(l))>>>6-u*2);return o}};crypt.exports=t}()),crypt.exports}var charenc_1,hasRequiredCharenc;function requireCharenc(){if(hasRequiredCharenc)return charenc_1;hasRequiredCharenc=1;var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var n=[],o=0;o<t.length;o++)n.push(t.charCodeAt(o)&255);return n},bytesToString:function(t){for(var n=[],o=0;o<t.length;o++)n.push(String.fromCharCode(t[o]));return n.join("")}}};return charenc_1=e,charenc_1}/*!
855
855
  * Determine if an object is a Buffer
@@ -857,7 +857,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const l="<p>An err
857
857
  * @author Feross Aboukhadijeh <https://feross.org>
858
858
  * @license MIT
859
859
  */var isBuffer_1,hasRequiredIsBuffer;function requireIsBuffer(){if(hasRequiredIsBuffer)return isBuffer_1;hasRequiredIsBuffer=1,isBuffer_1=function(n){return n!=null&&(e(n)||t(n)||!!n._isBuffer)};function e(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function t(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&e(n.slice(0,0))}return isBuffer_1}var hasRequiredMd5;function requireMd5(){return hasRequiredMd5||(hasRequiredMd5=1,function(){var e=requireCrypt(),t=requireCharenc().utf8,n=requireIsBuffer(),o=requireCharenc().bin,l=function(u,p){u.constructor==String?p&&p.encoding==="binary"?u=o.stringToBytes(u):u=t.stringToBytes(u):n(u)?u=Array.prototype.slice.call(u,0):!Array.isArray(u)&&u.constructor!==Uint8Array&&(u=u.toString());for(var d=e.bytesToWords(u),f=u.length*8,m=1732584193,g=-271733879,b=-1732584194,_=271733878,S=0;S<d.length;S++)d[S]=(d[S]<<8|d[S]>>>24)&16711935|(d[S]<<24|d[S]>>>8)&4278255360;d[f>>>5]|=128<<f%32,d[(f+64>>>9<<4)+14]=f;for(var E=l._ff,C=l._gg,R=l._hh,A=l._ii,S=0;S<d.length;S+=16){var N=m,O=g,V=b,M=_;m=E(m,g,b,_,d[S+0],7,-680876936),_=E(_,m,g,b,d[S+1],12,-389564586),b=E(b,_,m,g,d[S+2],17,606105819),g=E(g,b,_,m,d[S+3],22,-1044525330),m=E(m,g,b,_,d[S+4],7,-176418897),_=E(_,m,g,b,d[S+5],12,1200080426),b=E(b,_,m,g,d[S+6],17,-1473231341),g=E(g,b,_,m,d[S+7],22,-45705983),m=E(m,g,b,_,d[S+8],7,1770035416),_=E(_,m,g,b,d[S+9],12,-1958414417),b=E(b,_,m,g,d[S+10],17,-42063),g=E(g,b,_,m,d[S+11],22,-1990404162),m=E(m,g,b,_,d[S+12],7,1804603682),_=E(_,m,g,b,d[S+13],12,-40341101),b=E(b,_,m,g,d[S+14],17,-1502002290),g=E(g,b,_,m,d[S+15],22,1236535329),m=C(m,g,b,_,d[S+1],5,-165796510),_=C(_,m,g,b,d[S+6],9,-1069501632),b=C(b,_,m,g,d[S+11],14,643717713),g=C(g,b,_,m,d[S+0],20,-373897302),m=C(m,g,b,_,d[S+5],5,-701558691),_=C(_,m,g,b,d[S+10],9,38016083),b=C(b,_,m,g,d[S+15],14,-660478335),g=C(g,b,_,m,d[S+4],20,-405537848),m=C(m,g,b,_,d[S+9],5,568446438),_=C(_,m,g,b,d[S+14],9,-1019803690),b=C(b,_,m,g,d[S+3],14,-187363961),g=C(g,b,_,m,d[S+8],20,1163531501),m=C(m,g,b,_,d[S+13],5,-1444681467),_=C(_,m,g,b,d[S+2],9,-51403784),b=C(b,_,m,g,d[S+7],14,1735328473),g=C(g,b,_,m,d[S+12],20,-1926607734),m=R(m,g,b,_,d[S+5],4,-378558),_=R(_,m,g,b,d[S+8],11,-2022574463),b=R(b,_,m,g,d[S+11],16,1839030562),g=R(g,b,_,m,d[S+14],23,-35309556),m=R(m,g,b,_,d[S+1],4,-1530992060),_=R(_,m,g,b,d[S+4],11,1272893353),b=R(b,_,m,g,d[S+7],16,-155497632),g=R(g,b,_,m,d[S+10],23,-1094730640),m=R(m,g,b,_,d[S+13],4,681279174),_=R(_,m,g,b,d[S+0],11,-358537222),b=R(b,_,m,g,d[S+3],16,-722521979),g=R(g,b,_,m,d[S+6],23,76029189),m=R(m,g,b,_,d[S+9],4,-640364487),_=R(_,m,g,b,d[S+12],11,-421815835),b=R(b,_,m,g,d[S+15],16,530742520),g=R(g,b,_,m,d[S+2],23,-995338651),m=A(m,g,b,_,d[S+0],6,-198630844),_=A(_,m,g,b,d[S+7],10,1126891415),b=A(b,_,m,g,d[S+14],15,-1416354905),g=A(g,b,_,m,d[S+5],21,-57434055),m=A(m,g,b,_,d[S+12],6,1700485571),_=A(_,m,g,b,d[S+3],10,-1894986606),b=A(b,_,m,g,d[S+10],15,-1051523),g=A(g,b,_,m,d[S+1],21,-2054922799),m=A(m,g,b,_,d[S+8],6,1873313359),_=A(_,m,g,b,d[S+15],10,-30611744),b=A(b,_,m,g,d[S+6],15,-1560198380),g=A(g,b,_,m,d[S+13],21,1309151649),m=A(m,g,b,_,d[S+4],6,-145523070),_=A(_,m,g,b,d[S+11],10,-1120210379),b=A(b,_,m,g,d[S+2],15,718787259),g=A(g,b,_,m,d[S+9],21,-343485551),m=m+N>>>0,g=g+O>>>0,b=b+V>>>0,_=_+M>>>0}return e.endian([m,g,b,_])};l._ff=function(u,p,d,f,m,g,b){var _=u+(p&d|~p&f)+(m>>>0)+b;return(_<<g|_>>>32-g)+p},l._gg=function(u,p,d,f,m,g,b){var _=u+(p&f|d&~f)+(m>>>0)+b;return(_<<g|_>>>32-g)+p},l._hh=function(u,p,d,f,m,g,b){var _=u+(p^d^f)+(m>>>0)+b;return(_<<g|_>>>32-g)+p},l._ii=function(u,p,d,f,m,g,b){var _=u+(d^(p|~f))+(m>>>0)+b;return(_<<g|_>>>32-g)+p},l._blocksize=16,l._digestsize=16,md5$1.exports=function(u,p){if(u==null)throw new Error("Illegal argument "+u);var d=e.wordsToBytes(l(u,p));return p&&p.asBytes?d:p&&p.asString?o.bytesToString(d):e.bytesToHex(d)}}()),md5$1.exports}var md5Exports=requireMd5();const md5=getDefaultExportFromCjs(md5Exports),constructFromSymbol=Symbol.for("constructDateFrom");function constructFrom(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&constructFromSymbol in e?e[constructFromSymbol](t):e instanceof Date?new e.constructor(t):new Date(t)}function toDate(e,t){return constructFrom(e,e)}function addDays(e,t,n){const o=toDate(e);return isNaN(t)?constructFrom(e,NaN):(o.setDate(o.getDate()+t),o)}function normalizeDates(e,...t){const n=constructFrom.bind(null,t.find(o=>typeof o=="object"));return t.map(n)}function startOfDay(e,t){const n=toDate(e);return n.setHours(0,0,0,0),n}function constructNow(e){return constructFrom(e,Date.now())}function isSameDay(e,t,n){const[o,l]=normalizeDates(n==null?void 0:n.in,e,t);return+startOfDay(o)==+startOfDay(l)}function isToday(e,t){return isSameDay(constructFrom(e,e),constructNow(e))}function subDays(e,t,n){return addDays(e,-1)}function isYesterday(e,t){return isSameDay(constructFrom(e,e),subDays(constructNow(e)))}var lib$3={},htmlToDom={},domparser={},utilities$2={},lib$2={},lib$1={},hasRequiredLib$3;function requireLib$3(){return hasRequiredLib$3||(hasRequiredLib$3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(o){o.Root="root",o.Text="text",o.Directive="directive",o.Comment="comment",o.Script="script",o.Style="style",o.Tag="tag",o.CDATA="cdata",o.Doctype="doctype"})(t=e.ElementType||(e.ElementType={}));function n(o){return o.type===t.Tag||o.type===t.Script||o.type===t.Style}e.isTag=n,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype}(lib$1)),lib$1}var node={},hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var e=node&&node.__extends||function(){var M=function(I,j){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,L){B.__proto__=L}||function(B,L){for(var q in L)Object.prototype.hasOwnProperty.call(L,q)&&(B[q]=L[q])},M(I,j)};return function(I,j){if(typeof j!="function"&&j!==null)throw new TypeError("Class extends value "+String(j)+" is not a constructor or null");M(I,j);function B(){this.constructor=I}I.prototype=j===null?Object.create(j):(B.prototype=j.prototype,new B)}}(),t=node&&node.__assign||function(){return t=Object.assign||function(M){for(var I,j=1,B=arguments.length;j<B;j++){I=arguments[j];for(var L in I)Object.prototype.hasOwnProperty.call(I,L)&&(M[L]=I[L])}return M},t.apply(this,arguments)};Object.defineProperty(node,"__esModule",{value:!0}),node.cloneNode=node.hasChildren=node.isDocument=node.isDirective=node.isComment=node.isText=node.isCDATA=node.isTag=node.Element=node.Document=node.CDATA=node.NodeWithChildren=node.ProcessingInstruction=node.Comment=node.Text=node.DataNode=node.Node=void 0;var n=requireLib$3(),o=function(){function M(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(M.prototype,"parentNode",{get:function(){return this.parent},set:function(I){this.parent=I},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"previousSibling",{get:function(){return this.prev},set:function(I){this.prev=I},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"nextSibling",{get:function(){return this.next},set:function(I){this.next=I},enumerable:!1,configurable:!0}),M.prototype.cloneNode=function(I){return I===void 0&&(I=!1),O(this,I)},M}();node.Node=o;var l=function(M){e(I,M);function I(j){var B=M.call(this)||this;return B.data=j,B}return Object.defineProperty(I.prototype,"nodeValue",{get:function(){return this.data},set:function(j){this.data=j},enumerable:!1,configurable:!0}),I}(o);node.DataNode=l;var u=function(M){e(I,M);function I(){var j=M!==null&&M.apply(this,arguments)||this;return j.type=n.ElementType.Text,j}return Object.defineProperty(I.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),I}(l);node.Text=u;var p=function(M){e(I,M);function I(){var j=M!==null&&M.apply(this,arguments)||this;return j.type=n.ElementType.Comment,j}return Object.defineProperty(I.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),I}(l);node.Comment=p;var d=function(M){e(I,M);function I(j,B){var L=M.call(this,B)||this;return L.name=j,L.type=n.ElementType.Directive,L}return Object.defineProperty(I.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),I}(l);node.ProcessingInstruction=d;var f=function(M){e(I,M);function I(j){var B=M.call(this)||this;return B.children=j,B}return Object.defineProperty(I.prototype,"firstChild",{get:function(){var j;return(j=this.children[0])!==null&&j!==void 0?j:null},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"childNodes",{get:function(){return this.children},set:function(j){this.children=j},enumerable:!1,configurable:!0}),I}(o);node.NodeWithChildren=f;var m=function(M){e(I,M);function I(){var j=M!==null&&M.apply(this,arguments)||this;return j.type=n.ElementType.CDATA,j}return Object.defineProperty(I.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),I}(f);node.CDATA=m;var g=function(M){e(I,M);function I(){var j=M!==null&&M.apply(this,arguments)||this;return j.type=n.ElementType.Root,j}return Object.defineProperty(I.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),I}(f);node.Document=g;var b=function(M){e(I,M);function I(j,B,L,q){L===void 0&&(L=[]),q===void 0&&(q=j==="script"?n.ElementType.Script:j==="style"?n.ElementType.Style:n.ElementType.Tag);var F=M.call(this,L)||this;return F.name=j,F.attribs=B,F.type=q,F}return Object.defineProperty(I.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"tagName",{get:function(){return this.name},set:function(j){this.name=j},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"attributes",{get:function(){var j=this;return Object.keys(this.attribs).map(function(B){var L,q;return{name:B,value:j.attribs[B],namespace:(L=j["x-attribsNamespace"])===null||L===void 0?void 0:L[B],prefix:(q=j["x-attribsPrefix"])===null||q===void 0?void 0:q[B]}})},enumerable:!1,configurable:!0}),I}(f);node.Element=b;function _(M){return(0,n.isTag)(M)}node.isTag=_;function S(M){return M.type===n.ElementType.CDATA}node.isCDATA=S;function E(M){return M.type===n.ElementType.Text}node.isText=E;function C(M){return M.type===n.ElementType.Comment}node.isComment=C;function R(M){return M.type===n.ElementType.Directive}node.isDirective=R;function A(M){return M.type===n.ElementType.Root}node.isDocument=A;function N(M){return Object.prototype.hasOwnProperty.call(M,"children")}node.hasChildren=N;function O(M,I){I===void 0&&(I=!1);var j;if(E(M))j=new u(M.data);else if(C(M))j=new p(M.data);else if(_(M)){var B=I?V(M.children):[],L=new b(M.name,t({},M.attribs),B);B.forEach(function(U){return U.parent=L}),M.namespace!=null&&(L.namespace=M.namespace),M["x-attribsNamespace"]&&(L["x-attribsNamespace"]=t({},M["x-attribsNamespace"])),M["x-attribsPrefix"]&&(L["x-attribsPrefix"]=t({},M["x-attribsPrefix"])),j=L}else if(S(M)){var B=I?V(M.children):[],q=new m(B);B.forEach(function(G){return G.parent=q}),j=q}else if(A(M)){var B=I?V(M.children):[],F=new g(B);B.forEach(function(G){return G.parent=F}),M["x-mode"]&&(F["x-mode"]=M["x-mode"]),j=F}else if(R(M)){var H=new d(M.name,M.data);M["x-name"]!=null&&(H["x-name"]=M["x-name"],H["x-publicId"]=M["x-publicId"],H["x-systemId"]=M["x-systemId"]),j=H}else throw new Error("Not implemented yet: ".concat(M.type));return j.startIndex=M.startIndex,j.endIndex=M.endIndex,M.sourceCodeLocation!=null&&(j.sourceCodeLocation=M.sourceCodeLocation),j}node.cloneNode=O;function V(M){for(var I=M.map(function(B){return O(B,!0)}),j=1;j<I.length;j++)I[j].prev=I[j-1],I[j-1].next=I[j];return I}return node}var hasRequiredLib$2;function requireLib$2(){return hasRequiredLib$2||(hasRequiredLib$2=1,function(e){var t=lib$2&&lib$2.__createBinding||(Object.create?function(d,f,m,g){g===void 0&&(g=m);var b=Object.getOwnPropertyDescriptor(f,m);(!b||("get"in b?!f.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return f[m]}}),Object.defineProperty(d,g,b)}:function(d,f,m,g){g===void 0&&(g=m),d[g]=f[m]}),n=lib$2&&lib$2.__exportStar||function(d,f){for(var m in d)m!=="default"&&!Object.prototype.hasOwnProperty.call(f,m)&&t(f,d,m)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var o=requireLib$3(),l=requireNode();n(requireNode(),e);var u={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},p=function(){function d(f,m,g){this.dom=[],this.root=new l.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof m=="function"&&(g=m,m=u),typeof f=="object"&&(m=f,f=void 0),this.callback=f??null,this.options=m??u,this.elementCB=g??null}return d.prototype.onparserinit=function(f){this.parser=f},d.prototype.onreset=function(){this.dom=[],this.root=new l.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},d.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},d.prototype.onerror=function(f){this.handleCallback(f)},d.prototype.onclosetag=function(){this.lastNode=null;var f=this.tagStack.pop();this.options.withEndIndices&&(f.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(f)},d.prototype.onopentag=function(f,m){var g=this.options.xmlMode?o.ElementType.Tag:void 0,b=new l.Element(f,m,void 0,g);this.addNode(b),this.tagStack.push(b)},d.prototype.ontext=function(f){var m=this.lastNode;if(m&&m.type===o.ElementType.Text)m.data+=f,this.options.withEndIndices&&(m.endIndex=this.parser.endIndex);else{var g=new l.Text(f);this.addNode(g),this.lastNode=g}},d.prototype.oncomment=function(f){if(this.lastNode&&this.lastNode.type===o.ElementType.Comment){this.lastNode.data+=f;return}var m=new l.Comment(f);this.addNode(m),this.lastNode=m},d.prototype.oncommentend=function(){this.lastNode=null},d.prototype.oncdatastart=function(){var f=new l.Text(""),m=new l.CDATA([f]);this.addNode(m),f.parent=m,this.lastNode=f},d.prototype.oncdataend=function(){this.lastNode=null},d.prototype.onprocessinginstruction=function(f,m){var g=new l.ProcessingInstruction(f,m);this.addNode(g)},d.prototype.handleCallback=function(f){if(typeof this.callback=="function")this.callback(f,this.dom);else if(f)throw f},d.prototype.addNode=function(f){var m=this.tagStack[this.tagStack.length-1],g=m.children[m.children.length-1];this.options.withStartIndices&&(f.startIndex=this.parser.startIndex),this.options.withEndIndices&&(f.endIndex=this.parser.endIndex),m.children.push(f),g&&(f.prev=g,g.next=f),f.parent=m,this.lastNode=null},d}();e.DomHandler=p,e.default=p}(lib$2)),lib$2}var constants={},hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(t,n){return t[n.toLowerCase()]=n,t},{}),e.CARRIAGE_RETURN="\r",e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,"g"),e.CARRIAGE_RETURN_PLACEHOLDER="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(),"__"),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,"g")}(constants)),constants}var hasRequiredUtilities$2;function requireUtilities$2(){if(hasRequiredUtilities$2)return utilities$2;hasRequiredUtilities$2=1,Object.defineProperty(utilities$2,"__esModule",{value:!0}),utilities$2.formatAttributes=o,utilities$2.escapeSpecialCharacters=u,utilities$2.revertEscapedCharacters=p,utilities$2.formatDOM=d;var e=requireLib$2(),t=requireConstants();function n(f){return t.CASE_SENSITIVE_TAG_NAMES_MAP[f]}function o(f){for(var m={},g=0,b=f.length;g<b;g++){var _=f[g];m[_.name]=_.value}return m}function l(f){f=f.toLowerCase();var m=n(f);return m||f}function u(f){return f.replace(t.CARRIAGE_RETURN_REGEX,t.CARRIAGE_RETURN_PLACEHOLDER)}function p(f){return f.replace(t.CARRIAGE_RETURN_PLACEHOLDER_REGEX,t.CARRIAGE_RETURN)}function d(f,m,g){m===void 0&&(m=null);for(var b=[],_,S=0,E=f.length;S<E;S++){var C=f[S];switch(C.nodeType){case 1:{var R=l(C.nodeName);_=new e.Element(R,o(C.attributes)),_.children=d(R==="template"?C.content.childNodes:C.childNodes,_);break}case 3:_=new e.Text(p(C.nodeValue));break;case 8:_=new e.Comment(C.nodeValue);break;default:continue}var A=b[S-1]||null;A&&(A.next=_),_.parent=m,_.prev=A,_.next=null,b.push(_)}return g&&(_=new e.ProcessingInstruction(g.substring(0,g.indexOf(" ")).toLowerCase(),g),_.next=b[0]||null,_.parent=m,b.unshift(_),b[1]&&(b[1].prev=b[0])),b}return utilities$2}var hasRequiredDomparser;function requireDomparser(){if(hasRequiredDomparser)return domparser;hasRequiredDomparser=1,Object.defineProperty(domparser,"__esModule",{value:!0}),domparser.default=C;var e=requireUtilities$2(),t="html",n="head",o="body",l=/<([a-zA-Z]+[0-9]?)/,u=/<head[^]*>/i,p=/<body[^]*>/i,d=function(R,A){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},f=function(R,A){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},m=typeof window=="object"&&window.DOMParser;if(typeof m=="function"){var g=new m,b="text/html";f=function(R,A){return A&&(R="<".concat(A,">").concat(R,"</").concat(A,">")),g.parseFromString(R,b)},d=f}if(typeof document=="object"&&document.implementation){var _=document.implementation.createHTMLDocument();d=function(R,A){if(A){var N=_.documentElement.querySelector(A);return N&&(N.innerHTML=R),_}return _.documentElement.innerHTML=R,_}}var S=typeof document=="object"&&document.createElement("template"),E;S&&S.content&&(E=function(R){return S.innerHTML=R,S.content.childNodes});function C(R){var A,N;R=(0,e.escapeSpecialCharacters)(R);var O=R.match(l),V=O&&O[1]?O[1].toLowerCase():"";switch(V){case t:{var M=f(R);if(!u.test(R)){var I=M.querySelector(n);(A=I==null?void 0:I.parentNode)===null||A===void 0||A.removeChild(I)}if(!p.test(R)){var I=M.querySelector(o);(N=I==null?void 0:I.parentNode)===null||N===void 0||N.removeChild(I)}return M.querySelectorAll(t)}case n:case o:{var j=d(R).querySelectorAll(V);return p.test(R)&&u.test(R)?j[0].parentNode.childNodes:j}default:{if(E)return E(R);var I=d(R,o).querySelector(o);return I.childNodes}}}return domparser}var hasRequiredHtmlToDom;function requireHtmlToDom(){if(hasRequiredHtmlToDom)return htmlToDom;hasRequiredHtmlToDom=1;var e=htmlToDom&&htmlToDom.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(htmlToDom,"__esModule",{value:!0}),htmlToDom.default=l;var t=e(requireDomparser()),n=requireUtilities$2(),o=/<(![a-zA-Z\s]+)>/;function l(u){if(typeof u!="string")throw new TypeError("First argument must be a string");if(!u)return[];var p=u.match(o),d=p?p[1]:void 0;return(0,n.formatDOM)((0,t.default)(u),null,d)}return htmlToDom}var attributesToProps={},lib={},possibleStandardNamesOptimized={},hasRequiredPossibleStandardNamesOptimized;function requirePossibleStandardNamesOptimized(){if(hasRequiredPossibleStandardNamesOptimized)return possibleStandardNamesOptimized;hasRequiredPossibleStandardNamesOptimized=1;var e=0;possibleStandardNamesOptimized.SAME=e;var t=1;return possibleStandardNamesOptimized.CAMELCASE=t,possibleStandardNamesOptimized.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},possibleStandardNamesOptimized}var hasRequiredLib$1;function requireLib$1(){if(hasRequiredLib$1)return lib;hasRequiredLib$1=1;const e=0,t=1,n=2,o=3,l=4,u=5,p=6;function d(M){return m.hasOwnProperty(M)?m[M]:null}function f(M,I,j,B,L,q,F){this.acceptsBooleans=I===n||I===o||I===l,this.attributeName=B,this.attributeNamespace=L,this.mustUseProperty=j,this.propertyName=M,this.type=I,this.sanitizeURL=q,this.removeEmptyString=F}const m={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(M=>{m[M]=new f(M,e,!1,M,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([M,I])=>{m[M]=new f(M,t,!1,I,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(M=>{m[M]=new f(M,n,!1,M.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(M=>{m[M]=new f(M,n,!1,M,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(M=>{m[M]=new f(M,o,!1,M.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(M=>{m[M]=new f(M,o,!0,M,null,!1,!1)}),["capture","download"].forEach(M=>{m[M]=new f(M,l,!1,M,null,!1,!1)}),["cols","rows","size","span"].forEach(M=>{m[M]=new f(M,p,!1,M,null,!1,!1)}),["rowSpan","start"].forEach(M=>{m[M]=new f(M,u,!1,M.toLowerCase(),null,!1,!1)});const b=/[\-\:]([a-z])/g,_=M=>M[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(M=>{const I=M.replace(b,_);m[I]=new f(I,t,!1,M,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(M=>{const I=M.replace(b,_);m[I]=new f(I,t,!1,M,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(M=>{const I=M.replace(b,_);m[I]=new f(I,t,!1,M,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(M=>{m[M]=new f(M,t,!1,M.toLowerCase(),null,!1,!1)});const S="xlinkHref";m[S]=new f("xlinkHref",t,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(M=>{m[M]=new f(M,t,!1,M.toLowerCase(),null,!0,!0)});const{CAMELCASE:E,SAME:C,possibleStandardNames:R}=requirePossibleStandardNamesOptimized(),N=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+N+"]*$")),V=Object.keys(R).reduce((M,I)=>{const j=R[I];return j===C?M[I]=I:j===E?M[I.toLowerCase()]=I:M[I]=j,M},{});return lib.BOOLEAN=o,lib.BOOLEANISH_STRING=n,lib.NUMERIC=u,lib.OVERLOADED_BOOLEAN=l,lib.POSITIVE_NUMERIC=p,lib.RESERVED=e,lib.STRING=t,lib.getPropertyInfo=d,lib.isCustomAttribute=O,lib.possibleStandardNames=V,lib}var utilities$1={},cjs$1={},inlineStyleParser,hasRequiredInlineStyleParser;function requireInlineStyleParser(){if(hasRequiredInlineStyleParser)return inlineStyleParser;hasRequiredInlineStyleParser=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,p=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
860
- `,m="/",g="*",b="",_="comment",S="declaration";inlineStyleParser=function(C,R){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];R=R||{};var A=1,N=1;function O(U){var G=U.match(t);G&&(A+=G.length);var J=U.lastIndexOf(f);N=~J?U.length-J:N+U.length}function V(){var U={line:A,column:N};return function(G){return G.position=new M(U),B(),G}}function M(U){this.start=U,this.end={line:A,column:N},this.source=R.source}M.prototype.content=C;function I(U){var G=new Error(R.source+":"+A+":"+N+": "+U);if(G.reason=U,G.filename=R.source,G.line=A,G.column=N,G.source=C,!R.silent)throw G}function j(U){var G=U.exec(C);if(G){var J=G[0];return O(J),C=C.slice(J.length),G}}function B(){j(n)}function L(U){var G;for(U=U||[];G=q();)G!==!1&&U.push(G);return U}function q(){var U=V();if(!(m!=C.charAt(0)||g!=C.charAt(1))){for(var G=2;b!=C.charAt(G)&&(g!=C.charAt(G)||m!=C.charAt(G+1));)++G;if(G+=2,b===C.charAt(G-1))return I("End of comment missing");var J=C.slice(2,G-2);return N+=2,O(J),C=C.slice(G),N+=2,U({type:_,comment:J})}}function F(){var U=V(),G=j(o);if(G){if(q(),!j(l))return I("property missing ':'");var J=j(u),ee=U({type:S,property:E(G[0].replace(e,b)),value:J?E(J[0].replace(e,b)):b});return j(p),ee}}function H(){var U=[];L(U);for(var G;G=F();)G!==!1&&(U.push(G),L(U));return U}return B(),H()};function E(C){return C?C.replace(d,b):b}return inlineStyleParser}var hasRequiredCjs$1;function requireCjs$1(){if(hasRequiredCjs$1)return cjs$1;hasRequiredCjs$1=1;var e=cjs$1&&cjs$1.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(cjs$1,"__esModule",{value:!0}),cjs$1.default=n;var t=e(requireInlineStyleParser());function n(o,l){var u=null;if(!o||typeof o!="string")return u;var p=(0,t.default)(o),d=typeof l=="function";return p.forEach(function(f){if(f.type==="declaration"){var m=f.property,g=f.value;d?l(m,g,f):g&&(u=u||{},u[m]=g)}}),u}return cjs$1}var utilities={},hasRequiredUtilities$1;function requireUtilities$1(){if(hasRequiredUtilities$1)return utilities;hasRequiredUtilities$1=1,Object.defineProperty(utilities,"__esModule",{value:!0}),utilities.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(m){return!m||n.test(m)||e.test(m)},p=function(m,g){return g.toUpperCase()},d=function(m,g){return"".concat(g,"-")},f=function(m,g){return g===void 0&&(g={}),u(m)?m:(m=m.toLowerCase(),g.reactCompat?m=m.replace(l,d):m=m.replace(o,d),m.replace(t,p))};return utilities.camelCase=f,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var e=cjs&&cjs.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(requireCjs$1()),n=requireUtilities$1();function o(l,u){var p={};return!l||typeof l!="string"||(0,t.default)(l,function(d,f){d&&f&&(p[(0,n.camelCase)(d,u)]=f)}),p}return o.default=o,cjs=o,cjs}var hasRequiredUtilities;function requireUtilities(){return hasRequiredUtilities||(hasRequiredUtilities=1,function(e){var t=utilities$1&&utilities$1.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=u,e.setStyleProp=d;var n=React,o=t(requireCjs()),l=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function u(g,b){return g.includes("-")?!l.has(g):!!(b&&typeof b.is=="string")}var p={reactCompat:!0};function d(g,b){if(typeof g=="string"){if(!g.trim()){b.style={};return}try{b.style=(0,o.default)(g,p)}catch{b.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var f=function(g){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(g.name)};e.canTextBeChildOfNode=f;var m=function(g){return g};e.returnFirstArg=m}(utilities$1)),utilities$1}var hasRequiredAttributesToProps;function requireAttributesToProps(){if(hasRequiredAttributesToProps)return attributesToProps;hasRequiredAttributesToProps=1,Object.defineProperty(attributesToProps,"__esModule",{value:!0}),attributesToProps.default=u;var e=requireLib$1(),t=requireUtilities(),n=["checked","value"],o=["input","select","textarea"],l={reset:!0,submit:!0};function u(d,f){d===void 0&&(d={});var m={},g=!!(d.type&&l[d.type]);for(var b in d){var _=d[b];if((0,e.isCustomAttribute)(b)){m[b]=_;continue}var S=b.toLowerCase(),E=p(S);if(E){var C=(0,e.getPropertyInfo)(E);switch(n.includes(E)&&o.includes(f)&&!g&&(E=p("default"+S)),m[E]=_,C&&C.type){case e.BOOLEAN:m[E]=!0;break;case e.OVERLOADED_BOOLEAN:_===""&&(m[E]=!0);break}continue}t.PRESERVE_CUSTOM_ATTRIBUTES&&(m[b]=_)}return(0,t.setStyleProp)(d.style,m),m}function p(d){return e.possibleStandardNames[d]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var e=domToReact&&domToReact.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=u;var t=React,n=e(requireAttributesToProps()),o=requireUtilities(),l={cloneElement:t.cloneElement,createElement:t.createElement,isValidElement:t.isValidElement};function u(d,f){f===void 0&&(f={});for(var m=[],g=typeof f.replace=="function",b=f.transform||o.returnFirstArg,_=f.library||l,S=_.cloneElement,E=_.createElement,C=_.isValidElement,R=d.length,A=0;A<R;A++){var N=d[A];if(g){var O=f.replace(N,A);if(C(O)){R>1&&(O=S(O,{key:O.key||A})),m.push(b(O,N,A));continue}}if(N.type==="text"){var V=!N.data.trim().length;if(V&&N.parent&&!(0,o.canTextBeChildOfNode)(N.parent)||f.trim&&V)continue;m.push(b(N.data,N,A));continue}var M=N,I={};p(M)?((0,o.setStyleProp)(M.attribs.style,M.attribs),I=M.attribs):M.attribs&&(I=(0,n.default)(M.attribs,M.name));var j=void 0;switch(N.type){case"script":case"style":N.children[0]&&(I.dangerouslySetInnerHTML={__html:N.children[0].data});break;case"tag":N.name==="textarea"&&N.children[0]?I.defaultValue=N.children[0].data:N.children&&N.children.length&&(j=u(N.children,f));break;default:continue}R>1&&(I.key=A),m.push(b(E(N.name,I,j),N,A))}return m.length===1?m[0]:m}function p(d){return o.PRESERVE_CUSTOM_ATTRIBUTES&&d.type==="tag"&&(0,o.isCustomComponent)(d.name,d.attribs)}return domToReact}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(e){var t=lib$3&&lib$3.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=d;var n=t(requireHtmlToDom());e.htmlToDOM=n.default;var o=t(requireAttributesToProps());e.attributesToProps=o.default;var l=t(requireDomToReact());e.domToReact=l.default;var u=requireLib$2();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return u.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return u.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return u.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return u.Text}});var p={lowerCaseAttributeNames:!1};function d(f,m){if(typeof f!="string")throw new TypeError("First argument must be a string");return f?(0,l.default)((0,n.default)(f,(m==null?void 0:m.htmlparser2)||p),m):[]}}(lib$3)),lib$3}var libExports=requireLib();const HTMLReactParser=getDefaultExportFromCjs(libExports),parser=HTMLReactParser.default||HTMLReactParser;function SkeletonMessage({botStatus:e}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:e})]})})]})]})}function ChatMessages({messages:e,currentUserId:t,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[e.map(l=>{const u=l.fromPartnerID===t;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",u&&"flex-row-reverse"),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 mt-1",children:jsxRuntime.jsx(AvatarImage,{src:`https://api.dicebear.com/9.x/thumbs/svg?seed=${md5(l.senderName+l.fromPartnerID)}&flip=${u}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[l.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const p=new Date(l.timestamp);return isToday(p)?p.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(p)?`Yesterday, ${p.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${p.toLocaleDateString([],{month:"short",day:"numeric"})} ${p.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]}),jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",u?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:l.fromPartnerID===ASSISTANT_ID?parser(l.content):l.content})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),e.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),e.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}const ASSISTANT_ID="RandmarAIChatAssistant",ChatLayout=React.forwardRef(({userId:e,userName:t,apiKey:n,inputRef:o},l)=>{var ye,de,le;const{data:u}=useGetV4PartnerByApplicationIdBusinessDevelopmentConversationsQuery({applicationId:e}),[p]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[d]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[f]=useLazyGetV4PartnerByApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:m,botMessages:g,clearBotMessages:b,botReady:_,debugMessages:S,botStatus:E,reset:C}=useAIAssistant({userId:e,apiKey:n});React.useEffect(()=>{if(!u)return;const se={partner1:[e,ASSISTANT_ID].sort()[0],partner2:[e,ASSISTANT_ID].sort()[1],name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},te=u.map(xe=>{var oe;return{partner1:[xe.Participant1,xe.Participant2].sort()[0],partner2:[xe.Participant1,xe.Participant2].sort()[1],name:((oe=xe.Participant)==null?void 0:oe.PublicName)??"missing public name",unread:0,pending:xe.Status!="Approved",historyFetched:!1,messages:[],conversationID:xe.ConversationId}});setTimeout(()=>{var xe;return(xe=Z.current)==null?void 0:xe.focus()},50),L([se,...te])},[u]);const[R,A]=React.useState("all"),[N,O]=React.useState([[e,ASSISTANT_ID].sort()[0],[e,ASSISTANT_ID].sort()[1]]),[V,M]=React.useState(""),[I,j]=React.useState(null),[B,L]=React.useState([]),[q,F]=React.useState(""),[H,U]=React.useState(null),[G,J]=React.useState([]),[ee,ae]=React.useState(0),W=React.useRef(null),Q=React.useRef(null),Z=o||Q,ie=B.filter(se=>{const te=se.name.toLowerCase().includes(q.toLowerCase());return R==="all"?te:R==="approved"?te&&!se.pending:R==="pending"?te&&se.pending:te});React.useEffect(()=>{g.length!==0&&(g.forEach(se=>{if(!se||se.role!="assistant")return;if(se.isComponent){J(xe=>[...xe,se.content]),ae(0);return}const te={id:se.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:e,senderName:"Assistant",timestamp:se.timestamp.getTime(),content:se.content};te.content=marked(te.content??"Please ask again.",{async:!1}),ce(te)}),b())},[g]);function ce(se){const te=[se.fromPartnerID,se.toPartnerID];te.sort(),L(xe=>{let oe=!1;const be=xe.map(_e=>_e.partner1!==te[0]||_e.partner2!==te[1]||_e.messages.findIndex(Ce=>Ce.id==se.id)!==-1?_e:(oe=!0,{..._e,unread:_e.unread+1,messages:[..._e.messages,se]}));return oe&&j([te[0],te[1]]),be})}React.useEffect(()=>{const se=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":e}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return se.on("ReceiveMessage",ce),se.start().catch(te=>console.error("Error connecting to SignalR hub:",te)),U(se),()=>{se&&se.stop()}},[e]),React.useEffect(()=>{(I==null?void 0:I[0])!==(N==null?void 0:N[0])||(I==null?void 0:I[1])!==(N==null?void 0:N[1])||(L(se=>se.map(te=>te.partner1===(N==null?void 0:N[0])&&te.partner2===(N==null?void 0:N[1])?{...te,unread:0}:te)),setTimeout(()=>{var se;return(se=W.current)==null?void 0:se.scrollIntoView({behavior:"smooth"})},50))},[I,N]),React.useEffect(()=>{var te;if(!N)return;const se=getActiveChatObject(B,N);se&&((te=Z.current)==null||te.focus(),ae(G.length),p({applicationId:se.partner1===e?se.partner2:se.partner1}).then(xe=>{xe.data&&(J(oe=>[...oe,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:xe.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),ae(0))}),se.historyFetched?(L(xe=>xe.map(oe=>oe.partner1===N[0]&&oe.partner2===N[1]?{...oe,unread:0}:oe)),setTimeout(()=>{var xe;return(xe=W.current)==null?void 0:xe.scrollIntoView({behavior:"smooth"})},50)):f({applicationId:e,conversationId:se.conversationID}).unwrap().then(xe=>{const oe=xe.map(be=>({id:"history"+be.MessageId,fromPartnerID:be.SenderId,toPartnerID:be.SenderId==N[0]?N[1]:N[0],senderName:be.SenderName??"missing name",timestamp:new Date(be.SentDate+"Z").getTime(),content:be.Content??"no content"}));L(be=>be.map(_e=>_e.partner1===N[0]&&_e.partner2===N[1]?{..._e,messages:oe,historyFetched:!0}:_e)),setTimeout(()=>{var be;return(be=W.current)==null?void 0:be.scrollIntoView({behavior:"smooth"})},100)}).catch(xe=>{console.error("Error fetching conversation messages:",xe)}))},[N,f,e]);const ue=(se,te,xe)=>{const oe={id:crypto.randomUUID(),senderName:t,fromPartnerID:e,toPartnerID:te[0]===e?te[1]:te[0],content:se,timestamp:Date.now()};L(be=>be.map(_e=>_e.partner1===te[0]&&_e.partner2===te[1]?{..._e,messages:[..._e.messages,oe]}:_e)),j([te[0],te[1]]),oe.toPartnerID==ASSISTANT_ID?m(oe.content):xe.invoke("NewMessage",oe).catch(be=>console.error("Error sending message:",be)),M("")},fe=(se,te)=>{if(!B.length||!H||!_)return!1;const xe=B.find(oe=>oe.conversationID===se);return xe?(O([xe.partner1,xe.partner2]),te&&setTimeout(()=>ue(te,[xe.partner1,xe.partner2],H),100),!0):!1};if(React.useImperativeHandle(l,()=>({setActiveChatAndSendMessage:fe})),!_)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"flex items-center justify-center p-8",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),jsxRuntime.jsx("p",{children:"Loading API functions..."})]})})});const pe=()=>{!V.trim()||!N||!H||(ae(G.length),ue(V,N,H))},ve=()=>{const te={messages:B.find(xe=>xe.partner1===ASSISTANT_ID||xe.partner2===ASSISTANT_ID),debug:S};d({applicationId:e,emailAddress:t,body:te})},he=()=>{L(se=>se.map(xe=>xe.partner1!==ASSISTANT_ID&&xe.partner2!==ASSISTANT_ID?xe:{...xe,messages:[]})),C()};return jsxRuntime.jsxs("div",{className:"flex h-[85vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),B.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:q,onChange:se=>F(se.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:R,onValueChange:A,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-8 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"all",className:"text-xs col-span-2",children:"All"}),jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsx(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:"Pending"})]})})]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:B.length&&jsxRuntime.jsx(ChatList,{userId:e,chats:ie.filter(se=>se.partner1!=ASSISTANT_ID&&se.partner2!=ASSISTANT_ID),activeChat:getActiveChatObject(B,N)??null,onSelectChat:O,assistantChat:B.find(se=>se.partner1==ASSISTANT_ID||se.partner2==ASSISTANT_ID)})})]}),jsxRuntime.jsx("div",{className:"flex-1 flex flex-col",children:N?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:N[0]==ASSISTANT_ID||N[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-auto",onClick:()=>he(),children:jsxRuntime.jsx(MessageCircleX,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>ve()},children:jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5"})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${N[0]===e?N[1]:N[0]}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:(ye=getActiveChatObject(B,N))==null?void 0:ye.name})]})}),(de=getActiveChatObject(B,N))!=null&&de.pending?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is still awaiting approval — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:((le=getActiveChatObject(B,N))==null?void 0:le.messages)??[],currentUserId:e,isAssistantChat:isAssistantChat(N),botStatus:isAssistantChat(N)?E:""}),jsxRuntime.jsx("div",{ref:W})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t flex",children:[jsxRuntime.jsx(Textarea,{ref:Z,placeholder:"Type a message...",value:V,onChange:se=>M(se.target.value),onKeyDown:se=>{se.key!=="Enter"||se.shiftKey||(se.preventDefault(),pe())},className:"flex-1 resize-none"}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:"ml-2 h-15 w-15",disabled:E!=="",onClick:pe,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsxs("div",{className:"w-[480px] flex flex-1 flex-col border-l",children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Visuals and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 pl-2 pr-2 bg-slate-50",children:ee>=0&&G.length>ee&&G[G.length-(1+ee)]}),jsxRuntime.jsxs("div",{className:"flex bg-slate-50 border-t pt-1 pb-1 justify-center gap-4",children:[jsxRuntime.jsx(Button,{size:"icon",onClick:()=>ae(se=>se+1),children:jsxRuntime.jsx(ChevronLeft,{})}),jsxRuntime.jsx(Button,{size:"icon",onClick:()=>ae(se=>se-1),children:jsxRuntime.jsx(ChevronRight,{})})]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:S.map(se=>jsxRuntime.jsx("p",{className:"text-slate-600",children:se}))})})]})]})});function getActiveChatObject(e,t){return e.find(n=>n.partner1==(t==null?void 0:t[0])&&n.partner2==(t==null?void 0:t[1]))}function isAssistantChat(e){return(e==null?void 0:e[0])==ASSISTANT_ID||(e==null?void 0:e[1])==ASSISTANT_ID}function QualificationBadge({qualification:e}){return!e.QualificationId||e.QualificationId==="Suspended"?null:e.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:"pr-1",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),e.QualificationId,e.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:e.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function ManufacturerCard({manufacturer:e,link:t,linkNewTab:n=!0,actions:o,mainAction:l,loading:u=!1}){var E,C,R;if(u||!e)return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const p=e.ManufacturerId||"N/A",d=e.PublicName||"N/A",f=[e.City,e.Province,e.Country].filter(Boolean),m=f.length>0?f.join(", "):"",g=((E=e.Tags)==null?void 0:E.split(",").map(A=>A.trim()).filter(Boolean))||[],b=A=>A===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(A),S=(A=>!A||A.length===0?[]:[...A].sort((N,O)=>(N.Day||0)-(O.Day||0)).map(N=>({date:N.Day||0,amount:N.ExtendedPrice||0})))(e.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:t??"#",target:t&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${p}/Account/Logo?width=64&height=64`,alt:`${d}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:p})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"}),e.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:e.Name}),m&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:m})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:S.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:S,height:60,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((C=e.Qualification)!=null&&C.QualificationId)&&((R=e.Qualification)==null?void 0:R.QualificationId)!=="Suspended"||!!e.OpenToWork||g.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:e.Qualification??{}}),!!e.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!e.OnHold&&e.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),g.map((A,N)=>jsxRuntime.jsx(Badge,{variant:"outline",children:A},N))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[e.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${e.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Phone})]}),e.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${e.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.PublicEmail})]}),e.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:e.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Website})]}),e.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.CurrencyCode})]})]})]}),e.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:b(e.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:b(e.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:b(e.SalesData.SalesLast30Days)})]})]})}),(o||t||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[t&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{size:"icon",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:t,target:n?"_blank":"_self",children:[jsxRuntime.jsx(Eye,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"View Manufacturer"})]})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"View Manufacturer"})})]})}),o&&o]}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function ResellerCard({reseller:e,link:t,actions:n,loading:o=!1}){var m,g;const l=b=>b===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(b);if(o||!e)return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const u=e.ResellerId||"N/A",p=e.PublicName||"N/A",d=[e.City,e.Province,e.Country].filter(Boolean),f=d.length>0?d.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${u}/Account/Logo?width=64&height=64`,alt:`${p}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:u})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"}),e.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:e.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:f})]})]}),!!e.OnHold&&e.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[!!((m=e.Qualification)!=null&&m.QualificationId)&&((g=e.Qualification)==null?void 0:g.QualificationId)!=="Suspended"&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jsxRuntime.jsx(QualificationBadge,{qualification:e.Qualification??{}})}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[e.Phone&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Phone})]}),e.PublicEmail&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.PublicEmail})]}),e.Website&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Website})]}),e.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.CurrencyCode})]})]})]}),(e==null?void 0:e.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesLast30Days)})]})]})}),(n||t)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 ${n?"justify-between":"justify-end"}`,children:[n&&n,t&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:t,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}const Topbar=React.forwardRef(({onSignOut:e,handleValidSearch:t,rightMenu:n,searchPlaceholder:o},l)=>{const[u,p]=React.useState(""),d=reactRouterDom.useLocation(),{toast:f}=useToast();React.useEffect(()=>{const _=new URLSearchParams(d.search).get("q");_&&p(_)},[d.search]);const m=()=>{const b=u.trim();if(!b||b.length<2){f({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}t(b)},g=b=>{b.key==="Enter"&&m()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:m,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:u,onChange:b=>p(b.target.value),onKeyDown:g,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),e&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:e,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:e,loading:t=!1}){const n=u=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(u),o=React.useMemo(()=>{if(!e||e.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const u=e.filter(A=>A.DocumentType==="Order"),p=e.filter(A=>A.DocumentType==="Shipment"),d=u.filter(A=>A.WarehouseCode!=="3PLE"),f=d.reduce((A,N)=>A+(N.Quantity||0),0),m=d.reduce((A,N)=>A+(N.ExtendedPrice||0),0),g=u.filter(A=>A.WarehouseCode==="3PLE"),b=g.reduce((A,N)=>A+(N.Quantity||0),0),_=g.reduce((A,N)=>A+(N.ExtendedPrice||0),0),S=p.length,E=p.reduce((A,N)=>A+(N.ExtendedPrice||0),0),C=f+b+S,R=m+_+E;return{all:{orders:C,amount:R},processing:{orders:f,amount:m},shipped:{orders:S,amount:E},delayed:{orders:b,amount:_}}},[e]),l=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:o.all.orders,amount:o.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:o.processing.orders,amount:o.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:o.shipped.orders,amount:o.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:o.delayed.orders,amount:o.delayed.amount}];return t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(u=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},u))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:l.map(u=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${u.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:u.name}),jsxRuntime.jsx("div",{className:`${u.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(u.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:u.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:n(u.amount)})]})]})]})]},u.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(e,t,n)=>{n=e!=null?__create(__getProtoOf(e)):{};const o=t||!e||!e.__esModule?__defProp(n,"default",{value:e,enumerable:!0}):n;for(let l of __getOwnPropNames(e))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>e[l],enumerable:!0});return o},__commonJS=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),require_xhtml=__commonJS((e,t)=>{t.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((e,t)=>{(function(n,o){typeof e=="object"&&typeof t<"u"?o(e):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(e,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],u="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",p="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",d={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},f="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",m={5:f,"5module":f+" export import",6:f+" const class extends export import super"},g=/^in(stanceof)?$/,b=new RegExp("["+p+"]"),_=new RegExp("["+p+u+"]");function S(T,D){for(var z=65536,K=0;K<D.length;K+=2){if(z+=D[K],z>T)return!1;if(z+=D[K+1],z>=T)return!0}return!1}function E(T,D){return T<65?T===36:T<91?!0:T<97?T===95:T<123?!0:T<=65535?T>=170&&b.test(String.fromCharCode(T)):D===!1?!1:S(T,l)}function C(T,D){return T<48?T===36:T<58?!0:T<65?!1:T<91?!0:T<97?T===95:T<123?!0:T<=65535?T>=170&&_.test(String.fromCharCode(T)):D===!1?!1:S(T,l)||S(T,o)}var R=function(D,z){z===void 0&&(z={}),this.label=D,this.keyword=z.keyword,this.beforeExpr=!!z.beforeExpr,this.startsExpr=!!z.startsExpr,this.isLoop=!!z.isLoop,this.isAssign=!!z.isAssign,this.prefix=!!z.prefix,this.postfix=!!z.postfix,this.binop=z.binop||null,this.updateContext=null};function A(T,D){return new R(T,{beforeExpr:!0,binop:D})}var N={beforeExpr:!0},O={startsExpr:!0},V={};function M(T,D){return D===void 0&&(D={}),D.keyword=T,V[T]=new R(T,D)}var I={num:new R("num",O),regexp:new R("regexp",O),string:new R("string",O),name:new R("name",O),privateId:new R("privateId",O),eof:new R("eof"),bracketL:new R("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new R("]"),braceL:new R("{",{beforeExpr:!0,startsExpr:!0}),braceR:new R("}"),parenL:new R("(",{beforeExpr:!0,startsExpr:!0}),parenR:new R(")"),comma:new R(",",N),semi:new R(";",N),colon:new R(":",N),dot:new R("."),question:new R("?",N),questionDot:new R("?."),arrow:new R("=>",N),template:new R("template"),invalidTemplate:new R("invalidTemplate"),ellipsis:new R("...",N),backQuote:new R("`",O),dollarBraceL:new R("${",{beforeExpr:!0,startsExpr:!0}),eq:new R("=",{beforeExpr:!0,isAssign:!0}),assign:new R("_=",{beforeExpr:!0,isAssign:!0}),incDec:new R("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new R("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:A("||",1),logicalAND:A("&&",2),bitwiseOR:A("|",3),bitwiseXOR:A("^",4),bitwiseAND:A("&",5),equality:A("==/!=/===/!==",6),relational:A("</>/<=/>=",7),bitShift:A("<</>>/>>>",8),plusMin:new R("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:A("%",10),star:A("*",10),slash:A("/",10),starstar:new R("**",{beforeExpr:!0}),coalesce:A("??",1),_break:M("break"),_case:M("case",N),_catch:M("catch"),_continue:M("continue"),_debugger:M("debugger"),_default:M("default",N),_do:M("do",{isLoop:!0,beforeExpr:!0}),_else:M("else",N),_finally:M("finally"),_for:M("for",{isLoop:!0}),_function:M("function",O),_if:M("if"),_return:M("return",N),_switch:M("switch"),_throw:M("throw",N),_try:M("try"),_var:M("var"),_const:M("const"),_while:M("while",{isLoop:!0}),_with:M("with"),_new:M("new",{beforeExpr:!0,startsExpr:!0}),_this:M("this",O),_super:M("super",O),_class:M("class",O),_extends:M("extends",N),_export:M("export"),_import:M("import",O),_null:M("null",O),_true:M("true",O),_false:M("false",O),_in:M("in",{beforeExpr:!0,binop:7}),_instanceof:M("instanceof",{beforeExpr:!0,binop:7}),_typeof:M("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:M("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:M("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},j=/\r\n?|\n|\u2028|\u2029/,B=new RegExp(j.source,"g");function L(T){return T===10||T===13||T===8232||T===8233}function q(T,D,z){z===void 0&&(z=T.length);for(var K=D;K<z;K++){var ne=T.charCodeAt(K);if(L(ne))return K<z-1&&ne===13&&T.charCodeAt(K+1)===10?K+2:K+1}return-1}var F=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,H=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,U=Object.prototype,G=U.hasOwnProperty,J=U.toString,ee=Object.hasOwn||function(T,D){return G.call(T,D)},ae=Array.isArray||function(T){return J.call(T)==="[object Array]"},W=Object.create(null);function Q(T){return W[T]||(W[T]=new RegExp("^(?:"+T.replace(/ /g,"|")+")$"))}function Z(T){return T<=65535?String.fromCharCode(T):(T-=65536,String.fromCharCode((T>>10)+55296,(T&1023)+56320))}var ie=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ce=function(D,z){this.line=D,this.column=z};ce.prototype.offset=function(D){return new ce(this.line,this.column+D)};var ue=function(D,z,K){this.start=z,this.end=K,D.sourceFile!==null&&(this.source=D.sourceFile)};function fe(T,D){for(var z=1,K=0;;){var ne=q(T,K,D);if(ne<0)return new ce(z,D-K);++z,K=ne}}var pe={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ve=!1;function he(T){var D={};for(var z in pe)D[z]=T&&ee(T,z)?T[z]:pe[z];if(D.ecmaVersion==="latest"?D.ecmaVersion=1e8:D.ecmaVersion==null?(!ve&&typeof console=="object"&&console.warn&&(ve=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
860
+ `,m="/",g="*",b="",_="comment",S="declaration";inlineStyleParser=function(C,R){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];R=R||{};var A=1,N=1;function O(U){var G=U.match(t);G&&(A+=G.length);var J=U.lastIndexOf(f);N=~J?U.length-J:N+U.length}function V(){var U={line:A,column:N};return function(G){return G.position=new M(U),B(),G}}function M(U){this.start=U,this.end={line:A,column:N},this.source=R.source}M.prototype.content=C;function I(U){var G=new Error(R.source+":"+A+":"+N+": "+U);if(G.reason=U,G.filename=R.source,G.line=A,G.column=N,G.source=C,!R.silent)throw G}function j(U){var G=U.exec(C);if(G){var J=G[0];return O(J),C=C.slice(J.length),G}}function B(){j(n)}function L(U){var G;for(U=U||[];G=q();)G!==!1&&U.push(G);return U}function q(){var U=V();if(!(m!=C.charAt(0)||g!=C.charAt(1))){for(var G=2;b!=C.charAt(G)&&(g!=C.charAt(G)||m!=C.charAt(G+1));)++G;if(G+=2,b===C.charAt(G-1))return I("End of comment missing");var J=C.slice(2,G-2);return N+=2,O(J),C=C.slice(G),N+=2,U({type:_,comment:J})}}function F(){var U=V(),G=j(o);if(G){if(q(),!j(l))return I("property missing ':'");var J=j(u),ee=U({type:S,property:E(G[0].replace(e,b)),value:J?E(J[0].replace(e,b)):b});return j(p),ee}}function H(){var U=[];L(U);for(var G;G=F();)G!==!1&&(U.push(G),L(U));return U}return B(),H()};function E(C){return C?C.replace(d,b):b}return inlineStyleParser}var hasRequiredCjs$1;function requireCjs$1(){if(hasRequiredCjs$1)return cjs$1;hasRequiredCjs$1=1;var e=cjs$1&&cjs$1.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(cjs$1,"__esModule",{value:!0}),cjs$1.default=n;var t=e(requireInlineStyleParser());function n(o,l){var u=null;if(!o||typeof o!="string")return u;var p=(0,t.default)(o),d=typeof l=="function";return p.forEach(function(f){if(f.type==="declaration"){var m=f.property,g=f.value;d?l(m,g,f):g&&(u=u||{},u[m]=g)}}),u}return cjs$1}var utilities={},hasRequiredUtilities$1;function requireUtilities$1(){if(hasRequiredUtilities$1)return utilities;hasRequiredUtilities$1=1,Object.defineProperty(utilities,"__esModule",{value:!0}),utilities.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(m){return!m||n.test(m)||e.test(m)},p=function(m,g){return g.toUpperCase()},d=function(m,g){return"".concat(g,"-")},f=function(m,g){return g===void 0&&(g={}),u(m)?m:(m=m.toLowerCase(),g.reactCompat?m=m.replace(l,d):m=m.replace(o,d),m.replace(t,p))};return utilities.camelCase=f,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var e=cjs&&cjs.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(requireCjs$1()),n=requireUtilities$1();function o(l,u){var p={};return!l||typeof l!="string"||(0,t.default)(l,function(d,f){d&&f&&(p[(0,n.camelCase)(d,u)]=f)}),p}return o.default=o,cjs=o,cjs}var hasRequiredUtilities;function requireUtilities(){return hasRequiredUtilities||(hasRequiredUtilities=1,function(e){var t=utilities$1&&utilities$1.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=u,e.setStyleProp=d;var n=React,o=t(requireCjs()),l=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function u(g,b){return g.includes("-")?!l.has(g):!!(b&&typeof b.is=="string")}var p={reactCompat:!0};function d(g,b){if(typeof g=="string"){if(!g.trim()){b.style={};return}try{b.style=(0,o.default)(g,p)}catch{b.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var f=function(g){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(g.name)};e.canTextBeChildOfNode=f;var m=function(g){return g};e.returnFirstArg=m}(utilities$1)),utilities$1}var hasRequiredAttributesToProps;function requireAttributesToProps(){if(hasRequiredAttributesToProps)return attributesToProps;hasRequiredAttributesToProps=1,Object.defineProperty(attributesToProps,"__esModule",{value:!0}),attributesToProps.default=u;var e=requireLib$1(),t=requireUtilities(),n=["checked","value"],o=["input","select","textarea"],l={reset:!0,submit:!0};function u(d,f){d===void 0&&(d={});var m={},g=!!(d.type&&l[d.type]);for(var b in d){var _=d[b];if((0,e.isCustomAttribute)(b)){m[b]=_;continue}var S=b.toLowerCase(),E=p(S);if(E){var C=(0,e.getPropertyInfo)(E);switch(n.includes(E)&&o.includes(f)&&!g&&(E=p("default"+S)),m[E]=_,C&&C.type){case e.BOOLEAN:m[E]=!0;break;case e.OVERLOADED_BOOLEAN:_===""&&(m[E]=!0);break}continue}t.PRESERVE_CUSTOM_ATTRIBUTES&&(m[b]=_)}return(0,t.setStyleProp)(d.style,m),m}function p(d){return e.possibleStandardNames[d]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var e=domToReact&&domToReact.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=u;var t=React,n=e(requireAttributesToProps()),o=requireUtilities(),l={cloneElement:t.cloneElement,createElement:t.createElement,isValidElement:t.isValidElement};function u(d,f){f===void 0&&(f={});for(var m=[],g=typeof f.replace=="function",b=f.transform||o.returnFirstArg,_=f.library||l,S=_.cloneElement,E=_.createElement,C=_.isValidElement,R=d.length,A=0;A<R;A++){var N=d[A];if(g){var O=f.replace(N,A);if(C(O)){R>1&&(O=S(O,{key:O.key||A})),m.push(b(O,N,A));continue}}if(N.type==="text"){var V=!N.data.trim().length;if(V&&N.parent&&!(0,o.canTextBeChildOfNode)(N.parent)||f.trim&&V)continue;m.push(b(N.data,N,A));continue}var M=N,I={};p(M)?((0,o.setStyleProp)(M.attribs.style,M.attribs),I=M.attribs):M.attribs&&(I=(0,n.default)(M.attribs,M.name));var j=void 0;switch(N.type){case"script":case"style":N.children[0]&&(I.dangerouslySetInnerHTML={__html:N.children[0].data});break;case"tag":N.name==="textarea"&&N.children[0]?I.defaultValue=N.children[0].data:N.children&&N.children.length&&(j=u(N.children,f));break;default:continue}R>1&&(I.key=A),m.push(b(E(N.name,I,j),N,A))}return m.length===1?m[0]:m}function p(d){return o.PRESERVE_CUSTOM_ATTRIBUTES&&d.type==="tag"&&(0,o.isCustomComponent)(d.name,d.attribs)}return domToReact}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(e){var t=lib$3&&lib$3.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=d;var n=t(requireHtmlToDom());e.htmlToDOM=n.default;var o=t(requireAttributesToProps());e.attributesToProps=o.default;var l=t(requireDomToReact());e.domToReact=l.default;var u=requireLib$2();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return u.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return u.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return u.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return u.Text}});var p={lowerCaseAttributeNames:!1};function d(f,m){if(typeof f!="string")throw new TypeError("First argument must be a string");return f?(0,l.default)((0,n.default)(f,(m==null?void 0:m.htmlparser2)||p),m):[]}}(lib$3)),lib$3}var libExports=requireLib();const HTMLReactParser=getDefaultExportFromCjs(libExports),parser=HTMLReactParser.default||HTMLReactParser;function SkeletonMessage({botStatus:e}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:e})]})})]})]})}function ChatMessages({messages:e,currentUserId:t,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[e.map(l=>{const u=l.fromPartnerID===t;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",u&&"flex-row-reverse"),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 mt-1",children:jsxRuntime.jsx(AvatarImage,{src:`https://api.dicebear.com/9.x/thumbs/svg?seed=${md5(l.senderName+l.fromPartnerID)}&flip=${u}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[l.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const p=new Date(l.timestamp);return isToday(p)?p.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(p)?`Yesterday, ${p.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${p.toLocaleDateString([],{month:"short",day:"numeric"})} ${p.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]}),jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",u?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:l.fromPartnerID===ASSISTANT_ID?parser(l.content):l.content})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),e.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),e.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}const ASSISTANT_ID="RandmarAIChatAssistant",ChatLayout=React.forwardRef(({userId:e,userName:t,apiKey:n,inputRef:o},l)=>{var ye,de,le;const{data:u}=useGetV4PartnerByApplicationIdBusinessDevelopmentConversationsQuery({applicationId:e}),[p]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[d]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[f]=useLazyGetV4PartnerByApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:m,botMessages:g,clearBotMessages:b,botReady:_,debugMessages:S,botStatus:E,reset:C}=useAIAssistant({userId:e,apiKey:n});React.useEffect(()=>{if(!u)return;const se={partner1:[e,ASSISTANT_ID].sort()[0],partner2:[e,ASSISTANT_ID].sort()[1],name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},te=u.map(xe=>{var oe;return{partner1:[xe.Participant1,xe.Participant2].sort()[0],partner2:[xe.Participant1,xe.Participant2].sort()[1],name:((oe=xe.Participant)==null?void 0:oe.PublicName)??"missing public name",unread:0,pending:xe.Status!="Approved",historyFetched:!1,messages:[],conversationID:xe.ConversationId}});setTimeout(()=>{var xe;return(xe=Z.current)==null?void 0:xe.focus()},50),L([se,...te])},[u]);const[R,A]=React.useState("all"),[N,O]=React.useState([[e,ASSISTANT_ID].sort()[0],[e,ASSISTANT_ID].sort()[1]]),[V,M]=React.useState(""),[I,j]=React.useState(null),[B,L]=React.useState([]),[q,F]=React.useState(""),[H,U]=React.useState(null),[G,J]=React.useState([]),[ee,ae]=React.useState(0),W=React.useRef(null),Q=React.useRef(null),Z=o||Q,ie=B.filter(se=>{const te=se.name.toLowerCase().includes(q.toLowerCase());return R==="all"?te:R==="approved"?te&&!se.pending:R==="pending"?te&&se.pending:te});React.useEffect(()=>{g.length!==0&&(g.forEach(se=>{if(!se||se.role!="assistant")return;if(se.isComponent){J(xe=>[...xe,se.content]),ae(0);return}const te={id:se.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:e,senderName:"Assistant",timestamp:se.timestamp.getTime(),content:se.content};te.content=marked(te.content??"Please ask again.",{async:!1}),ce(te)}),b())},[g]);function ce(se){const te=[se.fromPartnerID,se.toPartnerID];te.sort(),L(xe=>{let oe=!1;const be=xe.map(_e=>_e.partner1!==te[0]||_e.partner2!==te[1]||_e.messages.findIndex(Ce=>Ce.id==se.id)!==-1?_e:(oe=!0,{..._e,unread:_e.unread+1,messages:[..._e.messages,se]}));return oe&&j([te[0],te[1]]),be})}React.useEffect(()=>{const se=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":e}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return se.on("ReceiveMessage",ce),se.start().catch(te=>console.error("Error connecting to SignalR hub:",te)),U(se),()=>{se&&se.stop()}},[e]),React.useEffect(()=>{(I==null?void 0:I[0])!==(N==null?void 0:N[0])||(I==null?void 0:I[1])!==(N==null?void 0:N[1])||(L(se=>se.map(te=>te.partner1===(N==null?void 0:N[0])&&te.partner2===(N==null?void 0:N[1])?{...te,unread:0}:te)),setTimeout(()=>{var se;return(se=W.current)==null?void 0:se.scrollIntoView({behavior:"smooth"})},50))},[I,N]),React.useEffect(()=>{var te;if(!N)return;const se=getActiveChatObject(B,N);se&&((te=Z.current)==null||te.focus(),ae(G.length),p({applicationId:se.partner1===e?se.partner2:se.partner1}).then(xe=>{xe.data&&(J(oe=>[...oe,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:xe.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),ae(0))}),se.historyFetched?(L(xe=>xe.map(oe=>oe.partner1===N[0]&&oe.partner2===N[1]?{...oe,unread:0}:oe)),setTimeout(()=>{var xe;return(xe=W.current)==null?void 0:xe.scrollIntoView({behavior:"smooth"})},50)):f({applicationId:e,conversationId:se.conversationID}).unwrap().then(xe=>{const oe=xe.map(be=>({id:"history"+be.MessageId,fromPartnerID:be.SenderId,toPartnerID:be.SenderId==N[0]?N[1]:N[0],senderName:be.SenderName??"missing name",timestamp:new Date(be.SentDate+"Z").getTime(),content:be.Content??"no content"}));L(be=>be.map(_e=>_e.partner1===N[0]&&_e.partner2===N[1]?{..._e,messages:oe,historyFetched:!0}:_e)),setTimeout(()=>{var be;return(be=W.current)==null?void 0:be.scrollIntoView({behavior:"smooth"})},100)}).catch(xe=>{console.error("Error fetching conversation messages:",xe)}))},[N,f,e]);const ue=(se,te,xe)=>{const oe={id:crypto.randomUUID(),senderName:t,fromPartnerID:e,toPartnerID:te[0]===e?te[1]:te[0],content:se,timestamp:Date.now()};L(be=>be.map(_e=>_e.partner1===te[0]&&_e.partner2===te[1]?{..._e,messages:[..._e.messages,oe]}:_e)),j([te[0],te[1]]),oe.toPartnerID==ASSISTANT_ID?m(oe.content):xe.invoke("NewMessage",oe).catch(be=>console.error("Error sending message:",be)),M("")},fe=(se,te)=>{if(!B.length||!H||!_)return!1;const xe=B.find(oe=>oe.conversationID===se);return xe?(O([xe.partner1,xe.partner2]),te&&setTimeout(()=>ue(te,[xe.partner1,xe.partner2],H),100),!0):!1};if(React.useImperativeHandle(l,()=>({setActiveChatAndSendMessage:fe})),!_)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"flex items-center justify-center p-8",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),jsxRuntime.jsx("p",{children:"Loading API functions..."})]})})});const pe=()=>{!V.trim()||!N||!H||(ae(G.length),ue(V,N,H))},ve=()=>{const te={messages:B.find(xe=>xe.partner1===ASSISTANT_ID||xe.partner2===ASSISTANT_ID),debug:S};d({applicationId:e,emailAddress:t,body:te})},he=()=>{L(se=>se.map(xe=>xe.partner1!==ASSISTANT_ID&&xe.partner2!==ASSISTANT_ID?xe:{...xe,messages:[]})),C()};return jsxRuntime.jsxs("div",{className:"flex h-[85vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),B.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:q,onChange:se=>F(se.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:R,onValueChange:A,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-8 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"all",className:"text-xs col-span-2",children:"All"}),jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsx(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:"Pending"})]})})]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:B.length&&jsxRuntime.jsx(ChatList,{userId:e,chats:ie.filter(se=>se.partner1!=ASSISTANT_ID&&se.partner2!=ASSISTANT_ID),activeChat:getActiveChatObject(B,N)??null,onSelectChat:O,assistantChat:B.find(se=>se.partner1==ASSISTANT_ID||se.partner2==ASSISTANT_ID)})})]}),jsxRuntime.jsx("div",{className:"flex-1 flex flex-col",children:N?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:N[0]==ASSISTANT_ID||N[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-auto",onClick:()=>he(),children:jsxRuntime.jsx(MessageCircleX,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>ve()},children:jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5"})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${N[0]===e?N[1]:N[0]}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:(ye=getActiveChatObject(B,N))==null?void 0:ye.name})]})}),(de=getActiveChatObject(B,N))!=null&&de.pending?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is still awaiting approval — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:((le=getActiveChatObject(B,N))==null?void 0:le.messages)??[],currentUserId:e,isAssistantChat:isAssistantChat(N),botStatus:isAssistantChat(N)?E:""}),jsxRuntime.jsx("div",{ref:W})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t flex",children:[jsxRuntime.jsx(Textarea,{ref:Z,placeholder:"Type a message...",value:V,onChange:se=>M(se.target.value),onKeyDown:se=>{se.key!=="Enter"||se.shiftKey||(se.preventDefault(),pe())},className:"flex-1 resize-none"}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:"ml-2 h-15 w-15",disabled:E!=="",onClick:pe,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsxs("div",{className:"w-[480px] flex flex-1 flex-col border-l",children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Visuals and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 pl-2 pr-2 bg-slate-50",children:ee>=0&&G.length>ee&&G[G.length-(1+ee)]}),jsxRuntime.jsxs("div",{className:"flex bg-slate-50 border-t pt-1 pb-1 justify-center gap-4",children:[jsxRuntime.jsx(Button,{size:"icon",onClick:()=>ae(se=>se+1),children:jsxRuntime.jsx(ChevronLeft,{})}),jsxRuntime.jsx(Button,{size:"icon",onClick:()=>ae(se=>se-1),children:jsxRuntime.jsx(ChevronRight,{})})]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:S.map(se=>jsxRuntime.jsx("p",{className:"text-slate-600",children:se}))})})]})]})});function getActiveChatObject(e,t){return e.find(n=>n.partner1==(t==null?void 0:t[0])&&n.partner2==(t==null?void 0:t[1]))}function isAssistantChat(e){return(e==null?void 0:e[0])==ASSISTANT_ID||(e==null?void 0:e[1])==ASSISTANT_ID}function QualificationBadge({qualification:e}){return!e.QualificationId||e.QualificationId==="Suspended"?null:e.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:e.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),e.QualificationId,e.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:e.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function ManufacturerCard({manufacturer:e,link:t,linkNewTab:n=!0,actions:o,mainAction:l,loading:u=!1}){var E,C,R;if(u||!e)return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const p=e.ManufacturerId||"N/A",d=e.PublicName||"N/A",f=[e.City,e.Province,e.Country].filter(Boolean),m=f.length>0?f.join(", "):"",g=((E=e.Tags)==null?void 0:E.split(",").map(A=>A.trim()).filter(Boolean))||[],b=A=>A===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(A),S=(A=>!A||A.length===0?[]:[...A].sort((N,O)=>(N.Day||0)-(O.Day||0)).map(N=>({date:N.Day||0,amount:N.ExtendedPrice||0})))(e.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:t??"#",target:t&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${p}/Account/Logo?width=64&height=64`,alt:`${d}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:p})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"}),e.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:e.Name}),m&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:m})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:S.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:S,height:60,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((C=e.Qualification)!=null&&C.QualificationId)&&((R=e.Qualification)==null?void 0:R.QualificationId)!=="Suspended"||!!e.OpenToWork||g.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:e.Qualification??{}}),!!e.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!e.OnHold&&e.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),g.map((A,N)=>jsxRuntime.jsx(Badge,{variant:"outline",children:A},N))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[e.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${e.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Phone})]}),e.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${e.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.PublicEmail})]}),e.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:e.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Website})]}),e.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.CurrencyCode})]})]})]}),e.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:b(e.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:b(e.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:b(e.SalesData.SalesLast30Days)})]})]})}),(o||t||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[t&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{size:"icon",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:t,target:n?"_blank":"_self",children:[jsxRuntime.jsx(Eye,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"View Manufacturer"})]})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"View Manufacturer"})})]})}),o&&o]}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function ResellerCard({reseller:e,link:t,actions:n,loading:o=!1}){var m,g;const l=b=>b===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(b);if(o||!e)return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const u=e.ResellerId||"N/A",p=e.PublicName||"N/A",d=[e.City,e.Province,e.Country].filter(Boolean),f=d.length>0?d.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${u}/Account/Logo?width=64&height=64`,alt:`${p}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:u})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"}),e.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:e.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:f})]})]}),!!e.OnHold&&e.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[!!((m=e.Qualification)!=null&&m.QualificationId)&&((g=e.Qualification)==null?void 0:g.QualificationId)!=="Suspended"&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jsxRuntime.jsx(QualificationBadge,{qualification:e.Qualification??{}})}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[e.Phone&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Phone})]}),e.PublicEmail&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.PublicEmail})]}),e.Website&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Website})]}),e.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.CurrencyCode})]})]})]}),(e==null?void 0:e.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesLast30Days)})]})]})}),(n||t)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 ${n?"justify-between":"justify-end"}`,children:[n&&n,t&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:t,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}const Topbar=React.forwardRef(({onSignOut:e,handleValidSearch:t,rightMenu:n,searchPlaceholder:o},l)=>{const[u,p]=React.useState(""),d=reactRouterDom.useLocation(),{toast:f}=useToast();React.useEffect(()=>{const _=new URLSearchParams(d.search).get("q");_&&p(_)},[d.search]);const m=()=>{const b=u.trim();if(!b||b.length<2){f({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}t(b)},g=b=>{b.key==="Enter"&&m()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:m,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:u,onChange:b=>p(b.target.value),onKeyDown:g,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),e&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:e,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:e,loading:t=!1}){const n=u=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(u),o=React.useMemo(()=>{if(!e||e.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const u=e.filter(A=>A.DocumentType==="Order"),p=e.filter(A=>A.DocumentType==="Shipment"),d=u.filter(A=>A.WarehouseCode!=="3PLE"),f=d.reduce((A,N)=>A+(N.Quantity||0),0),m=d.reduce((A,N)=>A+(N.ExtendedPrice||0),0),g=u.filter(A=>A.WarehouseCode==="3PLE"),b=g.reduce((A,N)=>A+(N.Quantity||0),0),_=g.reduce((A,N)=>A+(N.ExtendedPrice||0),0),S=p.length,E=p.reduce((A,N)=>A+(N.ExtendedPrice||0),0),C=f+b+S,R=m+_+E;return{all:{orders:C,amount:R},processing:{orders:f,amount:m},shipped:{orders:S,amount:E},delayed:{orders:b,amount:_}}},[e]),l=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:o.all.orders,amount:o.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:o.processing.orders,amount:o.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:o.shipped.orders,amount:o.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:o.delayed.orders,amount:o.delayed.amount}];return t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(u=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},u))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:l.map(u=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${u.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:u.name}),jsxRuntime.jsx("div",{className:`${u.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(u.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:u.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:n(u.amount)})]})]})]})]},u.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(e,t,n)=>{n=e!=null?__create(__getProtoOf(e)):{};const o=t||!e||!e.__esModule?__defProp(n,"default",{value:e,enumerable:!0}):n;for(let l of __getOwnPropNames(e))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>e[l],enumerable:!0});return o},__commonJS=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),require_xhtml=__commonJS((e,t)=>{t.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((e,t)=>{(function(n,o){typeof e=="object"&&typeof t<"u"?o(e):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(e,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],u="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",p="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",d={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},f="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",m={5:f,"5module":f+" export import",6:f+" const class extends export import super"},g=/^in(stanceof)?$/,b=new RegExp("["+p+"]"),_=new RegExp("["+p+u+"]");function S(T,D){for(var z=65536,K=0;K<D.length;K+=2){if(z+=D[K],z>T)return!1;if(z+=D[K+1],z>=T)return!0}return!1}function E(T,D){return T<65?T===36:T<91?!0:T<97?T===95:T<123?!0:T<=65535?T>=170&&b.test(String.fromCharCode(T)):D===!1?!1:S(T,l)}function C(T,D){return T<48?T===36:T<58?!0:T<65?!1:T<91?!0:T<97?T===95:T<123?!0:T<=65535?T>=170&&_.test(String.fromCharCode(T)):D===!1?!1:S(T,l)||S(T,o)}var R=function(D,z){z===void 0&&(z={}),this.label=D,this.keyword=z.keyword,this.beforeExpr=!!z.beforeExpr,this.startsExpr=!!z.startsExpr,this.isLoop=!!z.isLoop,this.isAssign=!!z.isAssign,this.prefix=!!z.prefix,this.postfix=!!z.postfix,this.binop=z.binop||null,this.updateContext=null};function A(T,D){return new R(T,{beforeExpr:!0,binop:D})}var N={beforeExpr:!0},O={startsExpr:!0},V={};function M(T,D){return D===void 0&&(D={}),D.keyword=T,V[T]=new R(T,D)}var I={num:new R("num",O),regexp:new R("regexp",O),string:new R("string",O),name:new R("name",O),privateId:new R("privateId",O),eof:new R("eof"),bracketL:new R("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new R("]"),braceL:new R("{",{beforeExpr:!0,startsExpr:!0}),braceR:new R("}"),parenL:new R("(",{beforeExpr:!0,startsExpr:!0}),parenR:new R(")"),comma:new R(",",N),semi:new R(";",N),colon:new R(":",N),dot:new R("."),question:new R("?",N),questionDot:new R("?."),arrow:new R("=>",N),template:new R("template"),invalidTemplate:new R("invalidTemplate"),ellipsis:new R("...",N),backQuote:new R("`",O),dollarBraceL:new R("${",{beforeExpr:!0,startsExpr:!0}),eq:new R("=",{beforeExpr:!0,isAssign:!0}),assign:new R("_=",{beforeExpr:!0,isAssign:!0}),incDec:new R("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new R("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:A("||",1),logicalAND:A("&&",2),bitwiseOR:A("|",3),bitwiseXOR:A("^",4),bitwiseAND:A("&",5),equality:A("==/!=/===/!==",6),relational:A("</>/<=/>=",7),bitShift:A("<</>>/>>>",8),plusMin:new R("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:A("%",10),star:A("*",10),slash:A("/",10),starstar:new R("**",{beforeExpr:!0}),coalesce:A("??",1),_break:M("break"),_case:M("case",N),_catch:M("catch"),_continue:M("continue"),_debugger:M("debugger"),_default:M("default",N),_do:M("do",{isLoop:!0,beforeExpr:!0}),_else:M("else",N),_finally:M("finally"),_for:M("for",{isLoop:!0}),_function:M("function",O),_if:M("if"),_return:M("return",N),_switch:M("switch"),_throw:M("throw",N),_try:M("try"),_var:M("var"),_const:M("const"),_while:M("while",{isLoop:!0}),_with:M("with"),_new:M("new",{beforeExpr:!0,startsExpr:!0}),_this:M("this",O),_super:M("super",O),_class:M("class",O),_extends:M("extends",N),_export:M("export"),_import:M("import",O),_null:M("null",O),_true:M("true",O),_false:M("false",O),_in:M("in",{beforeExpr:!0,binop:7}),_instanceof:M("instanceof",{beforeExpr:!0,binop:7}),_typeof:M("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:M("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:M("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},j=/\r\n?|\n|\u2028|\u2029/,B=new RegExp(j.source,"g");function L(T){return T===10||T===13||T===8232||T===8233}function q(T,D,z){z===void 0&&(z=T.length);for(var K=D;K<z;K++){var ne=T.charCodeAt(K);if(L(ne))return K<z-1&&ne===13&&T.charCodeAt(K+1)===10?K+2:K+1}return-1}var F=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,H=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,U=Object.prototype,G=U.hasOwnProperty,J=U.toString,ee=Object.hasOwn||function(T,D){return G.call(T,D)},ae=Array.isArray||function(T){return J.call(T)==="[object Array]"},W=Object.create(null);function Q(T){return W[T]||(W[T]=new RegExp("^(?:"+T.replace(/ /g,"|")+")$"))}function Z(T){return T<=65535?String.fromCharCode(T):(T-=65536,String.fromCharCode((T>>10)+55296,(T&1023)+56320))}var ie=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ce=function(D,z){this.line=D,this.column=z};ce.prototype.offset=function(D){return new ce(this.line,this.column+D)};var ue=function(D,z,K){this.start=z,this.end=K,D.sourceFile!==null&&(this.source=D.sourceFile)};function fe(T,D){for(var z=1,K=0;;){var ne=q(T,K,D);if(ne<0)return new ce(z,D-K);++z,K=ne}}var pe={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ve=!1;function he(T){var D={};for(var z in pe)D[z]=T&&ee(T,z)?T[z]:pe[z];if(D.ecmaVersion==="latest"?D.ecmaVersion=1e8:D.ecmaVersion==null?(!ve&&typeof console=="object"&&console.warn&&(ve=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
861
861
  Defaulting to 2020, but this will stop working in the future.`)),D.ecmaVersion=11):D.ecmaVersion>=2015&&(D.ecmaVersion-=2009),D.allowReserved==null&&(D.allowReserved=D.ecmaVersion<5),(!T||T.allowHashBang==null)&&(D.allowHashBang=D.ecmaVersion>=14),ae(D.onToken)){var K=D.onToken;D.onToken=function(ne){return K.push(ne)}}return ae(D.onComment)&&(D.onComment=ye(D,D.onComment)),D}function ye(T,D){return function(z,K,ne,me,ge,Se){var Pe={type:z?"Block":"Line",value:K,start:ne,end:me};T.locations&&(Pe.loc=new ue(this,ge,Se)),T.ranges&&(Pe.range=[ne,me]),D.push(Pe)}}var de=1,le=2,se=4,te=8,xe=16,oe=32,be=64,_e=128,Ce=256,Te=de|le|Ce;function Ee(T,D){return le|(T?se:0)|(D?te:0)}var Me=0,Le=1,Ne=2,qe=3,Ue=4,Fe=5,$e=function(D,z,K){this.options=D=he(D),this.sourceFile=D.sourceFile,this.keywords=Q(m[D.ecmaVersion>=6?6:D.sourceType==="module"?"5module":5]);var ne="";D.allowReserved!==!0&&(ne=d[D.ecmaVersion>=6?6:D.ecmaVersion===5?5:3],D.sourceType==="module"&&(ne+=" await")),this.reservedWords=Q(ne);var me=(ne?ne+" ":"")+d.strict;this.reservedWordsStrict=Q(me),this.reservedWordsStrictBind=Q(me+" "+d.strictBind),this.input=String(z),this.containsEsc=!1,K?(this.pos=K,this.lineStart=this.input.lastIndexOf(`
862
862
  `,K-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(j).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=I.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=D.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&D.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(de),this.regexpState=null,this.privateNameStack=[]},He={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};$e.prototype.parse=function(){var D=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(D)},He.inFunction.get=function(){return(this.currentVarScope().flags&le)>0},He.inGenerator.get=function(){return(this.currentVarScope().flags&te)>0&&!this.currentVarScope().inClassFieldInit},He.inAsync.get=function(){return(this.currentVarScope().flags&se)>0&&!this.currentVarScope().inClassFieldInit},He.canAwait.get=function(){for(var T=this.scopeStack.length-1;T>=0;T--){var D=this.scopeStack[T];if(D.inClassFieldInit||D.flags&Ce)return!1;if(D.flags&le)return(D.flags&se)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},He.allowSuper.get=function(){var T=this.currentThisScope(),D=T.flags,z=T.inClassFieldInit;return(D&be)>0||z||this.options.allowSuperOutsideMethod},He.allowDirectSuper.get=function(){return(this.currentThisScope().flags&_e)>0},He.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},He.allowNewDotTarget.get=function(){var T=this.currentThisScope(),D=T.flags,z=T.inClassFieldInit;return(D&(le|Ce))>0||z},He.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Ce)>0},$e.extend=function(){for(var D=[],z=arguments.length;z--;)D[z]=arguments[z];for(var K=this,ne=0;ne<D.length;ne++)K=D[ne](K);return K},$e.parse=function(D,z){return new this(z,D).parse()},$e.parseExpressionAt=function(D,z,K){var ne=new this(K,D,z);return ne.nextToken(),ne.parseExpression()},$e.tokenizer=function(D,z){return new this(z,D)},Object.defineProperties($e.prototype,He);var ze=$e.prototype,et=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ze.strictDirective=function(T){if(this.options.ecmaVersion<5)return!1;for(;;){H.lastIndex=T,T+=H.exec(this.input)[0].length;var D=et.exec(this.input.slice(T));if(!D)return!1;if((D[1]||D[2])==="use strict"){H.lastIndex=T+D[0].length;var z=H.exec(this.input),K=z.index+z[0].length,ne=this.input.charAt(K);return ne===";"||ne==="}"||j.test(z[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(ne)||ne==="!"&&this.input.charAt(K+1)==="=")}T+=D[0].length,H.lastIndex=T,T+=H.exec(this.input)[0].length,this.input[T]===";"&&T++}},ze.eat=function(T){return this.type===T?(this.next(),!0):!1},ze.isContextual=function(T){return this.type===I.name&&this.value===T&&!this.containsEsc},ze.eatContextual=function(T){return this.isContextual(T)?(this.next(),!0):!1},ze.expectContextual=function(T){this.eatContextual(T)||this.unexpected()},ze.canInsertSemicolon=function(){return this.type===I.eof||this.type===I.braceR||j.test(this.input.slice(this.lastTokEnd,this.start))},ze.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ze.semicolon=function(){!this.eat(I.semi)&&!this.insertSemicolon()&&this.unexpected()},ze.afterTrailingComma=function(T,D){if(this.type===T)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),D||this.next(),!0},ze.expect=function(T){this.eat(T)||this.unexpected()},ze.unexpected=function(T){this.raise(T??this.start,"Unexpected token")};var Je=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ze.checkPatternErrors=function(T,D){if(T){T.trailingComma>-1&&this.raiseRecoverable(T.trailingComma,"Comma is not permitted after the rest element");var z=D?T.parenthesizedAssign:T.parenthesizedBind;z>-1&&this.raiseRecoverable(z,D?"Assigning to rvalue":"Parenthesized pattern")}},ze.checkExpressionErrors=function(T,D){if(!T)return!1;var z=T.shorthandAssign,K=T.doubleProto;if(!D)return z>=0||K>=0;z>=0&&this.raise(z,"Shorthand property assignments are valid only in destructuring patterns"),K>=0&&this.raiseRecoverable(K,"Redefinition of __proto__ property")},ze.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},ze.isSimpleAssignTarget=function(T){return T.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(T.expression):T.type==="Identifier"||T.type==="MemberExpression"};var we=$e.prototype;we.parseTopLevel=function(T){var D=Object.create(null);for(T.body||(T.body=[]);this.type!==I.eof;){var z=this.parseStatement(null,!0,D);T.body.push(z)}if(this.inModule)for(var K=0,ne=Object.keys(this.undefinedExports);K<ne.length;K+=1){var me=ne[K];this.raiseRecoverable(this.undefinedExports[me].start,"Export '"+me+"' is not defined")}return this.adaptDirectivePrologue(T.body),this.next(),T.sourceType=this.options.sourceType,this.finishNode(T,"Program")};var ft={kind:"loop"},tt={kind:"switch"};we.isLet=function(T){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;H.lastIndex=this.pos;var D=H.exec(this.input),z=this.pos+D[0].length,K=this.input.charCodeAt(z);if(K===91||K===92)return!0;if(T)return!1;if(K===123||K>55295&&K<56320)return!0;if(E(K,!0)){for(var ne=z+1;C(K=this.input.charCodeAt(ne),!0);)++ne;if(K===92||K>55295&&K<56320)return!0;var me=this.input.slice(z,ne);if(!g.test(me))return!0}return!1},we.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;H.lastIndex=this.pos;var T=H.exec(this.input),D=this.pos+T[0].length,z;return!j.test(this.input.slice(this.pos,D))&&this.input.slice(D,D+8)==="function"&&(D+8===this.input.length||!(C(z=this.input.charCodeAt(D+8))||z>55295&&z<56320))},we.parseStatement=function(T,D,z){var K=this.type,ne=this.startNode(),me;switch(this.isLet(T)&&(K=I._var,me="let"),K){case I._break:case I._continue:return this.parseBreakContinueStatement(ne,K.keyword);case I._debugger:return this.parseDebuggerStatement(ne);case I._do:return this.parseDoStatement(ne);case I._for:return this.parseForStatement(ne);case I._function:return T&&(this.strict||T!=="if"&&T!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(ne,!1,!T);case I._class:return T&&this.unexpected(),this.parseClass(ne,!0);case I._if:return this.parseIfStatement(ne);case I._return:return this.parseReturnStatement(ne);case I._switch:return this.parseSwitchStatement(ne);case I._throw:return this.parseThrowStatement(ne);case I._try:return this.parseTryStatement(ne);case I._const:case I._var:return me=me||this.value,T&&me!=="var"&&this.unexpected(),this.parseVarStatement(ne,me);case I._while:return this.parseWhileStatement(ne);case I._with:return this.parseWithStatement(ne);case I.braceL:return this.parseBlock(!0,ne);case I.semi:return this.parseEmptyStatement(ne);case I._export:case I._import:if(this.options.ecmaVersion>10&&K===I._import){H.lastIndex=this.pos;var ge=H.exec(this.input),Se=this.pos+ge[0].length,Pe=this.input.charCodeAt(Se);if(Pe===40||Pe===46)return this.parseExpressionStatement(ne,this.parseExpression())}return this.options.allowImportExportEverywhere||(D||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),K===I._import?this.parseImport(ne):this.parseExport(ne,z);default:if(this.isAsyncFunction())return T&&this.unexpected(),this.next(),this.parseFunctionStatement(ne,!0,!T);var Oe=this.value,ke=this.parseExpression();return K===I.name&&ke.type==="Identifier"&&this.eat(I.colon)?this.parseLabeledStatement(ne,Oe,ke,T):this.parseExpressionStatement(ne,ke)}},we.parseBreakContinueStatement=function(T,D){var z=D==="break";this.next(),this.eat(I.semi)||this.insertSemicolon()?T.label=null:this.type!==I.name?this.unexpected():(T.label=this.parseIdent(),this.semicolon());for(var K=0;K<this.labels.length;++K){var ne=this.labels[K];if((T.label==null||ne.name===T.label.name)&&(ne.kind!=null&&(z||ne.kind==="loop")||T.label&&z))break}return K===this.labels.length&&this.raise(T.start,"Unsyntactic "+D),this.finishNode(T,z?"BreakStatement":"ContinueStatement")},we.parseDebuggerStatement=function(T){return this.next(),this.semicolon(),this.finishNode(T,"DebuggerStatement")},we.parseDoStatement=function(T){return this.next(),this.labels.push(ft),T.body=this.parseStatement("do"),this.labels.pop(),this.expect(I._while),T.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(I.semi):this.semicolon(),this.finishNode(T,"DoWhileStatement")},we.parseForStatement=function(T){this.next();var D=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(ft),this.enterScope(0),this.expect(I.parenL),this.type===I.semi)return D>-1&&this.unexpected(D),this.parseFor(T,null);var z=this.isLet();if(this.type===I._var||this.type===I._const||z){var K=this.startNode(),ne=z?"let":this.value;return this.next(),this.parseVar(K,!0,ne),this.finishNode(K,"VariableDeclaration"),(this.type===I._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&K.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===I._in?D>-1&&this.unexpected(D):T.await=D>-1),this.parseForIn(T,K)):(D>-1&&this.unexpected(D),this.parseFor(T,K))}var me=this.isContextual("let"),ge=!1,Se=this.containsEsc,Pe=new Je,Oe=this.start,ke=D>-1?this.parseExprSubscripts(Pe,"await"):this.parseExpression(!0,Pe);return this.type===I._in||(ge=this.options.ecmaVersion>=6&&this.isContextual("of"))?(D>-1?(this.type===I._in&&this.unexpected(D),T.await=!0):ge&&this.options.ecmaVersion>=8&&(ke.start===Oe&&!Se&&ke.type==="Identifier"&&ke.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(T.await=!1)),me&&ge&&this.raise(ke.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(ke,!1,Pe),this.checkLValPattern(ke),this.parseForIn(T,ke)):(this.checkExpressionErrors(Pe,!0),D>-1&&this.unexpected(D),this.parseFor(T,ke))},we.parseFunctionStatement=function(T,D,z){return this.next(),this.parseFunction(T,at|(z?0:Ht),!1,D)},we.parseIfStatement=function(T){return this.next(),T.test=this.parseParenExpression(),T.consequent=this.parseStatement("if"),T.alternate=this.eat(I._else)?this.parseStatement("if"):null,this.finishNode(T,"IfStatement")},we.parseReturnStatement=function(T){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(I.semi)||this.insertSemicolon()?T.argument=null:(T.argument=this.parseExpression(),this.semicolon()),this.finishNode(T,"ReturnStatement")},we.parseSwitchStatement=function(T){this.next(),T.discriminant=this.parseParenExpression(),T.cases=[],this.expect(I.braceL),this.labels.push(tt),this.enterScope(0);for(var D,z=!1;this.type!==I.braceR;)if(this.type===I._case||this.type===I._default){var K=this.type===I._case;D&&this.finishNode(D,"SwitchCase"),T.cases.push(D=this.startNode()),D.consequent=[],this.next(),K?D.test=this.parseExpression():(z&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),z=!0,D.test=null),this.expect(I.colon)}else D||this.unexpected(),D.consequent.push(this.parseStatement(null));return this.exitScope(),D&&this.finishNode(D,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(T,"SwitchStatement")},we.parseThrowStatement=function(T){return this.next(),j.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),T.argument=this.parseExpression(),this.semicolon(),this.finishNode(T,"ThrowStatement")};var mt=[];we.parseCatchClauseParam=function(){var T=this.parseBindingAtom(),D=T.type==="Identifier";return this.enterScope(D?oe:0),this.checkLValPattern(T,D?Ue:Ne),this.expect(I.parenR),T},we.parseTryStatement=function(T){if(this.next(),T.block=this.parseBlock(),T.handler=null,this.type===I._catch){var D=this.startNode();this.next(),this.eat(I.parenL)?D.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),D.param=null,this.enterScope(0)),D.body=this.parseBlock(!1),this.exitScope(),T.handler=this.finishNode(D,"CatchClause")}return T.finalizer=this.eat(I._finally)?this.parseBlock():null,!T.handler&&!T.finalizer&&this.raise(T.start,"Missing catch or finally clause"),this.finishNode(T,"TryStatement")},we.parseVarStatement=function(T,D,z){return this.next(),this.parseVar(T,!1,D,z),this.semicolon(),this.finishNode(T,"VariableDeclaration")},we.parseWhileStatement=function(T){return this.next(),T.test=this.parseParenExpression(),this.labels.push(ft),T.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(T,"WhileStatement")},we.parseWithStatement=function(T){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),T.object=this.parseParenExpression(),T.body=this.parseStatement("with"),this.finishNode(T,"WithStatement")},we.parseEmptyStatement=function(T){return this.next(),this.finishNode(T,"EmptyStatement")},we.parseLabeledStatement=function(T,D,z,K){for(var ne=0,me=this.labels;ne<me.length;ne+=1){var ge=me[ne];ge.name===D&&this.raise(z.start,"Label '"+D+"' is already declared")}for(var Se=this.type.isLoop?"loop":this.type===I._switch?"switch":null,Pe=this.labels.length-1;Pe>=0;Pe--){var Oe=this.labels[Pe];if(Oe.statementStart===T.start)Oe.statementStart=this.start,Oe.kind=Se;else break}return this.labels.push({name:D,kind:Se,statementStart:this.start}),T.body=this.parseStatement(K?K.indexOf("label")===-1?K+"label":K:"label"),this.labels.pop(),T.label=z,this.finishNode(T,"LabeledStatement")},we.parseExpressionStatement=function(T,D){return T.expression=D,this.semicolon(),this.finishNode(T,"ExpressionStatement")},we.parseBlock=function(T,D,z){for(T===void 0&&(T=!0),D===void 0&&(D=this.startNode()),D.body=[],this.expect(I.braceL),T&&this.enterScope(0);this.type!==I.braceR;){var K=this.parseStatement(null);D.body.push(K)}return z&&(this.strict=!1),this.next(),T&&this.exitScope(),this.finishNode(D,"BlockStatement")},we.parseFor=function(T,D){return T.init=D,this.expect(I.semi),T.test=this.type===I.semi?null:this.parseExpression(),this.expect(I.semi),T.update=this.type===I.parenR?null:this.parseExpression(),this.expect(I.parenR),T.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(T,"ForStatement")},we.parseForIn=function(T,D){var z=this.type===I._in;return this.next(),D.type==="VariableDeclaration"&&D.declarations[0].init!=null&&(!z||this.options.ecmaVersion<8||this.strict||D.kind!=="var"||D.declarations[0].id.type!=="Identifier")&&this.raise(D.start,(z?"for-in":"for-of")+" loop variable declaration may not have an initializer"),T.left=D,T.right=z?this.parseExpression():this.parseMaybeAssign(),this.expect(I.parenR),T.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(T,z?"ForInStatement":"ForOfStatement")},we.parseVar=function(T,D,z,K){for(T.declarations=[],T.kind=z;;){var ne=this.startNode();if(this.parseVarId(ne,z),this.eat(I.eq)?ne.init=this.parseMaybeAssign(D):!K&&z==="const"&&!(this.type===I._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!K&&ne.id.type!=="Identifier"&&!(D&&(this.type===I._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):ne.init=null,T.declarations.push(this.finishNode(ne,"VariableDeclarator")),!this.eat(I.comma))break}return T},we.parseVarId=function(T,D){T.id=this.parseBindingAtom(),this.checkLValPattern(T.id,D==="var"?Le:Ne,!1)};var at=1,Ht=2,Wt=4;we.parseFunction=function(T,D,z,K,ne){this.initFunction(T),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!K)&&(this.type===I.star&&D&Ht&&this.unexpected(),T.generator=this.eat(I.star)),this.options.ecmaVersion>=8&&(T.async=!!K),D&at&&(T.id=D&Wt&&this.type!==I.name?null:this.parseIdent(),T.id&&!(D&Ht)&&this.checkLValSimple(T.id,this.strict||T.generator||T.async?this.treatFunctionsAsVar?Le:Ne:qe));var me=this.yieldPos,ge=this.awaitPos,Se=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ee(T.async,T.generator)),D&at||(T.id=this.type===I.name?this.parseIdent():null),this.parseFunctionParams(T),this.parseFunctionBody(T,z,!1,ne),this.yieldPos=me,this.awaitPos=ge,this.awaitIdentPos=Se,this.finishNode(T,D&at?"FunctionDeclaration":"FunctionExpression")},we.parseFunctionParams=function(T){this.expect(I.parenL),T.params=this.parseBindingList(I.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},we.parseClass=function(T,D){this.next();var z=this.strict;this.strict=!0,this.parseClassId(T,D),this.parseClassSuper(T);var K=this.enterClassBody(),ne=this.startNode(),me=!1;for(ne.body=[],this.expect(I.braceL);this.type!==I.braceR;){var ge=this.parseClassElement(T.superClass!==null);ge&&(ne.body.push(ge),ge.type==="MethodDefinition"&&ge.kind==="constructor"?(me&&this.raiseRecoverable(ge.start,"Duplicate constructor in the same class"),me=!0):ge.key&&ge.key.type==="PrivateIdentifier"&&Pr(K,ge)&&this.raiseRecoverable(ge.key.start,"Identifier '#"+ge.key.name+"' has already been declared"))}return this.strict=z,this.next(),T.body=this.finishNode(ne,"ClassBody"),this.exitClassBody(),this.finishNode(T,D?"ClassDeclaration":"ClassExpression")},we.parseClassElement=function(T){if(this.eat(I.semi))return null;var D=this.options.ecmaVersion,z=this.startNode(),K="",ne=!1,me=!1,ge="method",Se=!1;if(this.eatContextual("static")){if(D>=13&&this.eat(I.braceL))return this.parseClassStaticBlock(z),z;this.isClassElementNameStart()||this.type===I.star?Se=!0:K="static"}if(z.static=Se,!K&&D>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===I.star)&&!this.canInsertSemicolon()?me=!0:K="async"),!K&&(D>=9||!me)&&this.eat(I.star)&&(ne=!0),!K&&!me&&!ne){var Pe=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?ge=Pe:K=Pe)}if(K?(z.computed=!1,z.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),z.key.name=K,this.finishNode(z.key,"Identifier")):this.parseClassElementName(z),D<13||this.type===I.parenL||ge!=="method"||ne||me){var Oe=!z.static&&Mt(z,"constructor"),ke=Oe&&T;Oe&&ge!=="method"&&this.raise(z.key.start,"Constructor can't have get/set modifier"),z.kind=Oe?"constructor":ge,this.parseClassMethod(z,ne,me,ke)}else this.parseClassField(z);return z},we.isClassElementNameStart=function(){return this.type===I.name||this.type===I.privateId||this.type===I.num||this.type===I.string||this.type===I.bracketL||this.type.keyword},we.parseClassElementName=function(T){this.type===I.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),T.computed=!1,T.key=this.parsePrivateIdent()):this.parsePropertyName(T)},we.parseClassMethod=function(T,D,z,K){var ne=T.key;T.kind==="constructor"?(D&&this.raise(ne.start,"Constructor can't be a generator"),z&&this.raise(ne.start,"Constructor can't be an async method")):T.static&&Mt(T,"prototype")&&this.raise(ne.start,"Classes may not have a static property named prototype");var me=T.value=this.parseMethod(D,z,K);return T.kind==="get"&&me.params.length!==0&&this.raiseRecoverable(me.start,"getter should have no params"),T.kind==="set"&&me.params.length!==1&&this.raiseRecoverable(me.start,"setter should have exactly one param"),T.kind==="set"&&me.params[0].type==="RestElement"&&this.raiseRecoverable(me.params[0].start,"Setter cannot use rest params"),this.finishNode(T,"MethodDefinition")},we.parseClassField=function(T){if(Mt(T,"constructor")?this.raise(T.key.start,"Classes can't have a field named 'constructor'"):T.static&&Mt(T,"prototype")&&this.raise(T.key.start,"Classes can't have a static field named 'prototype'"),this.eat(I.eq)){var D=this.currentThisScope(),z=D.inClassFieldInit;D.inClassFieldInit=!0,T.value=this.parseMaybeAssign(),D.inClassFieldInit=z}else T.value=null;return this.semicolon(),this.finishNode(T,"PropertyDefinition")},we.parseClassStaticBlock=function(T){T.body=[];var D=this.labels;for(this.labels=[],this.enterScope(Ce|be);this.type!==I.braceR;){var z=this.parseStatement(null);T.body.push(z)}return this.next(),this.exitScope(),this.labels=D,this.finishNode(T,"StaticBlock")},we.parseClassId=function(T,D){this.type===I.name?(T.id=this.parseIdent(),D&&this.checkLValSimple(T.id,Ne,!1)):(D===!0&&this.unexpected(),T.id=null)},we.parseClassSuper=function(T){T.superClass=this.eat(I._extends)?this.parseExprSubscripts(null,!1):null},we.enterClassBody=function(){var T={declared:Object.create(null),used:[]};return this.privateNameStack.push(T),T.declared},we.exitClassBody=function(){var T=this.privateNameStack.pop(),D=T.declared,z=T.used;if(this.options.checkPrivateFields)for(var K=this.privateNameStack.length,ne=K===0?null:this.privateNameStack[K-1],me=0;me<z.length;++me){var ge=z[me];ee(D,ge.name)||(ne?ne.used.push(ge):this.raiseRecoverable(ge.start,"Private field '#"+ge.name+"' must be declared in an enclosing class"))}};function Pr(T,D){var z=D.key.name,K=T[z],ne="true";return D.type==="MethodDefinition"&&(D.kind==="get"||D.kind==="set")&&(ne=(D.static?"s":"i")+D.kind),K==="iget"&&ne==="iset"||K==="iset"&&ne==="iget"||K==="sget"&&ne==="sset"||K==="sset"&&ne==="sget"?(T[z]="true",!1):K?!0:(T[z]=ne,!1)}function Mt(T,D){var z=T.computed,K=T.key;return!z&&(K.type==="Identifier"&&K.name===D||K.type==="Literal"&&K.value===D)}we.parseExportAllDeclaration=function(T,D){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(T.exported=this.parseModuleExportName(),this.checkExport(D,T.exported,this.lastTokStart)):T.exported=null),this.expectContextual("from"),this.type!==I.string&&this.unexpected(),T.source=this.parseExprAtom(),this.semicolon(),this.finishNode(T,"ExportAllDeclaration")},we.parseExport=function(T,D){if(this.next(),this.eat(I.star))return this.parseExportAllDeclaration(T,D);if(this.eat(I._default))return this.checkExport(D,"default",this.lastTokStart),T.declaration=this.parseExportDefaultDeclaration(),this.finishNode(T,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())T.declaration=this.parseExportDeclaration(T),T.declaration.type==="VariableDeclaration"?this.checkVariableExport(D,T.declaration.declarations):this.checkExport(D,T.declaration.id,T.declaration.id.start),T.specifiers=[],T.source=null;else{if(T.declaration=null,T.specifiers=this.parseExportSpecifiers(D),this.eatContextual("from"))this.type!==I.string&&this.unexpected(),T.source=this.parseExprAtom();else{for(var z=0,K=T.specifiers;z<K.length;z+=1){var ne=K[z];this.checkUnreserved(ne.local),this.checkLocalExport(ne.local),ne.local.type==="Literal"&&this.raise(ne.local.start,"A string literal cannot be used as an exported binding without `from`.")}T.source=null}this.semicolon()}return this.finishNode(T,"ExportNamedDeclaration")},we.parseExportDeclaration=function(T){return this.parseStatement(null)},we.parseExportDefaultDeclaration=function(){var T;if(this.type===I._function||(T=this.isAsyncFunction())){var D=this.startNode();return this.next(),T&&this.next(),this.parseFunction(D,at|Wt,!1,T)}else if(this.type===I._class){var z=this.startNode();return this.parseClass(z,"nullableID")}else{var K=this.parseMaybeAssign();return this.semicolon(),K}},we.checkExport=function(T,D,z){T&&(typeof D!="string"&&(D=D.type==="Identifier"?D.name:D.value),ee(T,D)&&this.raiseRecoverable(z,"Duplicate export '"+D+"'"),T[D]=!0)},we.checkPatternExport=function(T,D){var z=D.type;if(z==="Identifier")this.checkExport(T,D,D.start);else if(z==="ObjectPattern")for(var K=0,ne=D.properties;K<ne.length;K+=1){var me=ne[K];this.checkPatternExport(T,me)}else if(z==="ArrayPattern")for(var ge=0,Se=D.elements;ge<Se.length;ge+=1){var Pe=Se[ge];Pe&&this.checkPatternExport(T,Pe)}else z==="Property"?this.checkPatternExport(T,D.value):z==="AssignmentPattern"?this.checkPatternExport(T,D.left):z==="RestElement"&&this.checkPatternExport(T,D.argument)},we.checkVariableExport=function(T,D){if(T)for(var z=0,K=D;z<K.length;z+=1){var ne=K[z];this.checkPatternExport(T,ne.id)}},we.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},we.parseExportSpecifier=function(T){var D=this.startNode();return D.local=this.parseModuleExportName(),D.exported=this.eatContextual("as")?this.parseModuleExportName():D.local,this.checkExport(T,D.exported,D.exported.start),this.finishNode(D,"ExportSpecifier")},we.parseExportSpecifiers=function(T){var D=[],z=!0;for(this.expect(I.braceL);!this.eat(I.braceR);){if(z)z=!1;else if(this.expect(I.comma),this.afterTrailingComma(I.braceR))break;D.push(this.parseExportSpecifier(T))}return D},we.parseImport=function(T){return this.next(),this.type===I.string?(T.specifiers=mt,T.source=this.parseExprAtom()):(T.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),T.source=this.type===I.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(T,"ImportDeclaration")},we.parseImportSpecifier=function(){var T=this.startNode();return T.imported=this.parseModuleExportName(),this.eatContextual("as")?T.local=this.parseIdent():(this.checkUnreserved(T.imported),T.local=T.imported),this.checkLValSimple(T.local,Ne),this.finishNode(T,"ImportSpecifier")},we.parseImportDefaultSpecifier=function(){var T=this.startNode();return T.local=this.parseIdent(),this.checkLValSimple(T.local,Ne),this.finishNode(T,"ImportDefaultSpecifier")},we.parseImportNamespaceSpecifier=function(){var T=this.startNode();return this.next(),this.expectContextual("as"),T.local=this.parseIdent(),this.checkLValSimple(T.local,Ne),this.finishNode(T,"ImportNamespaceSpecifier")},we.parseImportSpecifiers=function(){var T=[],D=!0;if(this.type===I.name&&(T.push(this.parseImportDefaultSpecifier()),!this.eat(I.comma)))return T;if(this.type===I.star)return T.push(this.parseImportNamespaceSpecifier()),T;for(this.expect(I.braceL);!this.eat(I.braceR);){if(D)D=!1;else if(this.expect(I.comma),this.afterTrailingComma(I.braceR))break;T.push(this.parseImportSpecifier())}return T},we.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===I.string){var T=this.parseLiteral(this.value);return ie.test(T.value)&&this.raise(T.start,"An export name cannot include a lone surrogate."),T}return this.parseIdent(!0)},we.adaptDirectivePrologue=function(T){for(var D=0;D<T.length&&this.isDirectiveCandidate(T[D]);++D)T[D].directive=T[D].expression.raw.slice(1,-1)},we.isDirectiveCandidate=function(T){return this.options.ecmaVersion>=5&&T.type==="ExpressionStatement"&&T.expression.type==="Literal"&&typeof T.expression.value=="string"&&(this.input[T.start]==='"'||this.input[T.start]==="'")};var Ye=$e.prototype;Ye.toAssignable=function(T,D,z){if(this.options.ecmaVersion>=6&&T)switch(T.type){case"Identifier":this.inAsync&&T.name==="await"&&this.raise(T.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":T.type="ObjectPattern",z&&this.checkPatternErrors(z,!0);for(var K=0,ne=T.properties;K<ne.length;K+=1){var me=ne[K];this.toAssignable(me,D),me.type==="RestElement"&&(me.argument.type==="ArrayPattern"||me.argument.type==="ObjectPattern")&&this.raise(me.argument.start,"Unexpected token")}break;case"Property":T.kind!=="init"&&this.raise(T.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(T.value,D);break;case"ArrayExpression":T.type="ArrayPattern",z&&this.checkPatternErrors(z,!0),this.toAssignableList(T.elements,D);break;case"SpreadElement":T.type="RestElement",this.toAssignable(T.argument,D),T.argument.type==="AssignmentPattern"&&this.raise(T.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":T.operator!=="="&&this.raise(T.left.end,"Only '=' operator can be used for specifying default value."),T.type="AssignmentPattern",delete T.operator,this.toAssignable(T.left,D);break;case"ParenthesizedExpression":this.toAssignable(T.expression,D,z);break;case"ChainExpression":this.raiseRecoverable(T.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!D)break;default:this.raise(T.start,"Assigning to rvalue")}else z&&this.checkPatternErrors(z,!0);return T},Ye.toAssignableList=function(T,D){for(var z=T.length,K=0;K<z;K++){var ne=T[K];ne&&this.toAssignable(ne,D)}if(z){var me=T[z-1];this.options.ecmaVersion===6&&D&&me&&me.type==="RestElement"&&me.argument.type!=="Identifier"&&this.unexpected(me.argument.start)}return T},Ye.parseSpread=function(T){var D=this.startNode();return this.next(),D.argument=this.parseMaybeAssign(!1,T),this.finishNode(D,"SpreadElement")},Ye.parseRestBinding=function(){var T=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==I.name&&this.unexpected(),T.argument=this.parseBindingAtom(),this.finishNode(T,"RestElement")},Ye.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case I.bracketL:var T=this.startNode();return this.next(),T.elements=this.parseBindingList(I.bracketR,!0,!0),this.finishNode(T,"ArrayPattern");case I.braceL:return this.parseObj(!0)}return this.parseIdent()},Ye.parseBindingList=function(T,D,z,K){for(var ne=[],me=!0;!this.eat(T);)if(me?me=!1:this.expect(I.comma),D&&this.type===I.comma)ne.push(null);else{if(z&&this.afterTrailingComma(T))break;if(this.type===I.ellipsis){var ge=this.parseRestBinding();this.parseBindingListItem(ge),ne.push(ge),this.type===I.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(T);break}else ne.push(this.parseAssignableListItem(K))}return ne},Ye.parseAssignableListItem=function(T){var D=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(D),D},Ye.parseBindingListItem=function(T){return T},Ye.parseMaybeDefault=function(T,D,z){if(z=z||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(I.eq))return z;var K=this.startNodeAt(T,D);return K.left=z,K.right=this.parseMaybeAssign(),this.finishNode(K,"AssignmentPattern")},Ye.checkLValSimple=function(T,D,z){D===void 0&&(D=Me);var K=D!==Me;switch(T.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(T.name)&&this.raiseRecoverable(T.start,(K?"Binding ":"Assigning to ")+T.name+" in strict mode"),K&&(D===Ne&&T.name==="let"&&this.raiseRecoverable(T.start,"let is disallowed as a lexically bound name"),z&&(ee(z,T.name)&&this.raiseRecoverable(T.start,"Argument name clash"),z[T.name]=!0),D!==Fe&&this.declareName(T.name,D,T.start));break;case"ChainExpression":this.raiseRecoverable(T.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":K&&this.raiseRecoverable(T.start,"Binding member expression");break;case"ParenthesizedExpression":return K&&this.raiseRecoverable(T.start,"Binding parenthesized expression"),this.checkLValSimple(T.expression,D,z);default:this.raise(T.start,(K?"Binding":"Assigning to")+" rvalue")}},Ye.checkLValPattern=function(T,D,z){switch(D===void 0&&(D=Me),T.type){case"ObjectPattern":for(var K=0,ne=T.properties;K<ne.length;K+=1){var me=ne[K];this.checkLValInnerPattern(me,D,z)}break;case"ArrayPattern":for(var ge=0,Se=T.elements;ge<Se.length;ge+=1){var Pe=Se[ge];Pe&&this.checkLValInnerPattern(Pe,D,z)}break;default:this.checkLValSimple(T,D,z)}},Ye.checkLValInnerPattern=function(T,D,z){switch(D===void 0&&(D=Me),T.type){case"Property":this.checkLValInnerPattern(T.value,D,z);break;case"AssignmentPattern":this.checkLValPattern(T.left,D,z);break;case"RestElement":this.checkLValPattern(T.argument,D,z);break;default:this.checkLValPattern(T,D,z)}};var Xe=function(D,z,K,ne,me){this.token=D,this.isExpr=!!z,this.preserveSpace=!!K,this.override=ne,this.generator=!!me},Ge={b_stat:new Xe("{",!1),b_expr:new Xe("{",!0),b_tmpl:new Xe("${",!1),p_stat:new Xe("(",!1),p_expr:new Xe("(",!0),q_tmpl:new Xe("`",!0,!0,function(T){return T.tryReadTemplateToken()}),f_stat:new Xe("function",!1),f_expr:new Xe("function",!0),f_expr_gen:new Xe("function",!0,!1,null,!0),f_gen:new Xe("function",!1,!1,null,!0)},lt=$e.prototype;lt.initialContext=function(){return[Ge.b_stat]},lt.curContext=function(){return this.context[this.context.length-1]},lt.braceIsBlock=function(T){var D=this.curContext();return D===Ge.f_expr||D===Ge.f_stat?!0:T===I.colon&&(D===Ge.b_stat||D===Ge.b_expr)?!D.isExpr:T===I._return||T===I.name&&this.exprAllowed?j.test(this.input.slice(this.lastTokEnd,this.start)):T===I._else||T===I.semi||T===I.eof||T===I.parenR||T===I.arrow?!0:T===I.braceL?D===Ge.b_stat:T===I._var||T===I._const||T===I.name?!1:!this.exprAllowed},lt.inGeneratorContext=function(){for(var T=this.context.length-1;T>=1;T--){var D=this.context[T];if(D.token==="function")return D.generator}return!1},lt.updateContext=function(T){var D,z=this.type;z.keyword&&T===I.dot?this.exprAllowed=!1:(D=z.updateContext)?D.call(this,T):this.exprAllowed=z.beforeExpr},lt.overrideContext=function(T){this.curContext()!==T&&(this.context[this.context.length-1]=T)},I.parenR.updateContext=I.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var T=this.context.pop();T===Ge.b_stat&&this.curContext().token==="function"&&(T=this.context.pop()),this.exprAllowed=!T.isExpr},I.braceL.updateContext=function(T){this.context.push(this.braceIsBlock(T)?Ge.b_stat:Ge.b_expr),this.exprAllowed=!0},I.dollarBraceL.updateContext=function(){this.context.push(Ge.b_tmpl),this.exprAllowed=!0},I.parenL.updateContext=function(T){var D=T===I._if||T===I._for||T===I._with||T===I._while;this.context.push(D?Ge.p_stat:Ge.p_expr),this.exprAllowed=!0},I.incDec.updateContext=function(){},I._function.updateContext=I._class.updateContext=function(T){T.beforeExpr&&T!==I._else&&!(T===I.semi&&this.curContext()!==Ge.p_stat)&&!(T===I._return&&j.test(this.input.slice(this.lastTokEnd,this.start)))&&!((T===I.colon||T===I.braceL)&&this.curContext()===Ge.b_stat)?this.context.push(Ge.f_expr):this.context.push(Ge.f_stat),this.exprAllowed=!1},I.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},I.backQuote.updateContext=function(){this.curContext()===Ge.q_tmpl?this.context.pop():this.context.push(Ge.q_tmpl),this.exprAllowed=!1},I.star.updateContext=function(T){if(T===I._function){var D=this.context.length-1;this.context[D]===Ge.f_expr?this.context[D]=Ge.f_expr_gen:this.context[D]=Ge.f_gen}this.exprAllowed=!0},I.name.updateContext=function(T){var D=!1;this.options.ecmaVersion>=6&&T!==I.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(D=!0),this.exprAllowed=D};var Ie=$e.prototype;Ie.checkPropClash=function(T,D,z){if(!(this.options.ecmaVersion>=9&&T.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(T.computed||T.method||T.shorthand))){var K=T.key,ne;switch(K.type){case"Identifier":ne=K.name;break;case"Literal":ne=String(K.value);break;default:return}var me=T.kind;if(this.options.ecmaVersion>=6){ne==="__proto__"&&me==="init"&&(D.proto&&(z?z.doubleProto<0&&(z.doubleProto=K.start):this.raiseRecoverable(K.start,"Redefinition of __proto__ property")),D.proto=!0);return}ne="$"+ne;var ge=D[ne];if(ge){var Se;me==="init"?Se=this.strict&&ge.init||ge.get||ge.set:Se=ge.init||ge[me],Se&&this.raiseRecoverable(K.start,"Redefinition of property")}else ge=D[ne]={init:!1,get:!1,set:!1};ge[me]=!0}},Ie.parseExpression=function(T,D){var z=this.start,K=this.startLoc,ne=this.parseMaybeAssign(T,D);if(this.type===I.comma){var me=this.startNodeAt(z,K);for(me.expressions=[ne];this.eat(I.comma);)me.expressions.push(this.parseMaybeAssign(T,D));return this.finishNode(me,"SequenceExpression")}return ne},Ie.parseMaybeAssign=function(T,D,z){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(T);this.exprAllowed=!1}var K=!1,ne=-1,me=-1,ge=-1;D?(ne=D.parenthesizedAssign,me=D.trailingComma,ge=D.doubleProto,D.parenthesizedAssign=D.trailingComma=-1):(D=new Je,K=!0);var Se=this.start,Pe=this.startLoc;(this.type===I.parenL||this.type===I.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=T==="await");var Oe=this.parseMaybeConditional(T,D);if(z&&(Oe=z.call(this,Oe,Se,Pe)),this.type.isAssign){var ke=this.startNodeAt(Se,Pe);return ke.operator=this.value,this.type===I.eq&&(Oe=this.toAssignable(Oe,!1,D)),K||(D.parenthesizedAssign=D.trailingComma=D.doubleProto=-1),D.shorthandAssign>=Oe.start&&(D.shorthandAssign=-1),this.type===I.eq?this.checkLValPattern(Oe):this.checkLValSimple(Oe),ke.left=Oe,this.next(),ke.right=this.parseMaybeAssign(T),ge>-1&&(D.doubleProto=ge),this.finishNode(ke,"AssignmentExpression")}else K&&this.checkExpressionErrors(D,!0);return ne>-1&&(D.parenthesizedAssign=ne),me>-1&&(D.trailingComma=me),Oe},Ie.parseMaybeConditional=function(T,D){var z=this.start,K=this.startLoc,ne=this.parseExprOps(T,D);if(this.checkExpressionErrors(D))return ne;if(this.eat(I.question)){var me=this.startNodeAt(z,K);return me.test=ne,me.consequent=this.parseMaybeAssign(),this.expect(I.colon),me.alternate=this.parseMaybeAssign(T),this.finishNode(me,"ConditionalExpression")}return ne},Ie.parseExprOps=function(T,D){var z=this.start,K=this.startLoc,ne=this.parseMaybeUnary(D,!1,!1,T);return this.checkExpressionErrors(D)||ne.start===z&&ne.type==="ArrowFunctionExpression"?ne:this.parseExprOp(ne,z,K,-1,T)},Ie.parseExprOp=function(T,D,z,K,ne){var me=this.type.binop;if(me!=null&&(!ne||this.type!==I._in)&&me>K){var ge=this.type===I.logicalOR||this.type===I.logicalAND,Se=this.type===I.coalesce;Se&&(me=I.logicalAND.binop);var Pe=this.value;this.next();var Oe=this.start,ke=this.startLoc,We=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,ne),Oe,ke,me,ne),it=this.buildBinary(D,z,T,We,Pe,ge||Se);return(ge&&this.type===I.coalesce||Se&&(this.type===I.logicalOR||this.type===I.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(it,D,z,K,ne)}return T},Ie.buildBinary=function(T,D,z,K,ne,me){K.type==="PrivateIdentifier"&&this.raise(K.start,"Private identifier can only be left side of binary expression");var ge=this.startNodeAt(T,D);return ge.left=z,ge.operator=ne,ge.right=K,this.finishNode(ge,me?"LogicalExpression":"BinaryExpression")},Ie.parseMaybeUnary=function(T,D,z,K){var ne=this.start,me=this.startLoc,ge;if(this.isContextual("await")&&this.canAwait)ge=this.parseAwait(K),D=!0;else if(this.type.prefix){var Se=this.startNode(),Pe=this.type===I.incDec;Se.operator=this.value,Se.prefix=!0,this.next(),Se.argument=this.parseMaybeUnary(null,!0,Pe,K),this.checkExpressionErrors(T,!0),Pe?this.checkLValSimple(Se.argument):this.strict&&Se.operator==="delete"&&Kt(Se.argument)?this.raiseRecoverable(Se.start,"Deleting local variable in strict mode"):Se.operator==="delete"&&Ut(Se.argument)?this.raiseRecoverable(Se.start,"Private fields can not be deleted"):D=!0,ge=this.finishNode(Se,Pe?"UpdateExpression":"UnaryExpression")}else if(!D&&this.type===I.privateId)(K||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),ge=this.parsePrivateIdent(),this.type!==I._in&&this.unexpected();else{if(ge=this.parseExprSubscripts(T,K),this.checkExpressionErrors(T))return ge;for(;this.type.postfix&&!this.canInsertSemicolon();){var Oe=this.startNodeAt(ne,me);Oe.operator=this.value,Oe.prefix=!1,Oe.argument=ge,this.checkLValSimple(ge),this.next(),ge=this.finishNode(Oe,"UpdateExpression")}}if(!z&&this.eat(I.starstar))if(D)this.unexpected(this.lastTokStart);else return this.buildBinary(ne,me,ge,this.parseMaybeUnary(null,!1,!1,K),"**",!1);else return ge};function Kt(T){return T.type==="Identifier"||T.type==="ParenthesizedExpression"&&Kt(T.expression)}function Ut(T){return T.type==="MemberExpression"&&T.property.type==="PrivateIdentifier"||T.type==="ChainExpression"&&Ut(T.expression)||T.type==="ParenthesizedExpression"&&Ut(T.expression)}Ie.parseExprSubscripts=function(T,D){var z=this.start,K=this.startLoc,ne=this.parseExprAtom(T,D);if(ne.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return ne;var me=this.parseSubscripts(ne,z,K,!1,D);return T&&me.type==="MemberExpression"&&(T.parenthesizedAssign>=me.start&&(T.parenthesizedAssign=-1),T.parenthesizedBind>=me.start&&(T.parenthesizedBind=-1),T.trailingComma>=me.start&&(T.trailingComma=-1)),me},Ie.parseSubscripts=function(T,D,z,K,ne){for(var me=this.options.ecmaVersion>=8&&T.type==="Identifier"&&T.name==="async"&&this.lastTokEnd===T.end&&!this.canInsertSemicolon()&&T.end-T.start===5&&this.potentialArrowAt===T.start,ge=!1;;){var Se=this.parseSubscript(T,D,z,K,me,ge,ne);if(Se.optional&&(ge=!0),Se===T||Se.type==="ArrowFunctionExpression"){if(ge){var Pe=this.startNodeAt(D,z);Pe.expression=Se,Se=this.finishNode(Pe,"ChainExpression")}return Se}T=Se}},Ie.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(I.arrow)},Ie.parseSubscriptAsyncArrow=function(T,D,z,K){return this.parseArrowExpression(this.startNodeAt(T,D),z,!0,K)},Ie.parseSubscript=function(T,D,z,K,ne,me,ge){var Se=this.options.ecmaVersion>=11,Pe=Se&&this.eat(I.questionDot);K&&Pe&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Oe=this.eat(I.bracketL);if(Oe||Pe&&this.type!==I.parenL&&this.type!==I.backQuote||this.eat(I.dot)){var ke=this.startNodeAt(D,z);ke.object=T,Oe?(ke.property=this.parseExpression(),this.expect(I.bracketR)):this.type===I.privateId&&T.type!=="Super"?ke.property=this.parsePrivateIdent():ke.property=this.parseIdent(this.options.allowReserved!=="never"),ke.computed=!!Oe,Se&&(ke.optional=Pe),T=this.finishNode(ke,"MemberExpression")}else if(!K&&this.eat(I.parenL)){var We=new Je,it=this.yieldPos,Ct=this.awaitPos,ct=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var qt=this.parseExprList(I.parenR,this.options.ecmaVersion>=8,!1,We);if(ne&&!Pe&&this.shouldParseAsyncArrow())return this.checkPatternErrors(We,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=it,this.awaitPos=Ct,this.awaitIdentPos=ct,this.parseSubscriptAsyncArrow(D,z,qt,ge);this.checkExpressionErrors(We,!0),this.yieldPos=it||this.yieldPos,this.awaitPos=Ct||this.awaitPos,this.awaitIdentPos=ct||this.awaitIdentPos;var ut=this.startNodeAt(D,z);ut.callee=T,ut.arguments=qt,Se&&(ut.optional=Pe),T=this.finishNode(ut,"CallExpression")}else if(this.type===I.backQuote){(Pe||me)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var pt=this.startNodeAt(D,z);pt.tag=T,pt.quasi=this.parseTemplate({isTagged:!0}),T=this.finishNode(pt,"TaggedTemplateExpression")}return T},Ie.parseExprAtom=function(T,D,z){this.type===I.slash&&this.readRegexp();var K,ne=this.potentialArrowAt===this.start;switch(this.type){case I._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),K=this.startNode(),this.next(),this.type===I.parenL&&!this.allowDirectSuper&&this.raise(K.start,"super() call outside constructor of a subclass"),this.type!==I.dot&&this.type!==I.bracketL&&this.type!==I.parenL&&this.unexpected(),this.finishNode(K,"Super");case I._this:return K=this.startNode(),this.next(),this.finishNode(K,"ThisExpression");case I.name:var me=this.start,ge=this.startLoc,Se=this.containsEsc,Pe=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Se&&Pe.name==="async"&&!this.canInsertSemicolon()&&this.eat(I._function))return this.overrideContext(Ge.f_expr),this.parseFunction(this.startNodeAt(me,ge),0,!1,!0,D);if(ne&&!this.canInsertSemicolon()){if(this.eat(I.arrow))return this.parseArrowExpression(this.startNodeAt(me,ge),[Pe],!1,D);if(this.options.ecmaVersion>=8&&Pe.name==="async"&&this.type===I.name&&!Se&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return Pe=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(I.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(me,ge),[Pe],!0,D)}return Pe;case I.regexp:var Oe=this.value;return K=this.parseLiteral(Oe.value),K.regex={pattern:Oe.pattern,flags:Oe.flags},K;case I.num:case I.string:return this.parseLiteral(this.value);case I._null:case I._true:case I._false:return K=this.startNode(),K.value=this.type===I._null?null:this.type===I._true,K.raw=this.type.keyword,this.next(),this.finishNode(K,"Literal");case I.parenL:var ke=this.start,We=this.parseParenAndDistinguishExpression(ne,D);return T&&(T.parenthesizedAssign<0&&!this.isSimpleAssignTarget(We)&&(T.parenthesizedAssign=ke),T.parenthesizedBind<0&&(T.parenthesizedBind=ke)),We;case I.bracketL:return K=this.startNode(),this.next(),K.elements=this.parseExprList(I.bracketR,!0,!0,T),this.finishNode(K,"ArrayExpression");case I.braceL:return this.overrideContext(Ge.b_expr),this.parseObj(!1,T);case I._function:return K=this.startNode(),this.next(),this.parseFunction(K,0);case I._class:return this.parseClass(this.startNode(),!1);case I._new:return this.parseNew();case I.backQuote:return this.parseTemplate();case I._import:return this.options.ecmaVersion>=11?this.parseExprImport(z):this.unexpected();default:return this.parseExprAtomDefault()}},Ie.parseExprAtomDefault=function(){this.unexpected()},Ie.parseExprImport=function(T){var D=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===I.parenL&&!T)return this.parseDynamicImport(D);if(this.type===I.dot){var z=this.startNodeAt(D.start,D.loc&&D.loc.start);return z.name="import",D.meta=this.finishNode(z,"Identifier"),this.parseImportMeta(D)}else this.unexpected()},Ie.parseDynamicImport=function(T){if(this.next(),T.source=this.parseMaybeAssign(),!this.eat(I.parenR)){var D=this.start;this.eat(I.comma)&&this.eat(I.parenR)?this.raiseRecoverable(D,"Trailing comma is not allowed in import()"):this.unexpected(D)}return this.finishNode(T,"ImportExpression")},Ie.parseImportMeta=function(T){this.next();var D=this.containsEsc;return T.property=this.parseIdent(!0),T.property.name!=="meta"&&this.raiseRecoverable(T.property.start,"The only valid meta property for import is 'import.meta'"),D&&this.raiseRecoverable(T.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(T.start,"Cannot use 'import.meta' outside a module"),this.finishNode(T,"MetaProperty")},Ie.parseLiteral=function(T){var D=this.startNode();return D.value=T,D.raw=this.input.slice(this.start,this.end),D.raw.charCodeAt(D.raw.length-1)===110&&(D.bigint=D.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(D,"Literal")},Ie.parseParenExpression=function(){this.expect(I.parenL);var T=this.parseExpression();return this.expect(I.parenR),T},Ie.shouldParseArrow=function(T){return!this.canInsertSemicolon()},Ie.parseParenAndDistinguishExpression=function(T,D){var z=this.start,K=this.startLoc,ne,me=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var ge=this.start,Se=this.startLoc,Pe=[],Oe=!0,ke=!1,We=new Je,it=this.yieldPos,Ct=this.awaitPos,ct;for(this.yieldPos=0,this.awaitPos=0;this.type!==I.parenR;)if(Oe?Oe=!1:this.expect(I.comma),me&&this.afterTrailingComma(I.parenR,!0)){ke=!0;break}else if(this.type===I.ellipsis){ct=this.start,Pe.push(this.parseParenItem(this.parseRestBinding())),this.type===I.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Pe.push(this.parseMaybeAssign(!1,We,this.parseParenItem));var qt=this.lastTokEnd,ut=this.lastTokEndLoc;if(this.expect(I.parenR),T&&this.shouldParseArrow(Pe)&&this.eat(I.arrow))return this.checkPatternErrors(We,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=it,this.awaitPos=Ct,this.parseParenArrowList(z,K,Pe,D);(!Pe.length||ke)&&this.unexpected(this.lastTokStart),ct&&this.unexpected(ct),this.checkExpressionErrors(We,!0),this.yieldPos=it||this.yieldPos,this.awaitPos=Ct||this.awaitPos,Pe.length>1?(ne=this.startNodeAt(ge,Se),ne.expressions=Pe,this.finishNodeAt(ne,"SequenceExpression",qt,ut)):ne=Pe[0]}else ne=this.parseParenExpression();if(this.options.preserveParens){var pt=this.startNodeAt(z,K);return pt.expression=ne,this.finishNode(pt,"ParenthesizedExpression")}else return ne},Ie.parseParenItem=function(T){return T},Ie.parseParenArrowList=function(T,D,z,K){return this.parseArrowExpression(this.startNodeAt(T,D),z,!1,K)};var Rr=[];Ie.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var T=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===I.dot){var D=this.startNodeAt(T.start,T.loc&&T.loc.start);D.name="new",T.meta=this.finishNode(D,"Identifier"),this.next();var z=this.containsEsc;return T.property=this.parseIdent(!0),T.property.name!=="target"&&this.raiseRecoverable(T.property.start,"The only valid meta property for new is 'new.target'"),z&&this.raiseRecoverable(T.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(T.start,"'new.target' can only be used in functions and class static block"),this.finishNode(T,"MetaProperty")}var K=this.start,ne=this.startLoc;return T.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),K,ne,!0,!1),this.eat(I.parenL)?T.arguments=this.parseExprList(I.parenR,this.options.ecmaVersion>=8,!1):T.arguments=Rr,this.finishNode(T,"NewExpression")},Ie.parseTemplateElement=function(T){var D=T.isTagged,z=this.startNode();return this.type===I.invalidTemplate?(D||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),z.value={raw:this.value.replace(/\r\n?/g,`
863
863
  `),cooked:null}):z.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "randmarcomps",
3
3
  "private": false,
4
- "version": "1.164.0",
4
+ "version": "1.166.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [