randmarcomps 1.218.0 → 1.219.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.
@@ -54296,6 +54296,8 @@ function SkeletonMessage({ botStatus: e }) {
54296
54296
  ] })
54297
54297
  ] });
54298
54298
  }
54299
+ const toHTML = (e) => e.split(`
54300
+ `).map((t) => /* @__PURE__ */ jsx("p", { children: t }));
54299
54301
  function ChatMessages({ messages: e, currentUserId: t, botStatus: n, isAssistantChat: o }) {
54300
54302
  return /* @__PURE__ */ jsxs("div", { children: [
54301
54303
  e.map((l) => {
@@ -54317,7 +54319,7 @@ function ChatMessages({ messages: e, currentUserId: t, botStatus: n, isAssistant
54317
54319
  "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 ",
54318
54320
  d ? "bg-primary text-white rounded-tr-none" : "bg-white border rounded-tl-none"
54319
54321
  ),
54320
- children: l.fromPartnerID === ASSISTANT_ID ? parser(l.content) : l.content
54322
+ children: l.fromPartnerID === ASSISTANT_ID ? parser(l.content) : toHTML(l.content)
54321
54323
  }
54322
54324
  )
54323
54325
  ] })
@@ -969,7 +969,8 @@ Please report this to https://github.com/markedjs/marked.`,t){const l="<p>An err
969
969
  * @author Feross Aboukhadijeh <https://feross.org>
970
970
  * @license MIT
971
971
  */var isBuffer_1,hasRequiredIsBuffer;function requireIsBuffer(){if(hasRequiredIsBuffer)return isBuffer_1;hasRequiredIsBuffer=1,isBuffer_1=function(n){return n!=null&&(e(n)||t(n)||!!n._isBuffer)};function e(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function t(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&e(n.slice(0,0))}return isBuffer_1}var hasRequiredMd5;function requireMd5(){return hasRequiredMd5||(hasRequiredMd5=1,function(){var e=requireCrypt(),t=requireCharenc().utf8,n=requireIsBuffer(),o=requireCharenc().bin,l=function(d,f){d.constructor==String?f&&f.encoding==="binary"?d=o.stringToBytes(d):d=t.stringToBytes(d):n(d)?d=Array.prototype.slice.call(d,0):!Array.isArray(d)&&d.constructor!==Uint8Array&&(d=d.toString());for(var g=e.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 M=l._ff,I=l._gg,A=l._hh,O=l._ii,E=0;E<g.length;E+=16){var q=_,z=S,Q=R,F=C;_=M(_,S,R,C,g[E+0],7,-680876936),C=M(C,_,S,R,g[E+1],12,-389564586),R=M(R,C,_,S,g[E+2],17,606105819),S=M(S,R,C,_,g[E+3],22,-1044525330),_=M(_,S,R,C,g[E+4],7,-176418897),C=M(C,_,S,R,g[E+5],12,1200080426),R=M(R,C,_,S,g[E+6],17,-1473231341),S=M(S,R,C,_,g[E+7],22,-45705983),_=M(_,S,R,C,g[E+8],7,1770035416),C=M(C,_,S,R,g[E+9],12,-1958414417),R=M(R,C,_,S,g[E+10],17,-42063),S=M(S,R,C,_,g[E+11],22,-1990404162),_=M(_,S,R,C,g[E+12],7,1804603682),C=M(C,_,S,R,g[E+13],12,-40341101),R=M(R,C,_,S,g[E+14],17,-1502002290),S=M(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),_=A(_,S,R,C,g[E+5],4,-378558),C=A(C,_,S,R,g[E+8],11,-2022574463),R=A(R,C,_,S,g[E+11],16,1839030562),S=A(S,R,C,_,g[E+14],23,-35309556),_=A(_,S,R,C,g[E+1],4,-1530992060),C=A(C,_,S,R,g[E+4],11,1272893353),R=A(R,C,_,S,g[E+7],16,-155497632),S=A(S,R,C,_,g[E+10],23,-1094730640),_=A(_,S,R,C,g[E+13],4,681279174),C=A(C,_,S,R,g[E+0],11,-358537222),R=A(R,C,_,S,g[E+3],16,-722521979),S=A(S,R,C,_,g[E+6],23,76029189),_=A(_,S,R,C,g[E+9],4,-640364487),C=A(C,_,S,R,g[E+12],11,-421815835),R=A(R,C,_,S,g[E+15],16,530742520),S=A(S,R,C,_,g[E+2],23,-995338651),_=O(_,S,R,C,g[E+0],6,-198630844),C=O(C,_,S,R,g[E+7],10,1126891415),R=O(R,C,_,S,g[E+14],15,-1416354905),S=O(S,R,C,_,g[E+5],21,-57434055),_=O(_,S,R,C,g[E+12],6,1700485571),C=O(C,_,S,R,g[E+3],10,-1894986606),R=O(R,C,_,S,g[E+10],15,-1051523),S=O(S,R,C,_,g[E+1],21,-2054922799),_=O(_,S,R,C,g[E+8],6,1873313359),C=O(C,_,S,R,g[E+15],10,-30611744),R=O(R,C,_,S,g[E+6],15,-1560198380),S=O(S,R,C,_,g[E+13],21,1309151649),_=O(_,S,R,C,g[E+4],6,-145523070),C=O(C,_,S,R,g[E+11],10,-1120210379),R=O(R,C,_,S,g[E+2],15,718787259),S=O(S,R,C,_,g[E+9],21,-343485551),_=_+q>>>0,S=S+z>>>0,R=R+Q>>>0,C=C+F>>>0}return e.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=e.wordsToBytes(l(d,f));return f&&f.asBytes?g:f&&f.asString?o.bytesToString(g):e.bytesToHex(g)}}()),md5$1.exports}var md5Exports=requireMd5();const md5=getDefaultExportFromCjs(md5Exports),constructFromSymbol=Symbol.for("constructDateFrom");function constructFrom(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&constructFromSymbol in e?e[constructFromSymbol](t):e instanceof Date?new e.constructor(t):new Date(t)}function toDate(e,t){return constructFrom(e,e)}function addDays(e,t,n){const o=toDate(e);return isNaN(t)?constructFrom(e,NaN):(o.setDate(o.getDate()+t),o)}function normalizeDates(e,...t){const n=constructFrom.bind(null,t.find(o=>typeof o=="object"));return t.map(n)}function startOfDay(e,t){const n=toDate(e);return n.setHours(0,0,0,0),n}function constructNow(e){return constructFrom(e,Date.now())}function isSameDay(e,t,n){const[o,l]=normalizeDates(n==null?void 0:n.in,e,t);return+startOfDay(o)==+startOfDay(l)}function isToday(e,t){return isSameDay(constructFrom(e,e),constructNow(e))}function subDays(e,t,n){return addDays(e,-1)}function isYesterday(e,t){return isSameDay(constructFrom(e,e),subDays(constructNow(e)))}var lib$3={},htmlToDom={},domparser={},utilities$2={},lib$2={},lib$1={},hasRequiredLib$3;function requireLib$3(){return hasRequiredLib$3||(hasRequiredLib$3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(o){o.Root="root",o.Text="text",o.Directive="directive",o.Comment="comment",o.Script="script",o.Style="style",o.Tag="tag",o.CDATA="cdata",o.Doctype="doctype"})(t=e.ElementType||(e.ElementType={}));function n(o){return o.type===t.Tag||o.type===t.Script||o.type===t.Style}e.isTag=n,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype}(lib$1)),lib$1}var node={},hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var e=node&&node.__extends||function(){var F=function(V,te){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ie,ae){ie.__proto__=ae}||function(ie,ae){for(var oe in ae)Object.prototype.hasOwnProperty.call(ae,oe)&&(ie[oe]=ae[oe])},F(V,te)};return function(V,te){if(typeof te!="function"&&te!==null)throw new TypeError("Class extends value "+String(te)+" is not a constructor or null");F(V,te);function ie(){this.constructor=V}V.prototype=te===null?Object.create(te):(ie.prototype=te.prototype,new ie)}}(),t=node&&node.__assign||function(){return t=Object.assign||function(F){for(var V,te=1,ie=arguments.length;te<ie;te++){V=arguments[te];for(var ae in V)Object.prototype.hasOwnProperty.call(V,ae)&&(F[ae]=V[ae])}return F},t.apply(this,arguments)};Object.defineProperty(node,"__esModule",{value:!0}),node.cloneNode=node.hasChildren=node.isDocument=node.isDirective=node.isComment=node.isText=node.isCDATA=node.isTag=node.Element=node.Document=node.CDATA=node.NodeWithChildren=node.ProcessingInstruction=node.Comment=node.Text=node.DataNode=node.Node=void 0;var n=requireLib$3(),o=function(){function 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(V){this.parent=V},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"previousSibling",{get:function(){return this.prev},set:function(V){this.prev=V},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"nextSibling",{get:function(){return this.next},set:function(V){this.next=V},enumerable:!1,configurable:!0}),F.prototype.cloneNode=function(V){return V===void 0&&(V=!1),z(this,V)},F}();node.Node=o;var l=function(F){e(V,F);function V(te){var ie=F.call(this)||this;return ie.data=te,ie}return Object.defineProperty(V.prototype,"nodeValue",{get:function(){return this.data},set:function(te){this.data=te},enumerable:!1,configurable:!0}),V}(o);node.DataNode=l;var d=function(F){e(V,F);function V(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Text,te}return Object.defineProperty(V.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),V}(l);node.Text=d;var f=function(F){e(V,F);function V(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Comment,te}return Object.defineProperty(V.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),V}(l);node.Comment=f;var g=function(F){e(V,F);function V(te,ie){var ae=F.call(this,ie)||this;return ae.name=te,ae.type=n.ElementType.Directive,ae}return Object.defineProperty(V.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),V}(l);node.ProcessingInstruction=g;var b=function(F){e(V,F);function V(te){var ie=F.call(this)||this;return ie.children=te,ie}return Object.defineProperty(V.prototype,"firstChild",{get:function(){var te;return(te=this.children[0])!==null&&te!==void 0?te:null},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"childNodes",{get:function(){return this.children},set:function(te){this.children=te},enumerable:!1,configurable:!0}),V}(o);node.NodeWithChildren=b;var _=function(F){e(V,F);function V(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.CDATA,te}return Object.defineProperty(V.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),V}(b);node.CDATA=_;var S=function(F){e(V,F);function V(){var te=F!==null&&F.apply(this,arguments)||this;return te.type=n.ElementType.Root,te}return Object.defineProperty(V.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),V}(b);node.Document=S;var R=function(F){e(V,F);function V(te,ie,ae,oe){ae===void 0&&(ae=[]),oe===void 0&&(oe=te==="script"?n.ElementType.Script:te==="style"?n.ElementType.Style:n.ElementType.Tag);var se=F.call(this,ae)||this;return se.name=te,se.attribs=ie,se.type=oe,se}return Object.defineProperty(V.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"tagName",{get:function(){return this.name},set:function(te){this.name=te},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"attributes",{get:function(){var te=this;return Object.keys(this.attribs).map(function(ie){var ae,oe;return{name:ie,value:te.attribs[ie],namespace:(ae=te["x-attribsNamespace"])===null||ae===void 0?void 0:ae[ie],prefix:(oe=te["x-attribsPrefix"])===null||oe===void 0?void 0:oe[ie]}})},enumerable:!1,configurable:!0}),V}(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 M(F){return F.type===n.ElementType.Text}node.isText=M;function I(F){return F.type===n.ElementType.Comment}node.isComment=I;function A(F){return F.type===n.ElementType.Directive}node.isDirective=A;function O(F){return F.type===n.ElementType.Root}node.isDocument=O;function q(F){return Object.prototype.hasOwnProperty.call(F,"children")}node.hasChildren=q;function z(F,V){V===void 0&&(V=!1);var te;if(M(F))te=new d(F.data);else if(I(F))te=new f(F.data);else if(C(F)){var ie=V?Q(F.children):[],ae=new R(F.name,t({},F.attribs),ie);ie.forEach(function(Ae){return Ae.parent=ae}),F.namespace!=null&&(ae.namespace=F.namespace),F["x-attribsNamespace"]&&(ae["x-attribsNamespace"]=t({},F["x-attribsNamespace"])),F["x-attribsPrefix"]&&(ae["x-attribsPrefix"]=t({},F["x-attribsPrefix"])),te=ae}else if(E(F)){var ie=V?Q(F.children):[],oe=new _(ie);ie.forEach(function(Ne){return Ne.parent=oe}),te=oe}else if(O(F)){var ie=V?Q(F.children):[],se=new S(ie);ie.forEach(function(Ne){return Ne.parent=se}),F["x-mode"]&&(se["x-mode"]=F["x-mode"]),te=se}else if(A(F)){var ge=new g(F.name,F.data);F["x-name"]!=null&&(ge["x-name"]=F["x-name"],ge["x-publicId"]=F["x-publicId"],ge["x-systemId"]=F["x-systemId"]),te=ge}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 V=F.map(function(ie){return z(ie,!0)}),te=1;te<V.length;te++)V[te].prev=V[te-1],V[te-1].next=V[te];return V}return node}var hasRequiredLib$2;function requireLib$2(){return hasRequiredLib$2||(hasRequiredLib$2=1,function(e){var t=lib$2&&lib$2.__createBinding||(Object.create?function(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,_)&&t(b,g,_)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var o=requireLib$3(),l=requireNode();n(requireNode(),e);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}();e.DomHandler=f,e.default=f}(lib$2)),lib$2}var constants={},hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(t,n){return t[n.toLowerCase()]=n,t},{}),e.CARRIAGE_RETURN="\r",e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,"g"),e.CARRIAGE_RETURN_PLACEHOLDER="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(),"__"),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,"g")}(constants)),constants}var hasRequiredUtilities$2;function requireUtilities$2(){if(hasRequiredUtilities$2)return utilities$2;hasRequiredUtilities$2=1,Object.defineProperty(utilities$2,"__esModule",{value:!0}),utilities$2.formatAttributes=o,utilities$2.escapeSpecialCharacters=d,utilities$2.revertEscapedCharacters=f,utilities$2.formatDOM=g;var e=requireLib$2(),t=requireConstants();function n(b){return t.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(t.CARRIAGE_RETURN_REGEX,t.CARRIAGE_RETURN_PLACEHOLDER)}function f(b){return b.replace(t.CARRIAGE_RETURN_PLACEHOLDER_REGEX,t.CARRIAGE_RETURN)}function g(b,_,S){_===void 0&&(_=null);for(var R=[],C,E=0,M=b.length;E<M;E++){var I=b[E];switch(I.nodeType){case 1:{var A=l(I.nodeName);C=new e.Element(A,o(I.attributes)),C.children=g(A==="template"?I.content.childNodes:I.childNodes,C);break}case 3:C=new e.Text(f(I.nodeValue));break;case 8:C=new e.Comment(I.nodeValue);break;default:continue}var O=R[E-1]||null;O&&(O.next=C),C.parent=_,C.prev=O,C.next=null,R.push(C)}return S&&(C=new e.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 e=requireUtilities$2(),t="html",n="head",o="body",l=/<([a-zA-Z]+[0-9]?)/,d=/<head[^]*>/i,f=/<body[^]*>/i,g=function(A,O){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},b=function(A,O){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(A,O){return O&&(A="<".concat(O,">").concat(A,"</").concat(O,">")),S.parseFromString(A,R)},g=b}if(typeof document=="object"&&document.implementation){var C=document.implementation.createHTMLDocument();g=function(A,O){if(O){var q=C.documentElement.querySelector(O);return q&&(q.innerHTML=A),C}return C.documentElement.innerHTML=A,C}}var E=typeof document=="object"&&document.createElement("template"),M;E&&E.content&&(M=function(A){return E.innerHTML=A,E.content.childNodes});function I(A){var O,q;A=(0,e.escapeSpecialCharacters)(A);var z=A.match(l),Q=z&&z[1]?z[1].toLowerCase():"";switch(Q){case t:{var F=b(A);if(!d.test(A)){var V=F.querySelector(n);(O=V==null?void 0:V.parentNode)===null||O===void 0||O.removeChild(V)}if(!f.test(A)){var V=F.querySelector(o);(q=V==null?void 0:V.parentNode)===null||q===void 0||q.removeChild(V)}return F.querySelectorAll(t)}case n:case o:{var te=g(A).querySelectorAll(Q);return f.test(A)&&d.test(A)?te[0].parentNode.childNodes:te}default:{if(M)return M(A);var V=g(A,o).querySelector(o);return V.childNodes}}}return domparser}var hasRequiredHtmlToDom;function requireHtmlToDom(){if(hasRequiredHtmlToDom)return htmlToDom;hasRequiredHtmlToDom=1;var e=htmlToDom&&htmlToDom.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(htmlToDom,"__esModule",{value:!0}),htmlToDom.default=l;var t=e(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,t.default)(d),null,g)}return htmlToDom}var attributesToProps={},lib={},possibleStandardNamesOptimized={},hasRequiredPossibleStandardNamesOptimized;function requirePossibleStandardNamesOptimized(){if(hasRequiredPossibleStandardNamesOptimized)return possibleStandardNamesOptimized;hasRequiredPossibleStandardNamesOptimized=1;var e=0;possibleStandardNamesOptimized.SAME=e;var t=1;return possibleStandardNamesOptimized.CAMELCASE=t,possibleStandardNamesOptimized.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},possibleStandardNamesOptimized}var hasRequiredLib$1;function requireLib$1(){if(hasRequiredLib$1)return lib;hasRequiredLib$1=1;const e=0,t=1,n=2,o=3,l=4,d=5,f=6;function g(F){return _.hasOwnProperty(F)?_[F]:null}function b(F,V,te,ie,ae,oe,se){this.acceptsBooleans=V===n||V===o||V===l,this.attributeName=ie,this.attributeNamespace=ae,this.mustUseProperty=te,this.propertyName=F,this.type=V,this.sanitizeURL=oe,this.removeEmptyString=se}const _={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(F=>{_[F]=new b(F,e,!1,F,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([F,V])=>{_[F]=new b(F,t,!1,V,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 V=F.replace(R,C);_[V]=new b(V,t,!1,F,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(F=>{const V=F.replace(R,C);_[V]=new b(V,t,!1,F,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(F=>{const V=F.replace(R,C);_[V]=new b(V,t,!1,F,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(F=>{_[F]=new b(F,t,!1,F.toLowerCase(),null,!1,!1)});const E="xlinkHref";_[E]=new b("xlinkHref",t,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(F=>{_[F]=new b(F,t,!1,F.toLowerCase(),null,!0,!0)});const{CAMELCASE:M,SAME:I,possibleStandardNames:A}=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(A).reduce((F,V)=>{const te=A[V];return te===I?F[V]=V:te===M?F[V.toLowerCase()]=V:F[V]=te,F},{});return lib.BOOLEAN=o,lib.BOOLEANISH_STRING=n,lib.NUMERIC=d,lib.OVERLOADED_BOOLEAN=l,lib.POSITIVE_NUMERIC=f,lib.RESERVED=e,lib.STRING=t,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 e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,g=/^\s+|\s+$/g,b=`
972
- `,_="/",S="*",R="",C="comment",E="declaration";inlineStyleParser=function(I,A){if(typeof I!="string")throw new TypeError("First argument must be a string");if(!I)return[];A=A||{};var O=1,q=1;function z(Ae){var Ne=Ae.match(t);Ne&&(O+=Ne.length);var Oe=Ae.lastIndexOf(b);q=~Oe?Ae.length-Oe:q+Ae.length}function Q(){var Ae={line:O,column:q};return function(Ne){return Ne.position=new F(Ae),ie(),Ne}}function F(Ae){this.start=Ae,this.end={line:O,column:q},this.source=A.source}F.prototype.content=I;function V(Ae){var Ne=new Error(A.source+":"+O+":"+q+": "+Ae);if(Ne.reason=Ae,Ne.filename=A.source,Ne.line=O,Ne.column=q,Ne.source=I,!A.silent)throw Ne}function te(Ae){var Ne=Ae.exec(I);if(Ne){var Oe=Ne[0];return z(Oe),I=I.slice(Oe.length),Ne}}function ie(){te(n)}function ae(Ae){var Ne;for(Ae=Ae||[];Ne=oe();)Ne!==!1&&Ae.push(Ne);return Ae}function oe(){var Ae=Q();if(!(_!=I.charAt(0)||S!=I.charAt(1))){for(var Ne=2;R!=I.charAt(Ne)&&(S!=I.charAt(Ne)||_!=I.charAt(Ne+1));)++Ne;if(Ne+=2,R===I.charAt(Ne-1))return V("End of comment missing");var Oe=I.slice(2,Ne-2);return q+=2,z(Oe),I=I.slice(Ne),q+=2,Ae({type:C,comment:Oe})}}function se(){var Ae=Q(),Ne=te(o);if(Ne){if(oe(),!te(l))return V("property missing ':'");var Oe=te(d),Le=Ae({type:E,property:M(Ne[0].replace(e,R)),value:Oe?M(Oe[0].replace(e,R)):R});return te(f),Le}}function ge(){var Ae=[];ae(Ae);for(var Ne;Ne=se();)Ne!==!1&&(Ae.push(Ne),ae(Ae));return Ae}return ie(),ge()};function M(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 e=cjs$1&&cjs$1.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(cjs$1,"__esModule",{value:!0}),cjs$1.default=n;var t=e(requireInlineStyleParser());function n(o,l){var d=null;if(!o||typeof o!="string")return d;var f=(0,t.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 e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,d=function(_){return!_||n.test(_)||e.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(t,f))};return utilities.camelCase=b,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var e=cjs&&cjs.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(requireCjs$1()),n=requireUtilities$1();function o(l,d){var f={};return!l||typeof l!="string"||(0,t.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(e){var t=utilities$1&&utilities$1.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=d,e.setStyleProp=g;var n=React,o=t(requireCjs()),l=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function 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={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var b=function(S){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(S.name)};e.canTextBeChildOfNode=b;var _=function(S){return S};e.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 e=requireLib$1(),t=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,e.isCustomAttribute)(R)){_[R]=C;continue}var E=R.toLowerCase(),M=f(E);if(M){var I=(0,e.getPropertyInfo)(M);switch(n.includes(M)&&o.includes(b)&&!S&&(M=f("default"+E)),_[M]=C,I&&I.type){case e.BOOLEAN:_[M]=!0;break;case e.OVERLOADED_BOOLEAN:C===""&&(_[M]=!0);break}continue}t.PRESERVE_CUSTOM_ATTRIBUTES&&(_[R]=C)}return(0,t.setStyleProp)(g.style,_),_}function f(g){return e.possibleStandardNames[g]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var e=domToReact&&domToReact.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=d;var t=React,n=e(requireAttributesToProps()),o=requireUtilities(),l={cloneElement:t.cloneElement,createElement:t.createElement,isValidElement:t.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,M=C.createElement,I=C.isValidElement,A=g.length,O=0;O<A;O++){var q=g[O];if(S){var z=b.replace(q,O);if(I(z)){A>1&&(z=E(z,{key:z.key||O})),_.push(R(z,q,O));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,O));continue}var F=q,V={};f(F)?((0,o.setStyleProp)(F.attribs.style,F.attribs),V=F.attribs):F.attribs&&(V=(0,n.default)(F.attribs,F.name));var te=void 0;switch(q.type){case"script":case"style":q.children[0]&&(V.dangerouslySetInnerHTML={__html:q.children[0].data});break;case"tag":q.name==="textarea"&&q.children[0]?V.defaultValue=q.children[0].data:q.children&&q.children.length&&(te=d(q.children,b));break;default:continue}A>1&&(V.key=O),_.push(R(M(q.name,V,te),q,O))}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(e){var t=lib$3&&lib$3.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=g;var n=t(requireHtmlToDom());e.htmlToDOM=n.default;var o=t(requireAttributesToProps());e.attributesToProps=o.default;var l=t(requireDomToReact());e.domToReact=l.default;var d=requireLib$2();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(e,"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(libExports),parser=HTMLReactParser.default||HTMLReactParser;function SkeletonMessage({botStatus:e}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:e})]})})]})]})}function ChatMessages({messages:e,currentUserId:t,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[e.map(l=>{const d=l.fromPartnerID===t;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):l.content})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),e.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),e.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=e,[C,E]=React__namespace.useState(null),M=useComposedRefs(t,z=>E(z)),I=React__namespace.useRef(!1),A=C?S||!!C.closest("form"):!0,[O,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:O,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":O,"aria-required":f,"data-state":getState$2(O),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:M,onClick:composeEventHandlers(e.onClick,z=>{q(Q=>!Q),A&&(I.current=z.isPropagationStopped(),I.current||z.stopPropagation())})}),A&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:O,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(t);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const M=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(M)}},[b,n,o]),jsxRuntime.jsx("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(e){return e?"checked":"unchecked"}var Root=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root,{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",e),...t,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.displayName;const DebugMessageDisplay=({debugMessages:e})=>{const[t,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:e.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=t[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:e,userName:t,apiKey:n,inputRef:o},l)=>{const{data:d}=useGetV4PartnerByApplicationIdBusinessDevelopmentConversationsQuery({applicationId:e}),[f]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[g]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[b,{isLoading:_}]=usePostV4PartnerByApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[S,R]=React.useState(!1),[C]=useLazyGetV4PartnerByApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:E,botMessages:M,clearBotMessages:I,botReady:A,debugMessages:O,botStatus:q,reset:z}=useAIAssistant({userId:e,apiKey:n,smartAndSlow:S});React.useEffect(()=>{if(!d)return;const Qe={partner1:e,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},tt=d.map(rt=>{var ct;return{partner1:rt.Participant1,partner2:rt.Participant2,name:((ct=rt.Participant)==null?void 0:ct.PublicName)??"missing public name",unread:0,pending:rt.Status!="Approved",historyFetched:!1,messages:[],conversationID:rt.ConversationId}});setTimeout(()=>{var rt;return(rt=Ke.current)==null?void 0:rt.focus()},50),Ae([Qe,...tt])},[d]);const[Q,F]=React.useState("approved"),[V,te]=React.useState([e,ASSISTANT_ID]),[ie,ae]=React.useState(""),[oe,se]=React.useState(null),[ge,Ae]=React.useState([]),[Ne,Oe]=React.useState(""),[Le,ze]=React.useState(null),[$e,Be]=React.useState([]),[,Fe]=React.useState(0),We=React.useRef(null),He=React.useRef(null),[Ye,Ze]=React.useState(null),[Xe,ot]=React.useState([]),Ke=o||He,nt=React.useRef(null),{toast:et}=useToast(),it=ge.filter(Qe=>{const tt=Qe.name.toLowerCase().includes(Ne.toLowerCase());return Q==="approved"?tt&&!Qe.pending:Q==="pending"?tt&&Qe.pending:tt});React.useEffect(()=>{var Qe;Ye!==null&&(et({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(Qe=Ke.current)==null||Qe.focus())},[Ye]),React.useEffect(()=>{M.length!==0&&(M.forEach(Qe=>{if(!Qe||Qe.role!="assistant")return;if(Qe.isComponent){Be(rt=>[...rt,Qe.content]),Fe(0);return}const tt={id:Qe.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:e,senderName:"Assistant",timestamp:Qe.timestamp.getTime(),content:Qe.content};tt.content=marked(tt.content??"Please ask again.",{async:!1}),lt(tt)}),I())},[M]);function lt(Qe){const tt=[Qe.fromPartnerID,Qe.toPartnerID];tt.sort(),Ae(rt=>{let ct=!1;const dt=rt.map(Dt=>Dt.partner1!==tt[0]||Dt.partner2!==tt[1]||Dt.messages.findIndex(Xt=>Xt.id==Qe.id)!==-1?Dt:(ct=!0,{...Dt,unread:Dt.unread+1,messages:[...Dt.messages,Qe]}));return ct&&se([tt[0],tt[1]]),dt})}React.useEffect(()=>{const Qe=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":e}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return Qe.on("ReceiveMessage",lt),Qe.start().catch(tt=>console.error("Error connecting to SignalR hub:",tt)),ze(Qe),()=>{Qe&&Qe.stop()}},[e]),React.useEffect(()=>{(oe==null?void 0:oe[0])!==(V==null?void 0:V[0])||(oe==null?void 0:oe[1])!==(V==null?void 0:V[1])||(Ae(Qe=>Qe.map(tt=>tt.partner1===(V==null?void 0:V[0])&&tt.partner2===(V==null?void 0:V[1])?{...tt,unread:0}:tt)),setTimeout(()=>{var Qe;return(Qe=We.current)==null?void 0:Qe.scrollIntoView({behavior:"smooth"})},50))},[oe,V]),React.useEffect(()=>{if(!V)return;const Qe=getActiveChatObject(ge,V);if(Qe){if(Qe.historyFetched){Qe.unread>0&&Ae(tt=>tt.map(rt=>rt.partner1===V[0]&&rt.partner2===V[1]?{...rt,unread:0}:rt)),setTimeout(()=>{var tt;return(tt=We.current)==null?void 0:tt.scrollIntoView({behavior:"smooth"})},50);return}C({applicationId:e,conversationId:Qe.conversationID}).unwrap().then(tt=>{const rt=tt.map(ct=>({id:"history"+ct.MessageId,fromPartnerID:ct.SenderId,toPartnerID:ct.SenderId==V[0]?V[1]:V[0],senderName:ct.SenderName??"missing name",timestamp:new Date(ct.SentDate+"Z").getTime(),content:ct.Content??"no content"}));Ae(ct=>ct.map(dt=>dt.partner1===V[0]&&dt.partner2===V[1]?{...dt,messages:rt,historyFetched:!0}:dt))}).catch(tt=>{console.error("Error fetching conversation messages:",tt)})}},[ge,V,C,e]),React.useEffect(()=>{var tt;if(Fe($e.length),!V)return;const Qe=getActiveChatObject(ge,V);Qe&&((tt=Ke.current)==null||tt.focus(),f({applicationId:Qe.partner1===e?Qe.partner2:Qe.partner1}).then(rt=>{rt.data&&(Be(ct=>[...ct,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:rt.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),Fe(0))}))},[V,e]);const qe=(Qe,tt,rt)=>{const ct={id:crypto.randomUUID(),senderName:t,fromPartnerID:e,toPartnerID:tt[0]===e?tt[1]:tt[0],content:Qe+(Ye?` (${Ye==null?void 0:Ye.name} attached)`:""),timestamp:Date.now()};Ae(dt=>dt.map(Dt=>Dt.partner1===tt[0]&&Dt.partner2===tt[1]?{...Dt,messages:[...Dt.messages,ct]}:Dt)),se([tt[0],tt[1]]),ct.toPartnerID==ASSISTANT_ID?(E(ct.content,Ye??void 0),Ye&&ot(dt=>[...dt,Ye.name])):rt.invoke("NewMessage",ct).catch(dt=>console.error("Error sending message:",dt)),ae(""),Ze(null),nt.current&&(nt.current.value="")},ft=(Qe,tt)=>{if(!ge.length||!Le||!A)return!1;const rt=ge.find(ct=>ct.conversationID===Qe);return rt?(rt.pending&&setTimeout(()=>F("pending"),300),te([rt.partner1,rt.partner2]),tt&&setTimeout(()=>qe(tt,[rt.partner1,rt.partner2],Le),300),!0):!1};if(React.useImperativeHandle(l,()=>({setActiveChatAndSendMessage:ft})),!A)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 Je=Qe=>{var rt;if(!isAssistantChat(V))return;const tt=(rt=Qe.clipboardData)==null?void 0:rt.items;if(tt){for(let ct=0;ct<tt.length;ct++)if(tt[ct].type.indexOf("image")!==-1){const dt=tt[ct].getAsFile();if(dt){Ze(dt);return}}}},pt=()=>{!ie.trim()||!V||!Le||(Fe($e.length),qe(ie,V,Le))},Ct=Qe=>{Qe.target.files&&Qe.target.files[0]?Ze(Qe.target.files[0]):Ze(null)},Mt=()=>{var Qe;(Qe=nt.current)==null||Qe.click()},Vt=()=>{var Qe;Ze(null),et({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(Qe=Ke.current)==null||Qe.focus()},It=()=>{const tt={messages:ge.find(rt=>rt.partner1===ASSISTANT_ID||rt.partner2===ASSISTANT_ID),debug:O};g({applicationId:e,emailAddress:t,body:tt})},Ft=()=>{Ae(Qe=>Qe.map(rt=>rt.partner1!==ASSISTANT_ID&&rt.partner2!==ASSISTANT_ID?rt:{...rt,messages:[]})),ot([]),z()},Wt=()=>{V&&b({applicationId:e,partnerId:V[0]==e?V[1]:V[0]}).then(()=>{F("approved")})},Ue=getActiveChatObject(ge,V),at=ge.filter(Qe=>Qe.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"}),ge.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:Ne,onChange:Qe=>Oe(Qe.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:Q,onValueChange:F,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 ",at>0&&`(${at})`]})]})})]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:ge.length&&jsxRuntime.jsx(ChatList,{userId:e,chats:it.filter(Qe=>Qe.partner1!=ASSISTANT_ID&&Qe.partner2!=ASSISTANT_ID),activeChat:Ue??null,onSelectChat:te,assistantChat:ge.find(Qe=>Qe.partner1==ASSISTANT_ID||Qe.partner2==ASSISTANT_ID)})})]}),jsxRuntime.jsx("div",{className:"flex-3 flex flex-col",children:V?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:V[0]==ASSISTANT_ID||V[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:!!q,checked:S,onCheckedChange:Qe=>{Ft(),setTimeout(()=>R(Qe),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>Ft(),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:()=>It()},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/${V[0]===e?V[1]:V[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:Ue==null?void 0:Ue.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${e}/Partner/${V[0]===e?V[1]:V[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),Ue!=null&&Ue.pending&&Ue.partner1==e?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:(Ue==null?void 0:Ue.messages)??[],currentUserId:e,isAssistantChat:isAssistantChat(V),botStatus:isAssistantChat(V)?q:""}),jsxRuntime.jsx("div",{ref:We})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t flex",children:[(Ue==null?void 0:Ue.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:_,onClick:()=>Wt(),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:Ke,placeholder:"Type a message...",value:ie,onPaste:Je,onChange:Qe=>ae(Qe.target.value),onKeyDown:Qe=>{Qe.key!=="Enter"||Qe.shiftKey||(Qe.preventDefault(),pt())},className:Ue!=null&&Ue.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:Ue!=null&&Ue.pending?"collapse":"ml-2 h-8 w-8",disabled:!!q||(Ue==null?void 0:Ue.pending),onClick:pt,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),isAssistantChat(V)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:Ct,className:"hidden",ref:nt}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:Mt,className:Ue!=null&&Ue.pending?"collapse":"ml-2 h-8 w-8",disabled:q!==""||(Ue==null?void 0:Ue.pending)||!!Ye,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:Vt,className:Ue!=null&&Ue.pending?"collapse":"ml-2 h-8 w-8",disabled:q!==""||(Ue==null?void 0:Ue.pending)||!Ye,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.jsxs("div",{className:"w-[480px] flex flex-2 flex-col border-l",children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"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:[Ye?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",Ye.name," (pending send...)"]})}):Xe.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),Xe.slice().reverse().map(Qe=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",Qe]})}))]})}),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:O})})})]})]})});function getActiveChatObject(e,t){return e.find(n=>n.partner1==(t==null?void 0:t[0])&&n.partner2==(t==null?void 0:t[1]))}function isAssistantChat(e){return(e==null?void 0:e[0])==ASSISTANT_ID||(e==null?void 0:e[1])==ASSISTANT_ID}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:e,variant:t,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:t}),e),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",e),...t}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",e),...t}));AlertDescription.displayName="AlertDescription";function QualificationBadge({qualification:e}){return!e.QualificationId||e.QualificationId==="Suspended"?null:e.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$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:e.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),e.QualificationId,e.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:e.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function ManufacturerCard({manufacturer:e,link:t,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var M,I,A;if(d||!e)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=e.ManufacturerId||"N/A",g=e.PublicName||"N/A",b=[e.City,e.Province,e.Country].filter(Boolean),_=b.length>0?b.join(", "):"",S=((M=e.Tags)==null?void 0:M.split(",").map(O=>O.trim()).filter(Boolean))||[],R=O=>O===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(O),E=(O=>!O||O.length===0?[]:[...O].sort((q,z)=>(q.Day||0)-(z.Day||0)).map(q=>({date:q.Day||0,amount:q.ExtendedPrice||0})))(e.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:t??"#",target:t&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${f}/Account/Logo?width=64&height=64`,alt:`${g}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"}),e.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:e.Name}),_&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:_})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:E.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:E,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:[(!!((I=e.Qualification)!=null&&I.QualificationId)&&((A=e.Qualification)==null?void 0:A.QualificationId)!=="Suspended"||!!e.OpenToWork||S.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:e.Qualification??{}}),!!e.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!e.OnHold&&e.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),S.map((O,q)=>jsxRuntime.jsx(Badge,{variant:"outline",children:O},q))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[e.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${e.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Phone})]}),e.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${e.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.PublicEmail})]}),e.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:e.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Website})]}),e.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.CurrencyCode})]})]})]}),e.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:R(e.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:R(e.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:R(e.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:e,link:t,actions:n,loading:o=!1}){var _,S;const l=R=>R===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(R);if(o||!e)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 d=e.ResellerId||"N/A",f=e.PublicName||"N/A",g=[e.City,e.Province,e.Country].filter(Boolean),b=g.length>0?g.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("img",{src:`https://api.randmar.io/V4/Partner/${d}/Account/Logo?width=64&height=64`,alt:`${f}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:d})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"}),e.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:e.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),!!e.OnHold&&e.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:[!!((_=e.Qualification)!=null&&_.QualificationId)&&((S=e.Qualification)==null?void 0:S.QualificationId)!=="Suspended"&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jsxRuntime.jsx(QualificationBadge,{qualification:e.Qualification??{}})}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[e.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${e.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Phone})]}),e.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${e.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.PublicEmail})]}),e.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:e.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Website})]}),e.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.CurrencyCode})]})]})]}),(e==null?void 0:e.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesLast30Days)})]})]})}),(n||t)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 mt-auto ${n?"justify-between":"justify-end"}`,children:[n&&n,t&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:t,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}const Table=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",e),...t})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",e),...t}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",e),...t}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:e,...t},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]",e),...t}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",e),...t}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:e,handleValidSearch:t,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}t(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,{}),e&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:e,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:e,loading:t=!1}){const n=d=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(d),o=React.useMemo(()=>{if(!e||e.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const d=e.filter(O=>O.DocumentType==="Order"),f=e.filter(O=>O.DocumentType==="Shipment"),g=d.filter(O=>O.WarehouseCode!=="3PLE"),b=g.reduce((O,q)=>O+(q.Quantity||0),0),_=g.reduce((O,q)=>O+(q.ExtendedPrice||0),0),S=d.filter(O=>O.WarehouseCode==="3PLE"),R=S.reduce((O,q)=>O+(q.Quantity||0),0),C=S.reduce((O,q)=>O+(q.ExtendedPrice||0),0),E=f.length,M=f.reduce((O,q)=>O+(q.ExtendedPrice||0),0),I=b+R+E,A=_+C+M;return{all:{orders:I,amount:A},processing:{orders:b,amount:_},shipped:{orders:E,amount:M},delayed:{orders:R,amount:C}}},[e]),l=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:o.all.orders,amount:o.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:o.processing.orders,amount:o.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:o.shipped.orders,amount:o.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:o.delayed.orders,amount:o.delayed.amount}];return t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(d=>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"})]})]})]})]},d))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:l.map(d=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${d.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:d.name}),jsxRuntime.jsx("div",{className:`${d.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(d.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:d.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:n(d.amount)})]})]})]})]},d.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(e,t,n)=>{n=e!=null?__create(__getProtoOf(e)):{};const o=t||!e||!e.__esModule?__defProp(n,"default",{value:e,enumerable:!0}):n;for(let l of __getOwnPropNames(e))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>e[l],enumerable:!0});return o},__commonJS=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),require_xhtml=__commonJS((e,t)=>{t.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((e,t)=>{(function(n,o){typeof e=="object"&&typeof t<"u"?o(e):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(e,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],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(j,ne){for(var je=65536,Ve=0;Ve<ne.length;Ve+=2){if(je+=ne[Ve],je>j)return!1;if(je+=ne[Ve+1],je>=j)return!0}return!1}function M(j,ne){return j<65?j===36:j<91?!0:j<97?j===95:j<123?!0:j<=65535?j>=170&&R.test(String.fromCharCode(j)):ne===!1?!1:E(j,l)}function I(j,ne){return j<48?j===36:j<58?!0:j<65?!1:j<91?!0:j<97?j===95:j<123?!0:j<=65535?j>=170&&C.test(String.fromCharCode(j)):ne===!1?!1:E(j,l)||E(j,o)}var A=function(ne,je){je===void 0&&(je={}),this.label=ne,this.keyword=je.keyword,this.beforeExpr=!!je.beforeExpr,this.startsExpr=!!je.startsExpr,this.isLoop=!!je.isLoop,this.isAssign=!!je.isAssign,this.prefix=!!je.prefix,this.postfix=!!je.postfix,this.binop=je.binop||null,this.updateContext=null};function O(j,ne){return new A(j,{beforeExpr:!0,binop:ne})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(j,ne){return ne===void 0&&(ne={}),ne.keyword=j,Q[j]=new A(j,ne)}var V={num:new A("num",z),regexp:new A("regexp",z),string:new A("string",z),name:new A("name",z),privateId:new A("privateId",z),eof:new A("eof"),bracketL:new A("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new A("]"),braceL:new A("{",{beforeExpr:!0,startsExpr:!0}),braceR:new A("}"),parenL:new A("(",{beforeExpr:!0,startsExpr:!0}),parenR:new A(")"),comma:new A(",",q),semi:new A(";",q),colon:new A(":",q),dot:new A("."),question:new A("?",q),questionDot:new A("?."),arrow:new A("=>",q),template:new A("template"),invalidTemplate:new A("invalidTemplate"),ellipsis:new A("...",q),backQuote:new A("`",z),dollarBraceL:new A("${",{beforeExpr:!0,startsExpr:!0}),eq:new A("=",{beforeExpr:!0,isAssign:!0}),assign:new A("_=",{beforeExpr:!0,isAssign:!0}),incDec:new A("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new A("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:O("||",1),logicalAND:O("&&",2),bitwiseOR:O("|",3),bitwiseXOR:O("^",4),bitwiseAND:O("&",5),equality:O("==/!=/===/!==",6),relational:O("</>/<=/>=",7),bitShift:O("<</>>/>>>",8),plusMin:new A("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:O("%",10),star:O("*",10),slash:O("/",10),starstar:new A("**",{beforeExpr:!0}),coalesce:O("??",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/,ie=new RegExp(te.source,"g");function ae(j){return j===10||j===13||j===8232||j===8233}function oe(j,ne,je){je===void 0&&(je=j.length);for(var Ve=ne;Ve<je;Ve++){var Ge=j.charCodeAt(Ve);if(ae(Ge))return Ve<je-1&&Ge===13&&j.charCodeAt(Ve+1)===10?Ve+2:Ve+1}return-1}var se=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ge=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ae=Object.prototype,Ne=Ae.hasOwnProperty,Oe=Ae.toString,Le=Object.hasOwn||function(j,ne){return Ne.call(j,ne)},ze=Array.isArray||function(j){return Oe.call(j)==="[object Array]"},$e=Object.create(null);function Be(j){return $e[j]||($e[j]=new RegExp("^(?:"+j.replace(/ /g,"|")+")$"))}function Fe(j){return j<=65535?String.fromCharCode(j):(j-=65536,String.fromCharCode((j>>10)+55296,(j&1023)+56320))}var We=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(ne,je){this.line=ne,this.column=je};He.prototype.offset=function(ne){return new He(this.line,this.column+ne)};var Ye=function(ne,je,Ve){this.start=je,this.end=Ve,ne.sourceFile!==null&&(this.source=ne.sourceFile)};function Ze(j,ne){for(var je=1,Ve=0;;){var Ge=oe(j,Ve,ne);if(Ge<0)return new He(je,ne-Ve);++je,Ve=Ge}}var Xe={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},ot=!1;function Ke(j){var ne={};for(var je in Xe)ne[je]=j&&Le(j,je)?j[je]:Xe[je];if(ne.ecmaVersion==="latest"?ne.ecmaVersion=1e8:ne.ecmaVersion==null?(!ot&&typeof console=="object"&&console.warn&&(ot=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
972
+ `,_="/",S="*",R="",C="comment",E="declaration";inlineStyleParser=function(I,A){if(typeof I!="string")throw new TypeError("First argument must be a string");if(!I)return[];A=A||{};var O=1,q=1;function z(Ae){var Ne=Ae.match(t);Ne&&(O+=Ne.length);var Oe=Ae.lastIndexOf(b);q=~Oe?Ae.length-Oe:q+Ae.length}function Q(){var Ae={line:O,column:q};return function(Ne){return Ne.position=new F(Ae),ie(),Ne}}function F(Ae){this.start=Ae,this.end={line:O,column:q},this.source=A.source}F.prototype.content=I;function V(Ae){var Ne=new Error(A.source+":"+O+":"+q+": "+Ae);if(Ne.reason=Ae,Ne.filename=A.source,Ne.line=O,Ne.column=q,Ne.source=I,!A.silent)throw Ne}function te(Ae){var Ne=Ae.exec(I);if(Ne){var Oe=Ne[0];return z(Oe),I=I.slice(Oe.length),Ne}}function ie(){te(n)}function ae(Ae){var Ne;for(Ae=Ae||[];Ne=oe();)Ne!==!1&&Ae.push(Ne);return Ae}function oe(){var Ae=Q();if(!(_!=I.charAt(0)||S!=I.charAt(1))){for(var Ne=2;R!=I.charAt(Ne)&&(S!=I.charAt(Ne)||_!=I.charAt(Ne+1));)++Ne;if(Ne+=2,R===I.charAt(Ne-1))return V("End of comment missing");var Oe=I.slice(2,Ne-2);return q+=2,z(Oe),I=I.slice(Ne),q+=2,Ae({type:C,comment:Oe})}}function se(){var Ae=Q(),Ne=te(o);if(Ne){if(oe(),!te(l))return V("property missing ':'");var Oe=te(d),Le=Ae({type:E,property:M(Ne[0].replace(e,R)),value:Oe?M(Oe[0].replace(e,R)):R});return te(f),Le}}function ge(){var Ae=[];ae(Ae);for(var Ne;Ne=se();)Ne!==!1&&(Ae.push(Ne),ae(Ae));return Ae}return ie(),ge()};function M(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 e=cjs$1&&cjs$1.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(cjs$1,"__esModule",{value:!0}),cjs$1.default=n;var t=e(requireInlineStyleParser());function n(o,l){var d=null;if(!o||typeof o!="string")return d;var f=(0,t.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 e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,d=function(_){return!_||n.test(_)||e.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(t,f))};return utilities.camelCase=b,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var e=cjs&&cjs.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(requireCjs$1()),n=requireUtilities$1();function o(l,d){var f={};return!l||typeof l!="string"||(0,t.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(e){var t=utilities$1&&utilities$1.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=d,e.setStyleProp=g;var n=React,o=t(requireCjs()),l=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function 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={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var b=function(S){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(S.name)};e.canTextBeChildOfNode=b;var _=function(S){return S};e.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 e=requireLib$1(),t=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,e.isCustomAttribute)(R)){_[R]=C;continue}var E=R.toLowerCase(),M=f(E);if(M){var I=(0,e.getPropertyInfo)(M);switch(n.includes(M)&&o.includes(b)&&!S&&(M=f("default"+E)),_[M]=C,I&&I.type){case e.BOOLEAN:_[M]=!0;break;case e.OVERLOADED_BOOLEAN:C===""&&(_[M]=!0);break}continue}t.PRESERVE_CUSTOM_ATTRIBUTES&&(_[R]=C)}return(0,t.setStyleProp)(g.style,_),_}function f(g){return e.possibleStandardNames[g]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var e=domToReact&&domToReact.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=d;var t=React,n=e(requireAttributesToProps()),o=requireUtilities(),l={cloneElement:t.cloneElement,createElement:t.createElement,isValidElement:t.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,M=C.createElement,I=C.isValidElement,A=g.length,O=0;O<A;O++){var q=g[O];if(S){var z=b.replace(q,O);if(I(z)){A>1&&(z=E(z,{key:z.key||O})),_.push(R(z,q,O));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,O));continue}var F=q,V={};f(F)?((0,o.setStyleProp)(F.attribs.style,F.attribs),V=F.attribs):F.attribs&&(V=(0,n.default)(F.attribs,F.name));var te=void 0;switch(q.type){case"script":case"style":q.children[0]&&(V.dangerouslySetInnerHTML={__html:q.children[0].data});break;case"tag":q.name==="textarea"&&q.children[0]?V.defaultValue=q.children[0].data:q.children&&q.children.length&&(te=d(q.children,b));break;default:continue}A>1&&(V.key=O),_.push(R(M(q.name,V,te),q,O))}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(e){var t=lib$3&&lib$3.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=g;var n=t(requireHtmlToDom());e.htmlToDOM=n.default;var o=t(requireAttributesToProps());e.attributesToProps=o.default;var l=t(requireDomToReact());e.domToReact=l.default;var d=requireLib$2();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(e,"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(libExports),parser=HTMLReactParser.default||HTMLReactParser;function SkeletonMessage({botStatus:e}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:e})]})})]})]})}const toHTML=e=>e.split(`
973
+ `).map(t=>jsxRuntime.jsx("p",{children:t}));function ChatMessages({messages:e,currentUserId:t,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[e.map(l=>{const d=l.fromPartnerID===t;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}),e.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),e.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=e,[C,E]=React__namespace.useState(null),M=useComposedRefs(t,z=>E(z)),I=React__namespace.useRef(!1),A=C?S||!!C.closest("form"):!0,[O,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:O,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":O,"aria-required":f,"data-state":getState$2(O),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:M,onClick:composeEventHandlers(e.onClick,z=>{q(Q=>!Q),A&&(I.current=z.isPropagationStopped(),I.current||z.stopPropagation())})}),A&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:O,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(t);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const M=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(M)}},[b,n,o]),jsxRuntime.jsx("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(e){return e?"checked":"unchecked"}var Root=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Root,{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",e),...t,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.displayName;const DebugMessageDisplay=({debugMessages:e})=>{const[t,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:e.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=t[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:e,userName:t,apiKey:n,inputRef:o},l)=>{const{data:d}=useGetV4PartnerByApplicationIdBusinessDevelopmentConversationsQuery({applicationId:e}),[f]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[g]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[b,{isLoading:_}]=usePostV4PartnerByApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[S,R]=React.useState(!1),[C]=useLazyGetV4PartnerByApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:E,botMessages:M,clearBotMessages:I,botReady:A,debugMessages:O,botStatus:q,reset:z}=useAIAssistant({userId:e,apiKey:n,smartAndSlow:S});React.useEffect(()=>{if(!d)return;const Qe={partner1:e,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},tt=d.map(rt=>{var ct;return{partner1:rt.Participant1,partner2:rt.Participant2,name:((ct=rt.Participant)==null?void 0:ct.PublicName)??"missing public name",unread:0,pending:rt.Status!="Approved",historyFetched:!1,messages:[],conversationID:rt.ConversationId}});setTimeout(()=>{var rt;return(rt=Ke.current)==null?void 0:rt.focus()},50),Ae([Qe,...tt])},[d]);const[Q,F]=React.useState("approved"),[V,te]=React.useState([e,ASSISTANT_ID]),[ie,ae]=React.useState(""),[oe,se]=React.useState(null),[ge,Ae]=React.useState([]),[Ne,Oe]=React.useState(""),[Le,ze]=React.useState(null),[$e,Be]=React.useState([]),[,Fe]=React.useState(0),We=React.useRef(null),He=React.useRef(null),[Ye,Ze]=React.useState(null),[Xe,ot]=React.useState([]),Ke=o||He,nt=React.useRef(null),{toast:et}=useToast(),it=ge.filter(Qe=>{const tt=Qe.name.toLowerCase().includes(Ne.toLowerCase());return Q==="approved"?tt&&!Qe.pending:Q==="pending"?tt&&Qe.pending:tt});React.useEffect(()=>{var Qe;Ye!==null&&(et({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(Qe=Ke.current)==null||Qe.focus())},[Ye]),React.useEffect(()=>{M.length!==0&&(M.forEach(Qe=>{if(!Qe||Qe.role!="assistant")return;if(Qe.isComponent){Be(rt=>[...rt,Qe.content]),Fe(0);return}const tt={id:Qe.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:e,senderName:"Assistant",timestamp:Qe.timestamp.getTime(),content:Qe.content};tt.content=marked(tt.content??"Please ask again.",{async:!1}),lt(tt)}),I())},[M]);function lt(Qe){const tt=[Qe.fromPartnerID,Qe.toPartnerID];tt.sort(),Ae(rt=>{let ct=!1;const dt=rt.map(Dt=>Dt.partner1!==tt[0]||Dt.partner2!==tt[1]||Dt.messages.findIndex(Xt=>Xt.id==Qe.id)!==-1?Dt:(ct=!0,{...Dt,unread:Dt.unread+1,messages:[...Dt.messages,Qe]}));return ct&&se([tt[0],tt[1]]),dt})}React.useEffect(()=>{const Qe=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":e}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return Qe.on("ReceiveMessage",lt),Qe.start().catch(tt=>console.error("Error connecting to SignalR hub:",tt)),ze(Qe),()=>{Qe&&Qe.stop()}},[e]),React.useEffect(()=>{(oe==null?void 0:oe[0])!==(V==null?void 0:V[0])||(oe==null?void 0:oe[1])!==(V==null?void 0:V[1])||(Ae(Qe=>Qe.map(tt=>tt.partner1===(V==null?void 0:V[0])&&tt.partner2===(V==null?void 0:V[1])?{...tt,unread:0}:tt)),setTimeout(()=>{var Qe;return(Qe=We.current)==null?void 0:Qe.scrollIntoView({behavior:"smooth"})},50))},[oe,V]),React.useEffect(()=>{if(!V)return;const Qe=getActiveChatObject(ge,V);if(Qe){if(Qe.historyFetched){Qe.unread>0&&Ae(tt=>tt.map(rt=>rt.partner1===V[0]&&rt.partner2===V[1]?{...rt,unread:0}:rt)),setTimeout(()=>{var tt;return(tt=We.current)==null?void 0:tt.scrollIntoView({behavior:"smooth"})},50);return}C({applicationId:e,conversationId:Qe.conversationID}).unwrap().then(tt=>{const rt=tt.map(ct=>({id:"history"+ct.MessageId,fromPartnerID:ct.SenderId,toPartnerID:ct.SenderId==V[0]?V[1]:V[0],senderName:ct.SenderName??"missing name",timestamp:new Date(ct.SentDate+"Z").getTime(),content:ct.Content??"no content"}));Ae(ct=>ct.map(dt=>dt.partner1===V[0]&&dt.partner2===V[1]?{...dt,messages:rt,historyFetched:!0}:dt))}).catch(tt=>{console.error("Error fetching conversation messages:",tt)})}},[ge,V,C,e]),React.useEffect(()=>{var tt;if(Fe($e.length),!V)return;const Qe=getActiveChatObject(ge,V);Qe&&((tt=Ke.current)==null||tt.focus(),f({applicationId:Qe.partner1===e?Qe.partner2:Qe.partner1}).then(rt=>{rt.data&&(Be(ct=>[...ct,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:rt.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),Fe(0))}))},[V,e]);const qe=(Qe,tt,rt)=>{const ct={id:crypto.randomUUID(),senderName:t,fromPartnerID:e,toPartnerID:tt[0]===e?tt[1]:tt[0],content:Qe+(Ye?` (${Ye==null?void 0:Ye.name} attached)`:""),timestamp:Date.now()};Ae(dt=>dt.map(Dt=>Dt.partner1===tt[0]&&Dt.partner2===tt[1]?{...Dt,messages:[...Dt.messages,ct]}:Dt)),se([tt[0],tt[1]]),ct.toPartnerID==ASSISTANT_ID?(E(ct.content,Ye??void 0),Ye&&ot(dt=>[...dt,Ye.name])):rt.invoke("NewMessage",ct).catch(dt=>console.error("Error sending message:",dt)),ae(""),Ze(null),nt.current&&(nt.current.value="")},ft=(Qe,tt)=>{if(!ge.length||!Le||!A)return!1;const rt=ge.find(ct=>ct.conversationID===Qe);return rt?(rt.pending&&setTimeout(()=>F("pending"),300),te([rt.partner1,rt.partner2]),tt&&setTimeout(()=>qe(tt,[rt.partner1,rt.partner2],Le),300),!0):!1};if(React.useImperativeHandle(l,()=>({setActiveChatAndSendMessage:ft})),!A)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 Je=Qe=>{var rt;if(!isAssistantChat(V))return;const tt=(rt=Qe.clipboardData)==null?void 0:rt.items;if(tt){for(let ct=0;ct<tt.length;ct++)if(tt[ct].type.indexOf("image")!==-1){const dt=tt[ct].getAsFile();if(dt){Ze(dt);return}}}},pt=()=>{!ie.trim()||!V||!Le||(Fe($e.length),qe(ie,V,Le))},Ct=Qe=>{Qe.target.files&&Qe.target.files[0]?Ze(Qe.target.files[0]):Ze(null)},Mt=()=>{var Qe;(Qe=nt.current)==null||Qe.click()},Vt=()=>{var Qe;Ze(null),et({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(Qe=Ke.current)==null||Qe.focus()},It=()=>{const tt={messages:ge.find(rt=>rt.partner1===ASSISTANT_ID||rt.partner2===ASSISTANT_ID),debug:O};g({applicationId:e,emailAddress:t,body:tt})},Ft=()=>{Ae(Qe=>Qe.map(rt=>rt.partner1!==ASSISTANT_ID&&rt.partner2!==ASSISTANT_ID?rt:{...rt,messages:[]})),ot([]),z()},Wt=()=>{V&&b({applicationId:e,partnerId:V[0]==e?V[1]:V[0]}).then(()=>{F("approved")})},Ue=getActiveChatObject(ge,V),at=ge.filter(Qe=>Qe.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"}),ge.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:Ne,onChange:Qe=>Oe(Qe.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:Q,onValueChange:F,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 ",at>0&&`(${at})`]})]})})]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:ge.length&&jsxRuntime.jsx(ChatList,{userId:e,chats:it.filter(Qe=>Qe.partner1!=ASSISTANT_ID&&Qe.partner2!=ASSISTANT_ID),activeChat:Ue??null,onSelectChat:te,assistantChat:ge.find(Qe=>Qe.partner1==ASSISTANT_ID||Qe.partner2==ASSISTANT_ID)})})]}),jsxRuntime.jsx("div",{className:"flex-3 flex flex-col",children:V?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:V[0]==ASSISTANT_ID||V[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:!!q,checked:S,onCheckedChange:Qe=>{Ft(),setTimeout(()=>R(Qe),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>Ft(),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:()=>It()},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/${V[0]===e?V[1]:V[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:Ue==null?void 0:Ue.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${e}/Partner/${V[0]===e?V[1]:V[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),Ue!=null&&Ue.pending&&Ue.partner1==e?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:(Ue==null?void 0:Ue.messages)??[],currentUserId:e,isAssistantChat:isAssistantChat(V),botStatus:isAssistantChat(V)?q:""}),jsxRuntime.jsx("div",{ref:We})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t flex",children:[(Ue==null?void 0:Ue.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:_,onClick:()=>Wt(),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:Ke,placeholder:"Type a message...",value:ie,onPaste:Je,onChange:Qe=>ae(Qe.target.value),onKeyDown:Qe=>{Qe.key!=="Enter"||Qe.shiftKey||(Qe.preventDefault(),pt())},className:Ue!=null&&Ue.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:Ue!=null&&Ue.pending?"collapse":"ml-2 h-8 w-8",disabled:!!q||(Ue==null?void 0:Ue.pending),onClick:pt,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),isAssistantChat(V)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:Ct,className:"hidden",ref:nt}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:Mt,className:Ue!=null&&Ue.pending?"collapse":"ml-2 h-8 w-8",disabled:q!==""||(Ue==null?void 0:Ue.pending)||!!Ye,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:Vt,className:Ue!=null&&Ue.pending?"collapse":"ml-2 h-8 w-8",disabled:q!==""||(Ue==null?void 0:Ue.pending)||!Ye,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.jsxs("div",{className:"w-[480px] flex flex-2 flex-col border-l",children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"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:[Ye?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",Ye.name," (pending send...)"]})}):Xe.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),Xe.slice().reverse().map(Qe=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",Qe]})}))]})}),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:O})})})]})]})});function getActiveChatObject(e,t){return e.find(n=>n.partner1==(t==null?void 0:t[0])&&n.partner2==(t==null?void 0:t[1]))}function isAssistantChat(e){return(e==null?void 0:e[0])==ASSISTANT_ID||(e==null?void 0:e[1])==ASSISTANT_ID}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:e,variant:t,...n},o)=>jsxRuntime.jsx("div",{ref:o,role:"alert",className:cn(alertVariants({variant:t}),e),...n}));Alert.displayName="Alert";const AlertTitle=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("h5",{ref:n,className:cn("mb-1 font-medium leading-none tracking-tight",e),...t}));AlertTitle.displayName="AlertTitle";const AlertDescription=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm [&_p]:leading-relaxed",e),...t}));AlertDescription.displayName="AlertDescription";function QualificationBadge({qualification:e}){return!e.QualificationId||e.QualificationId==="Suspended"?null:e.QualificationId==="Do Not Sell"?jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs(Badge,{variant:"destructive",children:[jsxRuntime.jsx(X$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:e.DefaultOpportunityNumber?"pr-1":"",children:[jsxRuntime.jsx(BadgeCheck,{className:"h-3 w-3 mr-1"}),e.QualificationId,e.DefaultOpportunityNumber&&jsxRuntime.jsx(Badge,{variant:"secondary",size:"sm",className:"ml-1",children:e.DefaultOpportunityNumber})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Qualification"})})]})})}function ManufacturerCard({manufacturer:e,link:t,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var M,I,A;if(d||!e)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=e.ManufacturerId||"N/A",g=e.PublicName||"N/A",b=[e.City,e.Province,e.Country].filter(Boolean),_=b.length>0?b.join(", "):"",S=((M=e.Tags)==null?void 0:M.split(",").map(O=>O.trim()).filter(Boolean))||[],R=O=>O===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(O),E=(O=>!O||O.length===0?[]:[...O].sort((q,z)=>(q.Day||0)-(z.Day||0)).map(q=>({date:q.Day||0,amount:q.ExtendedPrice||0})))(e.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"manufacturer-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:t??"#",target:t&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${f}/Account/Logo?width=64&height=64`,alt:`${g}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Manufacturer"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"}),e.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:e.Name}),_&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:_})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:E.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:E,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:[(!!((I=e.Qualification)!=null&&I.QualificationId)&&((A=e.Qualification)==null?void 0:A.QualificationId)!=="Suspended"||!!e.OpenToWork||S.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:e.Qualification??{}}),!!e.OpenToWork&&jsxRuntime.jsxs(Badge,{variant:"success",children:[jsxRuntime.jsx(HardHat,{className:"h-3 w-3 mr-1"}),"Open To Work"]}),!!e.OnHold&&e.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"}),S.map((O,q)=>jsxRuntime.jsx(Badge,{variant:"outline",children:O},q))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[e.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${e.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Phone})]}),e.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${e.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.PublicEmail})]}),e.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:e.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Website})]}),e.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.CurrencyCode})]})]})]}),e.SalesData&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:R(e.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:R(e.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:R(e.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:e,link:t,actions:n,loading:o=!1}){var _,S;const l=R=>R===void 0?"n/a":new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:0,maximumFractionDigits:0}).format(R);if(o||!e)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 d=e.ResellerId||"N/A",f=e.PublicName||"N/A",g=[e.City,e.Province,e.Country].filter(Boolean),b=g.length>0?g.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("img",{src:`https://api.randmar.io/V4/Partner/${d}/Account/Logo?width=64&height=64`,alt:`${f}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:d})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:e.PublicName||"N/A"}),e.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:e.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),!!e.OnHold&&e.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:[!!((_=e.Qualification)!=null&&_.QualificationId)&&((S=e.Qualification)==null?void 0:S.QualificationId)!=="Suspended"&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:jsxRuntime.jsx(QualificationBadge,{qualification:e.Qualification??{}})}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[e.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${e.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Phone})]}),e.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${e.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.PublicEmail})]}),e.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:e.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.Website})]}),e.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:e.CurrencyCode})]})]})]}),(e==null?void 0:e.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesYearToDay)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesLast3Months)}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:l(e==null?void 0:e.SalesData.SalesLast30Days)})]})]})}),(n||t)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 mt-auto ${n?"justify-between":"justify-end"}`,children:[n&&n,t&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:t,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}const Table=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",e),...t})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",e),...t}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",e),...t}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:e,...t},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]",e),...t}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",e),...t}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:e,handleValidSearch:t,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}t(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,{}),e&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:e,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:e,loading:t=!1}){const n=d=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(d),o=React.useMemo(()=>{if(!e||e.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const d=e.filter(O=>O.DocumentType==="Order"),f=e.filter(O=>O.DocumentType==="Shipment"),g=d.filter(O=>O.WarehouseCode!=="3PLE"),b=g.reduce((O,q)=>O+(q.Quantity||0),0),_=g.reduce((O,q)=>O+(q.ExtendedPrice||0),0),S=d.filter(O=>O.WarehouseCode==="3PLE"),R=S.reduce((O,q)=>O+(q.Quantity||0),0),C=S.reduce((O,q)=>O+(q.ExtendedPrice||0),0),E=f.length,M=f.reduce((O,q)=>O+(q.ExtendedPrice||0),0),I=b+R+E,A=_+C+M;return{all:{orders:I,amount:A},processing:{orders:b,amount:_},shipped:{orders:E,amount:M},delayed:{orders:R,amount:C}}},[e]),l=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:o.all.orders,amount:o.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:o.processing.orders,amount:o.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:o.shipped.orders,amount:o.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:o.delayed.orders,amount:o.delayed.amount}];return t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(d=>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"})]})]})]})]},d))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:l.map(d=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${d.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:d.name}),jsxRuntime.jsx("div",{className:`${d.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(d.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:d.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:n(d.amount)})]})]})]})]},d.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(e,t,n)=>{n=e!=null?__create(__getProtoOf(e)):{};const o=t||!e||!e.__esModule?__defProp(n,"default",{value:e,enumerable:!0}):n;for(let l of __getOwnPropNames(e))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>e[l],enumerable:!0});return o},__commonJS=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),require_xhtml=__commonJS((e,t)=>{t.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((e,t)=>{(function(n,o){typeof e=="object"&&typeof t<"u"?o(e):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(e,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],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(j,ne){for(var je=65536,Ve=0;Ve<ne.length;Ve+=2){if(je+=ne[Ve],je>j)return!1;if(je+=ne[Ve+1],je>=j)return!0}return!1}function M(j,ne){return j<65?j===36:j<91?!0:j<97?j===95:j<123?!0:j<=65535?j>=170&&R.test(String.fromCharCode(j)):ne===!1?!1:E(j,l)}function I(j,ne){return j<48?j===36:j<58?!0:j<65?!1:j<91?!0:j<97?j===95:j<123?!0:j<=65535?j>=170&&C.test(String.fromCharCode(j)):ne===!1?!1:E(j,l)||E(j,o)}var A=function(ne,je){je===void 0&&(je={}),this.label=ne,this.keyword=je.keyword,this.beforeExpr=!!je.beforeExpr,this.startsExpr=!!je.startsExpr,this.isLoop=!!je.isLoop,this.isAssign=!!je.isAssign,this.prefix=!!je.prefix,this.postfix=!!je.postfix,this.binop=je.binop||null,this.updateContext=null};function O(j,ne){return new A(j,{beforeExpr:!0,binop:ne})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(j,ne){return ne===void 0&&(ne={}),ne.keyword=j,Q[j]=new A(j,ne)}var V={num:new A("num",z),regexp:new A("regexp",z),string:new A("string",z),name:new A("name",z),privateId:new A("privateId",z),eof:new A("eof"),bracketL:new A("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new A("]"),braceL:new A("{",{beforeExpr:!0,startsExpr:!0}),braceR:new A("}"),parenL:new A("(",{beforeExpr:!0,startsExpr:!0}),parenR:new A(")"),comma:new A(",",q),semi:new A(";",q),colon:new A(":",q),dot:new A("."),question:new A("?",q),questionDot:new A("?."),arrow:new A("=>",q),template:new A("template"),invalidTemplate:new A("invalidTemplate"),ellipsis:new A("...",q),backQuote:new A("`",z),dollarBraceL:new A("${",{beforeExpr:!0,startsExpr:!0}),eq:new A("=",{beforeExpr:!0,isAssign:!0}),assign:new A("_=",{beforeExpr:!0,isAssign:!0}),incDec:new A("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new A("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:O("||",1),logicalAND:O("&&",2),bitwiseOR:O("|",3),bitwiseXOR:O("^",4),bitwiseAND:O("&",5),equality:O("==/!=/===/!==",6),relational:O("</>/<=/>=",7),bitShift:O("<</>>/>>>",8),plusMin:new A("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:O("%",10),star:O("*",10),slash:O("/",10),starstar:new A("**",{beforeExpr:!0}),coalesce:O("??",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/,ie=new RegExp(te.source,"g");function ae(j){return j===10||j===13||j===8232||j===8233}function oe(j,ne,je){je===void 0&&(je=j.length);for(var Ve=ne;Ve<je;Ve++){var Ge=j.charCodeAt(Ve);if(ae(Ge))return Ve<je-1&&Ge===13&&j.charCodeAt(Ve+1)===10?Ve+2:Ve+1}return-1}var se=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ge=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ae=Object.prototype,Ne=Ae.hasOwnProperty,Oe=Ae.toString,Le=Object.hasOwn||function(j,ne){return Ne.call(j,ne)},ze=Array.isArray||function(j){return Oe.call(j)==="[object Array]"},$e=Object.create(null);function Be(j){return $e[j]||($e[j]=new RegExp("^(?:"+j.replace(/ /g,"|")+")$"))}function Fe(j){return j<=65535?String.fromCharCode(j):(j-=65536,String.fromCharCode((j>>10)+55296,(j&1023)+56320))}var We=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(ne,je){this.line=ne,this.column=je};He.prototype.offset=function(ne){return new He(this.line,this.column+ne)};var Ye=function(ne,je,Ve){this.start=je,this.end=Ve,ne.sourceFile!==null&&(this.source=ne.sourceFile)};function Ze(j,ne){for(var je=1,Ve=0;;){var Ge=oe(j,Ve,ne);if(Ge<0)return new He(je,ne-Ve);++je,Ve=Ge}}var Xe={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},ot=!1;function Ke(j){var ne={};for(var je in Xe)ne[je]=j&&Le(j,je)?j[je]:Xe[je];if(ne.ecmaVersion==="latest"?ne.ecmaVersion=1e8:ne.ecmaVersion==null?(!ot&&typeof console=="object"&&console.warn&&(ot=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
973
974
  Defaulting to 2020, but this will stop working in the future.`)),ne.ecmaVersion=11):ne.ecmaVersion>=2015&&(ne.ecmaVersion-=2009),ne.allowReserved==null&&(ne.allowReserved=ne.ecmaVersion<5),(!j||j.allowHashBang==null)&&(ne.allowHashBang=ne.ecmaVersion>=14),ze(ne.onToken)){var Ve=ne.onToken;ne.onToken=function(Ge){return Ve.push(Ge)}}return ze(ne.onComment)&&(ne.onComment=nt(ne,ne.onComment)),ne}function nt(j,ne){return function(je,Ve,Ge,st,ut,mt){var yt={type:je?"Block":"Line",value:Ve,start:Ge,end:st};j.locations&&(yt.loc=new Ye(this,ut,mt)),j.ranges&&(yt.range=[Ge,st]),ne.push(yt)}}var et=1,it=2,lt=4,qe=8,ft=16,Je=32,pt=64,Ct=128,Mt=256,Vt=et|it|Mt;function It(j,ne){return it|(j?lt:0)|(ne?qe:0)}var Ft=0,Wt=1,Ue=2,at=3,Qe=4,tt=5,rt=function(ne,je,Ve){this.options=ne=Ke(ne),this.sourceFile=ne.sourceFile,this.keywords=Be(_[ne.ecmaVersion>=6?6:ne.sourceType==="module"?"5module":5]);var Ge="";ne.allowReserved!==!0&&(Ge=g[ne.ecmaVersion>=6?6:ne.ecmaVersion===5?5:3],ne.sourceType==="module"&&(Ge+=" await")),this.reservedWords=Be(Ge);var st=(Ge?Ge+" ":"")+g.strict;this.reservedWordsStrict=Be(st),this.reservedWordsStrictBind=Be(st+" "+g.strictBind),this.input=String(je),this.containsEsc=!1,Ve?(this.pos=Ve,this.lineStart=this.input.lastIndexOf(`
974
975
  `,Ve-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(te).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=V.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=ne.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&&ne.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(et),this.regexpState=null,this.privateNameStack=[]},ct={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}};rt.prototype.parse=function(){var ne=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(ne)},ct.inFunction.get=function(){return(this.currentVarScope().flags&it)>0},ct.inGenerator.get=function(){return(this.currentVarScope().flags&qe)>0&&!this.currentVarScope().inClassFieldInit},ct.inAsync.get=function(){return(this.currentVarScope().flags&lt)>0&&!this.currentVarScope().inClassFieldInit},ct.canAwait.get=function(){for(var j=this.scopeStack.length-1;j>=0;j--){var ne=this.scopeStack[j];if(ne.inClassFieldInit||ne.flags&Mt)return!1;if(ne.flags&it)return(ne.flags&lt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ct.allowSuper.get=function(){var j=this.currentThisScope(),ne=j.flags,je=j.inClassFieldInit;return(ne&pt)>0||je||this.options.allowSuperOutsideMethod},ct.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ct)>0},ct.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ct.allowNewDotTarget.get=function(){var j=this.currentThisScope(),ne=j.flags,je=j.inClassFieldInit;return(ne&(it|Mt))>0||je},ct.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Mt)>0},rt.extend=function(){for(var ne=[],je=arguments.length;je--;)ne[je]=arguments[je];for(var Ve=this,Ge=0;Ge<ne.length;Ge++)Ve=ne[Ge](Ve);return Ve},rt.parse=function(ne,je){return new this(je,ne).parse()},rt.parseExpressionAt=function(ne,je,Ve){var Ge=new this(Ve,ne,je);return Ge.nextToken(),Ge.parseExpression()},rt.tokenizer=function(ne,je){return new this(je,ne)},Object.defineProperties(rt.prototype,ct);var dt=rt.prototype,Dt=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;dt.strictDirective=function(j){if(this.options.ecmaVersion<5)return!1;for(;;){ge.lastIndex=j,j+=ge.exec(this.input)[0].length;var ne=Dt.exec(this.input.slice(j));if(!ne)return!1;if((ne[1]||ne[2])==="use strict"){ge.lastIndex=j+ne[0].length;var je=ge.exec(this.input),Ve=je.index+je[0].length,Ge=this.input.charAt(Ve);return Ge===";"||Ge==="}"||te.test(je[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Ge)||Ge==="!"&&this.input.charAt(Ve+1)==="=")}j+=ne[0].length,ge.lastIndex=j,j+=ge.exec(this.input)[0].length,this.input[j]===";"&&j++}},dt.eat=function(j){return this.type===j?(this.next(),!0):!1},dt.isContextual=function(j){return this.type===V.name&&this.value===j&&!this.containsEsc},dt.eatContextual=function(j){return this.isContextual(j)?(this.next(),!0):!1},dt.expectContextual=function(j){this.eatContextual(j)||this.unexpected()},dt.canInsertSemicolon=function(){return this.type===V.eof||this.type===V.braceR||te.test(this.input.slice(this.lastTokEnd,this.start))},dt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},dt.semicolon=function(){!this.eat(V.semi)&&!this.insertSemicolon()&&this.unexpected()},dt.afterTrailingComma=function(j,ne){if(this.type===j)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),ne||this.next(),!0},dt.expect=function(j){this.eat(j)||this.unexpected()},dt.unexpected=function(j){this.raise(j??this.start,"Unexpected token")};var Xt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};dt.checkPatternErrors=function(j,ne){if(j){j.trailingComma>-1&&this.raiseRecoverable(j.trailingComma,"Comma is not permitted after the rest element");var je=ne?j.parenthesizedAssign:j.parenthesizedBind;je>-1&&this.raiseRecoverable(je,ne?"Assigning to rvalue":"Parenthesized pattern")}},dt.checkExpressionErrors=function(j,ne){if(!j)return!1;var je=j.shorthandAssign,Ve=j.doubleProto;if(!ne)return je>=0||Ve>=0;je>=0&&this.raise(je,"Shorthand property assignments are valid only in destructuring patterns"),Ve>=0&&this.raiseRecoverable(Ve,"Redefinition of __proto__ property")},dt.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")},dt.isSimpleAssignTarget=function(j){return j.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(j.expression):j.type==="Identifier"||j.type==="MemberExpression"};var Rt=rt.prototype;Rt.parseTopLevel=function(j){var ne=Object.create(null);for(j.body||(j.body=[]);this.type!==V.eof;){var je=this.parseStatement(null,!0,ne);j.body.push(je)}if(this.inModule)for(var Ve=0,Ge=Object.keys(this.undefinedExports);Ve<Ge.length;Ve+=1){var st=Ge[Ve];this.raiseRecoverable(this.undefinedExports[st].start,"Export '"+st+"' is not defined")}return this.adaptDirectivePrologue(j.body),this.next(),j.sourceType=this.options.sourceType,this.finishNode(j,"Program")};var dr={kind:"loop"},rr={kind:"switch"};Rt.isLet=function(j){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ge.lastIndex=this.pos;var ne=ge.exec(this.input),je=this.pos+ne[0].length,Ve=this.input.charCodeAt(je);if(Ve===91||Ve===92)return!0;if(j)return!1;if(Ve===123||Ve>55295&&Ve<56320)return!0;if(M(Ve,!0)){for(var Ge=je+1;I(Ve=this.input.charCodeAt(Ge),!0);)++Ge;if(Ve===92||Ve>55295&&Ve<56320)return!0;var st=this.input.slice(je,Ge);if(!S.test(st))return!0}return!1},Rt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ge.lastIndex=this.pos;var j=ge.exec(this.input),ne=this.pos+j[0].length,je;return!te.test(this.input.slice(this.pos,ne))&&this.input.slice(ne,ne+8)==="function"&&(ne+8===this.input.length||!(I(je=this.input.charCodeAt(ne+8))||je>55295&&je<56320))},Rt.parseStatement=function(j,ne,je){var Ve=this.type,Ge=this.startNode(),st;switch(this.isLet(j)&&(Ve=V._var,st="let"),Ve){case V._break:case V._continue:return this.parseBreakContinueStatement(Ge,Ve.keyword);case V._debugger:return this.parseDebuggerStatement(Ge);case V._do:return this.parseDoStatement(Ge);case V._for:return this.parseForStatement(Ge);case V._function:return j&&(this.strict||j!=="if"&&j!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(Ge,!1,!j);case V._class:return j&&this.unexpected(),this.parseClass(Ge,!0);case V._if:return this.parseIfStatement(Ge);case V._return:return this.parseReturnStatement(Ge);case V._switch:return this.parseSwitchStatement(Ge);case V._throw:return this.parseThrowStatement(Ge);case V._try:return this.parseTryStatement(Ge);case V._const:case V._var:return st=st||this.value,j&&st!=="var"&&this.unexpected(),this.parseVarStatement(Ge,st);case V._while:return this.parseWhileStatement(Ge);case V._with:return this.parseWithStatement(Ge);case V.braceL:return this.parseBlock(!0,Ge);case V.semi:return this.parseEmptyStatement(Ge);case V._export:case V._import:if(this.options.ecmaVersion>10&&Ve===V._import){ge.lastIndex=this.pos;var ut=ge.exec(this.input),mt=this.pos+ut[0].length,yt=this.input.charCodeAt(mt);if(yt===40||yt===46)return this.parseExpressionStatement(Ge,this.parseExpression())}return this.options.allowImportExportEverywhere||(ne||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'")),Ve===V._import?this.parseImport(Ge):this.parseExport(Ge,je);default:if(this.isAsyncFunction())return j&&this.unexpected(),this.next(),this.parseFunctionStatement(Ge,!0,!j);var zt=this.value,Ut=this.parseExpression();return Ve===V.name&&Ut.type==="Identifier"&&this.eat(V.colon)?this.parseLabeledStatement(Ge,zt,Ut,j):this.parseExpressionStatement(Ge,Ut)}},Rt.parseBreakContinueStatement=function(j,ne){var je=ne==="break";this.next(),this.eat(V.semi)||this.insertSemicolon()?j.label=null:this.type!==V.name?this.unexpected():(j.label=this.parseIdent(),this.semicolon());for(var Ve=0;Ve<this.labels.length;++Ve){var Ge=this.labels[Ve];if((j.label==null||Ge.name===j.label.name)&&(Ge.kind!=null&&(je||Ge.kind==="loop")||j.label&&je))break}return Ve===this.labels.length&&this.raise(j.start,"Unsyntactic "+ne),this.finishNode(j,je?"BreakStatement":"ContinueStatement")},Rt.parseDebuggerStatement=function(j){return this.next(),this.semicolon(),this.finishNode(j,"DebuggerStatement")},Rt.parseDoStatement=function(j){return this.next(),this.labels.push(dr),j.body=this.parseStatement("do"),this.labels.pop(),this.expect(V._while),j.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(V.semi):this.semicolon(),this.finishNode(j,"DoWhileStatement")},Rt.parseForStatement=function(j){this.next();var ne=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(dr),this.enterScope(0),this.expect(V.parenL),this.type===V.semi)return ne>-1&&this.unexpected(ne),this.parseFor(j,null);var je=this.isLet();if(this.type===V._var||this.type===V._const||je){var Ve=this.startNode(),Ge=je?"let":this.value;return this.next(),this.parseVar(Ve,!0,Ge),this.finishNode(Ve,"VariableDeclaration"),(this.type===V._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Ve.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===V._in?ne>-1&&this.unexpected(ne):j.await=ne>-1),this.parseForIn(j,Ve)):(ne>-1&&this.unexpected(ne),this.parseFor(j,Ve))}var st=this.isContextual("let"),ut=!1,mt=this.containsEsc,yt=new Xt,zt=this.start,Ut=ne>-1?this.parseExprSubscripts(yt,"await"):this.parseExpression(!0,yt);return this.type===V._in||(ut=this.options.ecmaVersion>=6&&this.isContextual("of"))?(ne>-1?(this.type===V._in&&this.unexpected(ne),j.await=!0):ut&&this.options.ecmaVersion>=8&&(Ut.start===zt&&!mt&&Ut.type==="Identifier"&&Ut.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(j.await=!1)),st&&ut&&this.raise(Ut.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Ut,!1,yt),this.checkLValPattern(Ut),this.parseForIn(j,Ut)):(this.checkExpressionErrors(yt,!0),ne>-1&&this.unexpected(ne),this.parseFor(j,Ut))},Rt.parseFunctionStatement=function(j,ne,je){return this.next(),this.parseFunction(j,lr|(je?0:yr),!1,ne)},Rt.parseIfStatement=function(j){return this.next(),j.test=this.parseParenExpression(),j.consequent=this.parseStatement("if"),j.alternate=this.eat(V._else)?this.parseStatement("if"):null,this.finishNode(j,"IfStatement")},Rt.parseReturnStatement=function(j){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(V.semi)||this.insertSemicolon()?j.argument=null:(j.argument=this.parseExpression(),this.semicolon()),this.finishNode(j,"ReturnStatement")},Rt.parseSwitchStatement=function(j){this.next(),j.discriminant=this.parseParenExpression(),j.cases=[],this.expect(V.braceL),this.labels.push(rr),this.enterScope(0);for(var ne,je=!1;this.type!==V.braceR;)if(this.type===V._case||this.type===V._default){var Ve=this.type===V._case;ne&&this.finishNode(ne,"SwitchCase"),j.cases.push(ne=this.startNode()),ne.consequent=[],this.next(),Ve?ne.test=this.parseExpression():(je&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),je=!0,ne.test=null),this.expect(V.colon)}else ne||this.unexpected(),ne.consequent.push(this.parseStatement(null));return this.exitScope(),ne&&this.finishNode(ne,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(j,"SwitchStatement")},Rt.parseThrowStatement=function(j){return this.next(),te.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),j.argument=this.parseExpression(),this.semicolon(),this.finishNode(j,"ThrowStatement")};var or=[];Rt.parseCatchClauseParam=function(){var j=this.parseBindingAtom(),ne=j.type==="Identifier";return this.enterScope(ne?Je:0),this.checkLValPattern(j,ne?Qe:Ue),this.expect(V.parenR),j},Rt.parseTryStatement=function(j){if(this.next(),j.block=this.parseBlock(),j.handler=null,this.type===V._catch){var ne=this.startNode();this.next(),this.eat(V.parenL)?ne.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),ne.param=null,this.enterScope(0)),ne.body=this.parseBlock(!1),this.exitScope(),j.handler=this.finishNode(ne,"CatchClause")}return j.finalizer=this.eat(V._finally)?this.parseBlock():null,!j.handler&&!j.finalizer&&this.raise(j.start,"Missing catch or finally clause"),this.finishNode(j,"TryStatement")},Rt.parseVarStatement=function(j,ne,je){return this.next(),this.parseVar(j,!1,ne,je),this.semicolon(),this.finishNode(j,"VariableDeclaration")},Rt.parseWhileStatement=function(j){return this.next(),j.test=this.parseParenExpression(),this.labels.push(dr),j.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(j,"WhileStatement")},Rt.parseWithStatement=function(j){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),j.object=this.parseParenExpression(),j.body=this.parseStatement("with"),this.finishNode(j,"WithStatement")},Rt.parseEmptyStatement=function(j){return this.next(),this.finishNode(j,"EmptyStatement")},Rt.parseLabeledStatement=function(j,ne,je,Ve){for(var Ge=0,st=this.labels;Ge<st.length;Ge+=1){var ut=st[Ge];ut.name===ne&&this.raise(je.start,"Label '"+ne+"' is already declared")}for(var mt=this.type.isLoop?"loop":this.type===V._switch?"switch":null,yt=this.labels.length-1;yt>=0;yt--){var zt=this.labels[yt];if(zt.statementStart===j.start)zt.statementStart=this.start,zt.kind=mt;else break}return this.labels.push({name:ne,kind:mt,statementStart:this.start}),j.body=this.parseStatement(Ve?Ve.indexOf("label")===-1?Ve+"label":Ve:"label"),this.labels.pop(),j.label=je,this.finishNode(j,"LabeledStatement")},Rt.parseExpressionStatement=function(j,ne){return j.expression=ne,this.semicolon(),this.finishNode(j,"ExpressionStatement")},Rt.parseBlock=function(j,ne,je){for(j===void 0&&(j=!0),ne===void 0&&(ne=this.startNode()),ne.body=[],this.expect(V.braceL),j&&this.enterScope(0);this.type!==V.braceR;){var Ve=this.parseStatement(null);ne.body.push(Ve)}return je&&(this.strict=!1),this.next(),j&&this.exitScope(),this.finishNode(ne,"BlockStatement")},Rt.parseFor=function(j,ne){return j.init=ne,this.expect(V.semi),j.test=this.type===V.semi?null:this.parseExpression(),this.expect(V.semi),j.update=this.type===V.parenR?null:this.parseExpression(),this.expect(V.parenR),j.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(j,"ForStatement")},Rt.parseForIn=function(j,ne){var je=this.type===V._in;return this.next(),ne.type==="VariableDeclaration"&&ne.declarations[0].init!=null&&(!je||this.options.ecmaVersion<8||this.strict||ne.kind!=="var"||ne.declarations[0].id.type!=="Identifier")&&this.raise(ne.start,(je?"for-in":"for-of")+" loop variable declaration may not have an initializer"),j.left=ne,j.right=je?this.parseExpression():this.parseMaybeAssign(),this.expect(V.parenR),j.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(j,je?"ForInStatement":"ForOfStatement")},Rt.parseVar=function(j,ne,je,Ve){for(j.declarations=[],j.kind=je;;){var Ge=this.startNode();if(this.parseVarId(Ge,je),this.eat(V.eq)?Ge.init=this.parseMaybeAssign(ne):!Ve&&je==="const"&&!(this.type===V._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!Ve&&Ge.id.type!=="Identifier"&&!(ne&&(this.type===V._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):Ge.init=null,j.declarations.push(this.finishNode(Ge,"VariableDeclarator")),!this.eat(V.comma))break}return j},Rt.parseVarId=function(j,ne){j.id=this.parseBindingAtom(),this.checkLValPattern(j.id,ne==="var"?Wt:Ue,!1)};var lr=1,yr=2,Ar=4;Rt.parseFunction=function(j,ne,je,Ve,Ge){this.initFunction(j),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Ve)&&(this.type===V.star&&ne&yr&&this.unexpected(),j.generator=this.eat(V.star)),this.options.ecmaVersion>=8&&(j.async=!!Ve),ne&lr&&(j.id=ne&Ar&&this.type!==V.name?null:this.parseIdent(),j.id&&!(ne&yr)&&this.checkLValSimple(j.id,this.strict||j.generator||j.async?this.treatFunctionsAsVar?Wt:Ue:at));var st=this.yieldPos,ut=this.awaitPos,mt=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(It(j.async,j.generator)),ne&lr||(j.id=this.type===V.name?this.parseIdent():null),this.parseFunctionParams(j),this.parseFunctionBody(j,je,!1,Ge),this.yieldPos=st,this.awaitPos=ut,this.awaitIdentPos=mt,this.finishNode(j,ne&lr?"FunctionDeclaration":"FunctionExpression")},Rt.parseFunctionParams=function(j){this.expect(V.parenL),j.params=this.parseBindingList(V.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Rt.parseClass=function(j,ne){this.next();var je=this.strict;this.strict=!0,this.parseClassId(j,ne),this.parseClassSuper(j);var Ve=this.enterClassBody(),Ge=this.startNode(),st=!1;for(Ge.body=[],this.expect(V.braceL);this.type!==V.braceR;){var ut=this.parseClassElement(j.superClass!==null);ut&&(Ge.body.push(ut),ut.type==="MethodDefinition"&&ut.kind==="constructor"?(st&&this.raiseRecoverable(ut.start,"Duplicate constructor in the same class"),st=!0):ut.key&&ut.key.type==="PrivateIdentifier"&&Ir(Ve,ut)&&this.raiseRecoverable(ut.key.start,"Identifier '#"+ut.key.name+"' has already been declared"))}return this.strict=je,this.next(),j.body=this.finishNode(Ge,"ClassBody"),this.exitClassBody(),this.finishNode(j,ne?"ClassDeclaration":"ClassExpression")},Rt.parseClassElement=function(j){if(this.eat(V.semi))return null;var ne=this.options.ecmaVersion,je=this.startNode(),Ve="",Ge=!1,st=!1,ut="method",mt=!1;if(this.eatContextual("static")){if(ne>=13&&this.eat(V.braceL))return this.parseClassStaticBlock(je),je;this.isClassElementNameStart()||this.type===V.star?mt=!0:Ve="static"}if(je.static=mt,!Ve&&ne>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===V.star)&&!this.canInsertSemicolon()?st=!0:Ve="async"),!Ve&&(ne>=9||!st)&&this.eat(V.star)&&(Ge=!0),!Ve&&!st&&!Ge){var yt=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?ut=yt:Ve=yt)}if(Ve?(je.computed=!1,je.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),je.key.name=Ve,this.finishNode(je.key,"Identifier")):this.parseClassElementName(je),ne<13||this.type===V.parenL||ut!=="method"||Ge||st){var zt=!je.static&&Nr(je,"constructor"),Ut=zt&&j;zt&&ut!=="method"&&this.raise(je.key.start,"Constructor can't have get/set modifier"),je.kind=zt?"constructor":ut,this.parseClassMethod(je,Ge,st,Ut)}else this.parseClassField(je);return je},Rt.isClassElementNameStart=function(){return this.type===V.name||this.type===V.privateId||this.type===V.num||this.type===V.string||this.type===V.bracketL||this.type.keyword},Rt.parseClassElementName=function(j){this.type===V.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),j.computed=!1,j.key=this.parsePrivateIdent()):this.parsePropertyName(j)},Rt.parseClassMethod=function(j,ne,je,Ve){var Ge=j.key;j.kind==="constructor"?(ne&&this.raise(Ge.start,"Constructor can't be a generator"),je&&this.raise(Ge.start,"Constructor can't be an async method")):j.static&&Nr(j,"prototype")&&this.raise(Ge.start,"Classes may not have a static property named prototype");var st=j.value=this.parseMethod(ne,je,Ve);return j.kind==="get"&&st.params.length!==0&&this.raiseRecoverable(st.start,"getter should have no params"),j.kind==="set"&&st.params.length!==1&&this.raiseRecoverable(st.start,"setter should have exactly one param"),j.kind==="set"&&st.params[0].type==="RestElement"&&this.raiseRecoverable(st.params[0].start,"Setter cannot use rest params"),this.finishNode(j,"MethodDefinition")},Rt.parseClassField=function(j){if(Nr(j,"constructor")?this.raise(j.key.start,"Classes can't have a field named 'constructor'"):j.static&&Nr(j,"prototype")&&this.raise(j.key.start,"Classes can't have a static field named 'prototype'"),this.eat(V.eq)){var ne=this.currentThisScope(),je=ne.inClassFieldInit;ne.inClassFieldInit=!0,j.value=this.parseMaybeAssign(),ne.inClassFieldInit=je}else j.value=null;return this.semicolon(),this.finishNode(j,"PropertyDefinition")},Rt.parseClassStaticBlock=function(j){j.body=[];var ne=this.labels;for(this.labels=[],this.enterScope(Mt|pt);this.type!==V.braceR;){var je=this.parseStatement(null);j.body.push(je)}return this.next(),this.exitScope(),this.labels=ne,this.finishNode(j,"StaticBlock")},Rt.parseClassId=function(j,ne){this.type===V.name?(j.id=this.parseIdent(),ne&&this.checkLValSimple(j.id,Ue,!1)):(ne===!0&&this.unexpected(),j.id=null)},Rt.parseClassSuper=function(j){j.superClass=this.eat(V._extends)?this.parseExprSubscripts(null,!1):null},Rt.enterClassBody=function(){var j={declared:Object.create(null),used:[]};return this.privateNameStack.push(j),j.declared},Rt.exitClassBody=function(){var j=this.privateNameStack.pop(),ne=j.declared,je=j.used;if(this.options.checkPrivateFields)for(var Ve=this.privateNameStack.length,Ge=Ve===0?null:this.privateNameStack[Ve-1],st=0;st<je.length;++st){var ut=je[st];Le(ne,ut.name)||(Ge?Ge.used.push(ut):this.raiseRecoverable(ut.start,"Private field '#"+ut.name+"' must be declared in an enclosing class"))}};function Ir(j,ne){var je=ne.key.name,Ve=j[je],Ge="true";return ne.type==="MethodDefinition"&&(ne.kind==="get"||ne.kind==="set")&&(Ge=(ne.static?"s":"i")+ne.kind),Ve==="iget"&&Ge==="iset"||Ve==="iset"&&Ge==="iget"||Ve==="sget"&&Ge==="sset"||Ve==="sset"&&Ge==="sget"?(j[je]="true",!1):Ve?!0:(j[je]=Ge,!1)}function Nr(j,ne){var je=j.computed,Ve=j.key;return!je&&(Ve.type==="Identifier"&&Ve.name===ne||Ve.type==="Literal"&&Ve.value===ne)}Rt.parseExportAllDeclaration=function(j,ne){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(j.exported=this.parseModuleExportName(),this.checkExport(ne,j.exported,this.lastTokStart)):j.exported=null),this.expectContextual("from"),this.type!==V.string&&this.unexpected(),j.source=this.parseExprAtom(),this.semicolon(),this.finishNode(j,"ExportAllDeclaration")},Rt.parseExport=function(j,ne){if(this.next(),this.eat(V.star))return this.parseExportAllDeclaration(j,ne);if(this.eat(V._default))return this.checkExport(ne,"default",this.lastTokStart),j.declaration=this.parseExportDefaultDeclaration(),this.finishNode(j,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())j.declaration=this.parseExportDeclaration(j),j.declaration.type==="VariableDeclaration"?this.checkVariableExport(ne,j.declaration.declarations):this.checkExport(ne,j.declaration.id,j.declaration.id.start),j.specifiers=[],j.source=null;else{if(j.declaration=null,j.specifiers=this.parseExportSpecifiers(ne),this.eatContextual("from"))this.type!==V.string&&this.unexpected(),j.source=this.parseExprAtom();else{for(var je=0,Ve=j.specifiers;je<Ve.length;je+=1){var Ge=Ve[je];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`.")}j.source=null}this.semicolon()}return this.finishNode(j,"ExportNamedDeclaration")},Rt.parseExportDeclaration=function(j){return this.parseStatement(null)},Rt.parseExportDefaultDeclaration=function(){var j;if(this.type===V._function||(j=this.isAsyncFunction())){var ne=this.startNode();return this.next(),j&&this.next(),this.parseFunction(ne,lr|Ar,!1,j)}else if(this.type===V._class){var je=this.startNode();return this.parseClass(je,"nullableID")}else{var Ve=this.parseMaybeAssign();return this.semicolon(),Ve}},Rt.checkExport=function(j,ne,je){j&&(typeof ne!="string"&&(ne=ne.type==="Identifier"?ne.name:ne.value),Le(j,ne)&&this.raiseRecoverable(je,"Duplicate export '"+ne+"'"),j[ne]=!0)},Rt.checkPatternExport=function(j,ne){var je=ne.type;if(je==="Identifier")this.checkExport(j,ne,ne.start);else if(je==="ObjectPattern")for(var Ve=0,Ge=ne.properties;Ve<Ge.length;Ve+=1){var st=Ge[Ve];this.checkPatternExport(j,st)}else if(je==="ArrayPattern")for(var ut=0,mt=ne.elements;ut<mt.length;ut+=1){var yt=mt[ut];yt&&this.checkPatternExport(j,yt)}else je==="Property"?this.checkPatternExport(j,ne.value):je==="AssignmentPattern"?this.checkPatternExport(j,ne.left):je==="RestElement"&&this.checkPatternExport(j,ne.argument)},Rt.checkVariableExport=function(j,ne){if(j)for(var je=0,Ve=ne;je<Ve.length;je+=1){var Ge=Ve[je];this.checkPatternExport(j,Ge.id)}},Rt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},Rt.parseExportSpecifier=function(j){var ne=this.startNode();return ne.local=this.parseModuleExportName(),ne.exported=this.eatContextual("as")?this.parseModuleExportName():ne.local,this.checkExport(j,ne.exported,ne.exported.start),this.finishNode(ne,"ExportSpecifier")},Rt.parseExportSpecifiers=function(j){var ne=[],je=!0;for(this.expect(V.braceL);!this.eat(V.braceR);){if(je)je=!1;else if(this.expect(V.comma),this.afterTrailingComma(V.braceR))break;ne.push(this.parseExportSpecifier(j))}return ne},Rt.parseImport=function(j){return this.next(),this.type===V.string?(j.specifiers=or,j.source=this.parseExprAtom()):(j.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),j.source=this.type===V.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(j,"ImportDeclaration")},Rt.parseImportSpecifier=function(){var j=this.startNode();return j.imported=this.parseModuleExportName(),this.eatContextual("as")?j.local=this.parseIdent():(this.checkUnreserved(j.imported),j.local=j.imported),this.checkLValSimple(j.local,Ue),this.finishNode(j,"ImportSpecifier")},Rt.parseImportDefaultSpecifier=function(){var j=this.startNode();return j.local=this.parseIdent(),this.checkLValSimple(j.local,Ue),this.finishNode(j,"ImportDefaultSpecifier")},Rt.parseImportNamespaceSpecifier=function(){var j=this.startNode();return this.next(),this.expectContextual("as"),j.local=this.parseIdent(),this.checkLValSimple(j.local,Ue),this.finishNode(j,"ImportNamespaceSpecifier")},Rt.parseImportSpecifiers=function(){var j=[],ne=!0;if(this.type===V.name&&(j.push(this.parseImportDefaultSpecifier()),!this.eat(V.comma)))return j;if(this.type===V.star)return j.push(this.parseImportNamespaceSpecifier()),j;for(this.expect(V.braceL);!this.eat(V.braceR);){if(ne)ne=!1;else if(this.expect(V.comma),this.afterTrailingComma(V.braceR))break;j.push(this.parseImportSpecifier())}return j},Rt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===V.string){var j=this.parseLiteral(this.value);return We.test(j.value)&&this.raise(j.start,"An export name cannot include a lone surrogate."),j}return this.parseIdent(!0)},Rt.adaptDirectivePrologue=function(j){for(var ne=0;ne<j.length&&this.isDirectiveCandidate(j[ne]);++ne)j[ne].directive=j[ne].expression.raw.slice(1,-1)},Rt.isDirectiveCandidate=function(j){return this.options.ecmaVersion>=5&&j.type==="ExpressionStatement"&&j.expression.type==="Literal"&&typeof j.expression.value=="string"&&(this.input[j.start]==='"'||this.input[j.start]==="'")};var nr=rt.prototype;nr.toAssignable=function(j,ne,je){if(this.options.ecmaVersion>=6&&j)switch(j.type){case"Identifier":this.inAsync&&j.name==="await"&&this.raise(j.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":j.type="ObjectPattern",je&&this.checkPatternErrors(je,!0);for(var Ve=0,Ge=j.properties;Ve<Ge.length;Ve+=1){var st=Ge[Ve];this.toAssignable(st,ne),st.type==="RestElement"&&(st.argument.type==="ArrayPattern"||st.argument.type==="ObjectPattern")&&this.raise(st.argument.start,"Unexpected token")}break;case"Property":j.kind!=="init"&&this.raise(j.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(j.value,ne);break;case"ArrayExpression":j.type="ArrayPattern",je&&this.checkPatternErrors(je,!0),this.toAssignableList(j.elements,ne);break;case"SpreadElement":j.type="RestElement",this.toAssignable(j.argument,ne),j.argument.type==="AssignmentPattern"&&this.raise(j.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":j.operator!=="="&&this.raise(j.left.end,"Only '=' operator can be used for specifying default value."),j.type="AssignmentPattern",delete j.operator,this.toAssignable(j.left,ne);break;case"ParenthesizedExpression":this.toAssignable(j.expression,ne,je);break;case"ChainExpression":this.raiseRecoverable(j.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ne)break;default:this.raise(j.start,"Assigning to rvalue")}else je&&this.checkPatternErrors(je,!0);return j},nr.toAssignableList=function(j,ne){for(var je=j.length,Ve=0;Ve<je;Ve++){var Ge=j[Ve];Ge&&this.toAssignable(Ge,ne)}if(je){var st=j[je-1];this.options.ecmaVersion===6&&ne&&st&&st.type==="RestElement"&&st.argument.type!=="Identifier"&&this.unexpected(st.argument.start)}return j},nr.parseSpread=function(j){var ne=this.startNode();return this.next(),ne.argument=this.parseMaybeAssign(!1,j),this.finishNode(ne,"SpreadElement")},nr.parseRestBinding=function(){var j=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==V.name&&this.unexpected(),j.argument=this.parseBindingAtom(),this.finishNode(j,"RestElement")},nr.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case V.bracketL:var j=this.startNode();return this.next(),j.elements=this.parseBindingList(V.bracketR,!0,!0),this.finishNode(j,"ArrayPattern");case V.braceL:return this.parseObj(!0)}return this.parseIdent()},nr.parseBindingList=function(j,ne,je,Ve){for(var Ge=[],st=!0;!this.eat(j);)if(st?st=!1:this.expect(V.comma),ne&&this.type===V.comma)Ge.push(null);else{if(je&&this.afterTrailingComma(j))break;if(this.type===V.ellipsis){var ut=this.parseRestBinding();this.parseBindingListItem(ut),Ge.push(ut),this.type===V.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(j);break}else Ge.push(this.parseAssignableListItem(Ve))}return Ge},nr.parseAssignableListItem=function(j){var ne=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ne),ne},nr.parseBindingListItem=function(j){return j},nr.parseMaybeDefault=function(j,ne,je){if(je=je||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(V.eq))return je;var Ve=this.startNodeAt(j,ne);return Ve.left=je,Ve.right=this.parseMaybeAssign(),this.finishNode(Ve,"AssignmentPattern")},nr.checkLValSimple=function(j,ne,je){ne===void 0&&(ne=Ft);var Ve=ne!==Ft;switch(j.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(j.name)&&this.raiseRecoverable(j.start,(Ve?"Binding ":"Assigning to ")+j.name+" in strict mode"),Ve&&(ne===Ue&&j.name==="let"&&this.raiseRecoverable(j.start,"let is disallowed as a lexically bound name"),je&&(Le(je,j.name)&&this.raiseRecoverable(j.start,"Argument name clash"),je[j.name]=!0),ne!==tt&&this.declareName(j.name,ne,j.start));break;case"ChainExpression":this.raiseRecoverable(j.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":Ve&&this.raiseRecoverable(j.start,"Binding member expression");break;case"ParenthesizedExpression":return Ve&&this.raiseRecoverable(j.start,"Binding parenthesized expression"),this.checkLValSimple(j.expression,ne,je);default:this.raise(j.start,(Ve?"Binding":"Assigning to")+" rvalue")}},nr.checkLValPattern=function(j,ne,je){switch(ne===void 0&&(ne=Ft),j.type){case"ObjectPattern":for(var Ve=0,Ge=j.properties;Ve<Ge.length;Ve+=1){var st=Ge[Ve];this.checkLValInnerPattern(st,ne,je)}break;case"ArrayPattern":for(var ut=0,mt=j.elements;ut<mt.length;ut+=1){var yt=mt[ut];yt&&this.checkLValInnerPattern(yt,ne,je)}break;default:this.checkLValSimple(j,ne,je)}},nr.checkLValInnerPattern=function(j,ne,je){switch(ne===void 0&&(ne=Ft),j.type){case"Property":this.checkLValInnerPattern(j.value,ne,je);break;case"AssignmentPattern":this.checkLValPattern(j.left,ne,je);break;case"RestElement":this.checkLValPattern(j.argument,ne,je);break;default:this.checkLValPattern(j,ne,je)}};var ir=function(ne,je,Ve,Ge,st){this.token=ne,this.isExpr=!!je,this.preserveSpace=!!Ve,this.override=Ge,this.generator=!!st},Zt={b_stat:new ir("{",!1),b_expr:new ir("{",!0),b_tmpl:new ir("${",!1),p_stat:new ir("(",!1),p_expr:new ir("(",!0),q_tmpl:new ir("`",!0,!0,function(j){return j.tryReadTemplateToken()}),f_stat:new ir("function",!1),f_expr:new ir("function",!0),f_expr_gen:new ir("function",!0,!1,null,!0),f_gen:new ir("function",!1,!1,null,!0)},vr=rt.prototype;vr.initialContext=function(){return[Zt.b_stat]},vr.curContext=function(){return this.context[this.context.length-1]},vr.braceIsBlock=function(j){var ne=this.curContext();return ne===Zt.f_expr||ne===Zt.f_stat?!0:j===V.colon&&(ne===Zt.b_stat||ne===Zt.b_expr)?!ne.isExpr:j===V._return||j===V.name&&this.exprAllowed?te.test(this.input.slice(this.lastTokEnd,this.start)):j===V._else||j===V.semi||j===V.eof||j===V.parenR||j===V.arrow?!0:j===V.braceL?ne===Zt.b_stat:j===V._var||j===V._const||j===V.name?!1:!this.exprAllowed},vr.inGeneratorContext=function(){for(var j=this.context.length-1;j>=1;j--){var ne=this.context[j];if(ne.token==="function")return ne.generator}return!1},vr.updateContext=function(j){var ne,je=this.type;je.keyword&&j===V.dot?this.exprAllowed=!1:(ne=je.updateContext)?ne.call(this,j):this.exprAllowed=je.beforeExpr},vr.overrideContext=function(j){this.curContext()!==j&&(this.context[this.context.length-1]=j)},V.parenR.updateContext=V.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var j=this.context.pop();j===Zt.b_stat&&this.curContext().token==="function"&&(j=this.context.pop()),this.exprAllowed=!j.isExpr},V.braceL.updateContext=function(j){this.context.push(this.braceIsBlock(j)?Zt.b_stat:Zt.b_expr),this.exprAllowed=!0},V.dollarBraceL.updateContext=function(){this.context.push(Zt.b_tmpl),this.exprAllowed=!0},V.parenL.updateContext=function(j){var ne=j===V._if||j===V._for||j===V._with||j===V._while;this.context.push(ne?Zt.p_stat:Zt.p_expr),this.exprAllowed=!0},V.incDec.updateContext=function(){},V._function.updateContext=V._class.updateContext=function(j){j.beforeExpr&&j!==V._else&&!(j===V.semi&&this.curContext()!==Zt.p_stat)&&!(j===V._return&&te.test(this.input.slice(this.lastTokEnd,this.start)))&&!((j===V.colon||j===V.braceL)&&this.curContext()===Zt.b_stat)?this.context.push(Zt.f_expr):this.context.push(Zt.f_stat),this.exprAllowed=!1},V.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},V.backQuote.updateContext=function(){this.curContext()===Zt.q_tmpl?this.context.pop():this.context.push(Zt.q_tmpl),this.exprAllowed=!1},V.star.updateContext=function(j){if(j===V._function){var ne=this.context.length-1;this.context[ne]===Zt.f_expr?this.context[ne]=Zt.f_expr_gen:this.context[ne]=Zt.f_gen}this.exprAllowed=!0},V.name.updateContext=function(j){var ne=!1;this.options.ecmaVersion>=6&&j!==V.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(ne=!0),this.exprAllowed=ne};var Ht=rt.prototype;Ht.checkPropClash=function(j,ne,je){if(!(this.options.ecmaVersion>=9&&j.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(j.computed||j.method||j.shorthand))){var Ve=j.key,Ge;switch(Ve.type){case"Identifier":Ge=Ve.name;break;case"Literal":Ge=String(Ve.value);break;default:return}var st=j.kind;if(this.options.ecmaVersion>=6){Ge==="__proto__"&&st==="init"&&(ne.proto&&(je?je.doubleProto<0&&(je.doubleProto=Ve.start):this.raiseRecoverable(Ve.start,"Redefinition of __proto__ property")),ne.proto=!0);return}Ge="$"+Ge;var ut=ne[Ge];if(ut){var mt;st==="init"?mt=this.strict&&ut.init||ut.get||ut.set:mt=ut.init||ut[st],mt&&this.raiseRecoverable(Ve.start,"Redefinition of property")}else ut=ne[Ge]={init:!1,get:!1,set:!1};ut[st]=!0}},Ht.parseExpression=function(j,ne){var je=this.start,Ve=this.startLoc,Ge=this.parseMaybeAssign(j,ne);if(this.type===V.comma){var st=this.startNodeAt(je,Ve);for(st.expressions=[Ge];this.eat(V.comma);)st.expressions.push(this.parseMaybeAssign(j,ne));return this.finishNode(st,"SequenceExpression")}return Ge},Ht.parseMaybeAssign=function(j,ne,je){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(j);this.exprAllowed=!1}var Ve=!1,Ge=-1,st=-1,ut=-1;ne?(Ge=ne.parenthesizedAssign,st=ne.trailingComma,ut=ne.doubleProto,ne.parenthesizedAssign=ne.trailingComma=-1):(ne=new Xt,Ve=!0);var mt=this.start,yt=this.startLoc;(this.type===V.parenL||this.type===V.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=j==="await");var zt=this.parseMaybeConditional(j,ne);if(je&&(zt=je.call(this,zt,mt,yt)),this.type.isAssign){var Ut=this.startNodeAt(mt,yt);return Ut.operator=this.value,this.type===V.eq&&(zt=this.toAssignable(zt,!1,ne)),Ve||(ne.parenthesizedAssign=ne.trailingComma=ne.doubleProto=-1),ne.shorthandAssign>=zt.start&&(ne.shorthandAssign=-1),this.type===V.eq?this.checkLValPattern(zt):this.checkLValSimple(zt),Ut.left=zt,this.next(),Ut.right=this.parseMaybeAssign(j),ut>-1&&(ne.doubleProto=ut),this.finishNode(Ut,"AssignmentExpression")}else Ve&&this.checkExpressionErrors(ne,!0);return Ge>-1&&(ne.parenthesizedAssign=Ge),st>-1&&(ne.trailingComma=st),zt},Ht.parseMaybeConditional=function(j,ne){var je=this.start,Ve=this.startLoc,Ge=this.parseExprOps(j,ne);if(this.checkExpressionErrors(ne))return Ge;if(this.eat(V.question)){var st=this.startNodeAt(je,Ve);return st.test=Ge,st.consequent=this.parseMaybeAssign(),this.expect(V.colon),st.alternate=this.parseMaybeAssign(j),this.finishNode(st,"ConditionalExpression")}return Ge},Ht.parseExprOps=function(j,ne){var je=this.start,Ve=this.startLoc,Ge=this.parseMaybeUnary(ne,!1,!1,j);return this.checkExpressionErrors(ne)||Ge.start===je&&Ge.type==="ArrowFunctionExpression"?Ge:this.parseExprOp(Ge,je,Ve,-1,j)},Ht.parseExprOp=function(j,ne,je,Ve,Ge){var st=this.type.binop;if(st!=null&&(!Ge||this.type!==V._in)&&st>Ve){var ut=this.type===V.logicalOR||this.type===V.logicalAND,mt=this.type===V.coalesce;mt&&(st=V.logicalAND.binop);var yt=this.value;this.next();var zt=this.start,Ut=this.startLoc,er=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Ge),zt,Ut,st,Ge),pr=this.buildBinary(ne,je,j,er,yt,ut||mt);return(ut&&this.type===V.coalesce||mt&&(this.type===V.logicalOR||this.type===V.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(pr,ne,je,Ve,Ge)}return j},Ht.buildBinary=function(j,ne,je,Ve,Ge,st){Ve.type==="PrivateIdentifier"&&this.raise(Ve.start,"Private identifier can only be left side of binary expression");var ut=this.startNodeAt(j,ne);return ut.left=je,ut.operator=Ge,ut.right=Ve,this.finishNode(ut,st?"LogicalExpression":"BinaryExpression")},Ht.parseMaybeUnary=function(j,ne,je,Ve){var Ge=this.start,st=this.startLoc,ut;if(this.isContextual("await")&&this.canAwait)ut=this.parseAwait(Ve),ne=!0;else if(this.type.prefix){var mt=this.startNode(),yt=this.type===V.incDec;mt.operator=this.value,mt.prefix=!0,this.next(),mt.argument=this.parseMaybeUnary(null,!0,yt,Ve),this.checkExpressionErrors(j,!0),yt?this.checkLValSimple(mt.argument):this.strict&&mt.operator==="delete"&&Lr(mt.argument)?this.raiseRecoverable(mt.start,"Deleting local variable in strict mode"):mt.operator==="delete"&&Dr(mt.argument)?this.raiseRecoverable(mt.start,"Private fields can not be deleted"):ne=!0,ut=this.finishNode(mt,yt?"UpdateExpression":"UnaryExpression")}else if(!ne&&this.type===V.privateId)(Ve||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),ut=this.parsePrivateIdent(),this.type!==V._in&&this.unexpected();else{if(ut=this.parseExprSubscripts(j,Ve),this.checkExpressionErrors(j))return ut;for(;this.type.postfix&&!this.canInsertSemicolon();){var zt=this.startNodeAt(Ge,st);zt.operator=this.value,zt.prefix=!1,zt.argument=ut,this.checkLValSimple(ut),this.next(),ut=this.finishNode(zt,"UpdateExpression")}}if(!je&&this.eat(V.starstar))if(ne)this.unexpected(this.lastTokStart);else return this.buildBinary(Ge,st,ut,this.parseMaybeUnary(null,!1,!1,Ve),"**",!1);else return ut};function Lr(j){return j.type==="Identifier"||j.type==="ParenthesizedExpression"&&Lr(j.expression)}function Dr(j){return j.type==="MemberExpression"&&j.property.type==="PrivateIdentifier"||j.type==="ChainExpression"&&Dr(j.expression)||j.type==="ParenthesizedExpression"&&Dr(j.expression)}Ht.parseExprSubscripts=function(j,ne){var je=this.start,Ve=this.startLoc,Ge=this.parseExprAtom(j,ne);if(Ge.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Ge;var st=this.parseSubscripts(Ge,je,Ve,!1,ne);return j&&st.type==="MemberExpression"&&(j.parenthesizedAssign>=st.start&&(j.parenthesizedAssign=-1),j.parenthesizedBind>=st.start&&(j.parenthesizedBind=-1),j.trailingComma>=st.start&&(j.trailingComma=-1)),st},Ht.parseSubscripts=function(j,ne,je,Ve,Ge){for(var st=this.options.ecmaVersion>=8&&j.type==="Identifier"&&j.name==="async"&&this.lastTokEnd===j.end&&!this.canInsertSemicolon()&&j.end-j.start===5&&this.potentialArrowAt===j.start,ut=!1;;){var mt=this.parseSubscript(j,ne,je,Ve,st,ut,Ge);if(mt.optional&&(ut=!0),mt===j||mt.type==="ArrowFunctionExpression"){if(ut){var yt=this.startNodeAt(ne,je);yt.expression=mt,mt=this.finishNode(yt,"ChainExpression")}return mt}j=mt}},Ht.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(V.arrow)},Ht.parseSubscriptAsyncArrow=function(j,ne,je,Ve){return this.parseArrowExpression(this.startNodeAt(j,ne),je,!0,Ve)},Ht.parseSubscript=function(j,ne,je,Ve,Ge,st,ut){var mt=this.options.ecmaVersion>=11,yt=mt&&this.eat(V.questionDot);Ve&&yt&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var zt=this.eat(V.bracketL);if(zt||yt&&this.type!==V.parenL&&this.type!==V.backQuote||this.eat(V.dot)){var Ut=this.startNodeAt(ne,je);Ut.object=j,zt?(Ut.property=this.parseExpression(),this.expect(V.bracketR)):this.type===V.privateId&&j.type!=="Super"?Ut.property=this.parsePrivateIdent():Ut.property=this.parseIdent(this.options.allowReserved!=="never"),Ut.computed=!!zt,mt&&(Ut.optional=yt),j=this.finishNode(Ut,"MemberExpression")}else if(!Ve&&this.eat(V.parenL)){var er=new Xt,pr=this.yieldPos,wr=this.awaitPos,xr=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Vr=this.parseExprList(V.parenR,this.options.ecmaVersion>=8,!1,er);if(Ge&&!yt&&this.shouldParseAsyncArrow())return this.checkPatternErrors(er,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=pr,this.awaitPos=wr,this.awaitIdentPos=xr,this.parseSubscriptAsyncArrow(ne,je,Vr,ut);this.checkExpressionErrors(er,!0),this.yieldPos=pr||this.yieldPos,this.awaitPos=wr||this.awaitPos,this.awaitIdentPos=xr||this.awaitIdentPos;var _r=this.startNodeAt(ne,je);_r.callee=j,_r.arguments=Vr,mt&&(_r.optional=yt),j=this.finishNode(_r,"CallExpression")}else if(this.type===V.backQuote){(yt||st)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Sr=this.startNodeAt(ne,je);Sr.tag=j,Sr.quasi=this.parseTemplate({isTagged:!0}),j=this.finishNode(Sr,"TaggedTemplateExpression")}return j},Ht.parseExprAtom=function(j,ne,je){this.type===V.slash&&this.readRegexp();var Ve,Ge=this.potentialArrowAt===this.start;switch(this.type){case V._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),Ve=this.startNode(),this.next(),this.type===V.parenL&&!this.allowDirectSuper&&this.raise(Ve.start,"super() call outside constructor of a subclass"),this.type!==V.dot&&this.type!==V.bracketL&&this.type!==V.parenL&&this.unexpected(),this.finishNode(Ve,"Super");case V._this:return Ve=this.startNode(),this.next(),this.finishNode(Ve,"ThisExpression");case V.name:var st=this.start,ut=this.startLoc,mt=this.containsEsc,yt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!mt&&yt.name==="async"&&!this.canInsertSemicolon()&&this.eat(V._function))return this.overrideContext(Zt.f_expr),this.parseFunction(this.startNodeAt(st,ut),0,!1,!0,ne);if(Ge&&!this.canInsertSemicolon()){if(this.eat(V.arrow))return this.parseArrowExpression(this.startNodeAt(st,ut),[yt],!1,ne);if(this.options.ecmaVersion>=8&&yt.name==="async"&&this.type===V.name&&!mt&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return yt=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(V.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(st,ut),[yt],!0,ne)}return yt;case V.regexp:var zt=this.value;return Ve=this.parseLiteral(zt.value),Ve.regex={pattern:zt.pattern,flags:zt.flags},Ve;case V.num:case V.string:return this.parseLiteral(this.value);case V._null:case V._true:case V._false:return Ve=this.startNode(),Ve.value=this.type===V._null?null:this.type===V._true,Ve.raw=this.type.keyword,this.next(),this.finishNode(Ve,"Literal");case V.parenL:var Ut=this.start,er=this.parseParenAndDistinguishExpression(Ge,ne);return j&&(j.parenthesizedAssign<0&&!this.isSimpleAssignTarget(er)&&(j.parenthesizedAssign=Ut),j.parenthesizedBind<0&&(j.parenthesizedBind=Ut)),er;case V.bracketL:return Ve=this.startNode(),this.next(),Ve.elements=this.parseExprList(V.bracketR,!0,!0,j),this.finishNode(Ve,"ArrayExpression");case V.braceL:return this.overrideContext(Zt.b_expr),this.parseObj(!1,j);case V._function:return Ve=this.startNode(),this.next(),this.parseFunction(Ve,0);case V._class:return this.parseClass(this.startNode(),!1);case V._new:return this.parseNew();case V.backQuote:return this.parseTemplate();case V._import:return this.options.ecmaVersion>=11?this.parseExprImport(je):this.unexpected();default:return this.parseExprAtomDefault()}},Ht.parseExprAtomDefault=function(){this.unexpected()},Ht.parseExprImport=function(j){var ne=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===V.parenL&&!j)return this.parseDynamicImport(ne);if(this.type===V.dot){var je=this.startNodeAt(ne.start,ne.loc&&ne.loc.start);return je.name="import",ne.meta=this.finishNode(je,"Identifier"),this.parseImportMeta(ne)}else this.unexpected()},Ht.parseDynamicImport=function(j){if(this.next(),j.source=this.parseMaybeAssign(),!this.eat(V.parenR)){var ne=this.start;this.eat(V.comma)&&this.eat(V.parenR)?this.raiseRecoverable(ne,"Trailing comma is not allowed in import()"):this.unexpected(ne)}return this.finishNode(j,"ImportExpression")},Ht.parseImportMeta=function(j){this.next();var ne=this.containsEsc;return j.property=this.parseIdent(!0),j.property.name!=="meta"&&this.raiseRecoverable(j.property.start,"The only valid meta property for import is 'import.meta'"),ne&&this.raiseRecoverable(j.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(j.start,"Cannot use 'import.meta' outside a module"),this.finishNode(j,"MetaProperty")},Ht.parseLiteral=function(j){var ne=this.startNode();return ne.value=j,ne.raw=this.input.slice(this.start,this.end),ne.raw.charCodeAt(ne.raw.length-1)===110&&(ne.bigint=ne.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(ne,"Literal")},Ht.parseParenExpression=function(){this.expect(V.parenL);var j=this.parseExpression();return this.expect(V.parenR),j},Ht.shouldParseArrow=function(j){return!this.canInsertSemicolon()},Ht.parseParenAndDistinguishExpression=function(j,ne){var je=this.start,Ve=this.startLoc,Ge,st=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var ut=this.start,mt=this.startLoc,yt=[],zt=!0,Ut=!1,er=new Xt,pr=this.yieldPos,wr=this.awaitPos,xr;for(this.yieldPos=0,this.awaitPos=0;this.type!==V.parenR;)if(zt?zt=!1:this.expect(V.comma),st&&this.afterTrailingComma(V.parenR,!0)){Ut=!0;break}else if(this.type===V.ellipsis){xr=this.start,yt.push(this.parseParenItem(this.parseRestBinding())),this.type===V.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else yt.push(this.parseMaybeAssign(!1,er,this.parseParenItem));var Vr=this.lastTokEnd,_r=this.lastTokEndLoc;if(this.expect(V.parenR),j&&this.shouldParseArrow(yt)&&this.eat(V.arrow))return this.checkPatternErrors(er,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=pr,this.awaitPos=wr,this.parseParenArrowList(je,Ve,yt,ne);(!yt.length||Ut)&&this.unexpected(this.lastTokStart),xr&&this.unexpected(xr),this.checkExpressionErrors(er,!0),this.yieldPos=pr||this.yieldPos,this.awaitPos=wr||this.awaitPos,yt.length>1?(Ge=this.startNodeAt(ut,mt),Ge.expressions=yt,this.finishNodeAt(Ge,"SequenceExpression",Vr,_r)):Ge=yt[0]}else Ge=this.parseParenExpression();if(this.options.preserveParens){var Sr=this.startNodeAt(je,Ve);return Sr.expression=Ge,this.finishNode(Sr,"ParenthesizedExpression")}else return Ge},Ht.parseParenItem=function(j){return j},Ht.parseParenArrowList=function(j,ne,je,Ve){return this.parseArrowExpression(this.startNodeAt(j,ne),je,!1,Ve)};var mn=[];Ht.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var j=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===V.dot){var ne=this.startNodeAt(j.start,j.loc&&j.loc.start);ne.name="new",j.meta=this.finishNode(ne,"Identifier"),this.next();var je=this.containsEsc;return j.property=this.parseIdent(!0),j.property.name!=="target"&&this.raiseRecoverable(j.property.start,"The only valid meta property for new is 'new.target'"),je&&this.raiseRecoverable(j.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(j.start,"'new.target' can only be used in functions and class static block"),this.finishNode(j,"MetaProperty")}var Ve=this.start,Ge=this.startLoc;return j.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Ve,Ge,!0,!1),this.eat(V.parenL)?j.arguments=this.parseExprList(V.parenR,this.options.ecmaVersion>=8,!1):j.arguments=mn,this.finishNode(j,"NewExpression")},Ht.parseTemplateElement=function(j){var ne=j.isTagged,je=this.startNode();return this.type===V.invalidTemplate?(ne||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),je.value={raw:this.value.replace(/\r\n?/g,`
975
976
  `),cooked:null}):je.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "randmarcomps",
3
3
  "private": false,
4
- "version": "1.218.0",
4
+ "version": "1.219.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [