randmarcomps 1.275.0 → 1.276.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.
@@ -60124,7 +60124,7 @@ const DebugMessageDisplay = ({ debugMessages: t }) => {
60124
60124
  /* @__PURE__ */ jsx("div", { className: "mt-1 mb-1", children: Ve.findIndex((ct) => ct.partner1 === "2" || ct.partner2 === "2") < 0 ? /* @__PURE__ */ jsx(Button, { className: "w-full", ref: R, onClick: () => dt(), children: "Chat with Randmar" }, "b1") : /* @__PURE__ */ jsx("a", { target: "_blank", href: `https://dashboard.randmar.io/${t}/ExploreManufacturers`, children: /* @__PURE__ */ jsx(Button, { className: "w-full", children: "Explore manufacturers" }, "b2") }) }),
60125
60125
  /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: Ve.length && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(ChatList, { userId: t, chats: Ct.filter((ct) => ct.partner1 != ASSISTANT_ID && ct.partner2 != ASSISTANT_ID), activeChat: ut ?? null, onSelectChat: ge, assistantChat: Ve.find((ct) => ct.partner1 == ASSISTANT_ID || ct.partner2 == ASSISTANT_ID) }) }) })
60126
60126
  ] }),
60127
- /* @__PURE__ */ jsx("div", { className: "flex-3 flex flex-col", children: ae ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
60127
+ /* @__PURE__ */ jsx("div", { className: "flex-5 flex flex-col", children: ae ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
60128
60128
  /* @__PURE__ */ jsx("div", { className: "flex items-center p-4 border-b", children: ae[0] == ASSISTANT_ID || ae[1] == ASSISTANT_ID ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
60129
60129
  /* @__PURE__ */ jsx(Avatar, { className: "h-8 w-8 flex-shrink-0 rounded-none", children: /* @__PURE__ */ jsx(Bot, { className: "text-primary fill-white min-h-full" }) }),
60130
60130
  /* @__PURE__ */ jsx("div", { className: "ml-3 font-medium", children: "Randmar Assistant" }),
@@ -60157,7 +60157,7 @@ const DebugMessageDisplay = ({ debugMessages: t }) => {
60157
60157
  ),
60158
60158
  /* @__PURE__ */ jsx("div", { ref: tt })
60159
60159
  ] }),
60160
- /* @__PURE__ */ jsxs("div", { className: "p-4 border-t flex", children: [
60160
+ /* @__PURE__ */ jsxs("div", { className: "p-4 border-t border-r flex", children: [
60161
60161
  (ut == null ? void 0 : ut.pending) && /* @__PURE__ */ jsxs(Fragment$1, { children: [
60162
60162
  /* @__PURE__ */ jsxs(Button, { disabled: _, onClick: () => ft(), children: [
60163
60163
  /* @__PURE__ */ jsx(Handshake, {}),
@@ -60231,7 +60231,7 @@ const DebugMessageDisplay = ({ debugMessages: t }) => {
60231
60231
  ] })
60232
60232
  ] })
60233
60233
  ] }) : /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center text-muted-foreground", children: "Select a chat to start messaging" }) }),
60234
- /* @__PURE__ */ jsx("div", { className: "w-[480px] flex flex-2 flex-col border-l", children: isAssistantChat(ae) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
60234
+ /* @__PURE__ */ jsx("div", { className: "w-[480px] flex flex-4 flex-col border-l", children: isAssistantChat(ae) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
60235
60235
  /* @__PURE__ */ jsx("div", { className: "flex items-center p-4 border-b", children: /* @__PURE__ */ jsx("p", { className: "h-9 text-base/9", children: "Sources and System Info" }) }),
60236
60236
  /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 pl-2 pr-2 bg-slate-50", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
60237
60237
  et ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs("div", { className: "flex", children: [
@@ -60249,7 +60249,7 @@ const DebugMessageDisplay = ({ debugMessages: t }) => {
60249
60249
  /* @__PURE__ */ jsx(ScrollArea, { className: "flex-4 border-t pl-2 pr-2 bg-slate-50", children: /* @__PURE__ */ jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsx(DebugMessageDisplay, { debugMessages: Q }) }) })
60250
60250
  ] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
60251
60251
  /* @__PURE__ */ jsx("div", { className: "flex items-center p-4 border-b", children: /* @__PURE__ */ jsx("p", { className: "h-9 text-base/9", children: "Partner Overview" }) }),
60252
- /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 pl-2 pr-2 bg-slate-50", children: /* @__PURE__ */ jsx(PartnerRelationshipPage, { applicationId: t, partnerId: ((ae == null ? void 0 : ae[0]) === t ? ae[1] : ae == null ? void 0 : ae[0]) ?? t, userEmail: e, shopifyHostName: void 0, isSuperAdmin: !1 }) })
60252
+ /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 pl-2 pr-2 bg-slate-50", children: /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(PartnerRelationshipPage, { applicationId: t, partnerId: ((ae == null ? void 0 : ae[0]) === t ? ae[1] : ae == null ? void 0 : ae[0]) ?? t, userEmail: e, shopifyHostName: void 0, isSuperAdmin: !1 }) }) })
60253
60253
  ] }) })
60254
60254
  ] });
60255
60255
  }
@@ -71963,7 +71963,7 @@ function LongMonthName(t) {
71963
71963
  }
71964
71964
  function SalesSummary({ fiscalYearMonthStart: t, salesData: e, isLoading: n }) {
71965
71965
  const o = (e == null ? void 0 : e.SalesLast30Days) ?? 0, l = (e == null ? void 0 : e.SalesLast3Months) ?? 0, d = (e == null ? void 0 : e.SalesYearToDay) ?? 0, f = LongMonthName(t);
71966
- return n ? /* @__PURE__ */ jsxs("div", { className: "grid gap-4 @sm:grid-cols-2 @lg:grid-cols-3 mb-4", children: [
71966
+ return n ? /* @__PURE__ */ jsxs("div", { className: "grid gap-4 @xl:grid-cols-2 @2xl:grid-cols-3 mb-4", children: [
71967
71967
  /* @__PURE__ */ jsxs(Card, { children: [
71968
71968
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
71969
71969
  /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" }),
@@ -71984,7 +71984,7 @@ function SalesSummary({ fiscalYearMonthStart: t, salesData: e, isLoading: n }) {
71984
71984
  /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" })
71985
71985
  ] })
71986
71986
  ] }),
71987
- /* @__PURE__ */ jsxs(Card, { className: "col-span-2 lg:col-span-1", children: [
71987
+ /* @__PURE__ */ jsxs(Card, { className: "@xl:col-span-2 @2xl:col-span-1", children: [
71988
71988
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
71989
71989
  /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-36" }),
71990
71990
  /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-8 rounded-full" })
@@ -71994,7 +71994,7 @@ function SalesSummary({ fiscalYearMonthStart: t, salesData: e, isLoading: n }) {
71994
71994
  /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" })
71995
71995
  ] })
71996
71996
  ] })
71997
- ] }) : /* @__PURE__ */ jsxs("div", { className: "grid gap-4 grid-cols-1 @sm:grid-cols-1 @md:grid-cols-2 @lg:grid-cols-3 mb-4", children: [
71997
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "grid gap-4 @xl:grid-cols-2 @2xl:grid-cols-3 mb-4", children: [
71998
71998
  /* @__PURE__ */ jsxs(Card, { children: [
71999
71999
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
72000
72000
  /* @__PURE__ */ jsx(CardTitle, { className: "text-sm font-medium", children: "Last 30 Days" }),
@@ -72015,7 +72015,7 @@ function SalesSummary({ fiscalYearMonthStart: t, salesData: e, isLoading: n }) {
72015
72015
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground" })
72016
72016
  ] })
72017
72017
  ] }),
72018
- f && /* @__PURE__ */ jsxs(Card, { className: "@sm:col-span-1 @md:col-span-2 @lg:col-span-1", children: [
72018
+ f && /* @__PURE__ */ jsxs(Card, { className: "@xl:col-span-2 @2xl:col-span-1", children: [
72019
72019
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
72020
72020
  /* @__PURE__ */ jsxs(CardTitle, { className: "text-sm font-medium", children: [
72021
72021
  "Year to Date (",
@@ -72324,7 +72324,7 @@ function ResellerOverview({
72324
72324
  isLoading: g
72325
72325
  }
72326
72326
  ),
72327
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 @lg:grid-cols-2 gap-6", children: [
72327
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 @2xl:grid-cols-2 gap-6", children: [
72328
72328
  /* @__PURE__ */ jsx(
72329
72329
  SalesChart,
72330
72330
  {
@@ -72365,7 +72365,7 @@ function ResellerOverview({
72365
72365
  ] }),
72366
72366
  g || M.length > 0 ? /* @__PURE__ */ jsxs(Card, { className: "w-full", children: [
72367
72367
  /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: "Manufacturers you are qualified for" }) }),
72368
- /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 @md:grid-cols-2 gap-4", children: g ? Array.from({ length: 2 }).map((q, z) => /* @__PURE__ */ jsx(ManufacturerCard, { loading: !0 }, z)) : M.map((q) => /* @__PURE__ */ jsx(
72368
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "grid @2xl:grid-cols-2 gap-4", children: g ? Array.from({ length: 2 }).map((q, z) => /* @__PURE__ */ jsx(ManufacturerCard, { loading: !0 }, z)) : M.map((q) => /* @__PURE__ */ jsx(
72369
72369
  ManufacturerCard,
72370
72370
  {
72371
72371
  manufacturer: q,
@@ -74640,7 +74640,7 @@ function PartnerRelationshipPage({
74640
74640
  }
74641
74641
  }, A = () => d != null && d.Reseller ? "reseller-overview" : d != null && d.Manufacturer ? "manufacturer-overview" : "";
74642
74642
  return /* @__PURE__ */ jsxs("div", { className: "@container", children: [
74643
- /* @__PURE__ */ jsxs("div", { className: "grid gap-4 grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2", children: [
74643
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-4 @2xl:grid-cols-2", children: [
74644
74644
  /* @__PURE__ */ jsx(
74645
74645
  PartnerCard,
74646
74646
  {
@@ -1045,7 +1045,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
1045
1045
  * @license MIT
1046
1046
  */var isBuffer_1,hasRequiredIsBuffer;function requireIsBuffer(){if(hasRequiredIsBuffer)return isBuffer_1;hasRequiredIsBuffer=1,isBuffer_1=function(n){return n!=null&&(t(n)||e(n)||!!n._isBuffer)};function t(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function e(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&t(n.slice(0,0))}return isBuffer_1}var hasRequiredMd5;function requireMd5(){return hasRequiredMd5||(hasRequiredMd5=1,function(){var t=requireCrypt(),e=requireCharenc().utf8,n=requireIsBuffer(),o=requireCharenc().bin,l=function(d,f){d.constructor==String?f&&f.encoding==="binary"?d=o.stringToBytes(d):d=e.stringToBytes(d):n(d)?d=Array.prototype.slice.call(d,0):!Array.isArray(d)&&d.constructor!==Uint8Array&&(d=d.toString());for(var g=t.bytesToWords(d),b=d.length*8,_=1732584193,S=-271733879,R=-1732584194,C=271733878,E=0;E<g.length;E++)g[E]=(g[E]<<8|g[E]>>>24)&16711935|(g[E]<<24|g[E]>>>8)&4278255360;g[b>>>5]|=128<<b%32,g[(b+64>>>9<<4)+14]=b;for(var A=l._ff,I=l._gg,M=l._hh,j=l._ii,E=0;E<g.length;E+=16){var q=_,z=S,Q=R,F=C;_=A(_,S,R,C,g[E+0],7,-680876936),C=A(C,_,S,R,g[E+1],12,-389564586),R=A(R,C,_,S,g[E+2],17,606105819),S=A(S,R,C,_,g[E+3],22,-1044525330),_=A(_,S,R,C,g[E+4],7,-176418897),C=A(C,_,S,R,g[E+5],12,1200080426),R=A(R,C,_,S,g[E+6],17,-1473231341),S=A(S,R,C,_,g[E+7],22,-45705983),_=A(_,S,R,C,g[E+8],7,1770035416),C=A(C,_,S,R,g[E+9],12,-1958414417),R=A(R,C,_,S,g[E+10],17,-42063),S=A(S,R,C,_,g[E+11],22,-1990404162),_=A(_,S,R,C,g[E+12],7,1804603682),C=A(C,_,S,R,g[E+13],12,-40341101),R=A(R,C,_,S,g[E+14],17,-1502002290),S=A(S,R,C,_,g[E+15],22,1236535329),_=I(_,S,R,C,g[E+1],5,-165796510),C=I(C,_,S,R,g[E+6],9,-1069501632),R=I(R,C,_,S,g[E+11],14,643717713),S=I(S,R,C,_,g[E+0],20,-373897302),_=I(_,S,R,C,g[E+5],5,-701558691),C=I(C,_,S,R,g[E+10],9,38016083),R=I(R,C,_,S,g[E+15],14,-660478335),S=I(S,R,C,_,g[E+4],20,-405537848),_=I(_,S,R,C,g[E+9],5,568446438),C=I(C,_,S,R,g[E+14],9,-1019803690),R=I(R,C,_,S,g[E+3],14,-187363961),S=I(S,R,C,_,g[E+8],20,1163531501),_=I(_,S,R,C,g[E+13],5,-1444681467),C=I(C,_,S,R,g[E+2],9,-51403784),R=I(R,C,_,S,g[E+7],14,1735328473),S=I(S,R,C,_,g[E+12],20,-1926607734),_=M(_,S,R,C,g[E+5],4,-378558),C=M(C,_,S,R,g[E+8],11,-2022574463),R=M(R,C,_,S,g[E+11],16,1839030562),S=M(S,R,C,_,g[E+14],23,-35309556),_=M(_,S,R,C,g[E+1],4,-1530992060),C=M(C,_,S,R,g[E+4],11,1272893353),R=M(R,C,_,S,g[E+7],16,-155497632),S=M(S,R,C,_,g[E+10],23,-1094730640),_=M(_,S,R,C,g[E+13],4,681279174),C=M(C,_,S,R,g[E+0],11,-358537222),R=M(R,C,_,S,g[E+3],16,-722521979),S=M(S,R,C,_,g[E+6],23,76029189),_=M(_,S,R,C,g[E+9],4,-640364487),C=M(C,_,S,R,g[E+12],11,-421815835),R=M(R,C,_,S,g[E+15],16,530742520),S=M(S,R,C,_,g[E+2],23,-995338651),_=j(_,S,R,C,g[E+0],6,-198630844),C=j(C,_,S,R,g[E+7],10,1126891415),R=j(R,C,_,S,g[E+14],15,-1416354905),S=j(S,R,C,_,g[E+5],21,-57434055),_=j(_,S,R,C,g[E+12],6,1700485571),C=j(C,_,S,R,g[E+3],10,-1894986606),R=j(R,C,_,S,g[E+10],15,-1051523),S=j(S,R,C,_,g[E+1],21,-2054922799),_=j(_,S,R,C,g[E+8],6,1873313359),C=j(C,_,S,R,g[E+15],10,-30611744),R=j(R,C,_,S,g[E+6],15,-1560198380),S=j(S,R,C,_,g[E+13],21,1309151649),_=j(_,S,R,C,g[E+4],6,-145523070),C=j(C,_,S,R,g[E+11],10,-1120210379),R=j(R,C,_,S,g[E+2],15,718787259),S=j(S,R,C,_,g[E+9],21,-343485551),_=_+q>>>0,S=S+z>>>0,R=R+Q>>>0,C=C+F>>>0}return t.endian([_,S,R,C])};l._ff=function(d,f,g,b,_,S,R){var C=d+(f&g|~f&b)+(_>>>0)+R;return(C<<S|C>>>32-S)+f},l._gg=function(d,f,g,b,_,S,R){var C=d+(f&b|g&~b)+(_>>>0)+R;return(C<<S|C>>>32-S)+f},l._hh=function(d,f,g,b,_,S,R){var C=d+(f^g^b)+(_>>>0)+R;return(C<<S|C>>>32-S)+f},l._ii=function(d,f,g,b,_,S,R){var C=d+(g^(f|~b))+(_>>>0)+R;return(C<<S|C>>>32-S)+f},l._blocksize=16,l._digestsize=16,md5$1.exports=function(d,f){if(d==null)throw new Error("Illegal argument "+d);var g=t.wordsToBytes(l(d,f));return f&&f.asBytes?g:f&&f.asString?o.bytesToString(g):t.bytesToHex(g)}}()),md5$1.exports}var md5Exports=requireMd5();const md5=getDefaultExportFromCjs$1(md5Exports),constructFromSymbol=Symbol.for("constructDateFrom");function constructFrom(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&constructFromSymbol in t?t[constructFromSymbol](e):t instanceof Date?new t.constructor(e):new Date(e)}function toDate(t,e){return constructFrom(t,t)}function addDays(t,e,n){const o=toDate(t);return isNaN(e)?constructFrom(t,NaN):(o.setDate(o.getDate()+e),o)}function normalizeDates(t,...e){const n=constructFrom.bind(null,e.find(o=>typeof o=="object"));return e.map(n)}function startOfDay(t,e){const n=toDate(t);return n.setHours(0,0,0,0),n}function constructNow(t){return constructFrom(t,Date.now())}function isSameDay(t,e,n){const[o,l]=normalizeDates(n==null?void 0:n.in,t,e);return+startOfDay(o)==+startOfDay(l)}function isToday(t,e){return isSameDay(constructFrom(t,t),constructNow(t))}function subDays(t,e,n){return addDays(t,-1)}function isYesterday(t,e){return isSameDay(constructFrom(t,t),subDays(constructNow(t)))}var lib$3={},htmlToDom={},domparser={},utilities$2={},lib$2={},lib$1={},hasRequiredLib$3;function requireLib$3(){return hasRequiredLib$3||(hasRequiredLib$3=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0;var e;(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"})(e=t.ElementType||(t.ElementType={}));function n(o){return o.type===e.Tag||o.type===e.Script||o.type===e.Style}t.isTag=n,t.Root=e.Root,t.Text=e.Text,t.Directive=e.Directive,t.Comment=e.Comment,t.Script=e.Script,t.Style=e.Style,t.Tag=e.Tag,t.CDATA=e.CDATA,t.Doctype=e.Doctype}(lib$1)),lib$1}var node={},hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var t=node&&node.__extends||function(){var F=function(O,te){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ne,ae){ne.__proto__=ae}||function(ne,ae){for(var ge in ae)Object.prototype.hasOwnProperty.call(ae,ge)&&(ne[ge]=ae[ge])},F(O,te)};return function(O,te){if(typeof te!="function"&&te!==null)throw new TypeError("Class extends value "+String(te)+" is not a constructor or null");F(O,te);function ne(){this.constructor=O}O.prototype=te===null?Object.create(te):(ne.prototype=te.prototype,new ne)}}(),e=node&&node.__assign||function(){return e=Object.assign||function(F){for(var O,te=1,ne=arguments.length;te<ne;te++){O=arguments[te];for(var ae in O)Object.prototype.hasOwnProperty.call(O,ae)&&(F[ae]=O[ae])}return F},e.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 F(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(F.prototype,"parentNode",{get:function(){return this.parent},set:function(O){this.parent=O},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"previousSibling",{get:function(){return this.prev},set:function(O){this.prev=O},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"nextSibling",{get:function(){return this.next},set:function(O){this.next=O},enumerable:!1,configurable:!0}),F.prototype.cloneNode=function(O){return O===void 0&&(O=!1),z(this,O)},F}();node.Node=o;var l=function(F){t(O,F);function O(te){var ne=F.call(this)||this;return ne.data=te,ne}return Object.defineProperty(O.prototype,"nodeValue",{get:function(){return this.data},set:function(te){this.data=te},enumerable:!1,configurable:!0}),O}(o);node.DataNode=l;var d=function(F){t(O,F);function O(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Text,te}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),O}(l);node.Text=d;var f=function(F){t(O,F);function O(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Comment,te}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),O}(l);node.Comment=f;var g=function(F){t(O,F);function O(te,ne){var ae=F.call(this,ne)||this;return ae.name=te,ae.type=n.ElementType.Directive,ae}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),O}(l);node.ProcessingInstruction=g;var b=function(F){t(O,F);function O(te){var ne=F.call(this)||this;return ne.children=te,ne}return Object.defineProperty(O.prototype,"firstChild",{get:function(){var te;return(te=this.children[0])!==null&&te!==void 0?te:null},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"childNodes",{get:function(){return this.children},set:function(te){this.children=te},enumerable:!1,configurable:!0}),O}(o);node.NodeWithChildren=b;var _=function(F){t(O,F);function O(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.CDATA,te}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),O}(b);node.CDATA=_;var S=function(F){t(O,F);function O(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Root,te}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),O}(b);node.Document=S;var R=function(F){t(O,F);function O(te,ne,ae,ge){ae===void 0&&(ae=[]),ge===void 0&&(ge=te==="script"?n.ElementType.Script:te==="style"?n.ElementType.Style:n.ElementType.Tag);var oe=F.call(this,ae)||this;return oe.name=te,oe.attribs=ne,oe.type=ge,oe}return Object.defineProperty(O.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"tagName",{get:function(){return this.name},set:function(te){this.name=te},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"attributes",{get:function(){var te=this;return Object.keys(this.attribs).map(function(ne){var ae,ge;return{name:ne,value:te.attribs[ne],namespace:(ae=te["x-attribsNamespace"])===null||ae===void 0?void 0:ae[ne],prefix:(ge=te["x-attribsPrefix"])===null||ge===void 0?void 0:ge[ne]}})},enumerable:!1,configurable:!0}),O}(b);node.Element=R;function C(F){return(0,n.isTag)(F)}node.isTag=C;function E(F){return F.type===n.ElementType.CDATA}node.isCDATA=E;function A(F){return F.type===n.ElementType.Text}node.isText=A;function I(F){return F.type===n.ElementType.Comment}node.isComment=I;function M(F){return F.type===n.ElementType.Directive}node.isDirective=M;function j(F){return F.type===n.ElementType.Root}node.isDocument=j;function q(F){return Object.prototype.hasOwnProperty.call(F,"children")}node.hasChildren=q;function z(F,O){O===void 0&&(O=!1);var te;if(A(F))te=new d(F.data);else if(I(F))te=new f(F.data);else if(C(F)){var ne=O?Q(F.children):[],ae=new R(F.name,e({},F.attribs),ne);ne.forEach(function(Ne){return Ne.parent=ae}),F.namespace!=null&&(ae.namespace=F.namespace),F["x-attribsNamespace"]&&(ae["x-attribsNamespace"]=e({},F["x-attribsNamespace"])),F["x-attribsPrefix"]&&(ae["x-attribsPrefix"]=e({},F["x-attribsPrefix"])),te=ae}else if(E(F)){var ne=O?Q(F.children):[],ge=new _(ne);ne.forEach(function(Ae){return Ae.parent=ge}),te=ge}else if(j(F)){var ne=O?Q(F.children):[],oe=new S(ne);ne.forEach(function(Ae){return Ae.parent=oe}),F["x-mode"]&&(oe["x-mode"]=F["x-mode"]),te=oe}else if(M(F)){var je=new g(F.name,F.data);F["x-name"]!=null&&(je["x-name"]=F["x-name"],je["x-publicId"]=F["x-publicId"],je["x-systemId"]=F["x-systemId"]),te=je}else throw new Error("Not implemented yet: ".concat(F.type));return te.startIndex=F.startIndex,te.endIndex=F.endIndex,F.sourceCodeLocation!=null&&(te.sourceCodeLocation=F.sourceCodeLocation),te}node.cloneNode=z;function Q(F){for(var O=F.map(function(ne){return z(ne,!0)}),te=1;te<O.length;te++)O[te].prev=O[te-1],O[te-1].next=O[te];return O}return node}var hasRequiredLib$2;function requireLib$2(){return hasRequiredLib$2||(hasRequiredLib$2=1,function(t){var e=lib$2&&lib$2.__createBinding||(Object.create?function(g,b,_,S){S===void 0&&(S=_);var R=Object.getOwnPropertyDescriptor(b,_);(!R||("get"in R?!b.__esModule:R.writable||R.configurable))&&(R={enumerable:!0,get:function(){return b[_]}}),Object.defineProperty(g,S,R)}:function(g,b,_,S){S===void 0&&(S=_),g[S]=b[_]}),n=lib$2&&lib$2.__exportStar||function(g,b){for(var _ in g)_!=="default"&&!Object.prototype.hasOwnProperty.call(b,_)&&e(b,g,_)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var o=requireLib$3(),l=requireNode();n(requireNode(),t);var d={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},f=function(){function g(b,_,S){this.dom=[],this.root=new l.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof _=="function"&&(S=_,_=d),typeof b=="object"&&(_=b,b=void 0),this.callback=b??null,this.options=_??d,this.elementCB=S??null}return g.prototype.onparserinit=function(b){this.parser=b},g.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},g.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},g.prototype.onerror=function(b){this.handleCallback(b)},g.prototype.onclosetag=function(){this.lastNode=null;var b=this.tagStack.pop();this.options.withEndIndices&&(b.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(b)},g.prototype.onopentag=function(b,_){var S=this.options.xmlMode?o.ElementType.Tag:void 0,R=new l.Element(b,_,void 0,S);this.addNode(R),this.tagStack.push(R)},g.prototype.ontext=function(b){var _=this.lastNode;if(_&&_.type===o.ElementType.Text)_.data+=b,this.options.withEndIndices&&(_.endIndex=this.parser.endIndex);else{var S=new l.Text(b);this.addNode(S),this.lastNode=S}},g.prototype.oncomment=function(b){if(this.lastNode&&this.lastNode.type===o.ElementType.Comment){this.lastNode.data+=b;return}var _=new l.Comment(b);this.addNode(_),this.lastNode=_},g.prototype.oncommentend=function(){this.lastNode=null},g.prototype.oncdatastart=function(){var b=new l.Text(""),_=new l.CDATA([b]);this.addNode(_),b.parent=_,this.lastNode=b},g.prototype.oncdataend=function(){this.lastNode=null},g.prototype.onprocessinginstruction=function(b,_){var S=new l.ProcessingInstruction(b,_);this.addNode(S)},g.prototype.handleCallback=function(b){if(typeof this.callback=="function")this.callback(b,this.dom);else if(b)throw b},g.prototype.addNode=function(b){var _=this.tagStack[this.tagStack.length-1],S=_.children[_.children.length-1];this.options.withStartIndices&&(b.startIndex=this.parser.startIndex),this.options.withEndIndices&&(b.endIndex=this.parser.endIndex),_.children.push(b),S&&(b.prev=S,S.next=b),b.parent=_,this.lastNode=null},g}();t.DomHandler=f,t.default=f}(lib$2)),lib$2}var constants={},hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CARRIAGE_RETURN_PLACEHOLDER_REGEX=t.CARRIAGE_RETURN_PLACEHOLDER=t.CARRIAGE_RETURN_REGEX=t.CARRIAGE_RETURN=t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES=void 0,t.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"],t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES.reduce(function(e,n){return e[n.toLowerCase()]=n,e},{}),t.CARRIAGE_RETURN="\r",t.CARRIAGE_RETURN_REGEX=new RegExp(t.CARRIAGE_RETURN,"g"),t.CARRIAGE_RETURN_PLACEHOLDER="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(),"__"),t.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(t.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=d,utilities$2.revertEscapedCharacters=f,utilities$2.formatDOM=g;var t=requireLib$2(),e=requireConstants();function n(b){return e.CASE_SENSITIVE_TAG_NAMES_MAP[b]}function o(b){for(var _={},S=0,R=b.length;S<R;S++){var C=b[S];_[C.name]=C.value}return _}function l(b){b=b.toLowerCase();var _=n(b);return _||b}function d(b){return b.replace(e.CARRIAGE_RETURN_REGEX,e.CARRIAGE_RETURN_PLACEHOLDER)}function f(b){return b.replace(e.CARRIAGE_RETURN_PLACEHOLDER_REGEX,e.CARRIAGE_RETURN)}function g(b,_,S){_===void 0&&(_=null);for(var R=[],C,E=0,A=b.length;E<A;E++){var I=b[E];switch(I.nodeType){case 1:{var M=l(I.nodeName);C=new t.Element(M,o(I.attributes)),C.children=g(M==="template"?I.content.childNodes:I.childNodes,C);break}case 3:C=new t.Text(f(I.nodeValue));break;case 8:C=new t.Comment(I.nodeValue);break;default:continue}var j=R[E-1]||null;j&&(j.next=C),C.parent=_,C.prev=j,C.next=null,R.push(C)}return S&&(C=new t.ProcessingInstruction(S.substring(0,S.indexOf(" ")).toLowerCase(),S),C.next=R[0]||null,C.parent=_,R.unshift(C),R[1]&&(R[1].prev=R[0])),R}return utilities$2}var hasRequiredDomparser;function requireDomparser(){if(hasRequiredDomparser)return domparser;hasRequiredDomparser=1,Object.defineProperty(domparser,"__esModule",{value:!0}),domparser.default=I;var t=requireUtilities$2(),e="html",n="head",o="body",l=/<([a-zA-Z]+[0-9]?)/,d=/<head[^]*>/i,f=/<body[^]*>/i,g=function(M,j){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},b=function(M,j){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},_=typeof window=="object"&&window.DOMParser;if(typeof _=="function"){var S=new _,R="text/html";b=function(M,j){return j&&(M="<".concat(j,">").concat(M,"</").concat(j,">")),S.parseFromString(M,R)},g=b}if(typeof document=="object"&&document.implementation){var C=document.implementation.createHTMLDocument();g=function(M,j){if(j){var q=C.documentElement.querySelector(j);return q&&(q.innerHTML=M),C}return C.documentElement.innerHTML=M,C}}var E=typeof document=="object"&&document.createElement("template"),A;E&&E.content&&(A=function(M){return E.innerHTML=M,E.content.childNodes});function I(M){var j,q;M=(0,t.escapeSpecialCharacters)(M);var z=M.match(l),Q=z&&z[1]?z[1].toLowerCase():"";switch(Q){case e:{var F=b(M);if(!d.test(M)){var O=F.querySelector(n);(j=O==null?void 0:O.parentNode)===null||j===void 0||j.removeChild(O)}if(!f.test(M)){var O=F.querySelector(o);(q=O==null?void 0:O.parentNode)===null||q===void 0||q.removeChild(O)}return F.querySelectorAll(e)}case n:case o:{var te=g(M).querySelectorAll(Q);return f.test(M)&&d.test(M)?te[0].parentNode.childNodes:te}default:{if(A)return A(M);var O=g(M,o).querySelector(o);return O.childNodes}}}return domparser}var hasRequiredHtmlToDom;function requireHtmlToDom(){if(hasRequiredHtmlToDom)return htmlToDom;hasRequiredHtmlToDom=1;var t=htmlToDom&&htmlToDom.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(htmlToDom,"__esModule",{value:!0}),htmlToDom.default=l;var e=t(requireDomparser()),n=requireUtilities$2(),o=/<(![a-zA-Z\s]+)>/;function l(d){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];var f=d.match(o),g=f?f[1]:void 0;return(0,n.formatDOM)((0,e.default)(d),null,g)}return htmlToDom}var attributesToProps={},lib={},possibleStandardNamesOptimized={},hasRequiredPossibleStandardNamesOptimized;function requirePossibleStandardNamesOptimized(){if(hasRequiredPossibleStandardNamesOptimized)return possibleStandardNamesOptimized;hasRequiredPossibleStandardNamesOptimized=1;var t=0;possibleStandardNamesOptimized.SAME=t;var e=1;return possibleStandardNamesOptimized.CAMELCASE=e,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 t=0,e=1,n=2,o=3,l=4,d=5,f=6;function g(F){return _.hasOwnProperty(F)?_[F]:null}function b(F,O,te,ne,ae,ge,oe){this.acceptsBooleans=O===n||O===o||O===l,this.attributeName=ne,this.attributeNamespace=ae,this.mustUseProperty=te,this.propertyName=F,this.type=O,this.sanitizeURL=ge,this.removeEmptyString=oe}const _={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(F=>{_[F]=new b(F,t,!1,F,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([F,O])=>{_[F]=new b(F,e,!1,O,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(F=>{_[F]=new b(F,n,!1,F.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(F=>{_[F]=new b(F,n,!1,F,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(F=>{_[F]=new b(F,o,!1,F.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(F=>{_[F]=new b(F,o,!0,F,null,!1,!1)}),["capture","download"].forEach(F=>{_[F]=new b(F,l,!1,F,null,!1,!1)}),["cols","rows","size","span"].forEach(F=>{_[F]=new b(F,f,!1,F,null,!1,!1)}),["rowSpan","start"].forEach(F=>{_[F]=new b(F,d,!1,F.toLowerCase(),null,!1,!1)});const R=/[\-\:]([a-z])/g,C=F=>F[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(F=>{const O=F.replace(R,C);_[O]=new b(O,e,!1,F,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(F=>{const O=F.replace(R,C);_[O]=new b(O,e,!1,F,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(F=>{const O=F.replace(R,C);_[O]=new b(O,e,!1,F,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(F=>{_[F]=new b(F,e,!1,F.toLowerCase(),null,!1,!1)});const E="xlinkHref";_[E]=new b("xlinkHref",e,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(F=>{_[F]=new b(F,e,!1,F.toLowerCase(),null,!0,!0)});const{CAMELCASE:A,SAME:I,possibleStandardNames:M}=requirePossibleStandardNamesOptimized(),q=":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",z=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+q+"]*$")),Q=Object.keys(M).reduce((F,O)=>{const te=M[O];return te===I?F[O]=O:te===A?F[O.toLowerCase()]=O:F[O]=te,F},{});return lib.BOOLEAN=o,lib.BOOLEANISH_STRING=n,lib.NUMERIC=d,lib.OVERLOADED_BOOLEAN=l,lib.POSITIVE_NUMERIC=f,lib.RESERVED=t,lib.STRING=e,lib.getPropertyInfo=g,lib.isCustomAttribute=z,lib.possibleStandardNames=Q,lib}var utilities$1={},cjs$1={},inlineStyleParser,hasRequiredInlineStyleParser;function requireInlineStyleParser(){if(hasRequiredInlineStyleParser)return inlineStyleParser;hasRequiredInlineStyleParser=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,g=/^\s+|\s+$/g,b=`
1047
1047
  `,_="/",S="*",R="",C="comment",E="declaration";inlineStyleParser=function(I,M){if(typeof I!="string")throw new TypeError("First argument must be a string");if(!I)return[];M=M||{};var j=1,q=1;function z(Ne){var Ae=Ne.match(e);Ae&&(j+=Ae.length);var $e=Ne.lastIndexOf(b);q=~$e?Ne.length-$e:q+Ne.length}function Q(){var Ne={line:j,column:q};return function(Ae){return Ae.position=new F(Ne),ne(),Ae}}function F(Ne){this.start=Ne,this.end={line:j,column:q},this.source=M.source}F.prototype.content=I;function O(Ne){var Ae=new Error(M.source+":"+j+":"+q+": "+Ne);if(Ae.reason=Ne,Ae.filename=M.source,Ae.line=j,Ae.column=q,Ae.source=I,!M.silent)throw Ae}function te(Ne){var Ae=Ne.exec(I);if(Ae){var $e=Ae[0];return z($e),I=I.slice($e.length),Ae}}function ne(){te(n)}function ae(Ne){var Ae;for(Ne=Ne||[];Ae=ge();)Ae!==!1&&Ne.push(Ae);return Ne}function ge(){var Ne=Q();if(!(_!=I.charAt(0)||S!=I.charAt(1))){for(var Ae=2;R!=I.charAt(Ae)&&(S!=I.charAt(Ae)||_!=I.charAt(Ae+1));)++Ae;if(Ae+=2,R===I.charAt(Ae-1))return O("End of comment missing");var $e=I.slice(2,Ae-2);return q+=2,z($e),I=I.slice(Ae),q+=2,Ne({type:C,comment:$e})}}function oe(){var Ne=Q(),Ae=te(o);if(Ae){if(ge(),!te(l))return O("property missing ':'");var $e=te(d),Fe=Ne({type:E,property:A(Ae[0].replace(t,R)),value:$e?A($e[0].replace(t,R)):R});return te(f),Fe}}function je(){var Ne=[];ae(Ne);for(var Ae;Ae=oe();)Ae!==!1&&(Ne.push(Ae),ae(Ne));return Ne}return ne(),je()};function A(I){return I?I.replace(g,R):R}return inlineStyleParser}var hasRequiredCjs$1;function requireCjs$1(){if(hasRequiredCjs$1)return cjs$1;hasRequiredCjs$1=1;var t=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 e=t(requireInlineStyleParser());function n(o,l){var d=null;if(!o||typeof o!="string")return d;var f=(0,e.default)(o),g=typeof l=="function";return f.forEach(function(b){if(b.type==="declaration"){var _=b.property,S=b.value;g?l(_,S,b):S&&(d=d||{},d[_]=S)}}),d}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 t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,d=function(_){return!_||n.test(_)||t.test(_)},f=function(_,S){return S.toUpperCase()},g=function(_,S){return"".concat(S,"-")},b=function(_,S){return S===void 0&&(S={}),d(_)?_:(_=_.toLowerCase(),S.reactCompat?_=_.replace(l,g):_=_.replace(o,g),_.replace(e,f))};return utilities.camelCase=b,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var t=cjs&&cjs.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},e=t(requireCjs$1()),n=requireUtilities$1();function o(l,d){var f={};return!l||typeof l!="string"||(0,e.default)(l,function(g,b){g&&b&&(f[(0,n.camelCase)(g,d)]=b)}),f}return o.default=o,cjs=o,cjs}var hasRequiredUtilities;function requireUtilities(){return hasRequiredUtilities||(hasRequiredUtilities=1,function(t){var e=utilities$1&&utilities$1.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(t,"__esModule",{value:!0}),t.returnFirstArg=t.canTextBeChildOfNode=t.ELEMENTS_WITH_NO_TEXT_CHILDREN=t.PRESERVE_CUSTOM_ATTRIBUTES=void 0,t.isCustomComponent=d,t.setStyleProp=g;var n=React,o=e(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 d(S,R){return S.includes("-")?!l.has(S):!!(R&&typeof R.is=="string")}var f={reactCompat:!0};function g(S,R){if(typeof S=="string"){if(!S.trim()){R.style={};return}try{R.style=(0,o.default)(S,f)}catch{R.style={}}}}t.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,t.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var b=function(S){return!t.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(S.name)};t.canTextBeChildOfNode=b;var _=function(S){return S};t.returnFirstArg=_}(utilities$1)),utilities$1}var hasRequiredAttributesToProps;function requireAttributesToProps(){if(hasRequiredAttributesToProps)return attributesToProps;hasRequiredAttributesToProps=1,Object.defineProperty(attributesToProps,"__esModule",{value:!0}),attributesToProps.default=d;var t=requireLib$1(),e=requireUtilities(),n=["checked","value"],o=["input","select","textarea"],l={reset:!0,submit:!0};function d(g,b){g===void 0&&(g={});var _={},S=!!(g.type&&l[g.type]);for(var R in g){var C=g[R];if((0,t.isCustomAttribute)(R)){_[R]=C;continue}var E=R.toLowerCase(),A=f(E);if(A){var I=(0,t.getPropertyInfo)(A);switch(n.includes(A)&&o.includes(b)&&!S&&(A=f("default"+E)),_[A]=C,I&&I.type){case t.BOOLEAN:_[A]=!0;break;case t.OVERLOADED_BOOLEAN:C===""&&(_[A]=!0);break}continue}e.PRESERVE_CUSTOM_ATTRIBUTES&&(_[R]=C)}return(0,e.setStyleProp)(g.style,_),_}function f(g){return t.possibleStandardNames[g]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var t=domToReact&&domToReact.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=d;var e=React,n=t(requireAttributesToProps()),o=requireUtilities(),l={cloneElement:e.cloneElement,createElement:e.createElement,isValidElement:e.isValidElement};function d(g,b){b===void 0&&(b={});for(var _=[],S=typeof b.replace=="function",R=b.transform||o.returnFirstArg,C=b.library||l,E=C.cloneElement,A=C.createElement,I=C.isValidElement,M=g.length,j=0;j<M;j++){var q=g[j];if(S){var z=b.replace(q,j);if(I(z)){M>1&&(z=E(z,{key:z.key||j})),_.push(R(z,q,j));continue}}if(q.type==="text"){var Q=!q.data.trim().length;if(Q&&q.parent&&!(0,o.canTextBeChildOfNode)(q.parent)||b.trim&&Q)continue;_.push(R(q.data,q,j));continue}var F=q,O={};f(F)?((0,o.setStyleProp)(F.attribs.style,F.attribs),O=F.attribs):F.attribs&&(O=(0,n.default)(F.attribs,F.name));var te=void 0;switch(q.type){case"script":case"style":q.children[0]&&(O.dangerouslySetInnerHTML={__html:q.children[0].data});break;case"tag":q.name==="textarea"&&q.children[0]?O.defaultValue=q.children[0].data:q.children&&q.children.length&&(te=d(q.children,b));break;default:continue}M>1&&(O.key=j),_.push(R(A(q.name,O,te),q,j))}return _.length===1?_[0]:_}function f(g){return o.PRESERVE_CUSTOM_ATTRIBUTES&&g.type==="tag"&&(0,o.isCustomComponent)(g.name,g.attribs)}return domToReact}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(t){var e=lib$3&&lib$3.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(t,"__esModule",{value:!0}),t.htmlToDOM=t.domToReact=t.attributesToProps=t.Text=t.ProcessingInstruction=t.Element=t.Comment=void 0,t.default=g;var n=e(requireHtmlToDom());t.htmlToDOM=n.default;var o=e(requireAttributesToProps());t.attributesToProps=o.default;var l=e(requireDomToReact());t.domToReact=l.default;var d=requireLib$2();Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return d.Text}});var f={lowerCaseAttributeNames:!1};function g(b,_){if(typeof b!="string")throw new TypeError("First argument must be a string");return b?(0,l.default)((0,n.default)(b,(_==null?void 0:_.htmlparser2)||f),_):[]}}(lib$3)),lib$3}var libExports=requireLib();const HTMLReactParser=getDefaultExportFromCjs$1(libExports),parser=HTMLReactParser.default||HTMLReactParser;function SkeletonMessage({botStatus:t}){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:t})]})})]})]})}const toHTML=t=>t.split(`
1048
- `).map(e=>jsxRuntime.jsx("p",{children:e}));function ChatMessages({messages:t,currentUserId:e,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[t.map(l=>{const d=l.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",d&&"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=${d}`})}),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 f=new Date(l.timestamp);return isToday(f)?f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(f)?`Yesterday, ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${f.toLocaleDateString([],{month:"short",day:"numeric"})} ${f.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 ",d?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:l.fromPartnerID===ASSISTANT_ID?parser(l.content):toHTML(l.content)})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.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"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=t,[C,E]=React__namespace.useState(null),A=useComposedRefs(e,z=>E(z)),I=React__namespace.useRef(!1),M=C?S||!!C.closest("form"):!0,[j,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:j,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":j,"aria-required":f,"data-state":getState$2(j),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:A,onClick:composeEventHandlers(t.onClick,z=>{q(Q=>!Q),M&&(I.current=z.isPropagationStopped(),I.current||z.stopPropagation())})}),M&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:j,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...o}=t,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function getState$2(t){return t?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DebugMessageDisplay=({debugMessages:t})=>{const[e,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:t.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=e[d];return jsxRuntime.jsxs("div",{className:"cursor-pointer",onClick:()=>o(d),children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("p",{className:"text-slate-600 mr-2",children:l[0]}),jsxRuntime.jsx("span",{className:"text-slate-500 text-xs",children:f?"▲":"▼"})]}),f&&jsxRuntime.jsx("p",{className:"text-slate-400 pl-4",children:l[1]})]},d)}})})},ASSISTANT_ID="RandmarAIChatAssistant",ChatLayout=React.forwardRef(({userId:t,userName:e,apiKey:n,inputRef:o},l)=>{const{data:d,refetch:f}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t}),[g]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[b]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[_,{isLoading:S}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[R,C]=React.useState(!1),E=React.useRef(null),[A]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[I]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:M,botMessages:j,clearBotMessages:q,botReady:z,debugMessages:Q,botStatus:F,reset:O}=useAIAssistant({userId:t,apiKey:n,smartAndSlow:R});React.useEffect(()=>{if(!d)return;const ut={partner1:t,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},Mt=d.map(Ut=>{var yt;return{partner1:Ut.Participant1,partner2:Ut.Participant2,name:((yt=Ut.Participant)==null?void 0:yt.PublicName)??"missing public name",unread:0,pending:Ut.Status!="Approved",historyFetched:!1,messages:[],conversationID:Ut.ConversationId}});setTimeout(()=>{var Ut;return(Ut=it.current)==null?void 0:Ut.focus()},50),Fe([ut,...Mt])},[d]);const[te,ne]=React.useState("approved"),[ae,ge]=React.useState([t,ASSISTANT_ID]),[oe,je]=React.useState(""),[Ne,Ae]=React.useState(null),[$e,Fe]=React.useState([]),[ze,Ve]=React.useState(""),[Be,qe]=React.useState(null),[Ke,He]=React.useState([]),[,Xe]=React.useState(0),tt=React.useRef(null),Ye=React.useRef(null),[et,Ze]=React.useState(null),[at,rt]=React.useState([]),it=o||Ye,st=React.useRef(null),{toast:Ue}=useToast(),Rt=$e.filter(ut=>{const Mt=ut.name.toLowerCase().includes(ze.toLowerCase());return te==="approved"?Mt&&!ut.pending:te==="pending"?Mt&&ut.pending:Mt});React.useEffect(()=>{var ut;et!==null&&(Ue({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(ut=it.current)==null||ut.focus())},[et]),React.useEffect(()=>{j.length!==0&&(j.forEach(ut=>{if(!ut)return;if(ut.isComponent){He(Ut=>[...Ut,ut.content]),Xe(0);return}const Mt={id:ut.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:ut.timestamp.getTime(),content:ut.content};Mt.content=marked(Mt.content,{async:!1}),Je(Mt)}),q())},[j]);function Je(ut){const Mt=[ut.fromPartnerID,ut.toPartnerID];Mt.sort(),Fe(Ut=>{let yt=!1;const nr=Ut.map(er=>er.partner1!==Mt[0]||er.partner2!==Mt[1]||er.messages.findIndex(lr=>lr.id==ut.id)!==-1?er:(yt=!0,{...er,unread:er.unread+1,messages:[...er.messages,ut]}));return yt&&Ae([Mt[0],Mt[1]]),nr})}React.useEffect(()=>{const ut=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return ut.on("ReceiveMessage",Je),ut.start().catch(Mt=>console.error("Error connecting to SignalR hub:",Mt)),qe(ut),()=>{ut&&ut.stop()}},[t]),React.useEffect(()=>{(Ne==null?void 0:Ne[0])!==(ae==null?void 0:ae[0])||(Ne==null?void 0:Ne[1])!==(ae==null?void 0:ae[1])||(Fe(ut=>ut.map(Mt=>Mt.partner1===(ae==null?void 0:ae[0])&&Mt.partner2===(ae==null?void 0:ae[1])?{...Mt,unread:0}:Mt)),setTimeout(()=>{var ut;return(ut=tt.current)==null?void 0:ut.scrollIntoView({behavior:"smooth"})},50))},[Ne,ae]),React.useEffect(()=>{if(!ae)return;const ut=getActiveChatObject($e,ae);if(ut){if(ut.historyFetched){ut.unread>0&&Fe(Mt=>Mt.map(Ut=>Ut.partner1===ae[0]&&Ut.partner2===ae[1]?{...Ut,unread:0}:Ut)),setTimeout(()=>{var Mt;return(Mt=tt.current)==null?void 0:Mt.scrollIntoView({behavior:"smooth"})},50);return}I({routeApplicationId:t,conversationId:ut.conversationID}).unwrap().then(Mt=>{const Ut=Mt.map(yt=>({id:"history"+yt.MessageId,fromPartnerID:yt.SenderId,toPartnerID:yt.SenderId==ae[0]?ae[1]:ae[0],senderName:yt.SenderName??"missing name",timestamp:new Date(yt.SentDate+"Z").getTime(),content:yt.Content??"no content"}));Fe(yt=>yt.map(nr=>nr.partner1===ae[0]&&nr.partner2===ae[1]?{...nr,messages:Ut,historyFetched:!0}:nr))}).catch(Mt=>{console.error("Error fetching conversation messages:",Mt)})}},[$e,ae,I,t]),React.useEffect(()=>{var Mt;if(Xe(Ke.length),!ae)return;const ut=getActiveChatObject($e,ae);ut&&((Mt=it.current)==null||Mt.focus(),g({applicationId:ut.partner1===t?ut.partner2:ut.partner1}).then(Ut=>{Ut.data&&(He(yt=>[...yt,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:Ut.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),Xe(0))}))},[ae,t]);const mt=(ut,Mt,Ut)=>{const yt={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:Mt[0]===t?Mt[1]:Mt[0],content:ut+(et?` (${et==null?void 0:et.name} attached)`:""),timestamp:Date.now()};Fe(nr=>nr.map(er=>er.partner1===Mt[0]&&er.partner2===Mt[1]?{...er,messages:[...er.messages,yt]}:er)),Ae([Mt[0],Mt[1]]),yt.toPartnerID==ASSISTANT_ID?(M(yt.content,et??void 0),et&&rt(nr=>[...nr,et.name])):Ut.invoke("NewMessage",yt).catch(nr=>console.error("Error sending message:",nr)),je(""),Ze(null),st.current&&(st.current.value="")},$t=(ut,Mt)=>{if(!$e.length||!Be||!z)return!1;const Ut=$e.find(yt=>yt.conversationID===ut);return Ut?(Ut.pending&&setTimeout(()=>ne("pending"),300),ge([Ut.partner1,Ut.partner2]),Mt&&setTimeout(()=>mt(Mt,[Ut.partner1,Ut.partner2],Be),300),!0):!1};if(React.useImperativeHandle(l,()=>({setActiveChatAndSendMessage:$t})),!z)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 Dt=ut=>{var Ut;if(!isAssistantChat(ae))return;const Mt=(Ut=ut.clipboardData)==null?void 0:Ut.items;if(Mt){for(let yt=0;yt<Mt.length;yt++)if(Mt[yt].type.indexOf("image")!==-1){const nr=Mt[yt].getAsFile();if(nr){Ze(nr);return}}}},Ht=()=>{!oe.trim()||!ae||!Be||(Xe(Ke.length),mt(oe,ae,Be))},Vt=ut=>{ut.target.files&&ut.target.files[0]?Ze(ut.target.files[0]):Ze(null)},We=()=>{var ut;(ut=st.current)==null||ut.click()},nt=()=>{var ut;Ze(null),Ue({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(ut=it.current)==null||ut.focus()},Qe=()=>{const Mt={messages:$e.find(Ut=>Ut.partner1===ASSISTANT_ID||Ut.partner2===ASSISTANT_ID),debug:Q};b({applicationId:t,emailAddress:e,body:Mt})},dt=async()=>{E.current&&(E.current.disabled=!0),await A({routeApplicationId:t,partnerId:"2"}),await f()},pt=()=>{Fe(ut=>ut.map(Ut=>Ut.partner1!==ASSISTANT_ID&&Ut.partner2!==ASSISTANT_ID?Ut:{...Ut,messages:[]})),rt([]),O()},ft=()=>{ae&&_({routeApplicationId:t,partnerId:ae[0]==t?ae[1]:ae[0]}).then(()=>{ne("approved")})},ct=getActiveChatObject($e,ae),qt=$e.filter(ut=>ut.pending).length;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"}),$e.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:ze,onChange:ut=>Ve(ut.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:te,onValueChange:ne,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",qt>0&&`(${qt})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:$e.findIndex(ut=>ut.partner1==="2"||ut.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:E,onClick:()=>dt(),children:"Chat with Randmar"},"b1"):jsxRuntime.jsx("a",{target:"_blank",href:`https://dashboard.randmar.io/${t}/ExploreManufacturers`,children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:$e.length&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(ChatList,{userId:t,chats:Rt.filter(ut=>ut.partner1!=ASSISTANT_ID&&ut.partner2!=ASSISTANT_ID),activeChat:ct??null,onSelectChat:ge,assistantChat:$e.find(ut=>ut.partner1==ASSISTANT_ID||ut.partner2==ASSISTANT_ID)})})})]}),jsxRuntime.jsx("div",{className:"flex-3 flex flex-col",children:ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:ae[0]==ASSISTANT_ID||ae[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.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[jsxRuntime.jsx(Switch,{id:"smartSwitch",disabled:!!F,checked:R,onCheckedChange:ut=>{pt(),setTimeout(()=>C(ut),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>pt(),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:()=>Qe()},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/${ae[0]===t?ae[1]:ae[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:ct==null?void 0:ct.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${t}/Partner/${ae[0]===t?ae[1]:ae[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),ct!=null&&ct.pending&&ct.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — 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:(ct==null?void 0:ct.messages)??[],currentUserId:t,isAssistantChat:isAssistantChat(ae),botStatus:isAssistantChat(ae)?F:""}),jsxRuntime.jsx("div",{ref:tt})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t flex",children:[(ct==null?void 0:ct.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:S,onClick:()=>ft(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:it,placeholder:"Type a message...",value:oe,onPaste:Dt,onChange:ut=>je(ut.target.value),onKeyDown:ut=>{ut.key!=="Enter"||ut.shiftKey||(ut.preventDefault(),Ht())},className:ct!=null&&ct.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:!!F||(ct==null?void 0:ct.pending),onClick:Ht,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),isAssistantChat(ae)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:Vt,className:"hidden",ref:st}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:We,className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:F!==""||(ct==null?void 0:ct.pending)||!!et,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:nt,className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:F!==""||(ct==null?void 0:ct.pending)||!et,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsx("div",{className:"w-[480px] flex flex-2 flex-col border-l",children:isAssistantChat(ae)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Sources and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[et?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",et.name," (pending send...)"]})}):at.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),at.slice().reverse().map(ut=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",ut]})}))]})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:Q})})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((ae==null?void 0:ae[0])===t?ae[1]:ae==null?void 0:ae[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})]})})]})});function getActiveChatObject(t,e){return t.find(n=>n.partner1==(e==null?void 0:e[0])&&n.partner2==(e==null?void 0:e[1]))}function isAssistantChat(t){return(t==null?void 0:t[0])==ASSISTANT_ID||(t==null?void 0:t[1])==ASSISTANT_ID}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var C,E,A;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ManufacturerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"",_=((C=t.Tags)==null?void 0:C.split(",").map(I=>I.trim()).filter(Boolean))||[],R=(I=>!I||I.length===0?[]:[...I].sort((M,j)=>(M.Day||0)-(j.Day||0)).map(M=>({date:M.Day||0,amount:M.ExtendedPrice||0})))(t.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&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(PartnerLogo,{id:t.ManufacturerId,width:48,height:48})}),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:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:R.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:R,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:[(!!((E=t.Qualification)!=null&&E.QualificationId)&&((A=t.Qualification)==null?void 0:A.QualificationId)!=="Suspended"||!!t.OpenToWork||_.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),_.map((I,M)=>jsxRuntime.jsx(Badge,{variant:"outline",children:I},M))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function ResellerCard({reseller:t,link:e,actions:n,loading:o=!1}){var g,b;if(o||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const l=t.ResellerId||"N/A",d=[t.City,t.Province,t.Country].filter(Boolean),f=d.length>0?d.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ResellerId,width:48,height:48})}),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:l})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:f})]})]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),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:[!!((g=t.Qualification)!=null&&g.QualificationId)&&((b=t.Qualification)==null?void 0:b.QualificationId)!=="Suspended"&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}})}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesYearToDay?formatMoney(t==null?void 0:t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast3Months?formatMoney(t==null?void 0:t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast30Days?formatMoney(t==null?void 0:t.SalesData.SalesLast30Days):"—"})]})]})}),(n||e)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 mt-auto ${n?"justify-between":"justify-end"}`,children:[n&&n,e&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:e,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("th",{ref:n,className:cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const _=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},S=R=>{R.key==="Enter"&&_()};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:_,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:S,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(M=>M.DocumentType==="Order"),d=t.filter(M=>M.DocumentType==="Shipment"),f=l.filter(M=>M.WarehouseCode!=="3PLE"),g=f.reduce((M,j)=>M+(j.Quantity||0),0),b=f.reduce((M,j)=>M+(j.ExtendedPrice||0),0),_=l.filter(M=>M.WarehouseCode==="3PLE"),S=_.reduce((M,j)=>M+(j.Quantity||0),0),R=_.reduce((M,j)=>M+(j.ExtendedPrice||0),0),C=d.length,E=d.reduce((M,j)=>M+(j.ExtendedPrice||0),0),A=g+S+C,I=b+R+E;return{all:{orders:A,amount:I},processing:{orders:g,amount:b},shipped:{orders:C,amount:E},delayed:{orders:S,amount:R}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:n.all.orders,amount:n.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:n.processing.orders,amount:n.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:n.shipped.orders,amount:n.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:n.delayed.orders,amount:n.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:formatMoney(l.amount)})]})]})]})]},l.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=e||!t||!t.__esModule?__defProp(n,"default",{value:t,enumerable:!0}):n;for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_={5:b,"5module":b+" export import",6:b+" const class extends export import super"},S=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(V,se){for(var Oe=65536,Le=0;Le<se.length;Le+=2){if(Oe+=se[Le],Oe>V)return!1;if(Oe+=se[Le+1],Oe>=V)return!0}return!1}function A(V,se){return V<65?V===36:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&R.test(String.fromCharCode(V)):se===!1?!1:E(V,l)}function I(V,se){return V<48?V===36:V<58?!0:V<65?!1:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&C.test(String.fromCharCode(V)):se===!1?!1:E(V,l)||E(V,o)}var M=function(se,Oe){Oe===void 0&&(Oe={}),this.label=se,this.keyword=Oe.keyword,this.beforeExpr=!!Oe.beforeExpr,this.startsExpr=!!Oe.startsExpr,this.isLoop=!!Oe.isLoop,this.isAssign=!!Oe.isAssign,this.prefix=!!Oe.prefix,this.postfix=!!Oe.postfix,this.binop=Oe.binop||null,this.updateContext=null};function j(V,se){return new M(V,{beforeExpr:!0,binop:se})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(V,se){return se===void 0&&(se={}),se.keyword=V,Q[V]=new M(V,se)}var O={num:new M("num",z),regexp:new M("regexp",z),string:new M("string",z),name:new M("name",z),privateId:new M("privateId",z),eof:new M("eof"),bracketL:new M("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new M("]"),braceL:new M("{",{beforeExpr:!0,startsExpr:!0}),braceR:new M("}"),parenL:new M("(",{beforeExpr:!0,startsExpr:!0}),parenR:new M(")"),comma:new M(",",q),semi:new M(";",q),colon:new M(":",q),dot:new M("."),question:new M("?",q),questionDot:new M("?."),arrow:new M("=>",q),template:new M("template"),invalidTemplate:new M("invalidTemplate"),ellipsis:new M("...",q),backQuote:new M("`",z),dollarBraceL:new M("${",{beforeExpr:!0,startsExpr:!0}),eq:new M("=",{beforeExpr:!0,isAssign:!0}),assign:new M("_=",{beforeExpr:!0,isAssign:!0}),incDec:new M("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new M("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new M("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new M("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function ae(V){return V===10||V===13||V===8232||V===8233}function ge(V,se,Oe){Oe===void 0&&(Oe=V.length);for(var Le=se;Le<Oe;Le++){var Ge=V.charCodeAt(Le);if(ae(Ge))return Le<Oe-1&&Ge===13&&V.charCodeAt(Le+1)===10?Le+2:Le+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,je=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ne=Object.prototype,Ae=Ne.hasOwnProperty,$e=Ne.toString,Fe=Object.hasOwn||function(V,se){return Ae.call(V,se)},ze=Array.isArray||function(V){return $e.call(V)==="[object Array]"},Ve=Object.create(null);function Be(V){return Ve[V]||(Ve[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function qe(V){return V<=65535?String.fromCharCode(V):(V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320))}var Ke=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(se,Oe){this.line=se,this.column=Oe};He.prototype.offset=function(se){return new He(this.line,this.column+se)};var Xe=function(se,Oe,Le){this.start=Oe,this.end=Le,se.sourceFile!==null&&(this.source=se.sourceFile)};function tt(V,se){for(var Oe=1,Le=0;;){var Ge=ge(V,Le,se);if(Ge<0)return new He(Oe,se-Le);++Oe,Le=Ge}}var Ye={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},et=!1;function Ze(V){var se={};for(var Oe in Ye)se[Oe]=V&&Fe(V,Oe)?V[Oe]:Ye[Oe];if(se.ecmaVersion==="latest"?se.ecmaVersion=1e8:se.ecmaVersion==null?(!et&&typeof console=="object"&&console.warn&&(et=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1048
+ `).map(e=>jsxRuntime.jsx("p",{children:e}));function ChatMessages({messages:t,currentUserId:e,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[t.map(l=>{const d=l.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",d&&"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=${d}`})}),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 f=new Date(l.timestamp);return isToday(f)?f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(f)?`Yesterday, ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${f.toLocaleDateString([],{month:"short",day:"numeric"})} ${f.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 ",d?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:l.fromPartnerID===ASSISTANT_ID?parser(l.content):toHTML(l.content)})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.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"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=t,[C,E]=React__namespace.useState(null),A=useComposedRefs(e,z=>E(z)),I=React__namespace.useRef(!1),M=C?S||!!C.closest("form"):!0,[j,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:j,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":j,"aria-required":f,"data-state":getState$2(j),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:A,onClick:composeEventHandlers(t.onClick,z=>{q(Q=>!Q),M&&(I.current=z.isPropagationStopped(),I.current||z.stopPropagation())})}),M&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:j,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...o}=t,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function getState$2(t){return t?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DebugMessageDisplay=({debugMessages:t})=>{const[e,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:t.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=e[d];return jsxRuntime.jsxs("div",{className:"cursor-pointer",onClick:()=>o(d),children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("p",{className:"text-slate-600 mr-2",children:l[0]}),jsxRuntime.jsx("span",{className:"text-slate-500 text-xs",children:f?"▲":"▼"})]}),f&&jsxRuntime.jsx("p",{className:"text-slate-400 pl-4",children:l[1]})]},d)}})})},ASSISTANT_ID="RandmarAIChatAssistant",ChatLayout=React.forwardRef(({userId:t,userName:e,apiKey:n,inputRef:o},l)=>{const{data:d,refetch:f}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t}),[g]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[b]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[_,{isLoading:S}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[R,C]=React.useState(!1),E=React.useRef(null),[A]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[I]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:M,botMessages:j,clearBotMessages:q,botReady:z,debugMessages:Q,botStatus:F,reset:O}=useAIAssistant({userId:t,apiKey:n,smartAndSlow:R});React.useEffect(()=>{if(!d)return;const ut={partner1:t,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},Mt=d.map(Ut=>{var yt;return{partner1:Ut.Participant1,partner2:Ut.Participant2,name:((yt=Ut.Participant)==null?void 0:yt.PublicName)??"missing public name",unread:0,pending:Ut.Status!="Approved",historyFetched:!1,messages:[],conversationID:Ut.ConversationId}});setTimeout(()=>{var Ut;return(Ut=it.current)==null?void 0:Ut.focus()},50),Fe([ut,...Mt])},[d]);const[te,ne]=React.useState("approved"),[ae,ge]=React.useState([t,ASSISTANT_ID]),[oe,je]=React.useState(""),[Ne,Ae]=React.useState(null),[$e,Fe]=React.useState([]),[ze,Ve]=React.useState(""),[Be,qe]=React.useState(null),[Ke,He]=React.useState([]),[,Xe]=React.useState(0),tt=React.useRef(null),Ye=React.useRef(null),[et,Ze]=React.useState(null),[at,rt]=React.useState([]),it=o||Ye,st=React.useRef(null),{toast:Ue}=useToast(),Rt=$e.filter(ut=>{const Mt=ut.name.toLowerCase().includes(ze.toLowerCase());return te==="approved"?Mt&&!ut.pending:te==="pending"?Mt&&ut.pending:Mt});React.useEffect(()=>{var ut;et!==null&&(Ue({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(ut=it.current)==null||ut.focus())},[et]),React.useEffect(()=>{j.length!==0&&(j.forEach(ut=>{if(!ut)return;if(ut.isComponent){He(Ut=>[...Ut,ut.content]),Xe(0);return}const Mt={id:ut.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:ut.timestamp.getTime(),content:ut.content};Mt.content=marked(Mt.content,{async:!1}),Je(Mt)}),q())},[j]);function Je(ut){const Mt=[ut.fromPartnerID,ut.toPartnerID];Mt.sort(),Fe(Ut=>{let yt=!1;const nr=Ut.map(er=>er.partner1!==Mt[0]||er.partner2!==Mt[1]||er.messages.findIndex(lr=>lr.id==ut.id)!==-1?er:(yt=!0,{...er,unread:er.unread+1,messages:[...er.messages,ut]}));return yt&&Ae([Mt[0],Mt[1]]),nr})}React.useEffect(()=>{const ut=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return ut.on("ReceiveMessage",Je),ut.start().catch(Mt=>console.error("Error connecting to SignalR hub:",Mt)),qe(ut),()=>{ut&&ut.stop()}},[t]),React.useEffect(()=>{(Ne==null?void 0:Ne[0])!==(ae==null?void 0:ae[0])||(Ne==null?void 0:Ne[1])!==(ae==null?void 0:ae[1])||(Fe(ut=>ut.map(Mt=>Mt.partner1===(ae==null?void 0:ae[0])&&Mt.partner2===(ae==null?void 0:ae[1])?{...Mt,unread:0}:Mt)),setTimeout(()=>{var ut;return(ut=tt.current)==null?void 0:ut.scrollIntoView({behavior:"smooth"})},50))},[Ne,ae]),React.useEffect(()=>{if(!ae)return;const ut=getActiveChatObject($e,ae);if(ut){if(ut.historyFetched){ut.unread>0&&Fe(Mt=>Mt.map(Ut=>Ut.partner1===ae[0]&&Ut.partner2===ae[1]?{...Ut,unread:0}:Ut)),setTimeout(()=>{var Mt;return(Mt=tt.current)==null?void 0:Mt.scrollIntoView({behavior:"smooth"})},50);return}I({routeApplicationId:t,conversationId:ut.conversationID}).unwrap().then(Mt=>{const Ut=Mt.map(yt=>({id:"history"+yt.MessageId,fromPartnerID:yt.SenderId,toPartnerID:yt.SenderId==ae[0]?ae[1]:ae[0],senderName:yt.SenderName??"missing name",timestamp:new Date(yt.SentDate+"Z").getTime(),content:yt.Content??"no content"}));Fe(yt=>yt.map(nr=>nr.partner1===ae[0]&&nr.partner2===ae[1]?{...nr,messages:Ut,historyFetched:!0}:nr))}).catch(Mt=>{console.error("Error fetching conversation messages:",Mt)})}},[$e,ae,I,t]),React.useEffect(()=>{var Mt;if(Xe(Ke.length),!ae)return;const ut=getActiveChatObject($e,ae);ut&&((Mt=it.current)==null||Mt.focus(),g({applicationId:ut.partner1===t?ut.partner2:ut.partner1}).then(Ut=>{Ut.data&&(He(yt=>[...yt,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:Ut.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),Xe(0))}))},[ae,t]);const mt=(ut,Mt,Ut)=>{const yt={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:Mt[0]===t?Mt[1]:Mt[0],content:ut+(et?` (${et==null?void 0:et.name} attached)`:""),timestamp:Date.now()};Fe(nr=>nr.map(er=>er.partner1===Mt[0]&&er.partner2===Mt[1]?{...er,messages:[...er.messages,yt]}:er)),Ae([Mt[0],Mt[1]]),yt.toPartnerID==ASSISTANT_ID?(M(yt.content,et??void 0),et&&rt(nr=>[...nr,et.name])):Ut.invoke("NewMessage",yt).catch(nr=>console.error("Error sending message:",nr)),je(""),Ze(null),st.current&&(st.current.value="")},$t=(ut,Mt)=>{if(!$e.length||!Be||!z)return!1;const Ut=$e.find(yt=>yt.conversationID===ut);return Ut?(Ut.pending&&setTimeout(()=>ne("pending"),300),ge([Ut.partner1,Ut.partner2]),Mt&&setTimeout(()=>mt(Mt,[Ut.partner1,Ut.partner2],Be),300),!0):!1};if(React.useImperativeHandle(l,()=>({setActiveChatAndSendMessage:$t})),!z)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 Dt=ut=>{var Ut;if(!isAssistantChat(ae))return;const Mt=(Ut=ut.clipboardData)==null?void 0:Ut.items;if(Mt){for(let yt=0;yt<Mt.length;yt++)if(Mt[yt].type.indexOf("image")!==-1){const nr=Mt[yt].getAsFile();if(nr){Ze(nr);return}}}},Ht=()=>{!oe.trim()||!ae||!Be||(Xe(Ke.length),mt(oe,ae,Be))},Vt=ut=>{ut.target.files&&ut.target.files[0]?Ze(ut.target.files[0]):Ze(null)},We=()=>{var ut;(ut=st.current)==null||ut.click()},nt=()=>{var ut;Ze(null),Ue({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(ut=it.current)==null||ut.focus()},Qe=()=>{const Mt={messages:$e.find(Ut=>Ut.partner1===ASSISTANT_ID||Ut.partner2===ASSISTANT_ID),debug:Q};b({applicationId:t,emailAddress:e,body:Mt})},dt=async()=>{E.current&&(E.current.disabled=!0),await A({routeApplicationId:t,partnerId:"2"}),await f()},pt=()=>{Fe(ut=>ut.map(Ut=>Ut.partner1!==ASSISTANT_ID&&Ut.partner2!==ASSISTANT_ID?Ut:{...Ut,messages:[]})),rt([]),O()},ft=()=>{ae&&_({routeApplicationId:t,partnerId:ae[0]==t?ae[1]:ae[0]}).then(()=>{ne("approved")})},ct=getActiveChatObject($e,ae),qt=$e.filter(ut=>ut.pending).length;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"}),$e.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:ze,onChange:ut=>Ve(ut.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:te,onValueChange:ne,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",qt>0&&`(${qt})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:$e.findIndex(ut=>ut.partner1==="2"||ut.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:E,onClick:()=>dt(),children:"Chat with Randmar"},"b1"):jsxRuntime.jsx("a",{target:"_blank",href:`https://dashboard.randmar.io/${t}/ExploreManufacturers`,children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:$e.length&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(ChatList,{userId:t,chats:Rt.filter(ut=>ut.partner1!=ASSISTANT_ID&&ut.partner2!=ASSISTANT_ID),activeChat:ct??null,onSelectChat:ge,assistantChat:$e.find(ut=>ut.partner1==ASSISTANT_ID||ut.partner2==ASSISTANT_ID)})})})]}),jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:ae[0]==ASSISTANT_ID||ae[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.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[jsxRuntime.jsx(Switch,{id:"smartSwitch",disabled:!!F,checked:R,onCheckedChange:ut=>{pt(),setTimeout(()=>C(ut),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>pt(),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:()=>Qe()},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/${ae[0]===t?ae[1]:ae[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:ct==null?void 0:ct.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${t}/Partner/${ae[0]===t?ae[1]:ae[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),ct!=null&&ct.pending&&ct.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — 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:(ct==null?void 0:ct.messages)??[],currentUserId:t,isAssistantChat:isAssistantChat(ae),botStatus:isAssistantChat(ae)?F:""}),jsxRuntime.jsx("div",{ref:tt})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(ct==null?void 0:ct.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:S,onClick:()=>ft(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:it,placeholder:"Type a message...",value:oe,onPaste:Dt,onChange:ut=>je(ut.target.value),onKeyDown:ut=>{ut.key!=="Enter"||ut.shiftKey||(ut.preventDefault(),Ht())},className:ct!=null&&ct.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:!!F||(ct==null?void 0:ct.pending),onClick:Ht,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),isAssistantChat(ae)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:Vt,className:"hidden",ref:st}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:We,className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:F!==""||(ct==null?void 0:ct.pending)||!!et,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:nt,className:ct!=null&&ct.pending?"collapse":"ml-2 h-8 w-8",disabled:F!==""||(ct==null?void 0:ct.pending)||!et,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsx("div",{className:"w-[480px] flex flex-4 flex-col border-l",children:isAssistantChat(ae)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Sources and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[et?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",et.name," (pending send...)"]})}):at.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),at.slice().reverse().map(ut=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",ut]})}))]})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:Q})})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"mt-1",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((ae==null?void 0:ae[0])===t?ae[1]:ae==null?void 0:ae[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})})]})})]})});function getActiveChatObject(t,e){return t.find(n=>n.partner1==(e==null?void 0:e[0])&&n.partner2==(e==null?void 0:e[1]))}function isAssistantChat(t){return(t==null?void 0:t[0])==ASSISTANT_ID||(t==null?void 0:t[1])==ASSISTANT_ID}const alertVariants=cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-500/50 bg-green-50 text-green-700 dark:border-green-500 dark:bg-green-950 dark:text-green-400 [&>svg]:text-green-500",warning:"border-yellow-500/50 bg-yellow-50 text-yellow-700 dark:border-yellow-500 dark:bg-yellow-950 dark:text-yellow-400 [&>svg]:text-yellow-500",info:"border-blue-500/50 bg-blue-50 text-blue-700 dark:border-blue-500 dark:bg-blue-950 dark:text-blue-400 [&>svg]:text-blue-500"}},defaultVariants:{variant:"default"}}),Alert=React__namespace.forwardRef(({className:t,variant:e,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:e}),t),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",t),...e}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",t),...e}));AlertDescription.displayName="AlertDescription";function QualificationBadge({qualification:t}){return!t.QualificationId||t.QualificationId==="Suspended"?null:t.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$1,{className:"h-3 w-3 mr-1"}),"Do Not Sell"]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})}):jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"info",className:t.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),t.QualificationId,t.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:t.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function ManufacturerCard({manufacturer:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var C,E,A;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-24"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ManufacturerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"",_=((C=t.Tags)==null?void 0:C.split(",").map(I=>I.trim()).filter(Boolean))||[],R=(I=>!I||I.length===0?[]:[...I].sort((M,j)=>(M.Day||0)-(j.Day||0)).map(M=>({date:M.Day||0,amount:M.ExtendedPrice||0})))(t.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&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(PartnerLogo,{id:t.ManufacturerId,width:48,height:48})}),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:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:R.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:R,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:[(!!((E=t.Qualification)!=null&&E.QualificationId)&&((A=t.Qualification)==null?void 0:A.QualificationId)!=="Suspended"||!!t.OpenToWork||_.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),_.map((I,M)=>jsxRuntime.jsx(Badge,{variant:"outline",children:I},M))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),t.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesYearToDay?formatMoney(t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast3Months?formatMoney(t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t.SalesData.SalesLast30Days?formatMoney(t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}function ResellerCard({reseller:t,link:e,actions:n,loading:o=!1}){var g,b;if(o||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const l=t.ResellerId||"N/A",d=[t.City,t.Province,t.Country].filter(Boolean),f=d.length>0?d.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ResellerId,width:48,height:48})}),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:l})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:f})]})]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),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:[!!((g=t.Qualification)!=null&&g.QualificationId)&&((b=t.Qualification)==null?void 0:b.QualificationId)!=="Suspended"&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}})}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesYearToDay?formatMoney(t==null?void 0:t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast3Months?formatMoney(t==null?void 0:t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast30Days?formatMoney(t==null?void 0:t.SalesData.SalesLast30Days):"—"})]})]})}),(n||e)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 mt-auto ${n?"justify-between":"justify-end"}`,children:[n&&n,e&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:e,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("th",{ref:n,className:cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const _=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},S=R=>{R.key==="Enter"&&_()};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:_,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:S,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(M=>M.DocumentType==="Order"),d=t.filter(M=>M.DocumentType==="Shipment"),f=l.filter(M=>M.WarehouseCode!=="3PLE"),g=f.reduce((M,j)=>M+(j.Quantity||0),0),b=f.reduce((M,j)=>M+(j.ExtendedPrice||0),0),_=l.filter(M=>M.WarehouseCode==="3PLE"),S=_.reduce((M,j)=>M+(j.Quantity||0),0),R=_.reduce((M,j)=>M+(j.ExtendedPrice||0),0),C=d.length,E=d.reduce((M,j)=>M+(j.ExtendedPrice||0),0),A=g+S+C,I=b+R+E;return{all:{orders:A,amount:I},processing:{orders:g,amount:b},shipped:{orders:C,amount:E},delayed:{orders:S,amount:R}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:n.all.orders,amount:n.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:n.processing.orders,amount:n.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:n.shipped.orders,amount:n.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:n.delayed.orders,amount:n.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:formatMoney(l.amount)})]})]})]})]},l.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=e||!t||!t.__esModule?__defProp(n,"default",{value:t,enumerable:!0}):n;for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_={5:b,"5module":b+" export import",6:b+" const class extends export import super"},S=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(V,se){for(var Oe=65536,Le=0;Le<se.length;Le+=2){if(Oe+=se[Le],Oe>V)return!1;if(Oe+=se[Le+1],Oe>=V)return!0}return!1}function A(V,se){return V<65?V===36:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&R.test(String.fromCharCode(V)):se===!1?!1:E(V,l)}function I(V,se){return V<48?V===36:V<58?!0:V<65?!1:V<91?!0:V<97?V===95:V<123?!0:V<=65535?V>=170&&C.test(String.fromCharCode(V)):se===!1?!1:E(V,l)||E(V,o)}var M=function(se,Oe){Oe===void 0&&(Oe={}),this.label=se,this.keyword=Oe.keyword,this.beforeExpr=!!Oe.beforeExpr,this.startsExpr=!!Oe.startsExpr,this.isLoop=!!Oe.isLoop,this.isAssign=!!Oe.isAssign,this.prefix=!!Oe.prefix,this.postfix=!!Oe.postfix,this.binop=Oe.binop||null,this.updateContext=null};function j(V,se){return new M(V,{beforeExpr:!0,binop:se})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(V,se){return se===void 0&&(se={}),se.keyword=V,Q[V]=new M(V,se)}var O={num:new M("num",z),regexp:new M("regexp",z),string:new M("string",z),name:new M("name",z),privateId:new M("privateId",z),eof:new M("eof"),bracketL:new M("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new M("]"),braceL:new M("{",{beforeExpr:!0,startsExpr:!0}),braceR:new M("}"),parenL:new M("(",{beforeExpr:!0,startsExpr:!0}),parenR:new M(")"),comma:new M(",",q),semi:new M(";",q),colon:new M(":",q),dot:new M("."),question:new M("?",q),questionDot:new M("?."),arrow:new M("=>",q),template:new M("template"),invalidTemplate:new M("invalidTemplate"),ellipsis:new M("...",q),backQuote:new M("`",z),dollarBraceL:new M("${",{beforeExpr:!0,startsExpr:!0}),eq:new M("=",{beforeExpr:!0,isAssign:!0}),assign:new M("_=",{beforeExpr:!0,isAssign:!0}),incDec:new M("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new M("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new M("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new M("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function ae(V){return V===10||V===13||V===8232||V===8233}function ge(V,se,Oe){Oe===void 0&&(Oe=V.length);for(var Le=se;Le<Oe;Le++){var Ge=V.charCodeAt(Le);if(ae(Ge))return Le<Oe-1&&Ge===13&&V.charCodeAt(Le+1)===10?Le+2:Le+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,je=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ne=Object.prototype,Ae=Ne.hasOwnProperty,$e=Ne.toString,Fe=Object.hasOwn||function(V,se){return Ae.call(V,se)},ze=Array.isArray||function(V){return $e.call(V)==="[object Array]"},Ve=Object.create(null);function Be(V){return Ve[V]||(Ve[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function qe(V){return V<=65535?String.fromCharCode(V):(V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320))}var Ke=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(se,Oe){this.line=se,this.column=Oe};He.prototype.offset=function(se){return new He(this.line,this.column+se)};var Xe=function(se,Oe,Le){this.start=Oe,this.end=Le,se.sourceFile!==null&&(this.source=se.sourceFile)};function tt(V,se){for(var Oe=1,Le=0;;){var Ge=ge(V,Le,se);if(Ge<0)return new He(Oe,se-Le);++Oe,Le=Ge}}var Ye={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},et=!1;function Ze(V){var se={};for(var Oe in Ye)se[Oe]=V&&Fe(V,Oe)?V[Oe]:Ye[Oe];if(se.ecmaVersion==="latest"?se.ecmaVersion=1e8:se.ecmaVersion==null?(!et&&typeof console=="object"&&console.warn&&(et=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1049
1049
  Defaulting to 2020, but this will stop working in the future.`)),se.ecmaVersion=11):se.ecmaVersion>=2015&&(se.ecmaVersion-=2009),se.allowReserved==null&&(se.allowReserved=se.ecmaVersion<5),(!V||V.allowHashBang==null)&&(se.allowHashBang=se.ecmaVersion>=14),ze(se.onToken)){var Le=se.onToken;se.onToken=function(Ge){return Le.push(Ge)}}return ze(se.onComment)&&(se.onComment=at(se,se.onComment)),se}function at(V,se){return function(Oe,Le,Ge,ot,lt,Ct){var It={type:Oe?"Block":"Line",value:Le,start:Ge,end:ot};V.locations&&(It.loc=new Xe(this,lt,Ct)),V.ranges&&(It.range=[Ge,ot]),se.push(It)}}var rt=1,it=2,st=4,Ue=8,Rt=16,Je=32,mt=64,$t=128,Dt=256,Ht=rt|it|Dt;function Vt(V,se){return it|(V?st:0)|(se?Ue:0)}var We=0,nt=1,Qe=2,dt=3,pt=4,ft=5,ct=function(se,Oe,Le){this.options=se=Ze(se),this.sourceFile=se.sourceFile,this.keywords=Be(_[se.ecmaVersion>=6?6:se.sourceType==="module"?"5module":5]);var Ge="";se.allowReserved!==!0&&(Ge=g[se.ecmaVersion>=6?6:se.ecmaVersion===5?5:3],se.sourceType==="module"&&(Ge+=" await")),this.reservedWords=Be(Ge);var ot=(Ge?Ge+" ":"")+g.strict;this.reservedWordsStrict=Be(ot),this.reservedWordsStrictBind=Be(ot+" "+g.strictBind),this.input=String(Oe),this.containsEsc=!1,Le?(this.pos=Le,this.lineStart=this.input.lastIndexOf(`
1050
1050
  `,Le-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(te).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=O.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=se.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&se.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(rt),this.regexpState=null,this.privateNameStack=[]},qt={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}};ct.prototype.parse=function(){var se=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(se)},qt.inFunction.get=function(){return(this.currentVarScope().flags&it)>0},qt.inGenerator.get=function(){return(this.currentVarScope().flags&Ue)>0&&!this.currentVarScope().inClassFieldInit},qt.inAsync.get=function(){return(this.currentVarScope().flags&st)>0&&!this.currentVarScope().inClassFieldInit},qt.canAwait.get=function(){for(var V=this.scopeStack.length-1;V>=0;V--){var se=this.scopeStack[V];if(se.inClassFieldInit||se.flags&Dt)return!1;if(se.flags&it)return(se.flags&st)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},qt.allowSuper.get=function(){var V=this.currentThisScope(),se=V.flags,Oe=V.inClassFieldInit;return(se&mt)>0||Oe||this.options.allowSuperOutsideMethod},qt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&$t)>0},qt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},qt.allowNewDotTarget.get=function(){var V=this.currentThisScope(),se=V.flags,Oe=V.inClassFieldInit;return(se&(it|Dt))>0||Oe},qt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Dt)>0},ct.extend=function(){for(var se=[],Oe=arguments.length;Oe--;)se[Oe]=arguments[Oe];for(var Le=this,Ge=0;Ge<se.length;Ge++)Le=se[Ge](Le);return Le},ct.parse=function(se,Oe){return new this(Oe,se).parse()},ct.parseExpressionAt=function(se,Oe,Le){var Ge=new this(Le,se,Oe);return Ge.nextToken(),Ge.parseExpression()},ct.tokenizer=function(se,Oe){return new this(Oe,se)},Object.defineProperties(ct.prototype,qt);var ut=ct.prototype,Mt=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ut.strictDirective=function(V){if(this.options.ecmaVersion<5)return!1;for(;;){je.lastIndex=V,V+=je.exec(this.input)[0].length;var se=Mt.exec(this.input.slice(V));if(!se)return!1;if((se[1]||se[2])==="use strict"){je.lastIndex=V+se[0].length;var Oe=je.exec(this.input),Le=Oe.index+Oe[0].length,Ge=this.input.charAt(Le);return Ge===";"||Ge==="}"||te.test(Oe[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Ge)||Ge==="!"&&this.input.charAt(Le+1)==="=")}V+=se[0].length,je.lastIndex=V,V+=je.exec(this.input)[0].length,this.input[V]===";"&&V++}},ut.eat=function(V){return this.type===V?(this.next(),!0):!1},ut.isContextual=function(V){return this.type===O.name&&this.value===V&&!this.containsEsc},ut.eatContextual=function(V){return this.isContextual(V)?(this.next(),!0):!1},ut.expectContextual=function(V){this.eatContextual(V)||this.unexpected()},ut.canInsertSemicolon=function(){return this.type===O.eof||this.type===O.braceR||te.test(this.input.slice(this.lastTokEnd,this.start))},ut.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ut.semicolon=function(){!this.eat(O.semi)&&!this.insertSemicolon()&&this.unexpected()},ut.afterTrailingComma=function(V,se){if(this.type===V)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),se||this.next(),!0},ut.expect=function(V){this.eat(V)||this.unexpected()},ut.unexpected=function(V){this.raise(V??this.start,"Unexpected token")};var Ut=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ut.checkPatternErrors=function(V,se){if(V){V.trailingComma>-1&&this.raiseRecoverable(V.trailingComma,"Comma is not permitted after the rest element");var Oe=se?V.parenthesizedAssign:V.parenthesizedBind;Oe>-1&&this.raiseRecoverable(Oe,se?"Assigning to rvalue":"Parenthesized pattern")}},ut.checkExpressionErrors=function(V,se){if(!V)return!1;var Oe=V.shorthandAssign,Le=V.doubleProto;if(!se)return Oe>=0||Le>=0;Oe>=0&&this.raise(Oe,"Shorthand property assignments are valid only in destructuring patterns"),Le>=0&&this.raiseRecoverable(Le,"Redefinition of __proto__ property")},ut.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")},ut.isSimpleAssignTarget=function(V){return V.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(V.expression):V.type==="Identifier"||V.type==="MemberExpression"};var yt=ct.prototype;yt.parseTopLevel=function(V){var se=Object.create(null);for(V.body||(V.body=[]);this.type!==O.eof;){var Oe=this.parseStatement(null,!0,se);V.body.push(Oe)}if(this.inModule)for(var Le=0,Ge=Object.keys(this.undefinedExports);Le<Ge.length;Le+=1){var ot=Ge[Le];this.raiseRecoverable(this.undefinedExports[ot].start,"Export '"+ot+"' is not defined")}return this.adaptDirectivePrologue(V.body),this.next(),V.sourceType=this.options.sourceType,this.finishNode(V,"Program")};var nr={kind:"loop"},er={kind:"switch"};yt.isLet=function(V){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;je.lastIndex=this.pos;var se=je.exec(this.input),Oe=this.pos+se[0].length,Le=this.input.charCodeAt(Oe);if(Le===91||Le===92)return!0;if(V)return!1;if(Le===123||Le>55295&&Le<56320)return!0;if(A(Le,!0)){for(var Ge=Oe+1;I(Le=this.input.charCodeAt(Ge),!0);)++Ge;if(Le===92||Le>55295&&Le<56320)return!0;var ot=this.input.slice(Oe,Ge);if(!S.test(ot))return!0}return!1},yt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;je.lastIndex=this.pos;var V=je.exec(this.input),se=this.pos+V[0].length,Oe;return!te.test(this.input.slice(this.pos,se))&&this.input.slice(se,se+8)==="function"&&(se+8===this.input.length||!(I(Oe=this.input.charCodeAt(se+8))||Oe>55295&&Oe<56320))},yt.parseStatement=function(V,se,Oe){var Le=this.type,Ge=this.startNode(),ot;switch(this.isLet(V)&&(Le=O._var,ot="let"),Le){case O._break:case O._continue:return this.parseBreakContinueStatement(Ge,Le.keyword);case O._debugger:return this.parseDebuggerStatement(Ge);case O._do:return this.parseDoStatement(Ge);case O._for:return this.parseForStatement(Ge);case O._function:return V&&(this.strict||V!=="if"&&V!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(Ge,!1,!V);case O._class:return V&&this.unexpected(),this.parseClass(Ge,!0);case O._if:return this.parseIfStatement(Ge);case O._return:return this.parseReturnStatement(Ge);case O._switch:return this.parseSwitchStatement(Ge);case O._throw:return this.parseThrowStatement(Ge);case O._try:return this.parseTryStatement(Ge);case O._const:case O._var:return ot=ot||this.value,V&&ot!=="var"&&this.unexpected(),this.parseVarStatement(Ge,ot);case O._while:return this.parseWhileStatement(Ge);case O._with:return this.parseWithStatement(Ge);case O.braceL:return this.parseBlock(!0,Ge);case O.semi:return this.parseEmptyStatement(Ge);case O._export:case O._import:if(this.options.ecmaVersion>10&&Le===O._import){je.lastIndex=this.pos;var lt=je.exec(this.input),Ct=this.pos+lt[0].length,It=this.input.charCodeAt(Ct);if(It===40||It===46)return this.parseExpressionStatement(Ge,this.parseExpression())}return this.options.allowImportExportEverywhere||(se||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),Le===O._import?this.parseImport(Ge):this.parseExport(Ge,Oe);default:if(this.isAsyncFunction())return V&&this.unexpected(),this.next(),this.parseFunctionStatement(Ge,!0,!V);var Kt=this.value,Wt=this.parseExpression();return Le===O.name&&Wt.type==="Identifier"&&this.eat(O.colon)?this.parseLabeledStatement(Ge,Kt,Wt,V):this.parseExpressionStatement(Ge,Wt)}},yt.parseBreakContinueStatement=function(V,se){var Oe=se==="break";this.next(),this.eat(O.semi)||this.insertSemicolon()?V.label=null:this.type!==O.name?this.unexpected():(V.label=this.parseIdent(),this.semicolon());for(var Le=0;Le<this.labels.length;++Le){var Ge=this.labels[Le];if((V.label==null||Ge.name===V.label.name)&&(Ge.kind!=null&&(Oe||Ge.kind==="loop")||V.label&&Oe))break}return Le===this.labels.length&&this.raise(V.start,"Unsyntactic "+se),this.finishNode(V,Oe?"BreakStatement":"ContinueStatement")},yt.parseDebuggerStatement=function(V){return this.next(),this.semicolon(),this.finishNode(V,"DebuggerStatement")},yt.parseDoStatement=function(V){return this.next(),this.labels.push(nr),V.body=this.parseStatement("do"),this.labels.pop(),this.expect(O._while),V.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(O.semi):this.semicolon(),this.finishNode(V,"DoWhileStatement")},yt.parseForStatement=function(V){this.next();var se=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(nr),this.enterScope(0),this.expect(O.parenL),this.type===O.semi)return se>-1&&this.unexpected(se),this.parseFor(V,null);var Oe=this.isLet();if(this.type===O._var||this.type===O._const||Oe){var Le=this.startNode(),Ge=Oe?"let":this.value;return this.next(),this.parseVar(Le,!0,Ge),this.finishNode(Le,"VariableDeclaration"),(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Le.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===O._in?se>-1&&this.unexpected(se):V.await=se>-1),this.parseForIn(V,Le)):(se>-1&&this.unexpected(se),this.parseFor(V,Le))}var ot=this.isContextual("let"),lt=!1,Ct=this.containsEsc,It=new Ut,Kt=this.start,Wt=se>-1?this.parseExprSubscripts(It,"await"):this.parseExpression(!0,It);return this.type===O._in||(lt=this.options.ecmaVersion>=6&&this.isContextual("of"))?(se>-1?(this.type===O._in&&this.unexpected(se),V.await=!0):lt&&this.options.ecmaVersion>=8&&(Wt.start===Kt&&!Ct&&Wt.type==="Identifier"&&Wt.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(V.await=!1)),ot&&lt&&this.raise(Wt.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Wt,!1,It),this.checkLValPattern(Wt),this.parseForIn(V,Wt)):(this.checkExpressionErrors(It,!0),se>-1&&this.unexpected(se),this.parseFor(V,Wt))},yt.parseFunctionStatement=function(V,se,Oe){return this.next(),this.parseFunction(V,cr|(Oe?0:vr),!1,se)},yt.parseIfStatement=function(V){return this.next(),V.test=this.parseParenExpression(),V.consequent=this.parseStatement("if"),V.alternate=this.eat(O._else)?this.parseStatement("if"):null,this.finishNode(V,"IfStatement")},yt.parseReturnStatement=function(V){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(O.semi)||this.insertSemicolon()?V.argument=null:(V.argument=this.parseExpression(),this.semicolon()),this.finishNode(V,"ReturnStatement")},yt.parseSwitchStatement=function(V){this.next(),V.discriminant=this.parseParenExpression(),V.cases=[],this.expect(O.braceL),this.labels.push(er),this.enterScope(0);for(var se,Oe=!1;this.type!==O.braceR;)if(this.type===O._case||this.type===O._default){var Le=this.type===O._case;se&&this.finishNode(se,"SwitchCase"),V.cases.push(se=this.startNode()),se.consequent=[],this.next(),Le?se.test=this.parseExpression():(Oe&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),Oe=!0,se.test=null),this.expect(O.colon)}else se||this.unexpected(),se.consequent.push(this.parseStatement(null));return this.exitScope(),se&&this.finishNode(se,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(V,"SwitchStatement")},yt.parseThrowStatement=function(V){return this.next(),te.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),V.argument=this.parseExpression(),this.semicolon(),this.finishNode(V,"ThrowStatement")};var lr=[];yt.parseCatchClauseParam=function(){var V=this.parseBindingAtom(),se=V.type==="Identifier";return this.enterScope(se?Je:0),this.checkLValPattern(V,se?pt:Qe),this.expect(O.parenR),V},yt.parseTryStatement=function(V){if(this.next(),V.block=this.parseBlock(),V.handler=null,this.type===O._catch){var se=this.startNode();this.next(),this.eat(O.parenL)?se.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),se.param=null,this.enterScope(0)),se.body=this.parseBlock(!1),this.exitScope(),V.handler=this.finishNode(se,"CatchClause")}return V.finalizer=this.eat(O._finally)?this.parseBlock():null,!V.handler&&!V.finalizer&&this.raise(V.start,"Missing catch or finally clause"),this.finishNode(V,"TryStatement")},yt.parseVarStatement=function(V,se,Oe){return this.next(),this.parseVar(V,!1,se,Oe),this.semicolon(),this.finishNode(V,"VariableDeclaration")},yt.parseWhileStatement=function(V){return this.next(),V.test=this.parseParenExpression(),this.labels.push(nr),V.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(V,"WhileStatement")},yt.parseWithStatement=function(V){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),V.object=this.parseParenExpression(),V.body=this.parseStatement("with"),this.finishNode(V,"WithStatement")},yt.parseEmptyStatement=function(V){return this.next(),this.finishNode(V,"EmptyStatement")},yt.parseLabeledStatement=function(V,se,Oe,Le){for(var Ge=0,ot=this.labels;Ge<ot.length;Ge+=1){var lt=ot[Ge];lt.name===se&&this.raise(Oe.start,"Label '"+se+"' is already declared")}for(var Ct=this.type.isLoop?"loop":this.type===O._switch?"switch":null,It=this.labels.length-1;It>=0;It--){var Kt=this.labels[It];if(Kt.statementStart===V.start)Kt.statementStart=this.start,Kt.kind=Ct;else break}return this.labels.push({name:se,kind:Ct,statementStart:this.start}),V.body=this.parseStatement(Le?Le.indexOf("label")===-1?Le+"label":Le:"label"),this.labels.pop(),V.label=Oe,this.finishNode(V,"LabeledStatement")},yt.parseExpressionStatement=function(V,se){return V.expression=se,this.semicolon(),this.finishNode(V,"ExpressionStatement")},yt.parseBlock=function(V,se,Oe){for(V===void 0&&(V=!0),se===void 0&&(se=this.startNode()),se.body=[],this.expect(O.braceL),V&&this.enterScope(0);this.type!==O.braceR;){var Le=this.parseStatement(null);se.body.push(Le)}return Oe&&(this.strict=!1),this.next(),V&&this.exitScope(),this.finishNode(se,"BlockStatement")},yt.parseFor=function(V,se){return V.init=se,this.expect(O.semi),V.test=this.type===O.semi?null:this.parseExpression(),this.expect(O.semi),V.update=this.type===O.parenR?null:this.parseExpression(),this.expect(O.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,"ForStatement")},yt.parseForIn=function(V,se){var Oe=this.type===O._in;return this.next(),se.type==="VariableDeclaration"&&se.declarations[0].init!=null&&(!Oe||this.options.ecmaVersion<8||this.strict||se.kind!=="var"||se.declarations[0].id.type!=="Identifier")&&this.raise(se.start,(Oe?"for-in":"for-of")+" loop variable declaration may not have an initializer"),V.left=se,V.right=Oe?this.parseExpression():this.parseMaybeAssign(),this.expect(O.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,Oe?"ForInStatement":"ForOfStatement")},yt.parseVar=function(V,se,Oe,Le){for(V.declarations=[],V.kind=Oe;;){var Ge=this.startNode();if(this.parseVarId(Ge,Oe),this.eat(O.eq)?Ge.init=this.parseMaybeAssign(se):!Le&&Oe==="const"&&!(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!Le&&Ge.id.type!=="Identifier"&&!(se&&(this.type===O._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):Ge.init=null,V.declarations.push(this.finishNode(Ge,"VariableDeclarator")),!this.eat(O.comma))break}return V},yt.parseVarId=function(V,se){V.id=this.parseBindingAtom(),this.checkLValPattern(V.id,se==="var"?nt:Qe,!1)};var cr=1,vr=2,Ir=4;yt.parseFunction=function(V,se,Oe,Le,Ge){this.initFunction(V),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Le)&&(this.type===O.star&&se&vr&&this.unexpected(),V.generator=this.eat(O.star)),this.options.ecmaVersion>=8&&(V.async=!!Le),se&cr&&(V.id=se&Ir&&this.type!==O.name?null:this.parseIdent(),V.id&&!(se&vr)&&this.checkLValSimple(V.id,this.strict||V.generator||V.async?this.treatFunctionsAsVar?nt:Qe:dt));var ot=this.yieldPos,lt=this.awaitPos,Ct=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Vt(V.async,V.generator)),se&cr||(V.id=this.type===O.name?this.parseIdent():null),this.parseFunctionParams(V),this.parseFunctionBody(V,Oe,!1,Ge),this.yieldPos=ot,this.awaitPos=lt,this.awaitIdentPos=Ct,this.finishNode(V,se&cr?"FunctionDeclaration":"FunctionExpression")},yt.parseFunctionParams=function(V){this.expect(O.parenL),V.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},yt.parseClass=function(V,se){this.next();var Oe=this.strict;this.strict=!0,this.parseClassId(V,se),this.parseClassSuper(V);var Le=this.enterClassBody(),Ge=this.startNode(),ot=!1;for(Ge.body=[],this.expect(O.braceL);this.type!==O.braceR;){var lt=this.parseClassElement(V.superClass!==null);lt&&(Ge.body.push(lt),lt.type==="MethodDefinition"&&lt.kind==="constructor"?(ot&&this.raiseRecoverable(lt.start,"Duplicate constructor in the same class"),ot=!0):lt.key&&lt.key.type==="PrivateIdentifier"&&Nr(Le,lt)&&this.raiseRecoverable(lt.key.start,"Identifier '#"+lt.key.name+"' has already been declared"))}return this.strict=Oe,this.next(),V.body=this.finishNode(Ge,"ClassBody"),this.exitClassBody(),this.finishNode(V,se?"ClassDeclaration":"ClassExpression")},yt.parseClassElement=function(V){if(this.eat(O.semi))return null;var se=this.options.ecmaVersion,Oe=this.startNode(),Le="",Ge=!1,ot=!1,lt="method",Ct=!1;if(this.eatContextual("static")){if(se>=13&&this.eat(O.braceL))return this.parseClassStaticBlock(Oe),Oe;this.isClassElementNameStart()||this.type===O.star?Ct=!0:Le="static"}if(Oe.static=Ct,!Le&&se>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===O.star)&&!this.canInsertSemicolon()?ot=!0:Le="async"),!Le&&(se>=9||!ot)&&this.eat(O.star)&&(Ge=!0),!Le&&!ot&&!Ge){var It=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?lt=It:Le=It)}if(Le?(Oe.computed=!1,Oe.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Oe.key.name=Le,this.finishNode(Oe.key,"Identifier")):this.parseClassElementName(Oe),se<13||this.type===O.parenL||lt!=="method"||Ge||ot){var Kt=!Oe.static&&Mr(Oe,"constructor"),Wt=Kt&&V;Kt&&lt!=="method"&&this.raise(Oe.key.start,"Constructor can't have get/set modifier"),Oe.kind=Kt?"constructor":lt,this.parseClassMethod(Oe,Ge,ot,Wt)}else this.parseClassField(Oe);return Oe},yt.isClassElementNameStart=function(){return this.type===O.name||this.type===O.privateId||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword},yt.parseClassElementName=function(V){this.type===O.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),V.computed=!1,V.key=this.parsePrivateIdent()):this.parsePropertyName(V)},yt.parseClassMethod=function(V,se,Oe,Le){var Ge=V.key;V.kind==="constructor"?(se&&this.raise(Ge.start,"Constructor can't be a generator"),Oe&&this.raise(Ge.start,"Constructor can't be an async method")):V.static&&Mr(V,"prototype")&&this.raise(Ge.start,"Classes may not have a static property named prototype");var ot=V.value=this.parseMethod(se,Oe,Le);return V.kind==="get"&&ot.params.length!==0&&this.raiseRecoverable(ot.start,"getter should have no params"),V.kind==="set"&&ot.params.length!==1&&this.raiseRecoverable(ot.start,"setter should have exactly one param"),V.kind==="set"&&ot.params[0].type==="RestElement"&&this.raiseRecoverable(ot.params[0].start,"Setter cannot use rest params"),this.finishNode(V,"MethodDefinition")},yt.parseClassField=function(V){if(Mr(V,"constructor")?this.raise(V.key.start,"Classes can't have a field named 'constructor'"):V.static&&Mr(V,"prototype")&&this.raise(V.key.start,"Classes can't have a static field named 'prototype'"),this.eat(O.eq)){var se=this.currentThisScope(),Oe=se.inClassFieldInit;se.inClassFieldInit=!0,V.value=this.parseMaybeAssign(),se.inClassFieldInit=Oe}else V.value=null;return this.semicolon(),this.finishNode(V,"PropertyDefinition")},yt.parseClassStaticBlock=function(V){V.body=[];var se=this.labels;for(this.labels=[],this.enterScope(Dt|mt);this.type!==O.braceR;){var Oe=this.parseStatement(null);V.body.push(Oe)}return this.next(),this.exitScope(),this.labels=se,this.finishNode(V,"StaticBlock")},yt.parseClassId=function(V,se){this.type===O.name?(V.id=this.parseIdent(),se&&this.checkLValSimple(V.id,Qe,!1)):(se===!0&&this.unexpected(),V.id=null)},yt.parseClassSuper=function(V){V.superClass=this.eat(O._extends)?this.parseExprSubscripts(null,!1):null},yt.enterClassBody=function(){var V={declared:Object.create(null),used:[]};return this.privateNameStack.push(V),V.declared},yt.exitClassBody=function(){var V=this.privateNameStack.pop(),se=V.declared,Oe=V.used;if(this.options.checkPrivateFields)for(var Le=this.privateNameStack.length,Ge=Le===0?null:this.privateNameStack[Le-1],ot=0;ot<Oe.length;++ot){var lt=Oe[ot];Fe(se,lt.name)||(Ge?Ge.used.push(lt):this.raiseRecoverable(lt.start,"Private field '#"+lt.name+"' must be declared in an enclosing class"))}};function Nr(V,se){var Oe=se.key.name,Le=V[Oe],Ge="true";return se.type==="MethodDefinition"&&(se.kind==="get"||se.kind==="set")&&(Ge=(se.static?"s":"i")+se.kind),Le==="iget"&&Ge==="iset"||Le==="iset"&&Ge==="iget"||Le==="sget"&&Ge==="sset"||Le==="sset"&&Ge==="sget"?(V[Oe]="true",!1):Le?!0:(V[Oe]=Ge,!1)}function Mr(V,se){var Oe=V.computed,Le=V.key;return!Oe&&(Le.type==="Identifier"&&Le.name===se||Le.type==="Literal"&&Le.value===se)}yt.parseExportAllDeclaration=function(V,se){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(V.exported=this.parseModuleExportName(),this.checkExport(se,V.exported,this.lastTokStart)):V.exported=null),this.expectContextual("from"),this.type!==O.string&&this.unexpected(),V.source=this.parseExprAtom(),this.semicolon(),this.finishNode(V,"ExportAllDeclaration")},yt.parseExport=function(V,se){if(this.next(),this.eat(O.star))return this.parseExportAllDeclaration(V,se);if(this.eat(O._default))return this.checkExport(se,"default",this.lastTokStart),V.declaration=this.parseExportDefaultDeclaration(),this.finishNode(V,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())V.declaration=this.parseExportDeclaration(V),V.declaration.type==="VariableDeclaration"?this.checkVariableExport(se,V.declaration.declarations):this.checkExport(se,V.declaration.id,V.declaration.id.start),V.specifiers=[],V.source=null;else{if(V.declaration=null,V.specifiers=this.parseExportSpecifiers(se),this.eatContextual("from"))this.type!==O.string&&this.unexpected(),V.source=this.parseExprAtom();else{for(var Oe=0,Le=V.specifiers;Oe<Le.length;Oe+=1){var Ge=Le[Oe];this.checkUnreserved(Ge.local),this.checkLocalExport(Ge.local),Ge.local.type==="Literal"&&this.raise(Ge.local.start,"A string literal cannot be used as an exported binding without `from`.")}V.source=null}this.semicolon()}return this.finishNode(V,"ExportNamedDeclaration")},yt.parseExportDeclaration=function(V){return this.parseStatement(null)},yt.parseExportDefaultDeclaration=function(){var V;if(this.type===O._function||(V=this.isAsyncFunction())){var se=this.startNode();return this.next(),V&&this.next(),this.parseFunction(se,cr|Ir,!1,V)}else if(this.type===O._class){var Oe=this.startNode();return this.parseClass(Oe,"nullableID")}else{var Le=this.parseMaybeAssign();return this.semicolon(),Le}},yt.checkExport=function(V,se,Oe){V&&(typeof se!="string"&&(se=se.type==="Identifier"?se.name:se.value),Fe(V,se)&&this.raiseRecoverable(Oe,"Duplicate export '"+se+"'"),V[se]=!0)},yt.checkPatternExport=function(V,se){var Oe=se.type;if(Oe==="Identifier")this.checkExport(V,se,se.start);else if(Oe==="ObjectPattern")for(var Le=0,Ge=se.properties;Le<Ge.length;Le+=1){var ot=Ge[Le];this.checkPatternExport(V,ot)}else if(Oe==="ArrayPattern")for(var lt=0,Ct=se.elements;lt<Ct.length;lt+=1){var It=Ct[lt];It&&this.checkPatternExport(V,It)}else Oe==="Property"?this.checkPatternExport(V,se.value):Oe==="AssignmentPattern"?this.checkPatternExport(V,se.left):Oe==="RestElement"&&this.checkPatternExport(V,se.argument)},yt.checkVariableExport=function(V,se){if(V)for(var Oe=0,Le=se;Oe<Le.length;Oe+=1){var Ge=Le[Oe];this.checkPatternExport(V,Ge.id)}},yt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},yt.parseExportSpecifier=function(V){var se=this.startNode();return se.local=this.parseModuleExportName(),se.exported=this.eatContextual("as")?this.parseModuleExportName():se.local,this.checkExport(V,se.exported,se.exported.start),this.finishNode(se,"ExportSpecifier")},yt.parseExportSpecifiers=function(V){var se=[],Oe=!0;for(this.expect(O.braceL);!this.eat(O.braceR);){if(Oe)Oe=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;se.push(this.parseExportSpecifier(V))}return se},yt.parseImport=function(V){return this.next(),this.type===O.string?(V.specifiers=lr,V.source=this.parseExprAtom()):(V.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),V.source=this.type===O.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(V,"ImportDeclaration")},yt.parseImportSpecifier=function(){var V=this.startNode();return V.imported=this.parseModuleExportName(),this.eatContextual("as")?V.local=this.parseIdent():(this.checkUnreserved(V.imported),V.local=V.imported),this.checkLValSimple(V.local,Qe),this.finishNode(V,"ImportSpecifier")},yt.parseImportDefaultSpecifier=function(){var V=this.startNode();return V.local=this.parseIdent(),this.checkLValSimple(V.local,Qe),this.finishNode(V,"ImportDefaultSpecifier")},yt.parseImportNamespaceSpecifier=function(){var V=this.startNode();return this.next(),this.expectContextual("as"),V.local=this.parseIdent(),this.checkLValSimple(V.local,Qe),this.finishNode(V,"ImportNamespaceSpecifier")},yt.parseImportSpecifiers=function(){var V=[],se=!0;if(this.type===O.name&&(V.push(this.parseImportDefaultSpecifier()),!this.eat(O.comma)))return V;if(this.type===O.star)return V.push(this.parseImportNamespaceSpecifier()),V;for(this.expect(O.braceL);!this.eat(O.braceR);){if(se)se=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;V.push(this.parseImportSpecifier())}return V},yt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===O.string){var V=this.parseLiteral(this.value);return Ke.test(V.value)&&this.raise(V.start,"An export name cannot include a lone surrogate."),V}return this.parseIdent(!0)},yt.adaptDirectivePrologue=function(V){for(var se=0;se<V.length&&this.isDirectiveCandidate(V[se]);++se)V[se].directive=V[se].expression.raw.slice(1,-1)},yt.isDirectiveCandidate=function(V){return this.options.ecmaVersion>=5&&V.type==="ExpressionStatement"&&V.expression.type==="Literal"&&typeof V.expression.value=="string"&&(this.input[V.start]==='"'||this.input[V.start]==="'")};var ar=ct.prototype;ar.toAssignable=function(V,se,Oe){if(this.options.ecmaVersion>=6&&V)switch(V.type){case"Identifier":this.inAsync&&V.name==="await"&&this.raise(V.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":V.type="ObjectPattern",Oe&&this.checkPatternErrors(Oe,!0);for(var Le=0,Ge=V.properties;Le<Ge.length;Le+=1){var ot=Ge[Le];this.toAssignable(ot,se),ot.type==="RestElement"&&(ot.argument.type==="ArrayPattern"||ot.argument.type==="ObjectPattern")&&this.raise(ot.argument.start,"Unexpected token")}break;case"Property":V.kind!=="init"&&this.raise(V.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(V.value,se);break;case"ArrayExpression":V.type="ArrayPattern",Oe&&this.checkPatternErrors(Oe,!0),this.toAssignableList(V.elements,se);break;case"SpreadElement":V.type="RestElement",this.toAssignable(V.argument,se),V.argument.type==="AssignmentPattern"&&this.raise(V.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":V.operator!=="="&&this.raise(V.left.end,"Only '=' operator can be used for specifying default value."),V.type="AssignmentPattern",delete V.operator,this.toAssignable(V.left,se);break;case"ParenthesizedExpression":this.toAssignable(V.expression,se,Oe);break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!se)break;default:this.raise(V.start,"Assigning to rvalue")}else Oe&&this.checkPatternErrors(Oe,!0);return V},ar.toAssignableList=function(V,se){for(var Oe=V.length,Le=0;Le<Oe;Le++){var Ge=V[Le];Ge&&this.toAssignable(Ge,se)}if(Oe){var ot=V[Oe-1];this.options.ecmaVersion===6&&se&&ot&&ot.type==="RestElement"&&ot.argument.type!=="Identifier"&&this.unexpected(ot.argument.start)}return V},ar.parseSpread=function(V){var se=this.startNode();return this.next(),se.argument=this.parseMaybeAssign(!1,V),this.finishNode(se,"SpreadElement")},ar.parseRestBinding=function(){var V=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==O.name&&this.unexpected(),V.argument=this.parseBindingAtom(),this.finishNode(V,"RestElement")},ar.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case O.bracketL:var V=this.startNode();return this.next(),V.elements=this.parseBindingList(O.bracketR,!0,!0),this.finishNode(V,"ArrayPattern");case O.braceL:return this.parseObj(!0)}return this.parseIdent()},ar.parseBindingList=function(V,se,Oe,Le){for(var Ge=[],ot=!0;!this.eat(V);)if(ot?ot=!1:this.expect(O.comma),se&&this.type===O.comma)Ge.push(null);else{if(Oe&&this.afterTrailingComma(V))break;if(this.type===O.ellipsis){var lt=this.parseRestBinding();this.parseBindingListItem(lt),Ge.push(lt),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(V);break}else Ge.push(this.parseAssignableListItem(Le))}return Ge},ar.parseAssignableListItem=function(V){var se=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(se),se},ar.parseBindingListItem=function(V){return V},ar.parseMaybeDefault=function(V,se,Oe){if(Oe=Oe||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(O.eq))return Oe;var Le=this.startNodeAt(V,se);return Le.left=Oe,Le.right=this.parseMaybeAssign(),this.finishNode(Le,"AssignmentPattern")},ar.checkLValSimple=function(V,se,Oe){se===void 0&&(se=We);var Le=se!==We;switch(V.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(V.name)&&this.raiseRecoverable(V.start,(Le?"Binding ":"Assigning to ")+V.name+" in strict mode"),Le&&(se===Qe&&V.name==="let"&&this.raiseRecoverable(V.start,"let is disallowed as a lexically bound name"),Oe&&(Fe(Oe,V.name)&&this.raiseRecoverable(V.start,"Argument name clash"),Oe[V.name]=!0),se!==ft&&this.declareName(V.name,se,V.start));break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":Le&&this.raiseRecoverable(V.start,"Binding member expression");break;case"ParenthesizedExpression":return Le&&this.raiseRecoverable(V.start,"Binding parenthesized expression"),this.checkLValSimple(V.expression,se,Oe);default:this.raise(V.start,(Le?"Binding":"Assigning to")+" rvalue")}},ar.checkLValPattern=function(V,se,Oe){switch(se===void 0&&(se=We),V.type){case"ObjectPattern":for(var Le=0,Ge=V.properties;Le<Ge.length;Le+=1){var ot=Ge[Le];this.checkLValInnerPattern(ot,se,Oe)}break;case"ArrayPattern":for(var lt=0,Ct=V.elements;lt<Ct.length;lt+=1){var It=Ct[lt];It&&this.checkLValInnerPattern(It,se,Oe)}break;default:this.checkLValSimple(V,se,Oe)}},ar.checkLValInnerPattern=function(V,se,Oe){switch(se===void 0&&(se=We),V.type){case"Property":this.checkLValInnerPattern(V.value,se,Oe);break;case"AssignmentPattern":this.checkLValPattern(V.left,se,Oe);break;case"RestElement":this.checkLValPattern(V.argument,se,Oe);break;default:this.checkLValPattern(V,se,Oe)}};var sr=function(se,Oe,Le,Ge,ot){this.token=se,this.isExpr=!!Oe,this.preserveSpace=!!Le,this.override=Ge,this.generator=!!ot},rr={b_stat:new sr("{",!1),b_expr:new sr("{",!0),b_tmpl:new sr("${",!1),p_stat:new sr("(",!1),p_expr:new sr("(",!0),q_tmpl:new sr("`",!0,!0,function(V){return V.tryReadTemplateToken()}),f_stat:new sr("function",!1),f_expr:new sr("function",!0),f_expr_gen:new sr("function",!0,!1,null,!0),f_gen:new sr("function",!1,!1,null,!0)},xr=ct.prototype;xr.initialContext=function(){return[rr.b_stat]},xr.curContext=function(){return this.context[this.context.length-1]},xr.braceIsBlock=function(V){var se=this.curContext();return se===rr.f_expr||se===rr.f_stat?!0:V===O.colon&&(se===rr.b_stat||se===rr.b_expr)?!se.isExpr:V===O._return||V===O.name&&this.exprAllowed?te.test(this.input.slice(this.lastTokEnd,this.start)):V===O._else||V===O.semi||V===O.eof||V===O.parenR||V===O.arrow?!0:V===O.braceL?se===rr.b_stat:V===O._var||V===O._const||V===O.name?!1:!this.exprAllowed},xr.inGeneratorContext=function(){for(var V=this.context.length-1;V>=1;V--){var se=this.context[V];if(se.token==="function")return se.generator}return!1},xr.updateContext=function(V){var se,Oe=this.type;Oe.keyword&&V===O.dot?this.exprAllowed=!1:(se=Oe.updateContext)?se.call(this,V):this.exprAllowed=Oe.beforeExpr},xr.overrideContext=function(V){this.curContext()!==V&&(this.context[this.context.length-1]=V)},O.parenR.updateContext=O.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var V=this.context.pop();V===rr.b_stat&&this.curContext().token==="function"&&(V=this.context.pop()),this.exprAllowed=!V.isExpr},O.braceL.updateContext=function(V){this.context.push(this.braceIsBlock(V)?rr.b_stat:rr.b_expr),this.exprAllowed=!0},O.dollarBraceL.updateContext=function(){this.context.push(rr.b_tmpl),this.exprAllowed=!0},O.parenL.updateContext=function(V){var se=V===O._if||V===O._for||V===O._with||V===O._while;this.context.push(se?rr.p_stat:rr.p_expr),this.exprAllowed=!0},O.incDec.updateContext=function(){},O._function.updateContext=O._class.updateContext=function(V){V.beforeExpr&&V!==O._else&&!(V===O.semi&&this.curContext()!==rr.p_stat)&&!(V===O._return&&te.test(this.input.slice(this.lastTokEnd,this.start)))&&!((V===O.colon||V===O.braceL)&&this.curContext()===rr.b_stat)?this.context.push(rr.f_expr):this.context.push(rr.f_stat),this.exprAllowed=!1},O.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},O.backQuote.updateContext=function(){this.curContext()===rr.q_tmpl?this.context.pop():this.context.push(rr.q_tmpl),this.exprAllowed=!1},O.star.updateContext=function(V){if(V===O._function){var se=this.context.length-1;this.context[se]===rr.f_expr?this.context[se]=rr.f_expr_gen:this.context[se]=rr.f_gen}this.exprAllowed=!0},O.name.updateContext=function(V){var se=!1;this.options.ecmaVersion>=6&&V!==O.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(se=!0),this.exprAllowed=se};var zt=ct.prototype;zt.checkPropClash=function(V,se,Oe){if(!(this.options.ecmaVersion>=9&&V.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(V.computed||V.method||V.shorthand))){var Le=V.key,Ge;switch(Le.type){case"Identifier":Ge=Le.name;break;case"Literal":Ge=String(Le.value);break;default:return}var ot=V.kind;if(this.options.ecmaVersion>=6){Ge==="__proto__"&&ot==="init"&&(se.proto&&(Oe?Oe.doubleProto<0&&(Oe.doubleProto=Le.start):this.raiseRecoverable(Le.start,"Redefinition of __proto__ property")),se.proto=!0);return}Ge="$"+Ge;var lt=se[Ge];if(lt){var Ct;ot==="init"?Ct=this.strict&&lt.init||lt.get||lt.set:Ct=lt.init||lt[ot],Ct&&this.raiseRecoverable(Le.start,"Redefinition of property")}else lt=se[Ge]={init:!1,get:!1,set:!1};lt[ot]=!0}},zt.parseExpression=function(V,se){var Oe=this.start,Le=this.startLoc,Ge=this.parseMaybeAssign(V,se);if(this.type===O.comma){var ot=this.startNodeAt(Oe,Le);for(ot.expressions=[Ge];this.eat(O.comma);)ot.expressions.push(this.parseMaybeAssign(V,se));return this.finishNode(ot,"SequenceExpression")}return Ge},zt.parseMaybeAssign=function(V,se,Oe){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(V);this.exprAllowed=!1}var Le=!1,Ge=-1,ot=-1,lt=-1;se?(Ge=se.parenthesizedAssign,ot=se.trailingComma,lt=se.doubleProto,se.parenthesizedAssign=se.trailingComma=-1):(se=new Ut,Le=!0);var Ct=this.start,It=this.startLoc;(this.type===O.parenL||this.type===O.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=V==="await");var Kt=this.parseMaybeConditional(V,se);if(Oe&&(Kt=Oe.call(this,Kt,Ct,It)),this.type.isAssign){var Wt=this.startNodeAt(Ct,It);return Wt.operator=this.value,this.type===O.eq&&(Kt=this.toAssignable(Kt,!1,se)),Le||(se.parenthesizedAssign=se.trailingComma=se.doubleProto=-1),se.shorthandAssign>=Kt.start&&(se.shorthandAssign=-1),this.type===O.eq?this.checkLValPattern(Kt):this.checkLValSimple(Kt),Wt.left=Kt,this.next(),Wt.right=this.parseMaybeAssign(V),lt>-1&&(se.doubleProto=lt),this.finishNode(Wt,"AssignmentExpression")}else Le&&this.checkExpressionErrors(se,!0);return Ge>-1&&(se.parenthesizedAssign=Ge),ot>-1&&(se.trailingComma=ot),Kt},zt.parseMaybeConditional=function(V,se){var Oe=this.start,Le=this.startLoc,Ge=this.parseExprOps(V,se);if(this.checkExpressionErrors(se))return Ge;if(this.eat(O.question)){var ot=this.startNodeAt(Oe,Le);return ot.test=Ge,ot.consequent=this.parseMaybeAssign(),this.expect(O.colon),ot.alternate=this.parseMaybeAssign(V),this.finishNode(ot,"ConditionalExpression")}return Ge},zt.parseExprOps=function(V,se){var Oe=this.start,Le=this.startLoc,Ge=this.parseMaybeUnary(se,!1,!1,V);return this.checkExpressionErrors(se)||Ge.start===Oe&&Ge.type==="ArrowFunctionExpression"?Ge:this.parseExprOp(Ge,Oe,Le,-1,V)},zt.parseExprOp=function(V,se,Oe,Le,Ge){var ot=this.type.binop;if(ot!=null&&(!Ge||this.type!==O._in)&&ot>Le){var lt=this.type===O.logicalOR||this.type===O.logicalAND,Ct=this.type===O.coalesce;Ct&&(ot=O.logicalAND.binop);var It=this.value;this.next();var Kt=this.start,Wt=this.startLoc,ir=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Ge),Kt,Wt,ot,Ge),mr=this.buildBinary(se,Oe,V,ir,It,lt||Ct);return(lt&&this.type===O.coalesce||Ct&&(this.type===O.logicalOR||this.type===O.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(mr,se,Oe,Le,Ge)}return V},zt.buildBinary=function(V,se,Oe,Le,Ge,ot){Le.type==="PrivateIdentifier"&&this.raise(Le.start,"Private identifier can only be left side of binary expression");var lt=this.startNodeAt(V,se);return lt.left=Oe,lt.operator=Ge,lt.right=Le,this.finishNode(lt,ot?"LogicalExpression":"BinaryExpression")},zt.parseMaybeUnary=function(V,se,Oe,Le){var Ge=this.start,ot=this.startLoc,lt;if(this.isContextual("await")&&this.canAwait)lt=this.parseAwait(Le),se=!0;else if(this.type.prefix){var Ct=this.startNode(),It=this.type===O.incDec;Ct.operator=this.value,Ct.prefix=!0,this.next(),Ct.argument=this.parseMaybeUnary(null,!0,It,Le),this.checkExpressionErrors(V,!0),It?this.checkLValSimple(Ct.argument):this.strict&&Ct.operator==="delete"&&Wr(Ct.argument)?this.raiseRecoverable(Ct.start,"Deleting local variable in strict mode"):Ct.operator==="delete"&&Br(Ct.argument)?this.raiseRecoverable(Ct.start,"Private fields can not be deleted"):se=!0,lt=this.finishNode(Ct,It?"UpdateExpression":"UnaryExpression")}else if(!se&&this.type===O.privateId)(Le||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),lt=this.parsePrivateIdent(),this.type!==O._in&&this.unexpected();else{if(lt=this.parseExprSubscripts(V,Le),this.checkExpressionErrors(V))return lt;for(;this.type.postfix&&!this.canInsertSemicolon();){var Kt=this.startNodeAt(Ge,ot);Kt.operator=this.value,Kt.prefix=!1,Kt.argument=lt,this.checkLValSimple(lt),this.next(),lt=this.finishNode(Kt,"UpdateExpression")}}if(!Oe&&this.eat(O.starstar))if(se)this.unexpected(this.lastTokStart);else return this.buildBinary(Ge,ot,lt,this.parseMaybeUnary(null,!1,!1,Le),"**",!1);else return lt};function Wr(V){return V.type==="Identifier"||V.type==="ParenthesizedExpression"&&Wr(V.expression)}function Br(V){return V.type==="MemberExpression"&&V.property.type==="PrivateIdentifier"||V.type==="ChainExpression"&&Br(V.expression)||V.type==="ParenthesizedExpression"&&Br(V.expression)}zt.parseExprSubscripts=function(V,se){var Oe=this.start,Le=this.startLoc,Ge=this.parseExprAtom(V,se);if(Ge.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Ge;var ot=this.parseSubscripts(Ge,Oe,Le,!1,se);return V&&ot.type==="MemberExpression"&&(V.parenthesizedAssign>=ot.start&&(V.parenthesizedAssign=-1),V.parenthesizedBind>=ot.start&&(V.parenthesizedBind=-1),V.trailingComma>=ot.start&&(V.trailingComma=-1)),ot},zt.parseSubscripts=function(V,se,Oe,Le,Ge){for(var ot=this.options.ecmaVersion>=8&&V.type==="Identifier"&&V.name==="async"&&this.lastTokEnd===V.end&&!this.canInsertSemicolon()&&V.end-V.start===5&&this.potentialArrowAt===V.start,lt=!1;;){var Ct=this.parseSubscript(V,se,Oe,Le,ot,lt,Ge);if(Ct.optional&&(lt=!0),Ct===V||Ct.type==="ArrowFunctionExpression"){if(lt){var It=this.startNodeAt(se,Oe);It.expression=Ct,Ct=this.finishNode(It,"ChainExpression")}return Ct}V=Ct}},zt.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(O.arrow)},zt.parseSubscriptAsyncArrow=function(V,se,Oe,Le){return this.parseArrowExpression(this.startNodeAt(V,se),Oe,!0,Le)},zt.parseSubscript=function(V,se,Oe,Le,Ge,ot,lt){var Ct=this.options.ecmaVersion>=11,It=Ct&&this.eat(O.questionDot);Le&&It&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Kt=this.eat(O.bracketL);if(Kt||It&&this.type!==O.parenL&&this.type!==O.backQuote||this.eat(O.dot)){var Wt=this.startNodeAt(se,Oe);Wt.object=V,Kt?(Wt.property=this.parseExpression(),this.expect(O.bracketR)):this.type===O.privateId&&V.type!=="Super"?Wt.property=this.parsePrivateIdent():Wt.property=this.parseIdent(this.options.allowReserved!=="never"),Wt.computed=!!Kt,Ct&&(Wt.optional=It),V=this.finishNode(Wt,"MemberExpression")}else if(!Le&&this.eat(O.parenL)){var ir=new Ut,mr=this.yieldPos,Tr=this.awaitPos,_r=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Dr=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1,ir);if(Ge&&!It&&this.shouldParseAsyncArrow())return this.checkPatternErrors(ir,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=mr,this.awaitPos=Tr,this.awaitIdentPos=_r,this.parseSubscriptAsyncArrow(se,Oe,Dr,lt);this.checkExpressionErrors(ir,!0),this.yieldPos=mr||this.yieldPos,this.awaitPos=Tr||this.awaitPos,this.awaitIdentPos=_r||this.awaitIdentPos;var Sr=this.startNodeAt(se,Oe);Sr.callee=V,Sr.arguments=Dr,Ct&&(Sr.optional=It),V=this.finishNode(Sr,"CallExpression")}else if(this.type===O.backQuote){(It||ot)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Rr=this.startNodeAt(se,Oe);Rr.tag=V,Rr.quasi=this.parseTemplate({isTagged:!0}),V=this.finishNode(Rr,"TaggedTemplateExpression")}return V},zt.parseExprAtom=function(V,se,Oe){this.type===O.slash&&this.readRegexp();var Le,Ge=this.potentialArrowAt===this.start;switch(this.type){case O._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),Le=this.startNode(),this.next(),this.type===O.parenL&&!this.allowDirectSuper&&this.raise(Le.start,"super() call outside constructor of a subclass"),this.type!==O.dot&&this.type!==O.bracketL&&this.type!==O.parenL&&this.unexpected(),this.finishNode(Le,"Super");case O._this:return Le=this.startNode(),this.next(),this.finishNode(Le,"ThisExpression");case O.name:var ot=this.start,lt=this.startLoc,Ct=this.containsEsc,It=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Ct&&It.name==="async"&&!this.canInsertSemicolon()&&this.eat(O._function))return this.overrideContext(rr.f_expr),this.parseFunction(this.startNodeAt(ot,lt),0,!1,!0,se);if(Ge&&!this.canInsertSemicolon()){if(this.eat(O.arrow))return this.parseArrowExpression(this.startNodeAt(ot,lt),[It],!1,se);if(this.options.ecmaVersion>=8&&It.name==="async"&&this.type===O.name&&!Ct&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return It=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(O.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(ot,lt),[It],!0,se)}return It;case O.regexp:var Kt=this.value;return Le=this.parseLiteral(Kt.value),Le.regex={pattern:Kt.pattern,flags:Kt.flags},Le;case O.num:case O.string:return this.parseLiteral(this.value);case O._null:case O._true:case O._false:return Le=this.startNode(),Le.value=this.type===O._null?null:this.type===O._true,Le.raw=this.type.keyword,this.next(),this.finishNode(Le,"Literal");case O.parenL:var Wt=this.start,ir=this.parseParenAndDistinguishExpression(Ge,se);return V&&(V.parenthesizedAssign<0&&!this.isSimpleAssignTarget(ir)&&(V.parenthesizedAssign=Wt),V.parenthesizedBind<0&&(V.parenthesizedBind=Wt)),ir;case O.bracketL:return Le=this.startNode(),this.next(),Le.elements=this.parseExprList(O.bracketR,!0,!0,V),this.finishNode(Le,"ArrayExpression");case O.braceL:return this.overrideContext(rr.b_expr),this.parseObj(!1,V);case O._function:return Le=this.startNode(),this.next(),this.parseFunction(Le,0);case O._class:return this.parseClass(this.startNode(),!1);case O._new:return this.parseNew();case O.backQuote:return this.parseTemplate();case O._import:return this.options.ecmaVersion>=11?this.parseExprImport(Oe):this.unexpected();default:return this.parseExprAtomDefault()}},zt.parseExprAtomDefault=function(){this.unexpected()},zt.parseExprImport=function(V){var se=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===O.parenL&&!V)return this.parseDynamicImport(se);if(this.type===O.dot){var Oe=this.startNodeAt(se.start,se.loc&&se.loc.start);return Oe.name="import",se.meta=this.finishNode(Oe,"Identifier"),this.parseImportMeta(se)}else this.unexpected()},zt.parseDynamicImport=function(V){if(this.next(),V.source=this.parseMaybeAssign(),!this.eat(O.parenR)){var se=this.start;this.eat(O.comma)&&this.eat(O.parenR)?this.raiseRecoverable(se,"Trailing comma is not allowed in import()"):this.unexpected(se)}return this.finishNode(V,"ImportExpression")},zt.parseImportMeta=function(V){this.next();var se=this.containsEsc;return V.property=this.parseIdent(!0),V.property.name!=="meta"&&this.raiseRecoverable(V.property.start,"The only valid meta property for import is 'import.meta'"),se&&this.raiseRecoverable(V.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(V.start,"Cannot use 'import.meta' outside a module"),this.finishNode(V,"MetaProperty")},zt.parseLiteral=function(V){var se=this.startNode();return se.value=V,se.raw=this.input.slice(this.start,this.end),se.raw.charCodeAt(se.raw.length-1)===110&&(se.bigint=se.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(se,"Literal")},zt.parseParenExpression=function(){this.expect(O.parenL);var V=this.parseExpression();return this.expect(O.parenR),V},zt.shouldParseArrow=function(V){return!this.canInsertSemicolon()},zt.parseParenAndDistinguishExpression=function(V,se){var Oe=this.start,Le=this.startLoc,Ge,ot=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var lt=this.start,Ct=this.startLoc,It=[],Kt=!0,Wt=!1,ir=new Ut,mr=this.yieldPos,Tr=this.awaitPos,_r;for(this.yieldPos=0,this.awaitPos=0;this.type!==O.parenR;)if(Kt?Kt=!1:this.expect(O.comma),ot&&this.afterTrailingComma(O.parenR,!0)){Wt=!0;break}else if(this.type===O.ellipsis){_r=this.start,It.push(this.parseParenItem(this.parseRestBinding())),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else It.push(this.parseMaybeAssign(!1,ir,this.parseParenItem));var Dr=this.lastTokEnd,Sr=this.lastTokEndLoc;if(this.expect(O.parenR),V&&this.shouldParseArrow(It)&&this.eat(O.arrow))return this.checkPatternErrors(ir,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=mr,this.awaitPos=Tr,this.parseParenArrowList(Oe,Le,It,se);(!It.length||Wt)&&this.unexpected(this.lastTokStart),_r&&this.unexpected(_r),this.checkExpressionErrors(ir,!0),this.yieldPos=mr||this.yieldPos,this.awaitPos=Tr||this.awaitPos,It.length>1?(Ge=this.startNodeAt(lt,Ct),Ge.expressions=It,this.finishNodeAt(Ge,"SequenceExpression",Dr,Sr)):Ge=It[0]}else Ge=this.parseParenExpression();if(this.options.preserveParens){var Rr=this.startNodeAt(Oe,Le);return Rr.expression=Ge,this.finishNode(Rr,"ParenthesizedExpression")}else return Ge},zt.parseParenItem=function(V){return V},zt.parseParenArrowList=function(V,se,Oe,Le){return this.parseArrowExpression(this.startNodeAt(V,se),Oe,!1,Le)};var Rn=[];zt.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var V=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===O.dot){var se=this.startNodeAt(V.start,V.loc&&V.loc.start);se.name="new",V.meta=this.finishNode(se,"Identifier"),this.next();var Oe=this.containsEsc;return V.property=this.parseIdent(!0),V.property.name!=="target"&&this.raiseRecoverable(V.property.start,"The only valid meta property for new is 'new.target'"),Oe&&this.raiseRecoverable(V.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(V.start,"'new.target' can only be used in functions and class static block"),this.finishNode(V,"MetaProperty")}var Le=this.start,Ge=this.startLoc;return V.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Le,Ge,!0,!1),this.eat(O.parenL)?V.arguments=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1):V.arguments=Rn,this.finishNode(V,"NewExpression")},zt.parseTemplateElement=function(V){var se=V.isTagged,Oe=this.startNode();return this.type===O.invalidTemplate?(se||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),Oe.value={raw:this.value.replace(/\r\n?/g,`
1051
1051
  `),cooked:null}):Oe.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
@@ -1099,7 +1099,7 @@ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=1
1099
1099
  * LICENSE file in the root directory of this source tree.
1100
1100
  */var hasRequiredReactIs_development;function requireReactIs_development(){return hasRequiredReactIs_development||(hasRequiredReactIs_development=1,process.env.NODE_ENV!=="production"&&function(){var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,o=t?Symbol.for("react.fragment"):60107,l=t?Symbol.for("react.strict_mode"):60108,d=t?Symbol.for("react.profiler"):60114,f=t?Symbol.for("react.provider"):60109,g=t?Symbol.for("react.context"):60110,b=t?Symbol.for("react.async_mode"):60111,_=t?Symbol.for("react.concurrent_mode"):60111,S=t?Symbol.for("react.forward_ref"):60112,R=t?Symbol.for("react.suspense"):60113,C=t?Symbol.for("react.suspense_list"):60120,E=t?Symbol.for("react.memo"):60115,A=t?Symbol.for("react.lazy"):60116,I=t?Symbol.for("react.block"):60121,M=t?Symbol.for("react.fundamental"):60117,j=t?Symbol.for("react.responder"):60118,q=t?Symbol.for("react.scope"):60119;function z(Ue){return typeof Ue=="string"||typeof Ue=="function"||Ue===o||Ue===_||Ue===d||Ue===l||Ue===R||Ue===C||typeof Ue=="object"&&Ue!==null&&(Ue.$$typeof===A||Ue.$$typeof===E||Ue.$$typeof===f||Ue.$$typeof===g||Ue.$$typeof===S||Ue.$$typeof===M||Ue.$$typeof===j||Ue.$$typeof===q||Ue.$$typeof===I)}function Q(Ue){if(typeof Ue=="object"&&Ue!==null){var Rt=Ue.$$typeof;switch(Rt){case e:var Je=Ue.type;switch(Je){case b:case _:case o:case d:case l:case R:return Je;default:var mt=Je&&Je.$$typeof;switch(mt){case g:case S:case A:case E:case f:return mt;default:return Rt}}case n:return Rt}}}var F=b,O=_,te=g,ne=f,ae=e,ge=S,oe=o,je=A,Ne=E,Ae=n,$e=d,Fe=l,ze=R,Ve=!1;function Be(Ue){return Ve||(Ve=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),qe(Ue)||Q(Ue)===b}function qe(Ue){return Q(Ue)===_}function Ke(Ue){return Q(Ue)===g}function He(Ue){return Q(Ue)===f}function Xe(Ue){return typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===e}function tt(Ue){return Q(Ue)===S}function Ye(Ue){return Q(Ue)===o}function et(Ue){return Q(Ue)===A}function Ze(Ue){return Q(Ue)===E}function at(Ue){return Q(Ue)===n}function rt(Ue){return Q(Ue)===d}function it(Ue){return Q(Ue)===l}function st(Ue){return Q(Ue)===R}reactIs_development.AsyncMode=F,reactIs_development.ConcurrentMode=O,reactIs_development.ContextConsumer=te,reactIs_development.ContextProvider=ne,reactIs_development.Element=ae,reactIs_development.ForwardRef=ge,reactIs_development.Fragment=oe,reactIs_development.Lazy=je,reactIs_development.Memo=Ne,reactIs_development.Portal=Ae,reactIs_development.Profiler=$e,reactIs_development.StrictMode=Fe,reactIs_development.Suspense=ze,reactIs_development.isAsyncMode=Be,reactIs_development.isConcurrentMode=qe,reactIs_development.isContextConsumer=Ke,reactIs_development.isContextProvider=He,reactIs_development.isElement=Xe,reactIs_development.isForwardRef=tt,reactIs_development.isFragment=Ye,reactIs_development.isLazy=et,reactIs_development.isMemo=Ze,reactIs_development.isPortal=at,reactIs_development.isProfiler=rt,reactIs_development.isStrictMode=it,reactIs_development.isSuspense=st,reactIs_development.isValidElementType=z,reactIs_development.typeOf=Q}()),reactIs_development}var hasRequiredReactIs;function requireReactIs(){return hasRequiredReactIs||(hasRequiredReactIs=1,process.env.NODE_ENV==="production"?reactIs.exports=requireReactIs_production_min():reactIs.exports=requireReactIs_development()),reactIs.exports}var hoistNonReactStatics_cjs,hasRequiredHoistNonReactStatics_cjs;function requireHoistNonReactStatics_cjs(){if(hasRequiredHoistNonReactStatics_cjs)return hoistNonReactStatics_cjs;hasRequiredHoistNonReactStatics_cjs=1;var t=requireReactIs(),e={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},d={};d[t.ForwardRef]=o,d[t.Memo]=l;function f(A){return t.isMemo(A)?l:d[A.$$typeof]||e}var g=Object.defineProperty,b=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols,S=Object.getOwnPropertyDescriptor,R=Object.getPrototypeOf,C=Object.prototype;function E(A,I,M){if(typeof I!="string"){if(C){var j=R(I);j&&j!==C&&E(A,j,M)}var q=b(I);_&&(q=q.concat(_(I)));for(var z=f(A),Q=f(I),F=0;F<q.length;++F){var O=q[F];if(!n[O]&&!(M&&M[O])&&!(Q&&Q[O])&&!(z&&z[O])){var te=S(I,O);try{g(A,O,te)}catch{}}}}return A}return hoistNonReactStatics_cjs=E,hoistNonReactStatics_cjs}requireHoistNonReactStatics_cjs();var IntlContext=typeof window<"u"&&!window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__?window.__REACT_INTL_CONTEXT__||(window.__REACT_INTL_CONTEXT__=React__namespace.createContext(null)):React__namespace.createContext(null);IntlContext.Consumer,IntlContext.Provider;var Context=IntlContext;function useIntl(){var t=React__namespace.useContext(Context);return invariantIntlContext(t),t}var DisplayName;(function(t){t.formatDate="FormattedDate",t.formatTime="FormattedTime",t.formatNumber="FormattedNumber",t.formatList="FormattedList",t.formatDisplayName="FormattedDisplayName"})(DisplayName||(DisplayName={}));var DisplayNameParts;(function(t){t.formatDate="FormattedDateParts",t.formatTime="FormattedTimeParts",t.formatNumber="FormattedNumberParts",t.formatList="FormattedListParts"})(DisplayNameParts||(DisplayNameParts={}));function createFormattedDateTimePartsComponent(t){var e=function(n){var o=useIntl(),l=n.value,d=n.children,f=__rest(n,["value","children"]),g=typeof l=="string"?new Date(l||0):l,b=t==="formatDate"?o.formatDateToParts(g,f):o.formatTimeToParts(g,f);return d(b)};return e.displayName=DisplayNameParts[t],e}function createFormattedComponent(t){var e=function(n){var o=useIntl(),l=n.value,d=n.children,f=__rest(n,["value","children"]),g=o[t](l,f);if(typeof d=="function")return d(g);var b=o.textComponent||React__namespace.Fragment;return React__namespace.createElement(b,null,g)};return e.displayName=DisplayName[t],e}createFormattedComponent("formatDate"),createFormattedComponent("formatTime");var FormattedNumber=createFormattedComponent("formatNumber");createFormattedComponent("formatList"),createFormattedComponent("formatDisplayName"),createFormattedDateTimePartsComponent("formatDate"),createFormattedDateTimePartsComponent("formatTime");function BillingCard({appID:t,reseller:e,isLoading:n,withoutReports:o}){const{Statement:l,CreditLimit:d}=e,f=[{label:"0 - 30 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(l==null?void 0:l.Over0)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:Calendar},{label:"31 - 45 Days",value:jsxRuntime.jsx(FormattedNumber,{value:(l==null?void 0:l.Over30)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarDays},{label:"45+ Days",value:jsxRuntime.jsx(FormattedNumber,{value:(l==null?void 0:l.Over45)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CalendarRange},{label:"Total",value:jsxRuntime.jsx(FormattedNumber,{value:(l==null?void 0:l.Total)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:DollarSign},{label:"Credit Limit",value:jsxRuntime.jsx(FormattedNumber,{value:d||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"}),icon:CreditCard}],g=()=>{const _=`https://dashboard.randmar.io/${t}/PayInvoice`;window.open(_,"_blank","noopener,noreferrer")};if(n)return jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-36"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:[1,2,3].map(_=>jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]},_))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:[1,2].map(_=>jsxRuntime.jsx("div",{className:_===2?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 ms-auto"})]})},_))})]}),jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-28 mt-6"})})]})]});const b=!o;return jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{className:"border-b p-6 md:p-5",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing Overview"})}),jsxRuntime.jsxs(CardContent,{className:"p-6 md:p-5",children:[jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 sm:divide-x divide-border",children:[jsxRuntime.jsx("div",{className:"space-y-6 sm:pe-4",children:f.slice(0,3).map((_,S)=>jsxRuntime.jsx(BillingItem,{icon:_.icon,label:_.label,value:_.value},S))}),jsxRuntime.jsx("div",{className:"space-y-6 sm:ps-4 pt-6 sm:pt-0 mt-6 sm:mt-0 border-t sm:border-t-0 border-border",children:f.slice(3).map((_,S)=>jsxRuntime.jsx("div",{className:S===1?"pt-6 mt-6 border-t border-border":"",children:jsxRuntime.jsx(BillingItem,{icon:_.icon,label:_.label,value:_.value})},S))})]}),b&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{className:"mt-6",onClick:g,children:"Pay Invoices"})})]})]})}function BillingItem({icon:t,label:e,value:n}){return jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(t,{className:"size-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:e})]}),jsxRuntime.jsx("span",{className:"text-base font-semibold ms-auto",children:n})]})}function ChangePricingTierModal({open:t,setOpen:e,tier:n,onTierChange:o,isLoading:l}){const d=()=>{e(!1)};return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Change Pricing Tier"})}),jsxRuntime.jsxs("div",{className:"grid gap-1.5 py-2",children:[jsxRuntime.jsxs("p",{className:"text-lg text-muted-foreground",children:["Requested Pricing Tier: ",jsxRuntime.jsx("span",{className:"font-bold",children:n})]}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If your account qualifies, your pricing will update immediately."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"If not, we'll review your request and notify you of the decision."})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:d,disabled:l,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:o,disabled:l,children:l?"Loading...":`Apply for ${n}`})]})]})})}const getPricingText=t=>t===1?"The Best":t===2?"Fixed 12.5% GP on all items":t===3?"Advantageous":t===4?"Buying Group":t===5?"Cost":t,getShippingText=t=>t==="A"?"Free or Custom":t==="B"?"Fixed $10 anywhere":t==="C"?`Free shipping on $150+ orders to your location,
1101
1101
  $15 for drop shipped orders under $1,500,
1102
- $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full shipping charges":t,getTermsText=t=>t==="STRIPE"?"Credit card payment":t==="NET30"?"Net 30 days":t,AccountTier=({isSuperAdmin:t,readonly:e,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=$e=>$e&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[$e]||"",E=$e=>$e&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[$e]||"",A=$e=>$e&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[$e]||"",[I,M]=React.useState(C((n==null?void 0:n.Priority)??"")),[j,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(A(n==null?void 0:n.PriceProfile)),F=$e=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[$e]||$e,O=$e=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[$e]||$e,te=$e=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[$e]||$e;React.useEffect(()=>{M(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(A(n==null?void 0:n.PriceProfile))},[n]);const ne=async($e,Fe,ze,Ve)=>{try{(await S({applicationId:o,fieldName:$e,newValue:Fe})).error?d({title:"Error",description:Ve,variant:"destructive"}):d({title:"Success",description:ze,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},ae=async $e=>{M($e);const Fe=F($e);ne("Priority",Fe,`Priority updated to ${Fe}`,"Failed to update priority")},ge=async $e=>{q($e);const Fe=O($e);ne("ShippingProfile",Fe,`Shipping profile updated to ${Fe}`,"Failed to update shipping profile")},oe=async $e=>{Q($e);const Fe=te($e);ne("PriceProfile",Fe,`Pricing profile updated to ${Fe}`,"Failed to update pricing profile")},je=async()=>{try{const $e=await S({applicationId:o,fieldName:"Tier",newValue:b});$e.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):$e.data?d({title:"Success",description:`Pricing Tier changed to ${b}`,variant:"success"}):d({title:"Considered",description:"Request being considered",variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{g(!1),_("")}},Ne=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:t}],Ae=$e=>{_($e),g(!0)};return l?jsxRuntime.jsxs(Card,{className:"md:col-span-2 xl:col-span-1 md:max-w-xl xl:max-w-[unset]",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-16 rounded-full"})]})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-56"})]}),jsxRuntime.jsx("div",{className:"grid gap-3",children:[1,2,3].map($e=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]})]},$e))}),jsxRuntime.jsxs("div",{className:"flex gap-2 mt-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"md:col-span-2 xl:col-span-1 md:max-w-xl xl:max-w-[unset]",children:[jsxRuntime.jsxs(CardHeader,{className:"pb-2 pt-4 px-4 flex flex-row items-center justify-between",children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Account Tier"}),jsxRuntime.jsx(Badge,{variant:"secondary",className:"bg-green-100 text-green-700 hover:bg-green-200 text-xs",children:"Active"})]}),jsxRuntime.jsxs(CardContent,{className:"pt-2 px-4 pb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 bg-primary/5 p-4 rounded-lg",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-bold text-primary",children:[(n==null?void 0:n.Priority)||""," Tier"]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Optimized for online retail"})]}),jsxRuntime.jsx(CircleCheck,{className:"h-6 w-6 text-green-600"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-2 mb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Package2,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Pricing"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground truncate",children:getPricingText(n.PriceProfile||0)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Truck,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Shipping"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getShippingText(n.ShippingProfile||"").split(".")[0]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Calendar,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Payment terms"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getTermsText((n==null?void 0:n.Terms)||"")})]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[!e&&jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs("a",{href:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",rel:"noreferrer",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4 mr-1"}),"Pricing Tiers"]})}),jsxRuntime.jsxs(Popover,{children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{disabled:e,className:e?"hidden":"flex-1",children:["Upgrade Tier ",jsxRuntime.jsx(ChevronRight,{className:"h-3 w-3 ml-1"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56 p-2",children:jsxRuntime.jsxs("div",{className:"grid gap-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-xs mb-1",children:"Select a tier"}),Ne.map($e=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!$e.enabled,onClick:()=>Ae($e.name),children:$e.name},$e.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:je}),t&&!e&&jsxRuntime.jsxs(Card,{className:"mt-4",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2 pt-3 px-4",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Admin Configuration"})}),jsxRuntime.jsx(CardContent,{className:"pt-2 px-4 pb-4",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Priority"}),jsxRuntime.jsx(RadioGroup$1,{value:I,onValueChange:ae,className:"grid grid-cols-2 @sm:grid-cols-3 @md:grid-cols-4 gap-1",children:[{value:"starter",label:"Starter"},{value:"ecommerce",label:"E-Commerce"},{value:"commercial",label:"Commercial"},{value:"cws",label:"CWS (Basics)"},{value:"novexco",label:"Novexco"},{value:"jeancoutu",label:"Jean Coutu"},{value:"exclusive",label:"Exclusive"}].map($e=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:$e.value,id:`priority-${$e.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${$e.value}`,className:"cursor-pointer text-xs",children:$e.label})]},$e.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Shipping Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:j,onValueChange:ge,className:"grid grid-cols-1 @md:grid-cols-2 gap-1",children:[{value:"free",label:"Free (A)"},{value:"fixed",label:"Fixed $10 Shipping (B)"},{value:"dropshipped",label:"$15 for drop shipped (C)"},{value:"under1500",label:"15$ under 1,500 (D)"},{value:"fullcharges",label:"Full shipping charges (E)"}].map($e=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:$e.value,id:`shipping-${$e.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${$e.value}`,className:"cursor-pointer text-xs",children:$e.label})]},$e.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Pricing Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:z,onValueChange:oe,className:"grid grid-cols-2 @sm:grid-cols-3 gap-1",children:[{value:"exclusive",label:"Exclusive (1)"},{value:"ecommerce",label:"E-Commerce (2)"},{value:"commercial",label:"Commercial (3)"},{value:"buyinggroup",label:"Buying Group (4)"},{value:"cost",label:"Cost (5)"}].map($e=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:$e.value,id:`pricing-${$e.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${$e.value}`,className:"cursor-pointer text-xs",children:$e.label})]},$e.value))})]})]})})]})]})};function OrderCategories({openOrders:t=[],isLoading:e=!1}){const n=(t==null?void 0:t.filter(I=>I.DocumentType==="Order"))||[],o=(t==null?void 0:t.filter(I=>I.DocumentType==="Shipment"))||[],l=n.filter(I=>I.WarehouseCode!=="3PLE"),d=l.reduce((I,M)=>I+(M.Quantity??0),0),f=l.reduce((I,M)=>I+(M.ExtendedPrice??0),0),g=n.filter(I=>I.WarehouseCode==="3PLE"),b=g.reduce((I,M)=>I+(M.Quantity??0),0),_=g.reduce((I,M)=>I+(M.ExtendedPrice??0),0),S=o.reduce((I,M)=>I+(M.Quantity??0),0),R=o.reduce((I,M)=>I+(M.ExtendedPrice??0),0),C=d+b+S,E=f+_+R,A=[{name:"All",icon:Package,color:"bg-blue-500",orders:C,amount:E},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:d,amount:f},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:S,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:_}];return e?jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(I=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:"bg-gray-200 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]})},I))})})]}):jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Order Categories"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:A.map(I=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${I.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:I.name}),jsxRuntime.jsx("div",{className:`${I.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(I.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:I.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:I.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},I.name))})})]})}function LongMonthName(t){if(!t)return;const e=["","January","February","March","April","May","June","July","August","September","October","November","December"];return t===void 0&&(t=new Date().getMonth()+1),t<1&&(t=12+t),e[t]}function SalesSummary({fiscalYearMonthStart:t,salesData:e,isLoading:n}){const o=(e==null?void 0:e.SalesLast30Days)??0,l=(e==null?void 0:e.SalesLast3Months)??0,d=(e==null?void 0:e.SalesYearToDay)??0,f=LongMonthName(t);return n?jsxRuntime.jsxs("div",{className:"grid gap-4 @sm:grid-cols-2 @lg:grid-cols-3 mb-4",children:[jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]}),jsxRuntime.jsxs(Card,{className:"col-span-2 lg:col-span-1",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-36"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]})]}):jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 @sm:grid-cols-1 @md:grid-cols-2 @lg:grid-cols-3 mb-4",children:[jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(CardTitle,{className:"text-sm font-medium",children:"Last 30 Days"}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(TrendingUp,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:o,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(CardTitle,{className:"text-sm font-medium",children:"Last 3 Months"}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(Calendar,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:l,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]}),f&&jsxRuntime.jsxs(Card,{className:"@sm:col-span-1 @md:col-span-2 @lg:col-span-1",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsxs(CardTitle,{className:"text-sm font-medium",children:["Year to Date (",f,")"]}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(CalendarDays,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:d,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]})]})}function ReportsSection({isLoading:t,userEmail:e,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:_}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[S,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[A,{isLoading:I}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[M,j]=React.useState(null),[q,z]=React.useState(e),[Q,F]=React.useState(!1),O=[{name:"Products",reports:[{id:"Products",title:"Universal Product List",description:"A comprehensive overview of your product list with detailed specifications and pricing information.",icon:Package}]},{name:"Operation Details",reports:[{id:"OpenOrders",title:"Order Details",description:"A detailed report of all your orders and shipments, including status, tracking information, and delivery estimates.",icon:ShoppingCart},{id:"Invoices",title:"Invoices and Credits Report",description:"Detailed overview of your invoices and credits within a specific date range. It also contains reports about additional charges, serial numbers, and other relevant information.",icon:ScrollText},{id:"Statement",title:"Statement and RMAs Report",description:"A detailed report of all unpaid invoices and active RMAs.",icon:Banknote}]},{name:"Tracking Files",reports:[{id:"AmazonTrackingFile",title:"Amazon Tracking File",description:"Track products sold on Amazon marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing},{id:"WalmartTrackingFile",title:"Walmart Tracking File",description:"Track products sold on Walmart marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing}]}],te=async ge=>{j(ge),F(!0)},ne=async()=>{if(!(!M||!n))try{switch(M.id){case"Products":await S({routeResellerId:n,emailAddress:q}).unwrap();break;case"AmazonTrackingFile":await f({routeResellerId:n,emailAddress:q}).unwrap();break;case"WalmartTrackingFile":await l({routeResellerId:n,emailAddress:q}).unwrap();break;case"OpenOrders":await b({routeResellerId:n,emailAddress:q}).unwrap();break;case"Invoices":await C({routeResellerId:n,emailAddress:q}).unwrap();break;case"Statement":await A({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${M.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(ge){console.error("Error requesting report:",ge),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},ae=_||R||g||d||I||E;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Product List to your Order Details."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},oe))]},ge))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:O.map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:ge.name}),ge.reports.map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(oe.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:oe.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:oe.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(oe),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},oe.id))]},ge.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",M==null?void 0:M.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:q,onChange:ge=>z(ge.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsx(DialogDescription,{children:"The report will take around 5 minutes to generate."}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:ne,disabled:!q||ae,children:ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function UnsavedChangesDialog({isOpen:t,onClose:e,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:e,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(t){const[e,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return t()&&_},[t]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(t())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[t]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:e,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[e,d,l]);return{showDialog:e,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}function ResellerOverview({appID:t,reseller:e,readonly:n,userEmail:o,isSuperAdmin:l,withoutReports:d=!1}){const{data:f,isLoading:g,isError:b}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:t??"",withSpecification:!0},{skip:!!e}),[_,S]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),R=React.useCallback(()=>n?!1:_.publicInfo.hasUnsavedChanges,[n,_]),C=React.useCallback((q,z)=>{S(Q=>{var F;return((F=Q[q])==null?void 0:F.hasUnsavedChanges)!==z.hasUnsavedChanges?{...Q,[q]:z}:Q})},[]),{NavigationGuardDialog:E}=useRouterNavigationGuard(R),A=e??f,I=!n||!!(A!=null&&A.Statement)&&(A.Statement.Total??0)>0,M=(A==null?void 0:A.QualifiedManufacturers)??[],j=(A==null?void 0:A.Qualifications)??[];return jsxRuntime.jsxs("div",{className:"@container",children:[b?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your reseller information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:(A==null?void 0:A.FiscalYearMonthStart)||1,salesData:A==null?void 0:A.SalesData,isLoading:g}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChart,{salesData:(A==null?void 0:A.SalesStatistics)??[],isLoading:g}),jsxRuntime.jsx(OrderCategories,{openOrders:(A==null?void 0:A.ActiveOrderDetails)??[],isLoading:g}),I&&jsxRuntime.jsx(BillingCard,{appID:t,reseller:A||{},withoutReports:d,isLoading:g}),jsxRuntime.jsx(PublicInfo,{reseller:A||{},appID:t??"",isLoading:g,readonly:n,onUnsavedChanges:q=>C("publicInfo",{hasUnsavedChanges:q})}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:l,readonly:n,reseller:A||{},appID:t??"",isLoading:g})]}),g||M.length>0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Manufacturers you are qualified for"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:g?Array.from({length:2}).map((q,z)=>jsxRuntime.jsx(ManufacturerCard,{loading:!0},z)):M.map(q=>jsxRuntime.jsx(ManufacturerCard,{manufacturer:q,link:`https://dashboard.randmar.io/${t}/Partner/${q.ManufacturerId}`},q.ManufacturerId))})})]}):jsxRuntime.jsx(ResellerQualificationsCard,{qualifications:j}),jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:A==null?void 0:A.Opportunities,loading:g}),!d&&jsxRuntime.jsx(ReportsSection,{appID:t,userEmail:o,isLoading:g})]}),jsxRuntime.jsx(E,{})]})}/**
1102
+ $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full shipping charges":t,getTermsText=t=>t==="STRIPE"?"Credit card payment":t==="NET30"?"Net 30 days":t,AccountTier=({isSuperAdmin:t,readonly:e,reseller:n,appID:o,isLoading:l})=>{const{toast:d}=useToast(),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,{isLoading:R}]=usePostV4PartnerByApplicationIdAccountResellerAndFieldNameMutation(),C=$e=>$e&&{Starter:"starter","E-Commerce":"ecommerce",Commercial:"commercial",Basics:"cws",Novexco:"novexco","Jean Coutu":"jeancoutu",Exclusive:"exclusive"}[$e]||"",E=$e=>$e&&{A:"free",B:"fixed",C:"dropshipped",D:"under1500",E:"fullcharges"}[$e]||"",A=$e=>$e&&{1:"exclusive",2:"ecommerce",3:"commercial",4:"buyinggroup",5:"cost"}[$e]||"",[I,M]=React.useState(C((n==null?void 0:n.Priority)??"")),[j,q]=React.useState(E((n==null?void 0:n.ShippingProfile)??"")),[z,Q]=React.useState(A(n==null?void 0:n.PriceProfile)),F=$e=>({starter:"Starter",ecommerce:"E-Commerce",commercial:"Commercial",cws:"Basics",novexco:"Novexco",jeancoutu:"Jean Coutu",exclusive:"Exclusive"})[$e]||$e,O=$e=>({free:"A",fixed:"B",dropshipped:"C",under1500:"D",fullcharges:"E"})[$e]||$e,te=$e=>({exclusive:"1",ecommerce:"2",commercial:"3",buyinggroup:"4",cost:"5"})[$e]||$e;React.useEffect(()=>{M(C((n==null?void 0:n.Priority)??"")),q(E((n==null?void 0:n.ShippingProfile)??"")),Q(A(n==null?void 0:n.PriceProfile))},[n]);const ne=async($e,Fe,ze,Ve)=>{try{(await S({applicationId:o,fieldName:$e,newValue:Fe})).error?d({title:"Error",description:Ve,variant:"destructive"}):d({title:"Success",description:ze,variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}},ae=async $e=>{M($e);const Fe=F($e);ne("Priority",Fe,`Priority updated to ${Fe}`,"Failed to update priority")},ge=async $e=>{q($e);const Fe=O($e);ne("ShippingProfile",Fe,`Shipping profile updated to ${Fe}`,"Failed to update shipping profile")},oe=async $e=>{Q($e);const Fe=te($e);ne("PriceProfile",Fe,`Pricing profile updated to ${Fe}`,"Failed to update pricing profile")},je=async()=>{try{const $e=await S({applicationId:o,fieldName:"Tier",newValue:b});$e.error?d({title:"Error",description:"Failed to update reseller",variant:"destructive"}):$e.data?d({title:"Success",description:`Pricing Tier changed to ${b}`,variant:"success"}):d({title:"Considered",description:"Request being considered",variant:"success"})}catch{d({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{g(!1),_("")}},Ne=[{name:"Terms",enabled:n.Priority==="Starter"},{name:"E-Commerce",enabled:n.Priority==="Commercial"},{name:"Commercial",enabled:n.Priority==="E-Commerce"},{name:"Exclusive",enabled:t}],Ae=$e=>{_($e),g(!0)};return l?jsxRuntime.jsxs(Card,{className:"md:col-span-2 xl:col-span-1 md:max-w-xl xl:max-w-[unset]",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-16 rounded-full"})]})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-56"})]}),jsxRuntime.jsx("div",{className:"grid gap-3",children:[1,2,3].map($e=>jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]})]},$e))}),jsxRuntime.jsxs("div",{className:"flex gap-2 mt-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"md:col-span-2 xl:col-span-1 md:max-w-xl xl:max-w-[unset]",children:[jsxRuntime.jsxs(CardHeader,{className:"pb-2 pt-4 px-4 flex flex-row items-center justify-between",children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Account Tier"}),jsxRuntime.jsx(Badge,{variant:"secondary",className:"bg-green-100 text-green-700 hover:bg-green-200 text-xs",children:"Active"})]}),jsxRuntime.jsxs(CardContent,{className:"pt-2 px-4 pb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 bg-primary/5 p-4 rounded-lg",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-bold text-primary",children:[(n==null?void 0:n.Priority)||""," Tier"]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Optimized for online retail"})]}),jsxRuntime.jsx(CircleCheck,{className:"h-6 w-6 text-green-600"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-2 mb-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Package2,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Pricing"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground truncate",children:getPricingText(n.PriceProfile||0)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Truck,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Shipping"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getShippingText(n.ShippingProfile||"").split(".")[0]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border bg-card hover:bg-accent/5 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-1.5 rounded-full shrink-0",children:jsxRuntime.jsx(Calendar,{className:"h-4 w-4 text-primary"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"font-medium text-sm",children:"Payment terms"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:getTermsText((n==null?void 0:n.Terms)||"")})]})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[!e&&jsxRuntime.jsx(Button,{variant:"outline",className:"flex-1",asChild:!0,children:jsxRuntime.jsxs("a",{href:"https://www.randmar.io/docs/overview/pricingTiers",target:"_blank",rel:"noreferrer",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4 mr-1"}),"Pricing Tiers"]})}),jsxRuntime.jsxs(Popover,{children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{disabled:e,className:e?"hidden":"flex-1",children:["Upgrade Tier ",jsxRuntime.jsx(ChevronRight,{className:"h-3 w-3 ml-1"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56 p-2",children:jsxRuntime.jsxs("div",{className:"grid gap-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-xs mb-1",children:"Select a tier"}),Ne.map($e=>jsxRuntime.jsx(Button,{variant:"ghost",size:"sm",className:"w-full justify-start h-8",disabled:!$e.enabled,onClick:()=>Ae($e.name),children:$e.name},$e.name))]})})]})]})]})]}),jsxRuntime.jsx(ChangePricingTierModal,{isLoading:R,open:f,setOpen:g,tier:b,onTierChange:je}),t&&!e&&jsxRuntime.jsxs(Card,{className:"mt-4",children:[jsxRuntime.jsx(CardHeader,{className:"pb-2 pt-3 px-4",children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Admin Configuration"})}),jsxRuntime.jsx(CardContent,{className:"pt-2 px-4 pb-4",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Priority"}),jsxRuntime.jsx(RadioGroup$1,{value:I,onValueChange:ae,className:"grid grid-cols-2 @sm:grid-cols-3 @md:grid-cols-4 gap-1",children:[{value:"starter",label:"Starter"},{value:"ecommerce",label:"E-Commerce"},{value:"commercial",label:"Commercial"},{value:"cws",label:"CWS (Basics)"},{value:"novexco",label:"Novexco"},{value:"jeancoutu",label:"Jean Coutu"},{value:"exclusive",label:"Exclusive"}].map($e=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:$e.value,id:`priority-${$e.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`priority-${$e.value}`,className:"cursor-pointer text-xs",children:$e.label})]},$e.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Shipping Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:j,onValueChange:ge,className:"grid grid-cols-1 @md:grid-cols-2 gap-1",children:[{value:"free",label:"Free (A)"},{value:"fixed",label:"Fixed $10 Shipping (B)"},{value:"dropshipped",label:"$15 for drop shipped (C)"},{value:"under1500",label:"15$ under 1,500 (D)"},{value:"fullcharges",label:"Full shipping charges (E)"}].map($e=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:$e.value,id:`shipping-${$e.value}`,className:"h-6 w-6 scale-50"}),jsxRuntime.jsx(Label$2,{htmlFor:`shipping-${$e.value}`,className:"cursor-pointer text-xs",children:$e.label})]},$e.value))})]}),jsxRuntime.jsxs("div",{className:"bg-muted/30 p-2 rounded-lg",children:[jsxRuntime.jsx(Label$2,{className:"block mb-1 text-xs font-medium",children:"Pricing Profile"}),jsxRuntime.jsx(RadioGroup$1,{value:z,onValueChange:oe,className:"grid grid-cols-2 @sm:grid-cols-3 gap-1",children:[{value:"exclusive",label:"Exclusive (1)"},{value:"ecommerce",label:"E-Commerce (2)"},{value:"commercial",label:"Commercial (3)"},{value:"buyinggroup",label:"Buying Group (4)"},{value:"cost",label:"Cost (5)"}].map($e=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntime.jsx(RadioGroupItem,{value:$e.value,id:`pricing-${$e.value}`,className:"h-6 w-6 scale-50 antialiased"}),jsxRuntime.jsx(Label$2,{htmlFor:`pricing-${$e.value}`,className:"cursor-pointer text-xs",children:$e.label})]},$e.value))})]})]})})]})]})};function OrderCategories({openOrders:t=[],isLoading:e=!1}){const n=(t==null?void 0:t.filter(I=>I.DocumentType==="Order"))||[],o=(t==null?void 0:t.filter(I=>I.DocumentType==="Shipment"))||[],l=n.filter(I=>I.WarehouseCode!=="3PLE"),d=l.reduce((I,M)=>I+(M.Quantity??0),0),f=l.reduce((I,M)=>I+(M.ExtendedPrice??0),0),g=n.filter(I=>I.WarehouseCode==="3PLE"),b=g.reduce((I,M)=>I+(M.Quantity??0),0),_=g.reduce((I,M)=>I+(M.ExtendedPrice??0),0),S=o.reduce((I,M)=>I+(M.Quantity??0),0),R=o.reduce((I,M)=>I+(M.ExtendedPrice??0),0),C=d+b+S,E=f+_+R,A=[{name:"All",icon:Package,color:"bg-blue-500",orders:C,amount:E},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:d,amount:f},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:S,amount:R},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:b,amount:_}];return e?jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(I=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:"bg-gray-200 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]})},I))})})]}):jsxRuntime.jsxs(Card,{className:"w-full @md:col-span-2 @xl:col-span-1",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Order Categories"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:A.map(I=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${I.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:I.name}),jsxRuntime.jsx("div",{className:`${I.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(I.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:I.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:I.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},I.name))})})]})}function LongMonthName(t){if(!t)return;const e=["","January","February","March","April","May","June","July","August","September","October","November","December"];return t===void 0&&(t=new Date().getMonth()+1),t<1&&(t=12+t),e[t]}function SalesSummary({fiscalYearMonthStart:t,salesData:e,isLoading:n}){const o=(e==null?void 0:e.SalesLast30Days)??0,l=(e==null?void 0:e.SalesLast3Months)??0,d=(e==null?void 0:e.SalesYearToDay)??0,f=LongMonthName(t);return n?jsxRuntime.jsxs("div",{className:"grid gap-4 @xl:grid-cols-2 @2xl:grid-cols-3 mb-4",children:[jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-28"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]}),jsxRuntime.jsxs(Card,{className:"@xl:col-span-2 @2xl:col-span-1",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-36"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"})]})]})]}):jsxRuntime.jsxs("div",{className:"grid gap-4 @xl:grid-cols-2 @2xl:grid-cols-3 mb-4",children:[jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(CardTitle,{className:"text-sm font-medium",children:"Last 30 Days"}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(TrendingUp,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:o,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]}),jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsx(CardTitle,{className:"text-sm font-medium",children:"Last 3 Months"}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(Calendar,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:l,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]}),f&&jsxRuntime.jsxs(Card,{className:"@xl:col-span-2 @2xl:col-span-1",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxRuntime.jsxs(CardTitle,{className:"text-sm font-medium",children:["Year to Date (",f,")"]}),jsxRuntime.jsx("div",{className:"p-2 rounded-full bg-neutral-200",children:jsxRuntime.jsx(CalendarDays,{className:"size-4 shrink-0 text-muted-foreground"})})]}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{className:"text-2xl font-bold",children:jsxRuntime.jsx(FormattedNumber,{value:d,style:"currency",currency:"CAD",currencyDisplay:"symbol"})}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground"})]})]})]})}function ReportsSection({isLoading:t,userEmail:e,appID:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ResellerByRouteResellerIdReportWalmartTrackingFileEmailMutation(),[f,{isLoading:g}]=usePostV4ResellerByRouteResellerIdReportAmazonTrackingFileEmailMutation(),[b,{isLoading:_}]=usePostV4ResellerByRouteResellerIdReportOpenOrdersEmailMutation(),[S,{isLoading:R}]=usePostV4ResellerByRouteResellerIdReportProductsEmailMutation(),[C,{isLoading:E}]=usePostV4ResellerByRouteResellerIdReportInvoicesEmailMutation(),[A,{isLoading:I}]=usePostV4ResellerByRouteResellerIdDocumentStatementEmailMutation(),[M,j]=React.useState(null),[q,z]=React.useState(e),[Q,F]=React.useState(!1),O=[{name:"Products",reports:[{id:"Products",title:"Universal Product List",description:"A comprehensive overview of your product list with detailed specifications and pricing information.",icon:Package}]},{name:"Operation Details",reports:[{id:"OpenOrders",title:"Order Details",description:"A detailed report of all your orders and shipments, including status, tracking information, and delivery estimates.",icon:ShoppingCart},{id:"Invoices",title:"Invoices and Credits Report",description:"Detailed overview of your invoices and credits within a specific date range. It also contains reports about additional charges, serial numbers, and other relevant information.",icon:ScrollText},{id:"Statement",title:"Statement and RMAs Report",description:"A detailed report of all unpaid invoices and active RMAs.",icon:Banknote}]},{name:"Tracking Files",reports:[{id:"AmazonTrackingFile",title:"Amazon Tracking File",description:"Track products sold on Amazon marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing},{id:"WalmartTrackingFile",title:"Walmart Tracking File",description:"Track products sold on Walmart marketplace with detailed sales and inventory information.",icon:ChartNoAxesColumnIncreasing}]}],te=async ge=>{j(ge),F(!0)},ne=async()=>{if(!(!M||!n))try{switch(M.id){case"Products":await S({routeResellerId:n,emailAddress:q}).unwrap();break;case"AmazonTrackingFile":await f({routeResellerId:n,emailAddress:q}).unwrap();break;case"WalmartTrackingFile":await l({routeResellerId:n,emailAddress:q}).unwrap();break;case"OpenOrders":await b({routeResellerId:n,emailAddress:q}).unwrap();break;case"Invoices":await C({routeResellerId:n,emailAddress:q}).unwrap();break;case"Statement":await A({routeResellerId:n,emailAddress:q}).unwrap();break;default:throw new Error("invalid report id")}o({title:"Report requested",description:`The ${M.title} will be sent to ${q} shortly.`,variant:"success"}),F(!1)}catch(ge){console.error("Error requesting report:",ge),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}},ae=_||R||g||d||I||E;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Product List to your Order Details."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},oe))]},ge))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:O.map(ge=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:ge.name}),ge.reports.map(oe=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(oe.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:oe.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:oe.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>te(oe),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},oe.id))]},ge.name))})}),jsxRuntime.jsx(Dialog,{open:Q,onOpenChange:F,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",M==null?void 0:M.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:q,onChange:ge=>z(ge.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsx(DialogDescription,{children:"The report will take around 5 minutes to generate."}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:ne,disabled:!q||ae,children:ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function UnsavedChangesDialog({isOpen:t,onClose:e,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:e,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(t){const[e,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return t()&&_},[t]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(t())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[t]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:e,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[e,d,l]);return{showDialog:e,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}function ResellerOverview({appID:t,reseller:e,readonly:n,userEmail:o,isSuperAdmin:l,withoutReports:d=!1}){const{data:f,isLoading:g,isError:b}=useGetV4PartnerByApplicationIdAccountResellerQuery({applicationId:t??"",withSpecification:!0},{skip:!!e}),[_,S]=React.useState({publicInfo:{hasUnsavedChanges:!1}}),R=React.useCallback(()=>n?!1:_.publicInfo.hasUnsavedChanges,[n,_]),C=React.useCallback((q,z)=>{S(Q=>{var F;return((F=Q[q])==null?void 0:F.hasUnsavedChanges)!==z.hasUnsavedChanges?{...Q,[q]:z}:Q})},[]),{NavigationGuardDialog:E}=useRouterNavigationGuard(R),A=e??f,I=!n||!!(A!=null&&A.Statement)&&(A.Statement.Total??0)>0,M=(A==null?void 0:A.QualifiedManufacturers)??[],j=(A==null?void 0:A.Qualifications)??[];return jsxRuntime.jsxs("div",{className:"@container",children:[b?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your reseller information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:(A==null?void 0:A.FiscalYearMonthStart)||1,salesData:A==null?void 0:A.SalesData,isLoading:g}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChart,{salesData:(A==null?void 0:A.SalesStatistics)??[],isLoading:g}),jsxRuntime.jsx(OrderCategories,{openOrders:(A==null?void 0:A.ActiveOrderDetails)??[],isLoading:g}),I&&jsxRuntime.jsx(BillingCard,{appID:t,reseller:A||{},withoutReports:d,isLoading:g}),jsxRuntime.jsx(PublicInfo,{reseller:A||{},appID:t??"",isLoading:g,readonly:n,onUnsavedChanges:q=>C("publicInfo",{hasUnsavedChanges:q})}),jsxRuntime.jsx(AccountTier,{isSuperAdmin:l,readonly:n,reseller:A||{},appID:t??"",isLoading:g})]}),g||M.length>0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Manufacturers you are qualified for"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"grid @2xl:grid-cols-2 gap-4",children:g?Array.from({length:2}).map((q,z)=>jsxRuntime.jsx(ManufacturerCard,{loading:!0},z)):M.map(q=>jsxRuntime.jsx(ManufacturerCard,{manufacturer:q,link:`https://dashboard.randmar.io/${t}/Partner/${q.ManufacturerId}`},q.ManufacturerId))})})]}):jsxRuntime.jsx(ResellerQualificationsCard,{qualifications:j}),jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:A==null?void 0:A.Opportunities,loading:g}),!d&&jsxRuntime.jsx(ReportsSection,{appID:t,userEmail:o,isLoading:g})]}),jsxRuntime.jsx(E,{})]})}/**
1103
1103
  * table-core
1104
1104
  *
1105
1105
  * Copyright (c) TanStack
@@ -1120,7 +1120,7 @@ $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full sh
1120
1120
  * LICENSE.md file in the root directory of this source tree.
1121
1121
  *
1122
1122
  * @license MIT
1123
- */function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n}){var E;const[o,l]=React.useState([]),[d,f]=React.useState([]),[g,b]=React.useState({pageIndex:0,pageSize:10}),[_,S]=React.useState(null),R=useReactTable({data:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:l,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:f,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:b,state:{sorting:o,columnFilters:d,pagination:g}}),C=(A,I)=>{A.toggleSorting(I),S(null)};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:"rounded-md border",children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:R.getHeaderGroups().map(A=>jsxRuntime.jsx(TableRow,{children:A.headers.map(I=>{var M;return jsxRuntime.jsx(TableHead,{children:I.isPlaceholder?null:I.column.getCanSort()||I.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:_===I.id,onOpenChange:j=>S(j?I.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(I.column.columnDef.header,I.getContext()),I.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[I.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),I.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[I.column.id]?jsxRuntime.jsxs(Select,{onValueChange:j=>I.column.setFilterValue(j==="all"?void 0:[j]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${I.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(M=n[I.column.id])==null?void 0:M.map(j=>jsxRuntime.jsx(SelectItem,{value:j||"empty",children:j||"(Empty)"},j))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${I.column.columnDef.header}...`,value:I.column.getFilterValue()??"",onChange:j=>I.column.setFilterValue(j.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(I.column.columnDef.header,I.getContext())})},I.id)})},A.id))}),jsxRuntime.jsx(TableBody,{children:(E=R.getRowModel().rows)!=null&&E.length?R.getRowModel().rows.map(A=>jsxRuntime.jsx(TableRow,{"data-state":A.getIsSelected()&&"selected",children:A.getVisibleCells().map(I=>jsxRuntime.jsx(TableCell,{children:flexRender(I.column.columnDef.cell,I.getContext())},I.id))},A.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${R.getState().pagination.pageSize}`,onValueChange:A=>{R.setPageSize(Number(A))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:R.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(A=>jsxRuntime.jsx(SelectItem,{value:`${A}`,children:jsxRuntime.jsx("span",{children:A})},A))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var M,j,q,z;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((j=(M=e.Categories)==null?void 0:M[0])==null?void 0:j.CategoryCode)||""),[f,g]=React.useState(!1),[b,_]=React.useState(!1),{toast:S}=useToast(),{data:R,isLoading:C,isFetching:E}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),A=async()=>{try{g(!0),_(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&S({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(Q){console.error("Error syncing to Shopify:",Q),S({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},I=()=>{var Q,F;return((F=(Q=e.Categories)==null?void 0:Q.find(O=>O.CategoryCode===l))==null?void 0:F.CategoryName)||l};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),n&&((q=e.Categories)==null?void 0:q.findIndex(Q=>Q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 mb-4",disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',I(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:A,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:C||E?Array.from({length:4}).map((Q,F)=>jsxRuntime.jsx(ProductCard,{},F)):R!=null&&R.Products&&(R==null?void 0:R.Products.length)>0?(z=[...R.Products].sort((Q,F)=>{const O=Q.OverallPercentileRank??0;return(F.OverallPercentileRank??0)-O}))==null?void 0:z.map(Q=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:Q,viewProductLink:`/${t}/Product/${Q.RandmarSKU}`,shopifyHostname:n},Q.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var I,M,j;const{data:d,isLoading:f}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:g}=useToast(),[b]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[_,S]=React.useState(!1),[R,C]=React.useState(!1),E=async()=>{try{S(!0),C(!1),await b({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&g({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(q){console.error("Error syncing to Shopify:",q),g({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{S(!1)}},A=()=>d!=null&&d.Reseller?"reseller-overview":d!=null&&d.Manufacturer?"manufacturer-overview":"";return jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2",children:[jsxRuntime.jsx(PartnerCard,{account:d,loading:f,withAbout:!0,withVoice:!1,action:" "}),jsxRuntime.jsxs("div",{className:"grid gap-4",children:[((d==null?void 0:d.Manufacturer)||f)&&jsxRuntime.jsx(ManufacturerCard,{manufacturer:d==null?void 0:d.Manufacturer,loading:f,mainAction:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(ManufacturerGetStartedButton,{applicationId:t,manufacturer:d==null?void 0:d.Manufacturer}),o&&((M=(I=d==null?void 0:d.Manufacturer)==null?void 0:I.Categories)==null?void 0:M.findIndex(q=>q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:R,onOpenChange:C,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 ml-2",disabled:_,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Manufacturer to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the manufacturer "',(j=d==null?void 0:d.Manufacturer)==null?void 0:j.PublicName,'" to Shopify? This will add all products from this manufacturer to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:E,disabled:_,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]})}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(ResellerCard,{reseller:d==null?void 0:d.Reseller,loading:f})]})]}),((d==null?void 0:d.Reseller)||(d==null?void 0:d.Manufacturer))&&!f&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4",children:jsxRuntime.jsxs(Tabs,{defaultValue:A(),className:"w-full",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsTrigger,{value:"reseller-overview",className:"reseller-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Reseller Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"manufacturer-overview",className:"manufacturer-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Manufacturer Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"products",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Products"})]}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsContent,{value:"reseller-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOverview,{readonly:!0,appID:d.ApplicationId||"",reseller:d==null?void 0:d.Reseller,userEmail:n,isSuperAdmin:l,withoutReports:!0})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"manufacturer-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerOverviewPage,{readonly:!0,manufacturer:d==null?void 0:d.Manufacturer,applicationId:d.ApplicationId||"",userEmail:n})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"products",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerProducts,{applicationId:t,manufacturer:d.Manufacturer,shopifyHostName:o})})})]})}),f&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4 mt-4 flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})})]})}function ManufacturerBillingInfoSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState({}),b=React.useMemo(()=>({accountsPayableRep:(t==null?void 0:t.ContactName)??"",representativeEmail:(t==null?void 0:t.RepresentativeEmail)??"",phone:(t==null?void 0:t.Phone)??"",creditLimit:(t==null?void 0:t.CreditLimit)??0,terms:(t==null?void 0:t.Terms)??""}),[t]),{register:_,handleSubmit:S,reset:R,watch:C,formState:{errors:E,isSubmitting:A}}=useForm({defaultValues:b}),I=C(),M=React.useCallback(()=>e||!f?!1:JSON.stringify(I)!==JSON.stringify(f),[e,I,f]);React.useEffect(()=>{o&&o(M())},[M,o]),React.useEffect(()=>{t&&(R(b),g(b))},[t,R,b]);const j=async q=>{if(e)return;let z=!0,Q=!1;const F=[{key:"accountsPayableRep",apiKey:"ContactName",value:q.accountsPayableRep},{key:"representativeEmail",apiKey:"RepresentativeEmail",value:q.representativeEmail},{key:"phone",apiKey:"Phone",value:q.phone},{key:"terms",apiKey:"Terms",value:q.terms}];for(const O of F){const te=O.value,ne=t==null?void 0:t[O.apiKey];if(te!==ne&&te!==void 0){Q=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:O.apiKey,newValue:String(te)}).unwrap()||(z=!1,console.error(`Failed to update ${O.apiKey}`))}catch(ae){console.error(`Error updating ${O.apiKey}:`,ae),z=!1}}}z&&Q?(l({title:"Billing info",description:"Information updated successfully",variant:"success"}),g({...q}),o&&o(!1)):z?Q||l({title:"No changes",description:"No changes were made to the information.",variant:"info"}):l({title:"Update error",description:"Failed to update. Please try again.",variant:"destructive"})};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing, Credit, & Rebates"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs("form",{onSubmit:S(j),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"accountsPayableRep",children:"Accounts Payable Representative"}),jsxRuntime.jsx(Input,{id:"accountsPayableRep",placeholder:"John Doe",..._("accountsPayableRep"),readOnly:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"representativeEmail",children:"Representative Email"}),jsxRuntime.jsx(Input,{id:"representativeEmail",placeholder:"john.doe@company.com",..._("representativeEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),readOnly:e}),E.representativeEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.representativeEmail.message})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"phone",children:"Phone"}),jsxRuntime.jsx(Input,{id:"phone",placeholder:"(555) 123-4567",..._("phone"),readOnly:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"creditLimit",children:"Credit Limit"}),jsxRuntime.jsx("div",{className:"p-2 border rounded-md bg-gray-100",children:jsxRuntime.jsx(FormattedNumber,{value:(t==null?void 0:t.CreditLimit)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"terms",children:"Terms"}),jsxRuntime.jsx(Input,{id:"terms",placeholder:"NET 30 DAYS",..._("terms"),readOnly:!0})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:A,className:"w-full sm:w-auto",children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})})]})}function OpenToWorkSection({manufacturer:t,readonly:e=!1,isLoading:n}){const{toast:o}=useToast(),[l]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),d=React.useMemo(()=>({openToWork:(t==null?void 0:t.OpenToWork)??!1}),[t]),{reset:f,watch:g}=useForm({defaultValues:d});React.useEffect(()=>{t&&f(d)},[t,f,d]);const b=async _=>{if(!e)try{await l({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:"OpenToWork",newValue:_?"true":"false"}).unwrap()&&o({title:"Open to work info",description:"Information updated successfully",variant:"success"})}catch(S){console.error("Error updating",S)}};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Open to Work with Resellers"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsx("div",{className:"space-y-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})}):jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Resellers will be introducing their business, and communicating opportunities for your Brand through Randmar."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"You'll engage directly with resellers, allow them to learn about your product lines, and grow your business faster."}),jsxRuntime.jsx("br",{}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"openToWork",checked:g("openToWork"),onCheckedChange:_=>b(_),disabled:e}),jsxRuntime.jsx(Label$2,{htmlFor:"openToWork",children:"Open to work with Resellers"})]})]})})]})}const tagSuggestions=["Arts and Crafts","Cleaning Solutions","Clothing","Electronics","Generic Compatible Toner","Ink","Luggage and Bags","Miscellaneous","Networking Devices","Paper Products","Printers","Printing Supplies","Toner"];function ManufacturerPublicInfoSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState([]),[b,_]=React.useState({}),S=React.useMemo(()=>({publicName:(t==null?void 0:t.PublicName)??"",website:(t==null?void 0:t.Website)??"",customerServiceEmail:(t==null?void 0:t.PublicEmail)??"",publicResources:(t==null?void 0:t.PublicResourcesLink)??""}),[t]),{register:R,handleSubmit:C,reset:E,watch:A,formState:{errors:I,isSubmitting:M}}=useForm({defaultValues:S}),j=A(),q=React.useCallback(()=>e||!b?!1:JSON.stringify(j)!==JSON.stringify(b),[e,j,b]);React.useEffect(()=>{o&&o(q())},[q,o]),React.useEffect(()=>{t&&(E(S),g(t.Tags?t.Tags.split(",").map(O=>O.trim()):[]),_(S))},[t,E,S]);const z=async O=>{if(e)return;let te=!0,ne=!1;const ae=[{key:"publicName",apiKey:"PublicName",value:O.publicName},{key:"website",apiKey:"Website",value:O.website},{key:"manufacturerCategories",apiKey:"Tags",value:f.join(", ")},{key:"customerServiceEmail",apiKey:"PublicEmail",value:O.customerServiceEmail},{key:"publicResources",apiKey:"PublicResourcesLink",value:O.publicResources}];for(const ge of ae){const oe=ge.value,je=t==null?void 0:t[ge.apiKey],Ne=typeof je=="boolean"?String(je):je;if(oe!==Ne&&oe!==void 0){ne=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:ge.apiKey,newValue:String(oe)}).unwrap()||(te=!1)}catch(Ae){console.error(`Error updating ${ge.apiKey}:`,Ae),te=!1}}}te&&ne?(l({title:"Public info",description:"Information updated successfully",variant:"success"}),_({...O}),o&&o(!1)):te||l({title:"Update error",description:"Failed to update",variant:"destructive"})},Q=O=>!O||O.trim()==="",F=O=>{g(O)};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Public Information"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(Q(A("publicName"))||Q(A("website"))||Q(A("customerServiceEmail")))&&jsxRuntime.jsxs(Alert,{variant:"destructive",className:"mb-6",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Missing information"}),jsxRuntime.jsx(AlertDescription,{children:"All fields are required to get started at working with Resellers."})]}),jsxRuntime.jsxs("form",{onSubmit:C(z),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"publicName",children:"Public Manufacturer Name *"}),jsxRuntime.jsx(Input,{id:"publicName",placeholder:"Company Name",...R("publicName",{}),className:Q(A("publicName"))?"input-error-indicator":"",readOnly:e}),I.publicName&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.publicName.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"website",children:"Website *"}),jsxRuntime.jsx(Input,{id:"website",placeholder:"https://company.com",...R("website",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:Q(A("website"))?"input-error-indicator":"",readOnly:e}),I.website&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.website.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"manufacturerCategories",children:"Manufacturer Categories"}),jsxRuntime.jsx(MultiSelect,{options:tagSuggestions,selected:f,onChange:F,placeholder:"Select or type categories...",disabled:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"customerServiceEmail",children:"Customer Service Email *"}),jsxRuntime.jsx(Input,{id:"customerServiceEmail",placeholder:"support@company.com",...R("customerServiceEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:Q(A("customerServiceEmail"))?"input-error-indicator":"",readOnly:e}),I.customerServiceEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.customerServiceEmail.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"publicResources",children:"Public Resources"}),jsxRuntime.jsx(Input,{id:"publicResources",placeholder:"https://resources.company.com",...R("publicResources"),readOnly:e})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:M,className:"w-full sm:w-auto",children:M?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})]})})]})}function ManufacturerQualificationsSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState({}),b=React.useMemo(()=>({partnerPortal:(t==null?void 0:t.PartnerPortal)??"",partnerRegistrationLink:(t==null?void 0:t.PartnerRegistrationLink)??""}),[t]),{register:_,handleSubmit:S,reset:R,watch:C,formState:{errors:E,isSubmitting:A}}=useForm({defaultValues:b}),I=C(),M=React.useCallback(()=>e||!f?!1:JSON.stringify(I)!==JSON.stringify(f),[e,I,f]);React.useEffect(()=>{o&&o(M())},[M,o]),React.useEffect(()=>{t&&(R(b),g(b))},[t,R,b]);const j=async z=>{if(e)return!1;let Q=!0,F=!1;const O=[{key:"partnerPortal",apiKey:"PartnerPortal",value:z.partnerPortal},{key:"partnerRegistrationLink",apiKey:"PartnerRegistrationLink",value:z.partnerRegistrationLink}];for(const te of O){const ne=te.value,ae=t==null?void 0:t[te.apiKey];if(ne!==ae&&ne!==void 0){F=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:te.apiKey,newValue:String(ne)}).unwrap()||(Q=!1,console.error(`Failed to update ${te.apiKey}`))}catch(ge){console.error(`Error updating ${te.apiKey}:`,ge),Q=!1}}}Q&&F?(l({title:"Qualifications info",description:"Information updated successfully",variant:"success"}),g({...z}),o&&o(!1)):Q?F||l({title:"No changes",description:"No changes were made to the information.",variant:"info"}):l({title:"Update error",description:"Failed to update. Please try again.",variant:"destructive"})},q=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?(\?[^\s#]*)??(#[^\s]*)?$/i;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs("form",{onSubmit:S(j),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"partnerPortal",children:"Partner Portal"}),jsxRuntime.jsx(Input,{id:"partnerPortal",placeholder:"https://partner.example.com",..._("partnerPortal",{pattern:{value:q,message:"Invalid URL format"}}),readOnly:e}),E.partnerPortal&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.partnerPortal.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"partnerRegistrationLink",children:"Partner Registration Link"}),jsxRuntime.jsx(Input,{id:"partnerRegistrationLink",placeholder:"https://register.example.com",..._("partnerRegistrationLink",{pattern:{value:q,message:"Invalid URL format"}}),readOnly:e}),E.partnerRegistrationLink&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.partnerRegistrationLink.message})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:A,className:"w-full sm:w-auto",children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})})]})}function ManufacturerReportsSection({manufacturerId:t,userEmail:e,isLoading:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ManufacturerByRouteManufacturerIdDocumentAndDocumentNumberEmailMutation(),[f,g]=React.useState(null),[b,_]=React.useState(e),[S,R]=React.useState(!1),C=[{name:"Orders & Sales",reports:[{id:"OpenOrders",title:"Open Orders Report",description:"The Open Orders Report provides a snapshot of active orders, aiding your business in efficiently tracking and fulfilling customer demands.",icon:FileText},{id:"Sales",title:"Sales Report",description:"Summary of your company's sales activity over a certain period, detailing total sales and helping identifying trends, successes, and areas needing improvement.",icon:ChartNoAxesColumnIncreasing}]},{name:"Purchase Orders",reports:[{id:"PurchasedOrders",title:"Open Purchase Orders Report",description:"The Open Purchase Orders Report provides a snapshot of Randmar's active orders, aiding your business in efficiently tracking and fulfilling Randmar's inventory demands.",icon:ShoppingCart},{id:"Reorder",title:"Reordering Report",description:"The Reordering Report provides a snapshot of all part numbers auto-reordering statuses. Aiding your understanding of what will be automatically reordered by our system or not once the inventory reaches low numbers.",icon:ClipboardList}]},{name:"Inventory",reports:[{id:"Inventory",title:"Inventory Report",description:"Detailed document outlining the quantity, type, and value of products Randmar has on hand. It aids in managing stock levels, identifying shortages or surpluses, and informing purchasing decisions.",icon:Package},{id:"Products",title:"Products Report",description:"Detailed document outlining all your products properties. It provides a comprehensive overview of essential information and insights that help you make informed decisions.",icon:ClipboardList}]}],E=async I=>{g(I),R(!0)},A=async()=>{if(!(!f||!t))try{await l({routeManufacturerId:t,documentNumber:f.id,emailAddress:b}).unwrap(),o({title:"Report requested",description:`The ${f.title} will be sent to ${b} shortly.`,variant:"success"}),R(!1),_("")}catch(I){console.error("Error requesting report:",I),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Open Orders & Sales Report, to your Inventory Reports."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(I=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(M=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},M))]},I))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:C.map(I=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:I.name}),I.reports.map(M=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(M.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:M.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:M.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>E(M),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},M.id))]},I.name))})}),jsxRuntime.jsx(Dialog,{open:S,onOpenChange:R,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",f==null?void 0:f.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:b,onChange:I=>_(I.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:A,disabled:!b||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function ManufacturerResellerOrdersSection(t){const{data:e,isLoading:n,isError:o}=useGetV4ManufacturerByRouteManufacturerIdDocumentsActiveOrderDetailsQuery({routeManufacturerId:t.manufacturerId},{skip:!!t.activeOrders||t.isLoading}),l=t.activeOrders??e,f=(()=>{if(!l)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const b=l.filter(Q=>Q.DocumentType==="Order"),_=l.filter(Q=>Q.DocumentType==="Shipment"),S=b.filter(Q=>Q.WarehouseCode!=="3PLE"),R=S.reduce((Q,F)=>Q+(F.Quantity||0),0),C=S.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),E=b.filter(Q=>Q.WarehouseCode==="3PLE"),A=E.reduce((Q,F)=>Q+(F.Quantity||0),0),I=E.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),M=_.length,j=_.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),q=R+A+M,z=C+I+j;return{all:{orders:q,amount:z},processing:{orders:R,amount:C},shipped:{orders:M,amount:j},delayed:{orders:A,amount:I}}})(),g=[{name:"All",icon:Package,color:"bg-blue-500",orders:f.all.orders,amount:f.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:f.processing.orders,amount:f.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:f.shipped.orders,amount:f.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:f.delayed.orders,amount:f.delayed.amount}];return n||t.isLoading?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 mb-4"}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(b=>jsxRuntime.jsx(Skeleton,{className:"h-32 w-full"},b))})]})]}):o?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"Failed to load reseller orders. Please try again later."})]})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-4",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Active Orders:"}),jsxRuntime.jsx("span",{className:"ml-2 font-bold",children:f.all.orders})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:g.map(b=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${b.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:b.name}),jsxRuntime.jsx("div",{className:`${b.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(b.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:b.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:b.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},b.name))})]})]})}var PROGRESS_NAME="Progress",DEFAULT_MAX=100,[createProgressContext,createProgressScope]=createContextScope(PROGRESS_NAME),[ProgressProvider,useProgressContext]=createProgressContext(PROGRESS_NAME),Progress$1=React__namespace.forwardRef((t,e)=>{const{__scopeProgress:n,value:o=null,max:l,getValueLabel:d=defaultGetValueLabel,...f}=t;(l||l===0)&&!isValidMaxNumber(l)&&console.error(getInvalidMaxError(`${l}`,"Progress"));const g=isValidMaxNumber(l)?l:DEFAULT_MAX;o!==null&&!isValidValueNumber(o,g)&&console.error(getInvalidValueError(`${o}`,"Progress"));const b=isValidValueNumber(o,g)?o:null,_=isNumber$1(b)?d(b,g):void 0;return jsxRuntime.jsx(ProgressProvider,{scope:n,value:b,max:g,children:jsxRuntime.jsx(Primitive.div,{"aria-valuemax":g,"aria-valuemin":0,"aria-valuenow":isNumber$1(b)?b:void 0,"aria-valuetext":_,role:"progressbar","data-state":getProgressState(b,g),"data-value":b??void 0,"data-max":g,...f,ref:e})})});Progress$1.displayName=PROGRESS_NAME;var INDICATOR_NAME="ProgressIndicator",ProgressIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeProgress:n,...o}=t,l=useProgressContext(INDICATOR_NAME,n);return jsxRuntime.jsx(Primitive.div,{"data-state":getProgressState(l.value,l.max),"data-value":l.value??void 0,"data-max":l.max,...o,ref:e})});ProgressIndicator.displayName=INDICATOR_NAME;function defaultGetValueLabel(t,e){return`${Math.round(t/e*100)}%`}function getProgressState(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function isNumber$1(t){return typeof t=="number"}function isValidMaxNumber(t){return isNumber$1(t)&&!isNaN(t)&&t>0}function isValidValueNumber(t,e){return isNumber$1(t)&&!isNaN(t)&&t<=e&&t>=0}function getInvalidMaxError(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${DEFAULT_MAX}\`.`}function getInvalidValueError(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
1123
+ */function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n}){var E;const[o,l]=React.useState([]),[d,f]=React.useState([]),[g,b]=React.useState({pageIndex:0,pageSize:10}),[_,S]=React.useState(null),R=useReactTable({data:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:l,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:f,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:b,state:{sorting:o,columnFilters:d,pagination:g}}),C=(A,I)=>{A.toggleSorting(I),S(null)};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:"rounded-md border",children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:R.getHeaderGroups().map(A=>jsxRuntime.jsx(TableRow,{children:A.headers.map(I=>{var M;return jsxRuntime.jsx(TableHead,{children:I.isPlaceholder?null:I.column.getCanSort()||I.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:_===I.id,onOpenChange:j=>S(j?I.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(I.column.columnDef.header,I.getContext()),I.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[I.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),I.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[I.column.id]?jsxRuntime.jsxs(Select,{onValueChange:j=>I.column.setFilterValue(j==="all"?void 0:[j]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${I.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(M=n[I.column.id])==null?void 0:M.map(j=>jsxRuntime.jsx(SelectItem,{value:j||"empty",children:j||"(Empty)"},j))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${I.column.columnDef.header}...`,value:I.column.getFilterValue()??"",onChange:j=>I.column.setFilterValue(j.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(I.column.columnDef.header,I.getContext())})},I.id)})},A.id))}),jsxRuntime.jsx(TableBody,{children:(E=R.getRowModel().rows)!=null&&E.length?R.getRowModel().rows.map(A=>jsxRuntime.jsx(TableRow,{"data-state":A.getIsSelected()&&"selected",children:A.getVisibleCells().map(I=>jsxRuntime.jsx(TableCell,{children:flexRender(I.column.columnDef.cell,I.getContext())},I.id))},A.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${R.getState().pagination.pageSize}`,onValueChange:A=>{R.setPageSize(Number(A))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:R.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(A=>jsxRuntime.jsx(SelectItem,{value:`${A}`,children:jsxRuntime.jsx("span",{children:A})},A))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var M,j,q,z;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((j=(M=e.Categories)==null?void 0:M[0])==null?void 0:j.CategoryCode)||""),[f,g]=React.useState(!1),[b,_]=React.useState(!1),{toast:S}=useToast(),{data:R,isLoading:C,isFetching:E}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),A=async()=>{try{g(!0),_(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&S({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(Q){console.error("Error syncing to Shopify:",Q),S({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},I=()=>{var Q,F;return((F=(Q=e.Categories)==null?void 0:Q.find(O=>O.CategoryCode===l))==null?void 0:F.CategoryName)||l};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),n&&((q=e.Categories)==null?void 0:q.findIndex(Q=>Q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:b,onOpenChange:_,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 mb-4",disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',I(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:A,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:C||E?Array.from({length:4}).map((Q,F)=>jsxRuntime.jsx(ProductCard,{},F)):R!=null&&R.Products&&(R==null?void 0:R.Products.length)>0?(z=[...R.Products].sort((Q,F)=>{const O=Q.OverallPercentileRank??0;return(F.OverallPercentileRank??0)-O}))==null?void 0:z.map(Q=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:Q,viewProductLink:`/${t}/Product/${Q.RandmarSKU}`,shopifyHostname:n},Q.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var I,M,j;const{data:d,isLoading:f}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:g}=useToast(),[b]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[_,S]=React.useState(!1),[R,C]=React.useState(!1),E=async()=>{try{S(!0),C(!1),await b({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&g({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(q){console.error("Error syncing to Shopify:",q),g({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{S(!1)}},A=()=>d!=null&&d.Reseller?"reseller-overview":d!=null&&d.Manufacturer?"manufacturer-overview":"";return jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 @2xl:grid-cols-2",children:[jsxRuntime.jsx(PartnerCard,{account:d,loading:f,withAbout:!0,withVoice:!1,action:" "}),jsxRuntime.jsxs("div",{className:"grid gap-4",children:[((d==null?void 0:d.Manufacturer)||f)&&jsxRuntime.jsx(ManufacturerCard,{manufacturer:d==null?void 0:d.Manufacturer,loading:f,mainAction:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(ManufacturerGetStartedButton,{applicationId:t,manufacturer:d==null?void 0:d.Manufacturer}),o&&((M=(I=d==null?void 0:d.Manufacturer)==null?void 0:I.Categories)==null?void 0:M.findIndex(q=>q.AvailableToBuy))!==-1&&jsxRuntime.jsxs(Dialog,{open:R,onOpenChange:C,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 ml-2",disabled:_,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Manufacturer to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the manufacturer "',(j=d==null?void 0:d.Manufacturer)==null?void 0:j.PublicName,'" to Shopify? This will add all products from this manufacturer to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:E,disabled:_,children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})]})}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(ResellerCard,{reseller:d==null?void 0:d.Reseller,loading:f})]})]}),((d==null?void 0:d.Reseller)||(d==null?void 0:d.Manufacturer))&&!f&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4",children:jsxRuntime.jsxs(Tabs,{defaultValue:A(),className:"w-full",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsTrigger,{value:"reseller-overview",className:"reseller-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Reseller Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"manufacturer-overview",className:"manufacturer-theme relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Manufacturer Overview"}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsTrigger,{value:"products",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",children:"Products"})]}),(d==null?void 0:d.Reseller)&&jsxRuntime.jsx(TabsContent,{value:"reseller-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ResellerOverview,{readonly:!0,appID:d.ApplicationId||"",reseller:d==null?void 0:d.Reseller,userEmail:n,isSuperAdmin:l,withoutReports:!0})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"manufacturer-overview",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerOverviewPage,{readonly:!0,manufacturer:d==null?void 0:d.Manufacturer,applicationId:d.ApplicationId||"",userEmail:n})})}),(d==null?void 0:d.Manufacturer)&&jsxRuntime.jsx(TabsContent,{value:"products",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ManufacturerProducts,{applicationId:t,manufacturer:d.Manufacturer,shopifyHostName:o})})})]})}),f&&jsxRuntime.jsx("div",{className:"max-w-6xl mx-auto p-4 mt-4 flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})})]})}function ManufacturerBillingInfoSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState({}),b=React.useMemo(()=>({accountsPayableRep:(t==null?void 0:t.ContactName)??"",representativeEmail:(t==null?void 0:t.RepresentativeEmail)??"",phone:(t==null?void 0:t.Phone)??"",creditLimit:(t==null?void 0:t.CreditLimit)??0,terms:(t==null?void 0:t.Terms)??""}),[t]),{register:_,handleSubmit:S,reset:R,watch:C,formState:{errors:E,isSubmitting:A}}=useForm({defaultValues:b}),I=C(),M=React.useCallback(()=>e||!f?!1:JSON.stringify(I)!==JSON.stringify(f),[e,I,f]);React.useEffect(()=>{o&&o(M())},[M,o]),React.useEffect(()=>{t&&(R(b),g(b))},[t,R,b]);const j=async q=>{if(e)return;let z=!0,Q=!1;const F=[{key:"accountsPayableRep",apiKey:"ContactName",value:q.accountsPayableRep},{key:"representativeEmail",apiKey:"RepresentativeEmail",value:q.representativeEmail},{key:"phone",apiKey:"Phone",value:q.phone},{key:"terms",apiKey:"Terms",value:q.terms}];for(const O of F){const te=O.value,ne=t==null?void 0:t[O.apiKey];if(te!==ne&&te!==void 0){Q=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:O.apiKey,newValue:String(te)}).unwrap()||(z=!1,console.error(`Failed to update ${O.apiKey}`))}catch(ae){console.error(`Error updating ${O.apiKey}:`,ae),z=!1}}}z&&Q?(l({title:"Billing info",description:"Information updated successfully",variant:"success"}),g({...q}),o&&o(!1)):z?Q||l({title:"No changes",description:"No changes were made to the information.",variant:"info"}):l({title:"Update error",description:"Failed to update. Please try again.",variant:"destructive"})};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Billing, Credit, & Rebates"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs("form",{onSubmit:S(j),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"accountsPayableRep",children:"Accounts Payable Representative"}),jsxRuntime.jsx(Input,{id:"accountsPayableRep",placeholder:"John Doe",..._("accountsPayableRep"),readOnly:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"representativeEmail",children:"Representative Email"}),jsxRuntime.jsx(Input,{id:"representativeEmail",placeholder:"john.doe@company.com",..._("representativeEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),readOnly:e}),E.representativeEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.representativeEmail.message})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"phone",children:"Phone"}),jsxRuntime.jsx(Input,{id:"phone",placeholder:"(555) 123-4567",..._("phone"),readOnly:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"creditLimit",children:"Credit Limit"}),jsxRuntime.jsx("div",{className:"p-2 border rounded-md bg-gray-100",children:jsxRuntime.jsx(FormattedNumber,{value:(t==null?void 0:t.CreditLimit)||0,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"terms",children:"Terms"}),jsxRuntime.jsx(Input,{id:"terms",placeholder:"NET 30 DAYS",..._("terms"),readOnly:!0})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:A,className:"w-full sm:w-auto",children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})})]})}function OpenToWorkSection({manufacturer:t,readonly:e=!1,isLoading:n}){const{toast:o}=useToast(),[l]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),d=React.useMemo(()=>({openToWork:(t==null?void 0:t.OpenToWork)??!1}),[t]),{reset:f,watch:g}=useForm({defaultValues:d});React.useEffect(()=>{t&&f(d)},[t,f,d]);const b=async _=>{if(!e)try{await l({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:"OpenToWork",newValue:_?"true":"false"}).unwrap()&&o({title:"Open to work info",description:"Information updated successfully",variant:"success"})}catch(S){console.error("Error updating",S)}};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Open to Work with Resellers"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsx("div",{className:"space-y-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})}):jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Resellers will be introducing their business, and communicating opportunities for your Brand through Randmar."}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"You'll engage directly with resellers, allow them to learn about your product lines, and grow your business faster."}),jsxRuntime.jsx("br",{}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"openToWork",checked:g("openToWork"),onCheckedChange:_=>b(_),disabled:e}),jsxRuntime.jsx(Label$2,{htmlFor:"openToWork",children:"Open to work with Resellers"})]})]})})]})}const tagSuggestions=["Arts and Crafts","Cleaning Solutions","Clothing","Electronics","Generic Compatible Toner","Ink","Luggage and Bags","Miscellaneous","Networking Devices","Paper Products","Printers","Printing Supplies","Toner"];function ManufacturerPublicInfoSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState([]),[b,_]=React.useState({}),S=React.useMemo(()=>({publicName:(t==null?void 0:t.PublicName)??"",website:(t==null?void 0:t.Website)??"",customerServiceEmail:(t==null?void 0:t.PublicEmail)??"",publicResources:(t==null?void 0:t.PublicResourcesLink)??""}),[t]),{register:R,handleSubmit:C,reset:E,watch:A,formState:{errors:I,isSubmitting:M}}=useForm({defaultValues:S}),j=A(),q=React.useCallback(()=>e||!b?!1:JSON.stringify(j)!==JSON.stringify(b),[e,j,b]);React.useEffect(()=>{o&&o(q())},[q,o]),React.useEffect(()=>{t&&(E(S),g(t.Tags?t.Tags.split(",").map(O=>O.trim()):[]),_(S))},[t,E,S]);const z=async O=>{if(e)return;let te=!0,ne=!1;const ae=[{key:"publicName",apiKey:"PublicName",value:O.publicName},{key:"website",apiKey:"Website",value:O.website},{key:"manufacturerCategories",apiKey:"Tags",value:f.join(", ")},{key:"customerServiceEmail",apiKey:"PublicEmail",value:O.customerServiceEmail},{key:"publicResources",apiKey:"PublicResourcesLink",value:O.publicResources}];for(const ge of ae){const oe=ge.value,je=t==null?void 0:t[ge.apiKey],Ne=typeof je=="boolean"?String(je):je;if(oe!==Ne&&oe!==void 0){ne=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:ge.apiKey,newValue:String(oe)}).unwrap()||(te=!1)}catch(Ae){console.error(`Error updating ${ge.apiKey}:`,Ae),te=!1}}}te&&ne?(l({title:"Public info",description:"Information updated successfully",variant:"success"}),_({...O}),o&&o(!1)):te||l({title:"Update error",description:"Failed to update",variant:"destructive"})},Q=O=>!O||O.trim()==="",F=O=>{g(O)};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Public Information"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[(Q(A("publicName"))||Q(A("website"))||Q(A("customerServiceEmail")))&&jsxRuntime.jsxs(Alert,{variant:"destructive",className:"mb-6",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Missing information"}),jsxRuntime.jsx(AlertDescription,{children:"All fields are required to get started at working with Resellers."})]}),jsxRuntime.jsxs("form",{onSubmit:C(z),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"publicName",children:"Public Manufacturer Name *"}),jsxRuntime.jsx(Input,{id:"publicName",placeholder:"Company Name",...R("publicName",{}),className:Q(A("publicName"))?"input-error-indicator":"",readOnly:e}),I.publicName&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.publicName.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"website",children:"Website *"}),jsxRuntime.jsx(Input,{id:"website",placeholder:"https://company.com",...R("website",{pattern:{value:/^.{7,}$/,message:"Must be at least 7 characters"}}),className:Q(A("website"))?"input-error-indicator":"",readOnly:e}),I.website&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.website.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"manufacturerCategories",children:"Manufacturer Categories"}),jsxRuntime.jsx(MultiSelect,{options:tagSuggestions,selected:f,onChange:F,placeholder:"Select or type categories...",disabled:e})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"customerServiceEmail",children:"Customer Service Email *"}),jsxRuntime.jsx(Input,{id:"customerServiceEmail",placeholder:"support@company.com",...R("customerServiceEmail",{pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:Q(A("customerServiceEmail"))?"input-error-indicator":"",readOnly:e}),I.customerServiceEmail&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:I.customerServiceEmail.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"publicResources",children:"Public Resources"}),jsxRuntime.jsx(Input,{id:"publicResources",placeholder:"https://resources.company.com",...R("publicResources"),readOnly:e})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:M,className:"w-full sm:w-auto",children:M?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})]})})]})}function ManufacturerQualificationsSection({manufacturer:t,readonly:e=!1,isLoading:n,onUnsavedChanges:o}){const{toast:l}=useToast(),[d]=usePostV4PartnerByApplicationIdAccountManufacturerAndFieldNameMutation(),[f,g]=React.useState({}),b=React.useMemo(()=>({partnerPortal:(t==null?void 0:t.PartnerPortal)??"",partnerRegistrationLink:(t==null?void 0:t.PartnerRegistrationLink)??""}),[t]),{register:_,handleSubmit:S,reset:R,watch:C,formState:{errors:E,isSubmitting:A}}=useForm({defaultValues:b}),I=C(),M=React.useCallback(()=>e||!f?!1:JSON.stringify(I)!==JSON.stringify(f),[e,I,f]);React.useEffect(()=>{o&&o(M())},[M,o]),React.useEffect(()=>{t&&(R(b),g(b))},[t,R,b]);const j=async z=>{if(e)return!1;let Q=!0,F=!1;const O=[{key:"partnerPortal",apiKey:"PartnerPortal",value:z.partnerPortal},{key:"partnerRegistrationLink",apiKey:"PartnerRegistrationLink",value:z.partnerRegistrationLink}];for(const te of O){const ne=te.value,ae=t==null?void 0:t[te.apiKey];if(ne!==ae&&ne!==void 0){F=!0;try{await d({applicationId:(t==null?void 0:t.ManufacturerId)??"",fieldName:te.apiKey,newValue:String(ne)}).unwrap()||(Q=!1,console.error(`Failed to update ${te.apiKey}`))}catch(ge){console.error(`Error updating ${te.apiKey}:`,ge),Q=!1}}}Q&&F?(l({title:"Qualifications info",description:"Information updated successfully",variant:"success"}),g({...z}),o&&o(!1)):Q?F||l({title:"No changes",description:"No changes were made to the information.",variant:"info"}):l({title:"Update error",description:"Failed to update. Please try again.",variant:"destructive"})},q=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?(\?[^\s#]*)??(#[^\s]*)?$/i;return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{children:n?jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"})]}):jsxRuntime.jsxs("form",{onSubmit:S(j),className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"partnerPortal",children:"Partner Portal"}),jsxRuntime.jsx(Input,{id:"partnerPortal",placeholder:"https://partner.example.com",..._("partnerPortal",{pattern:{value:q,message:"Invalid URL format"}}),readOnly:e}),E.partnerPortal&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.partnerPortal.message})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{className:"text-sm font-medium leading-none",htmlFor:"partnerRegistrationLink",children:"Partner Registration Link"}),jsxRuntime.jsx(Input,{id:"partnerRegistrationLink",placeholder:"https://register.example.com",..._("partnerRegistrationLink",{pattern:{value:q,message:"Invalid URL format"}}),readOnly:e}),E.partnerRegistrationLink&&jsxRuntime.jsx("p",{className:"text-red-500 text-sm",children:E.partnerRegistrationLink.message})]}),!e&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx(Button,{type:"submit",disabled:A,className:"w-full sm:w-auto",children:A?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})})]})})]})}function ManufacturerReportsSection({manufacturerId:t,userEmail:e,isLoading:n}){const{toast:o}=useToast(),[l,{isLoading:d}]=usePostV4ManufacturerByRouteManufacturerIdDocumentAndDocumentNumberEmailMutation(),[f,g]=React.useState(null),[b,_]=React.useState(e),[S,R]=React.useState(!1),C=[{name:"Orders & Sales",reports:[{id:"OpenOrders",title:"Open Orders Report",description:"The Open Orders Report provides a snapshot of active orders, aiding your business in efficiently tracking and fulfilling customer demands.",icon:FileText},{id:"Sales",title:"Sales Report",description:"Summary of your company's sales activity over a certain period, detailing total sales and helping identifying trends, successes, and areas needing improvement.",icon:ChartNoAxesColumnIncreasing}]},{name:"Purchase Orders",reports:[{id:"PurchasedOrders",title:"Open Purchase Orders Report",description:"The Open Purchase Orders Report provides a snapshot of Randmar's active orders, aiding your business in efficiently tracking and fulfilling Randmar's inventory demands.",icon:ShoppingCart},{id:"Reorder",title:"Reordering Report",description:"The Reordering Report provides a snapshot of all part numbers auto-reordering statuses. Aiding your understanding of what will be automatically reordered by our system or not once the inventory reaches low numbers.",icon:ClipboardList}]},{name:"Inventory",reports:[{id:"Inventory",title:"Inventory Report",description:"Detailed document outlining the quantity, type, and value of products Randmar has on hand. It aids in managing stock levels, identifying shortages or surpluses, and informing purchasing decisions.",icon:Package},{id:"Products",title:"Products Report",description:"Detailed document outlining all your products properties. It provides a comprehensive overview of essential information and insights that help you make informed decisions.",icon:ClipboardList}]}],E=async I=>{g(I),R(!0)},A=async()=>{if(!(!f||!t))try{await l({routeManufacturerId:t,documentNumber:f.id,emailAddress:b}).unwrap(),o({title:"Report requested",description:`The ${f.title} will be sent to ${b} shortly.`,variant:"success"}),R(!1),_("")}catch(I){console.error("Error requesting report:",I),o({title:"Error",description:"Failed to request report. Please try again.",variant:"destructive"})}};return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reports"}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:"Download essential business reports, from your Open Orders & Sales Report, to your Inventory Reports."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(I=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-48"}),[1,2].map(M=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full"})]}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})]},M))]},I))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:C.map(I=>jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:I.name}),I.reports.map(M=>jsxRuntime.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg hover:bg-gray-100 transition-colors",children:[jsxRuntime.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:jsxRuntime.jsx(M.icon,{className:"h-5 w-5 text-primary"})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h4",{className:"font-semibold text-sm",children:M.title}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:M.description})]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center gap-1",onClick:()=>E(M),children:[jsxRuntime.jsx(Download,{className:"h-4 w-4"}),"Request"]})]},M.id))]},I.name))})}),jsxRuntime.jsx(Dialog,{open:S,onOpenChange:R,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsxs(DialogTitle,{children:["Request ",f==null?void 0:f.title]}),jsxRuntime.jsx(DialogDescription,{children:"Enter the email address where you would like to receive the report."})]}),jsxRuntime.jsxs("div",{className:"py-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",value:b,onChange:I=>_(I.target.value),placeholder:"your@email.com",className:"mt-2"})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:A,disabled:!b||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Report"})]})]})})]})}function ManufacturerResellerOrdersSection(t){const{data:e,isLoading:n,isError:o}=useGetV4ManufacturerByRouteManufacturerIdDocumentsActiveOrderDetailsQuery({routeManufacturerId:t.manufacturerId},{skip:!!t.activeOrders||t.isLoading}),l=t.activeOrders??e,f=(()=>{if(!l)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const b=l.filter(Q=>Q.DocumentType==="Order"),_=l.filter(Q=>Q.DocumentType==="Shipment"),S=b.filter(Q=>Q.WarehouseCode!=="3PLE"),R=S.reduce((Q,F)=>Q+(F.Quantity||0),0),C=S.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),E=b.filter(Q=>Q.WarehouseCode==="3PLE"),A=E.reduce((Q,F)=>Q+(F.Quantity||0),0),I=E.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),M=_.length,j=_.reduce((Q,F)=>Q+(F.ExtendedPrice||0),0),q=R+A+M,z=C+I+j;return{all:{orders:q,amount:z},processing:{orders:R,amount:C},shipped:{orders:M,amount:j},delayed:{orders:A,amount:I}}})(),g=[{name:"All",icon:Package,color:"bg-blue-500",orders:f.all.orders,amount:f.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",orders:f.processing.orders,amount:f.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",orders:f.shipped.orders,amount:f.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",orders:f.delayed.orders,amount:f.delayed.amount}];return n||t.isLoading?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 mb-4"}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:[1,2,3,4].map(b=>jsxRuntime.jsx(Skeleton,{className:"h-32 w-full"},b))})]})]}):o?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"Failed to load reseller orders. Please try again later."})]})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Reseller Orders"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-4",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Active Orders:"}),jsxRuntime.jsx("span",{className:"ml-2 font-bold",children:f.all.orders})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-3.5",children:g.map(b=>jsxRuntime.jsx(Card,{className:"overflow-hidden rounded-md rounded-b-lg border-0 shadow-md",children:jsxRuntime.jsxs(CardContent,{className:"p-0",children:[jsxRuntime.jsx("div",{className:`${b.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:b.name}),jsxRuntime.jsx("div",{className:`${b.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(b.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:b.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:jsxRuntime.jsx(FormattedNumber,{value:b.amount,style:"currency",currency:"CAD",currencyDisplay:"symbol"})})]})]})]})]})},b.name))})]})]})}var PROGRESS_NAME="Progress",DEFAULT_MAX=100,[createProgressContext,createProgressScope]=createContextScope(PROGRESS_NAME),[ProgressProvider,useProgressContext]=createProgressContext(PROGRESS_NAME),Progress$1=React__namespace.forwardRef((t,e)=>{const{__scopeProgress:n,value:o=null,max:l,getValueLabel:d=defaultGetValueLabel,...f}=t;(l||l===0)&&!isValidMaxNumber(l)&&console.error(getInvalidMaxError(`${l}`,"Progress"));const g=isValidMaxNumber(l)?l:DEFAULT_MAX;o!==null&&!isValidValueNumber(o,g)&&console.error(getInvalidValueError(`${o}`,"Progress"));const b=isValidValueNumber(o,g)?o:null,_=isNumber$1(b)?d(b,g):void 0;return jsxRuntime.jsx(ProgressProvider,{scope:n,value:b,max:g,children:jsxRuntime.jsx(Primitive.div,{"aria-valuemax":g,"aria-valuemin":0,"aria-valuenow":isNumber$1(b)?b:void 0,"aria-valuetext":_,role:"progressbar","data-state":getProgressState(b,g),"data-value":b??void 0,"data-max":g,...f,ref:e})})});Progress$1.displayName=PROGRESS_NAME;var INDICATOR_NAME="ProgressIndicator",ProgressIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeProgress:n,...o}=t,l=useProgressContext(INDICATOR_NAME,n);return jsxRuntime.jsx(Primitive.div,{"data-state":getProgressState(l.value,l.max),"data-value":l.value??void 0,"data-max":l.max,...o,ref:e})});ProgressIndicator.displayName=INDICATOR_NAME;function defaultGetValueLabel(t,e){return`${Math.round(t/e*100)}%`}function getProgressState(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function isNumber$1(t){return typeof t=="number"}function isValidMaxNumber(t){return isNumber$1(t)&&!isNaN(t)&&t>0}function isValidValueNumber(t,e){return isNumber$1(t)&&!isNaN(t)&&t<=e&&t>=0}function getInvalidMaxError(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${DEFAULT_MAX}\`.`}function getInvalidValueError(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
1124
1124
  - a positive number
1125
1125
  - less than the value passed to \`max\` (or ${DEFAULT_MAX} if no \`max\` prop is set)
1126
1126
  - \`null\` or \`undefined\` if the progress is indeterminate.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "randmarcomps",
3
3
  "private": false,
4
- "version": "1.275.0",
4
+ "version": "1.276.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [