randmarcomps 1.134.0 → 1.136.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.
package/dist/randmarcomps.js
CHANGED
|
@@ -38500,8 +38500,8 @@ function ChatMessages({ messages: t, currentUserId: e, loading: n, isAssistantCh
|
|
|
38500
38500
|
n && /* @__PURE__ */ jsx(SkeletonMessage, {}),
|
|
38501
38501
|
t.length === 0 && !n && !i && /* @__PURE__ */ jsx("div", { className: "text-center text-muted-foreground py-8", children: "No messages yet" }),
|
|
38502
38502
|
t.length === 0 && !n && i && /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
|
|
38503
|
-
"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers.
|
|
38504
|
-
/* @__PURE__ */ jsx("strong", { children: 'Try it now, type "my open orders"!' })
|
|
38503
|
+
/* @__PURE__ */ jsx("p", { children: "The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers." }),
|
|
38504
|
+
/* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("strong", { children: 'Try it now, type "my open orders"!' }) })
|
|
38505
38505
|
] })
|
|
38506
38506
|
] });
|
|
38507
38507
|
}
|
|
@@ -50240,10 +50240,7 @@ function useAIAssistant({ userId: t, apiKey: e }) {
|
|
|
50240
50240
|
config: {
|
|
50241
50241
|
systemInstruction: b,
|
|
50242
50242
|
maxOutputTokens: 4096,
|
|
50243
|
-
tools: m.length > 0 ? [{ functionDeclarations: m.map(({ declaration: N }) => N) }] : []
|
|
50244
|
-
thinkingConfig: {
|
|
50245
|
-
thinkingBudget: 2048
|
|
50246
|
-
}
|
|
50243
|
+
tools: m.length > 0 ? [{ functionDeclarations: m.map(({ declaration: N }) => N) }] : []
|
|
50247
50244
|
}
|
|
50248
50245
|
});
|
|
50249
50246
|
l(R);
|
|
@@ -54760,7 +54757,7 @@ function SalesOverviewData({
|
|
|
54760
54757
|
icon: /* @__PURE__ */ jsx(Calendar, { className: "h-5 w-5 text-white" }),
|
|
54761
54758
|
color: "bg-emerald-500"
|
|
54762
54759
|
}
|
|
54763
|
-
], o = e.sort((l, u) => (l.Day || 0) - (u.Day || 0)).map((l) => {
|
|
54760
|
+
], o = [...e].sort((l, u) => (l.Day || 0) - (u.Day || 0)).map((l) => {
|
|
54764
54761
|
var m;
|
|
54765
54762
|
const u = ((m = l.Day) == null ? void 0 : m.toString()) || "", d = u.substring(4, 6), f = u.substring(6, 8);
|
|
54766
54763
|
return {
|
|
@@ -659,7 +659,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
659
659
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
660
660
|
* @license MIT
|
|
661
661
|
*/var isBuffer_1,hasRequiredIsBuffer;function requireIsBuffer(){if(hasRequiredIsBuffer)return isBuffer_1;hasRequiredIsBuffer=1,isBuffer_1=function(n){return n!=null&&(t(n)||e(n)||!!n._isBuffer)};function t(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function e(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&t(n.slice(0,0))}return isBuffer_1}var hasRequiredMd5;function requireMd5(){return hasRequiredMd5||(hasRequiredMd5=1,function(){var t=requireCrypt(),e=requireCharenc().utf8,n=requireIsBuffer(),i=requireCharenc().bin,o=function(l,u){l.constructor==String?u&&u.encoding==="binary"?l=i.stringToBytes(l):l=e.stringToBytes(l):n(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var d=t.bytesToWords(l),f=l.length*8,p=1732584193,m=-271733879,g=-1732584194,b=271733878,_=0;_<d.length;_++)d[_]=(d[_]<<8|d[_]>>>24)&16711935|(d[_]<<24|d[_]>>>8)&4278255360;d[f>>>5]|=128<<f%32,d[(f+64>>>9<<4)+14]=f;for(var C=o._ff,R=o._gg,S=o._hh,E=o._ii,_=0;_<d.length;_+=16){var A=p,I=m,M=g,T=b;p=C(p,m,g,b,d[_+0],7,-680876936),b=C(b,p,m,g,d[_+1],12,-389564586),g=C(g,b,p,m,d[_+2],17,606105819),m=C(m,g,b,p,d[_+3],22,-1044525330),p=C(p,m,g,b,d[_+4],7,-176418897),b=C(b,p,m,g,d[_+5],12,1200080426),g=C(g,b,p,m,d[_+6],17,-1473231341),m=C(m,g,b,p,d[_+7],22,-45705983),p=C(p,m,g,b,d[_+8],7,1770035416),b=C(b,p,m,g,d[_+9],12,-1958414417),g=C(g,b,p,m,d[_+10],17,-42063),m=C(m,g,b,p,d[_+11],22,-1990404162),p=C(p,m,g,b,d[_+12],7,1804603682),b=C(b,p,m,g,d[_+13],12,-40341101),g=C(g,b,p,m,d[_+14],17,-1502002290),m=C(m,g,b,p,d[_+15],22,1236535329),p=R(p,m,g,b,d[_+1],5,-165796510),b=R(b,p,m,g,d[_+6],9,-1069501632),g=R(g,b,p,m,d[_+11],14,643717713),m=R(m,g,b,p,d[_+0],20,-373897302),p=R(p,m,g,b,d[_+5],5,-701558691),b=R(b,p,m,g,d[_+10],9,38016083),g=R(g,b,p,m,d[_+15],14,-660478335),m=R(m,g,b,p,d[_+4],20,-405537848),p=R(p,m,g,b,d[_+9],5,568446438),b=R(b,p,m,g,d[_+14],9,-1019803690),g=R(g,b,p,m,d[_+3],14,-187363961),m=R(m,g,b,p,d[_+8],20,1163531501),p=R(p,m,g,b,d[_+13],5,-1444681467),b=R(b,p,m,g,d[_+2],9,-51403784),g=R(g,b,p,m,d[_+7],14,1735328473),m=R(m,g,b,p,d[_+12],20,-1926607734),p=S(p,m,g,b,d[_+5],4,-378558),b=S(b,p,m,g,d[_+8],11,-2022574463),g=S(g,b,p,m,d[_+11],16,1839030562),m=S(m,g,b,p,d[_+14],23,-35309556),p=S(p,m,g,b,d[_+1],4,-1530992060),b=S(b,p,m,g,d[_+4],11,1272893353),g=S(g,b,p,m,d[_+7],16,-155497632),m=S(m,g,b,p,d[_+10],23,-1094730640),p=S(p,m,g,b,d[_+13],4,681279174),b=S(b,p,m,g,d[_+0],11,-358537222),g=S(g,b,p,m,d[_+3],16,-722521979),m=S(m,g,b,p,d[_+6],23,76029189),p=S(p,m,g,b,d[_+9],4,-640364487),b=S(b,p,m,g,d[_+12],11,-421815835),g=S(g,b,p,m,d[_+15],16,530742520),m=S(m,g,b,p,d[_+2],23,-995338651),p=E(p,m,g,b,d[_+0],6,-198630844),b=E(b,p,m,g,d[_+7],10,1126891415),g=E(g,b,p,m,d[_+14],15,-1416354905),m=E(m,g,b,p,d[_+5],21,-57434055),p=E(p,m,g,b,d[_+12],6,1700485571),b=E(b,p,m,g,d[_+3],10,-1894986606),g=E(g,b,p,m,d[_+10],15,-1051523),m=E(m,g,b,p,d[_+1],21,-2054922799),p=E(p,m,g,b,d[_+8],6,1873313359),b=E(b,p,m,g,d[_+15],10,-30611744),g=E(g,b,p,m,d[_+6],15,-1560198380),m=E(m,g,b,p,d[_+13],21,1309151649),p=E(p,m,g,b,d[_+4],6,-145523070),b=E(b,p,m,g,d[_+11],10,-1120210379),g=E(g,b,p,m,d[_+2],15,718787259),m=E(m,g,b,p,d[_+9],21,-343485551),p=p+A>>>0,m=m+I>>>0,g=g+M>>>0,b=b+T>>>0}return t.endian([p,m,g,b])};o._ff=function(l,u,d,f,p,m,g){var b=l+(u&d|~u&f)+(p>>>0)+g;return(b<<m|b>>>32-m)+u},o._gg=function(l,u,d,f,p,m,g){var b=l+(u&f|d&~f)+(p>>>0)+g;return(b<<m|b>>>32-m)+u},o._hh=function(l,u,d,f,p,m,g){var b=l+(u^d^f)+(p>>>0)+g;return(b<<m|b>>>32-m)+u},o._ii=function(l,u,d,f,p,m,g){var b=l+(d^(u|~f))+(p>>>0)+g;return(b<<m|b>>>32-m)+u},o._blocksize=16,o._digestsize=16,md5$1.exports=function(l,u){if(l==null)throw new Error("Illegal argument "+l);var d=t.wordsToBytes(o(l,u));return u&&u.asBytes?d:u&&u.asString?i.bytesToString(d):t.bytesToHex(d)}}()),md5$1.exports}var md5Exports=requireMd5();const md5=getDefaultExportFromCjs(md5Exports),constructFromSymbol=Symbol.for("constructDateFrom");function constructFrom(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&constructFromSymbol in t?t[constructFromSymbol](e):t instanceof Date?new t.constructor(e):new Date(e)}function toDate(t,e){return constructFrom(t,t)}function addDays(t,e,n){const i=toDate(t);return isNaN(e)?constructFrom(t,NaN):(i.setDate(i.getDate()+e),i)}function normalizeDates(t,...e){const n=constructFrom.bind(null,e.find(i=>typeof i=="object"));return e.map(n)}function startOfDay(t,e){const n=toDate(t);return n.setHours(0,0,0,0),n}function constructNow(t){return constructFrom(t,Date.now())}function isSameDay(t,e,n){const[i,o]=normalizeDates(n==null?void 0:n.in,t,e);return+startOfDay(i)==+startOfDay(o)}function isToday(t,e){return isSameDay(constructFrom(t,t),constructNow(t))}function subDays(t,e,n){return addDays(t,-1)}function isYesterday(t,e){return isSameDay(constructFrom(t,t),subDays(constructNow(t)))}var lib$3={},htmlToDom={},domparser={},utilities$2={},lib$2={},lib$1={},hasRequiredLib$3;function requireLib$3(){return hasRequiredLib$3||(hasRequiredLib$3=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0;var e;(function(i){i.Root="root",i.Text="text",i.Directive="directive",i.Comment="comment",i.Script="script",i.Style="style",i.Tag="tag",i.CDATA="cdata",i.Doctype="doctype"})(e=t.ElementType||(t.ElementType={}));function n(i){return i.type===e.Tag||i.type===e.Script||i.type===e.Style}t.isTag=n,t.Root=e.Root,t.Text=e.Text,t.Directive=e.Directive,t.Comment=e.Comment,t.Script=e.Script,t.Style=e.Style,t.Tag=e.Tag,t.CDATA=e.CDATA,t.Doctype=e.Doctype}(lib$1)),lib$1}var node={},hasRequiredNode;function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var t=node&&node.__extends||function(){var T=function(N,O){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(j,D){j.__proto__=D}||function(j,D){for(var B in D)Object.prototype.hasOwnProperty.call(D,B)&&(j[B]=D[B])},T(N,O)};return function(N,O){if(typeof O!="function"&&O!==null)throw new TypeError("Class extends value "+String(O)+" is not a constructor or null");T(N,O);function j(){this.constructor=N}N.prototype=O===null?Object.create(O):(j.prototype=O.prototype,new j)}}(),e=node&&node.__assign||function(){return e=Object.assign||function(T){for(var N,O=1,j=arguments.length;O<j;O++){N=arguments[O];for(var D in N)Object.prototype.hasOwnProperty.call(N,D)&&(T[D]=N[D])}return T},e.apply(this,arguments)};Object.defineProperty(node,"__esModule",{value:!0}),node.cloneNode=node.hasChildren=node.isDocument=node.isDirective=node.isComment=node.isText=node.isCDATA=node.isTag=node.Element=node.Document=node.CDATA=node.NodeWithChildren=node.ProcessingInstruction=node.Comment=node.Text=node.DataNode=node.Node=void 0;var n=requireLib$3(),i=function(){function T(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(T.prototype,"parentNode",{get:function(){return this.parent},set:function(N){this.parent=N},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"previousSibling",{get:function(){return this.prev},set:function(N){this.prev=N},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"nextSibling",{get:function(){return this.next},set:function(N){this.next=N},enumerable:!1,configurable:!0}),T.prototype.cloneNode=function(N){return N===void 0&&(N=!1),I(this,N)},T}();node.Node=i;var o=function(T){t(N,T);function N(O){var j=T.call(this)||this;return j.data=O,j}return Object.defineProperty(N.prototype,"nodeValue",{get:function(){return this.data},set:function(O){this.data=O},enumerable:!1,configurable:!0}),N}(i);node.DataNode=o;var l=function(T){t(N,T);function N(){var O=T!==null&&T.apply(this,arguments)||this;return O.type=n.ElementType.Text,O}return Object.defineProperty(N.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),N}(o);node.Text=l;var u=function(T){t(N,T);function N(){var O=T!==null&&T.apply(this,arguments)||this;return O.type=n.ElementType.Comment,O}return Object.defineProperty(N.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),N}(o);node.Comment=u;var d=function(T){t(N,T);function N(O,j){var D=T.call(this,j)||this;return D.name=O,D.type=n.ElementType.Directive,D}return Object.defineProperty(N.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),N}(o);node.ProcessingInstruction=d;var f=function(T){t(N,T);function N(O){var j=T.call(this)||this;return j.children=O,j}return Object.defineProperty(N.prototype,"firstChild",{get:function(){var O;return(O=this.children[0])!==null&&O!==void 0?O:null},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"childNodes",{get:function(){return this.children},set:function(O){this.children=O},enumerable:!1,configurable:!0}),N}(i);node.NodeWithChildren=f;var p=function(T){t(N,T);function N(){var O=T!==null&&T.apply(this,arguments)||this;return O.type=n.ElementType.CDATA,O}return Object.defineProperty(N.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),N}(f);node.CDATA=p;var m=function(T){t(N,T);function N(){var O=T!==null&&T.apply(this,arguments)||this;return O.type=n.ElementType.Root,O}return Object.defineProperty(N.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),N}(f);node.Document=m;var g=function(T){t(N,T);function N(O,j,D,B){D===void 0&&(D=[]),B===void 0&&(B=O==="script"?n.ElementType.Script:O==="style"?n.ElementType.Style:n.ElementType.Tag);var V=T.call(this,D)||this;return V.name=O,V.attribs=j,V.type=B,V}return Object.defineProperty(N.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"tagName",{get:function(){return this.name},set:function(O){this.name=O},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"attributes",{get:function(){var O=this;return Object.keys(this.attribs).map(function(j){var D,B;return{name:j,value:O.attribs[j],namespace:(D=O["x-attribsNamespace"])===null||D===void 0?void 0:D[j],prefix:(B=O["x-attribsPrefix"])===null||B===void 0?void 0:B[j]}})},enumerable:!1,configurable:!0}),N}(f);node.Element=g;function b(T){return(0,n.isTag)(T)}node.isTag=b;function _(T){return T.type===n.ElementType.CDATA}node.isCDATA=_;function C(T){return T.type===n.ElementType.Text}node.isText=C;function R(T){return T.type===n.ElementType.Comment}node.isComment=R;function S(T){return T.type===n.ElementType.Directive}node.isDirective=S;function E(T){return T.type===n.ElementType.Root}node.isDocument=E;function A(T){return Object.prototype.hasOwnProperty.call(T,"children")}node.hasChildren=A;function I(T,N){N===void 0&&(N=!1);var O;if(C(T))O=new l(T.data);else if(R(T))O=new u(T.data);else if(b(T)){var j=N?M(T.children):[],D=new g(T.name,e({},T.attribs),j);j.forEach(function(L){return L.parent=D}),T.namespace!=null&&(D.namespace=T.namespace),T["x-attribsNamespace"]&&(D["x-attribsNamespace"]=e({},T["x-attribsNamespace"])),T["x-attribsPrefix"]&&(D["x-attribsPrefix"]=e({},T["x-attribsPrefix"])),O=D}else if(_(T)){var j=N?M(T.children):[],B=new p(j);j.forEach(function(q){return q.parent=B}),O=B}else if(E(T)){var j=N?M(T.children):[],V=new m(j);j.forEach(function(q){return q.parent=V}),T["x-mode"]&&(V["x-mode"]=T["x-mode"]),O=V}else if(S(T)){var F=new d(T.name,T.data);T["x-name"]!=null&&(F["x-name"]=T["x-name"],F["x-publicId"]=T["x-publicId"],F["x-systemId"]=T["x-systemId"]),O=F}else throw new Error("Not implemented yet: ".concat(T.type));return O.startIndex=T.startIndex,O.endIndex=T.endIndex,T.sourceCodeLocation!=null&&(O.sourceCodeLocation=T.sourceCodeLocation),O}node.cloneNode=I;function M(T){for(var N=T.map(function(j){return I(j,!0)}),O=1;O<N.length;O++)N[O].prev=N[O-1],N[O-1].next=N[O];return N}return node}var hasRequiredLib$2;function requireLib$2(){return hasRequiredLib$2||(hasRequiredLib$2=1,function(t){var e=lib$2&&lib$2.__createBinding||(Object.create?function(d,f,p,m){m===void 0&&(m=p);var g=Object.getOwnPropertyDescriptor(f,p);(!g||("get"in g?!f.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return f[p]}}),Object.defineProperty(d,m,g)}:function(d,f,p,m){m===void 0&&(m=p),d[m]=f[p]}),n=lib$2&&lib$2.__exportStar||function(d,f){for(var p in d)p!=="default"&&!Object.prototype.hasOwnProperty.call(f,p)&&e(f,d,p)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var i=requireLib$3(),o=requireNode();n(requireNode(),t);var l={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},u=function(){function d(f,p,m){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof p=="function"&&(m=p,p=l),typeof f=="object"&&(p=f,f=void 0),this.callback=f??null,this.options=p??l,this.elementCB=m??null}return d.prototype.onparserinit=function(f){this.parser=f},d.prototype.onreset=function(){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},d.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},d.prototype.onerror=function(f){this.handleCallback(f)},d.prototype.onclosetag=function(){this.lastNode=null;var f=this.tagStack.pop();this.options.withEndIndices&&(f.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(f)},d.prototype.onopentag=function(f,p){var m=this.options.xmlMode?i.ElementType.Tag:void 0,g=new o.Element(f,p,void 0,m);this.addNode(g),this.tagStack.push(g)},d.prototype.ontext=function(f){var p=this.lastNode;if(p&&p.type===i.ElementType.Text)p.data+=f,this.options.withEndIndices&&(p.endIndex=this.parser.endIndex);else{var m=new o.Text(f);this.addNode(m),this.lastNode=m}},d.prototype.oncomment=function(f){if(this.lastNode&&this.lastNode.type===i.ElementType.Comment){this.lastNode.data+=f;return}var p=new o.Comment(f);this.addNode(p),this.lastNode=p},d.prototype.oncommentend=function(){this.lastNode=null},d.prototype.oncdatastart=function(){var f=new o.Text(""),p=new o.CDATA([f]);this.addNode(p),f.parent=p,this.lastNode=f},d.prototype.oncdataend=function(){this.lastNode=null},d.prototype.onprocessinginstruction=function(f,p){var m=new o.ProcessingInstruction(f,p);this.addNode(m)},d.prototype.handleCallback=function(f){if(typeof this.callback=="function")this.callback(f,this.dom);else if(f)throw f},d.prototype.addNode=function(f){var p=this.tagStack[this.tagStack.length-1],m=p.children[p.children.length-1];this.options.withStartIndices&&(f.startIndex=this.parser.startIndex),this.options.withEndIndices&&(f.endIndex=this.parser.endIndex),p.children.push(f),m&&(f.prev=m,m.next=f),f.parent=p,this.lastNode=null},d}();t.DomHandler=u,t.default=u}(lib$2)),lib$2}var constants={},hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CARRIAGE_RETURN_PLACEHOLDER_REGEX=t.CARRIAGE_RETURN_PLACEHOLDER=t.CARRIAGE_RETURN_REGEX=t.CARRIAGE_RETURN=t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES=void 0,t.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES.reduce(function(e,n){return e[n.toLowerCase()]=n,e},{}),t.CARRIAGE_RETURN="\r",t.CARRIAGE_RETURN_REGEX=new RegExp(t.CARRIAGE_RETURN,"g"),t.CARRIAGE_RETURN_PLACEHOLDER="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(),"__"),t.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(t.CARRIAGE_RETURN_PLACEHOLDER,"g")}(constants)),constants}var hasRequiredUtilities$2;function requireUtilities$2(){if(hasRequiredUtilities$2)return utilities$2;hasRequiredUtilities$2=1,Object.defineProperty(utilities$2,"__esModule",{value:!0}),utilities$2.formatAttributes=i,utilities$2.escapeSpecialCharacters=l,utilities$2.revertEscapedCharacters=u,utilities$2.formatDOM=d;var t=requireLib$2(),e=requireConstants();function n(f){return e.CASE_SENSITIVE_TAG_NAMES_MAP[f]}function i(f){for(var p={},m=0,g=f.length;m<g;m++){var b=f[m];p[b.name]=b.value}return p}function o(f){f=f.toLowerCase();var p=n(f);return p||f}function l(f){return f.replace(e.CARRIAGE_RETURN_REGEX,e.CARRIAGE_RETURN_PLACEHOLDER)}function u(f){return f.replace(e.CARRIAGE_RETURN_PLACEHOLDER_REGEX,e.CARRIAGE_RETURN)}function d(f,p,m){p===void 0&&(p=null);for(var g=[],b,_=0,C=f.length;_<C;_++){var R=f[_];switch(R.nodeType){case 1:{var S=o(R.nodeName);b=new t.Element(S,i(R.attributes)),b.children=d(S==="template"?R.content.childNodes:R.childNodes,b);break}case 3:b=new t.Text(u(R.nodeValue));break;case 8:b=new t.Comment(R.nodeValue);break;default:continue}var E=g[_-1]||null;E&&(E.next=b),b.parent=p,b.prev=E,b.next=null,g.push(b)}return m&&(b=new t.ProcessingInstruction(m.substring(0,m.indexOf(" ")).toLowerCase(),m),b.next=g[0]||null,b.parent=p,g.unshift(b),g[1]&&(g[1].prev=g[0])),g}return utilities$2}var hasRequiredDomparser;function requireDomparser(){if(hasRequiredDomparser)return domparser;hasRequiredDomparser=1,Object.defineProperty(domparser,"__esModule",{value:!0}),domparser.default=R;var t=requireUtilities$2(),e="html",n="head",i="body",o=/<([a-zA-Z]+[0-9]?)/,l=/<head[^]*>/i,u=/<body[^]*>/i,d=function(S,E){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},f=function(S,E){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},p=typeof window=="object"&&window.DOMParser;if(typeof p=="function"){var m=new p,g="text/html";f=function(S,E){return E&&(S="<".concat(E,">").concat(S,"</").concat(E,">")),m.parseFromString(S,g)},d=f}if(typeof document=="object"&&document.implementation){var b=document.implementation.createHTMLDocument();d=function(S,E){if(E){var A=b.documentElement.querySelector(E);return A&&(A.innerHTML=S),b}return b.documentElement.innerHTML=S,b}}var _=typeof document=="object"&&document.createElement("template"),C;_&&_.content&&(C=function(S){return _.innerHTML=S,_.content.childNodes});function R(S){var E,A;S=(0,t.escapeSpecialCharacters)(S);var I=S.match(o),M=I&&I[1]?I[1].toLowerCase():"";switch(M){case e:{var T=f(S);if(!l.test(S)){var N=T.querySelector(n);(E=N==null?void 0:N.parentNode)===null||E===void 0||E.removeChild(N)}if(!u.test(S)){var N=T.querySelector(i);(A=N==null?void 0:N.parentNode)===null||A===void 0||A.removeChild(N)}return T.querySelectorAll(e)}case n:case i:{var O=d(S).querySelectorAll(M);return u.test(S)&&l.test(S)?O[0].parentNode.childNodes:O}default:{if(C)return C(S);var N=d(S,i).querySelector(i);return N.childNodes}}}return domparser}var hasRequiredHtmlToDom;function requireHtmlToDom(){if(hasRequiredHtmlToDom)return htmlToDom;hasRequiredHtmlToDom=1;var t=htmlToDom&&htmlToDom.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(htmlToDom,"__esModule",{value:!0}),htmlToDom.default=o;var e=t(requireDomparser()),n=requireUtilities$2(),i=/<(![a-zA-Z\s]+)>/;function o(l){if(typeof l!="string")throw new TypeError("First argument must be a string");if(!l)return[];var u=l.match(i),d=u?u[1]:void 0;return(0,n.formatDOM)((0,e.default)(l),null,d)}return htmlToDom}var attributesToProps={},lib={},possibleStandardNamesOptimized={},hasRequiredPossibleStandardNamesOptimized;function requirePossibleStandardNamesOptimized(){if(hasRequiredPossibleStandardNamesOptimized)return possibleStandardNamesOptimized;hasRequiredPossibleStandardNamesOptimized=1;var t=0;possibleStandardNamesOptimized.SAME=t;var e=1;return possibleStandardNamesOptimized.CAMELCASE=e,possibleStandardNamesOptimized.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},possibleStandardNamesOptimized}var hasRequiredLib$1;function requireLib$1(){if(hasRequiredLib$1)return lib;hasRequiredLib$1=1;const t=0,e=1,n=2,i=3,o=4,l=5,u=6;function d(T){return p.hasOwnProperty(T)?p[T]:null}function f(T,N,O,j,D,B,V){this.acceptsBooleans=N===n||N===i||N===o,this.attributeName=j,this.attributeNamespace=D,this.mustUseProperty=O,this.propertyName=T,this.type=N,this.sanitizeURL=B,this.removeEmptyString=V}const p={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(T=>{p[T]=new f(T,t,!1,T,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([T,N])=>{p[T]=new f(T,e,!1,N,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(T=>{p[T]=new f(T,n,!1,T.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(T=>{p[T]=new f(T,n,!1,T,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(T=>{p[T]=new f(T,i,!1,T.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(T=>{p[T]=new f(T,i,!0,T,null,!1,!1)}),["capture","download"].forEach(T=>{p[T]=new f(T,o,!1,T,null,!1,!1)}),["cols","rows","size","span"].forEach(T=>{p[T]=new f(T,u,!1,T,null,!1,!1)}),["rowSpan","start"].forEach(T=>{p[T]=new f(T,l,!1,T.toLowerCase(),null,!1,!1)});const g=/[\-\:]([a-z])/g,b=T=>T[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(T=>{const N=T.replace(g,b);p[N]=new f(N,e,!1,T,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(T=>{const N=T.replace(g,b);p[N]=new f(N,e,!1,T,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(T=>{const N=T.replace(g,b);p[N]=new f(N,e,!1,T,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(T=>{p[T]=new f(T,e,!1,T.toLowerCase(),null,!1,!1)});const _="xlinkHref";p[_]=new f("xlinkHref",e,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(T=>{p[T]=new f(T,e,!1,T.toLowerCase(),null,!0,!0)});const{CAMELCASE:C,SAME:R,possibleStandardNames:S}=requirePossibleStandardNamesOptimized(),A=":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",I=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+A+"]*$")),M=Object.keys(S).reduce((T,N)=>{const O=S[N];return O===R?T[N]=N:O===C?T[N.toLowerCase()]=N:T[N]=O,T},{});return lib.BOOLEAN=i,lib.BOOLEANISH_STRING=n,lib.NUMERIC=l,lib.OVERLOADED_BOOLEAN=o,lib.POSITIVE_NUMERIC=u,lib.RESERVED=t,lib.STRING=e,lib.getPropertyInfo=d,lib.isCustomAttribute=I,lib.possibleStandardNames=M,lib}var utilities$1={},cjs$1={},inlineStyleParser,hasRequiredInlineStyleParser;function requireInlineStyleParser(){if(hasRequiredInlineStyleParser)return inlineStyleParser;hasRequiredInlineStyleParser=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
|
|
662
|
-
`,p="/",m="*",g="",b="comment",_="declaration";inlineStyleParser=function(R,S){if(typeof R!="string")throw new TypeError("First argument must be a string");if(!R)return[];S=S||{};var E=1,A=1;function I(L){var q=L.match(e);q&&(E+=q.length);var G=L.lastIndexOf(f);A=~G?L.length-G:A+L.length}function M(){var L={line:E,column:A};return function(q){return q.position=new T(L),j(),q}}function T(L){this.start=L,this.end={line:E,column:A},this.source=S.source}T.prototype.content=R;function N(L){var q=new Error(S.source+":"+E+":"+A+": "+L);if(q.reason=L,q.filename=S.source,q.line=E,q.column=A,q.source=R,!S.silent)throw q}function O(L){var q=L.exec(R);if(q){var G=q[0];return I(G),R=R.slice(G.length),q}}function j(){O(n)}function D(L){var q;for(L=L||[];q=B();)q!==!1&&L.push(q);return L}function B(){var L=M();if(!(p!=R.charAt(0)||m!=R.charAt(1))){for(var q=2;g!=R.charAt(q)&&(m!=R.charAt(q)||p!=R.charAt(q+1));)++q;if(q+=2,g===R.charAt(q-1))return N("End of comment missing");var G=R.slice(2,q-2);return A+=2,I(G),R=R.slice(q),A+=2,L({type:b,comment:G})}}function V(){var L=M(),q=O(i);if(q){if(B(),!O(o))return N("property missing ':'");var G=O(l),U=L({type:_,property:C(q[0].replace(t,g)),value:G?C(G[0].replace(t,g)):g});return O(u),U}}function F(){var L=[];D(L);for(var q;q=V();)q!==!1&&(L.push(q),D(L));return L}return j(),F()};function C(R){return R?R.replace(d,g):g}return inlineStyleParser}var hasRequiredCjs$1;function requireCjs$1(){if(hasRequiredCjs$1)return cjs$1;hasRequiredCjs$1=1;var t=cjs$1&&cjs$1.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(cjs$1,"__esModule",{value:!0}),cjs$1.default=n;var e=t(requireInlineStyleParser());function n(i,o){var l=null;if(!i||typeof i!="string")return l;var u=(0,e.default)(i),d=typeof o=="function";return u.forEach(function(f){if(f.type==="declaration"){var p=f.property,m=f.value;d?o(p,m,f):m&&(l=l||{},l[p]=m)}}),l}return cjs$1}var utilities={},hasRequiredUtilities$1;function requireUtilities$1(){if(hasRequiredUtilities$1)return utilities;hasRequiredUtilities$1=1,Object.defineProperty(utilities,"__esModule",{value:!0}),utilities.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,l=function(p){return!p||n.test(p)||t.test(p)},u=function(p,m){return m.toUpperCase()},d=function(p,m){return"".concat(m,"-")},f=function(p,m){return m===void 0&&(m={}),l(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(o,d):p=p.replace(i,d),p.replace(e,u))};return utilities.camelCase=f,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var t=cjs&&cjs.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},e=t(requireCjs$1()),n=requireUtilities$1();function i(o,l){var u={};return!o||typeof o!="string"||(0,e.default)(o,function(d,f){d&&f&&(u[(0,n.camelCase)(d,l)]=f)}),u}return i.default=i,cjs=i,cjs}var hasRequiredUtilities;function requireUtilities(){return hasRequiredUtilities||(hasRequiredUtilities=1,function(t){var e=utilities$1&&utilities$1.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(t,"__esModule",{value:!0}),t.returnFirstArg=t.canTextBeChildOfNode=t.ELEMENTS_WITH_NO_TEXT_CHILDREN=t.PRESERVE_CUSTOM_ATTRIBUTES=void 0,t.isCustomComponent=l,t.setStyleProp=d;var n=React,i=e(requireCjs()),o=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function l(m,g){return m.includes("-")?!o.has(m):!!(g&&typeof g.is=="string")}var u={reactCompat:!0};function d(m,g){if(typeof m=="string"){if(!m.trim()){g.style={};return}try{g.style=(0,i.default)(m,u)}catch{g.style={}}}}t.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,t.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var f=function(m){return!t.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(m.name)};t.canTextBeChildOfNode=f;var p=function(m){return m};t.returnFirstArg=p}(utilities$1)),utilities$1}var hasRequiredAttributesToProps;function requireAttributesToProps(){if(hasRequiredAttributesToProps)return attributesToProps;hasRequiredAttributesToProps=1,Object.defineProperty(attributesToProps,"__esModule",{value:!0}),attributesToProps.default=l;var t=requireLib$1(),e=requireUtilities(),n=["checked","value"],i=["input","select","textarea"],o={reset:!0,submit:!0};function l(d,f){d===void 0&&(d={});var p={},m=!!(d.type&&o[d.type]);for(var g in d){var b=d[g];if((0,t.isCustomAttribute)(g)){p[g]=b;continue}var _=g.toLowerCase(),C=u(_);if(C){var R=(0,t.getPropertyInfo)(C);switch(n.includes(C)&&i.includes(f)&&!m&&(C=u("default"+_)),p[C]=b,R&&R.type){case t.BOOLEAN:p[C]=!0;break;case t.OVERLOADED_BOOLEAN:b===""&&(p[C]=!0);break}continue}e.PRESERVE_CUSTOM_ATTRIBUTES&&(p[g]=b)}return(0,e.setStyleProp)(d.style,p),p}function u(d){return t.possibleStandardNames[d]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var t=domToReact&&domToReact.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=l;var e=React,n=t(requireAttributesToProps()),i=requireUtilities(),o={cloneElement:e.cloneElement,createElement:e.createElement,isValidElement:e.isValidElement};function l(d,f){f===void 0&&(f={});for(var p=[],m=typeof f.replace=="function",g=f.transform||i.returnFirstArg,b=f.library||o,_=b.cloneElement,C=b.createElement,R=b.isValidElement,S=d.length,E=0;E<S;E++){var A=d[E];if(m){var I=f.replace(A,E);if(R(I)){S>1&&(I=_(I,{key:I.key||E})),p.push(g(I,A,E));continue}}if(A.type==="text"){var M=!A.data.trim().length;if(M&&A.parent&&!(0,i.canTextBeChildOfNode)(A.parent)||f.trim&&M)continue;p.push(g(A.data,A,E));continue}var T=A,N={};u(T)?((0,i.setStyleProp)(T.attribs.style,T.attribs),N=T.attribs):T.attribs&&(N=(0,n.default)(T.attribs,T.name));var O=void 0;switch(A.type){case"script":case"style":A.children[0]&&(N.dangerouslySetInnerHTML={__html:A.children[0].data});break;case"tag":A.name==="textarea"&&A.children[0]?N.defaultValue=A.children[0].data:A.children&&A.children.length&&(O=l(A.children,f));break;default:continue}S>1&&(N.key=E),p.push(g(C(A.name,N,O),A,E))}return p.length===1?p[0]:p}function u(d){return i.PRESERVE_CUSTOM_ATTRIBUTES&&d.type==="tag"&&(0,i.isCustomComponent)(d.name,d.attribs)}return domToReact}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(t){var e=lib$3&&lib$3.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(t,"__esModule",{value:!0}),t.htmlToDOM=t.domToReact=t.attributesToProps=t.Text=t.ProcessingInstruction=t.Element=t.Comment=void 0,t.default=d;var n=e(requireHtmlToDom());t.htmlToDOM=n.default;var i=e(requireAttributesToProps());t.attributesToProps=i.default;var o=e(requireDomToReact());t.domToReact=o.default;var l=requireLib$2();Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return l.Comment}}),Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return l.Element}}),Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return l.ProcessingInstruction}}),Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return l.Text}});var u={lowerCaseAttributeNames:!1};function d(f,p){if(typeof f!="string")throw new TypeError("First argument must be a string");return f?(0,o.default)((0,n.default)(f,(p==null?void 0:p.htmlparser2)||u),p):[]}}(lib$3)),lib$3}var libExports=requireLib();const HTMLReactParser=getDefaultExportFromCjs(libExports),parser=HTMLReactParser.default||HTMLReactParser;function SkeletonMessage(){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:"Thinking..."})]})})]})]})}function ChatMessages({messages:t,currentUserId:e,loading:n,isAssistantChat:i}){return jsxRuntime.jsxs("div",{children:[t.map(o=>{const l=o.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",l&&"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(o.senderName+o.fromPartnerID)}&flip=${l}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[o.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const u=new Date(o.timestamp);return isToday(u)?u.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(u)?`Yesterday, ${u.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${u.toLocaleDateString([],{month:"short",day:"numeric"})} ${u.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 ",l?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:o.fromPartnerID===ASSISTANT_ID?parser(o.content):o.content})]})]},o.id)}),n&&jsxRuntime.jsx(SkeletonMessage,{}),t.length===0&&!n&&!i&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&!n&&i&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:["The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers. ",jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})]})]})}function formatProdErrorMessage$1(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var randomString=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString()}`,REPLACE:`@@redux/REPLACE${randomString()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString()}`},actionTypes_default=ActionTypes;function isPlainObject$1(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function miniKindOf(t){if(t===void 0)return"undefined";if(t===null)return"null";const e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(isDate(t))return"date";if(isError(t))return"error";const n=ctorName(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function ctorName(t){return typeof t.constructor=="function"?t.constructor.name:null}function isError(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function isDate(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function kindOf(t){let e=typeof t;return process.env.NODE_ENV!=="production"&&(e=miniKindOf(t)),e}function warning(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function getUnexpectedStateShapeWarningMessage(t,e,n,i){const o=Object.keys(e),l=n&&n.type===actionTypes_default.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(o.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!isPlainObject$1(t))return`The ${l} has unexpected type of "${kindOf(t)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;const u=Object.keys(t).filter(d=>!e.hasOwnProperty(d)&&!i[d]);if(u.forEach(d=>{i[d]=!0}),!(n&&n.type===actionTypes_default.REPLACE)&&u.length>0)return`Unexpected ${u.length>1?"keys":"key"} "${u.join('", "')}" found in ${l}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`}function assertReducerShape(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(12):`The slice reducer for key "${e}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(13):`The slice reducer for key "${e}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function combineReducers(t){const e=Object.keys(t),n={};for(let u=0;u<e.length;u++){const d=e[u];process.env.NODE_ENV!=="production"&&typeof t[d]>"u"&&warning(`No reducer provided for key "${d}"`),typeof t[d]=="function"&&(n[d]=t[d])}const i=Object.keys(n);let o;process.env.NODE_ENV!=="production"&&(o={});let l;try{assertReducerShape(n)}catch(u){l=u}return function(d={},f){if(l)throw l;if(process.env.NODE_ENV!=="production"){const g=getUnexpectedStateShapeWarningMessage(d,n,f,o);g&&warning(g)}let p=!1;const m={};for(let g=0;g<i.length;g++){const b=i[g],_=n[b],C=d[b],R=_(C,f);if(typeof R>"u"){const S=f&&f.type;throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(14):`When called with an action of type ${S?`"${String(S)}"`:"(unknown type)"}, the slice reducer for key "${b}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}m[b]=R,p=p||R!==C}return p=p||i.length!==Object.keys(d).length,p?m:d}}function isAction(t){return isPlainObject$1(t)&&"type"in t&&typeof t.type=="string"}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state"),errors=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function die(t,...e){if(process.env.NODE_ENV!=="production"){const n=errors[t],i=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf=Object.getPrototypeOf;function isDraft(t){return!!t&&!!t[DRAFT_STATE]}function isDraftable(t){var e;return t?isPlainObject(t)||Array.isArray(t)||!!t[DRAFTABLE]||!!((e=t.constructor)!=null&&e[DRAFTABLE])||isMap(t)||isSet(t):!1}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject(t){if(!t||typeof t!="object")return!1;const e=getPrototypeOf(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===objectCtorString}function original(t){return isDraft(t)||die(15,t),t[DRAFT_STATE].base_}function each(t,e){getArchtype(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,i)=>e(i,n,t))}function getArchtype(t){const e=t[DRAFT_STATE];return e?e.type_:Array.isArray(t)?1:isMap(t)?2:isSet(t)?3:0}function has(t,e){return getArchtype(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function get(t,e){return getArchtype(t)===2?t.get(e):t[e]}function set(t,e,n){const i=getArchtype(t);i===2?t.set(e,n):i===3?t.add(n):t[e]=n}function is$1(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function isMap(t){return t instanceof Map}function isSet(t){return t instanceof Set}function latest(t){return t.copy_||t.base_}function shallowCopy(t,e){if(isMap(t))return new Map(t);if(isSet(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=isPlainObject(t);if(e===!0||e==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[DRAFT_STATE];let o=Reflect.ownKeys(i);for(let l=0;l<o.length;l++){const u=o[l],d=i[u];d.writable===!1&&(d.writable=!0,d.configurable=!0),(d.get||d.set)&&(i[u]={configurable:!0,writable:!0,enumerable:d.enumerable,value:t[u]})}return Object.create(getPrototypeOf(t),i)}else{const i=getPrototypeOf(t);if(i!==null&&n)return{...t};const o=Object.create(i);return Object.assign(o,t)}}function freeze(t,e=!1){return isFrozen(t)||isDraft(t)||!isDraftable(t)||(getArchtype(t)>1&&(t.set=t.add=t.clear=t.delete=dontMutateFrozenCollections),Object.freeze(t),e&&Object.entries(t).forEach(([n,i])=>freeze(i,!0))),t}function dontMutateFrozenCollections(){die(2)}function isFrozen(t){return Object.isFrozen(t)}var plugins={};function getPlugin(t){const e=plugins[t];return e||die(0,t),e}function loadPlugin(t,e){plugins[t]||(plugins[t]=e)}var currentScope;function getCurrentScope(){return currentScope}function createScope(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(t,e){e&&(getPlugin("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function revokeScope(t){leaveScope(t),t.drafts_.forEach(revokeDraft),t.drafts_=null}function leaveScope(t){t===currentScope&&(currentScope=t.parent_)}function enterScope(t){return currentScope=createScope(currentScope,t)}function revokeDraft(t){const e=t[DRAFT_STATE];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function processResult(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[DRAFT_STATE].modified_&&(revokeScope(e),die(4)),isDraftable(t)&&(t=finalize(e,t),e.parent_||maybeFreeze(e,t)),e.patches_&&getPlugin("Patches").generateReplacementPatches_(n[DRAFT_STATE].base_,t,e.patches_,e.inversePatches_)):t=finalize(e,n,[]),revokeScope(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==NOTHING?t:void 0}function finalize(t,e,n){if(isFrozen(e))return e;const i=e[DRAFT_STATE];if(!i)return each(e,(o,l)=>finalizeProperty(t,i,e,o,l,n)),e;if(i.scope_!==t)return e;if(!i.modified_)return maybeFreeze(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const o=i.copy_;let l=o,u=!1;i.type_===3&&(l=new Set(o),o.clear(),u=!0),each(l,(d,f)=>finalizeProperty(t,i,o,d,f,n,u)),maybeFreeze(t,o,!1),n&&t.patches_&&getPlugin("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function finalizeProperty(t,e,n,i,o,l,u){if(process.env.NODE_ENV!=="production"&&o===n&&die(5),isDraft(o)){const d=l&&e&&e.type_!==3&&!has(e.assigned_,i)?l.concat(i):void 0,f=finalize(t,o,d);if(set(n,i,f),isDraft(f))t.canAutoFreeze_=!1;else return}else u&&n.add(o);if(isDraftable(o)&&!isFrozen(o)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;finalize(t,o),(!e||!e.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&maybeFreeze(t,o)}}function maybeFreeze(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&freeze(e,n)}function createProxyProxy(t,e){const n=Array.isArray(t),i={type_:n?1:0,scope_:e?e.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=i,l=objectTraps;n&&(o=[i],l=arrayTraps);const{revoke:u,proxy:d}=Proxy.revocable(o,l);return i.draft_=d,i.revoke_=u,d}var objectTraps={get(t,e){if(e===DRAFT_STATE)return t;const n=latest(t);if(!has(n,e))return readPropFromProto(t,n,e);const i=n[e];return t.finalized_||!isDraftable(i)?i:i===peek(t.base_,e)?(prepareCopy(t),t.copy_[e]=createProxy(i,t)):i},has(t,e){return e in latest(t)},ownKeys(t){return Reflect.ownKeys(latest(t))},set(t,e,n){const i=getDescriptorFromProto(latest(t),e);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const o=peek(latest(t),e),l=o==null?void 0:o[DRAFT_STATE];if(l&&l.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(is$1(n,o)&&(n!==void 0||has(t.base_,e)))return!0;prepareCopy(t),markChanged(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return peek(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,prepareCopy(t),markChanged(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=latest(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:i.enumerable,value:n[e]}},defineProperty(){die(11)},getPrototypeOf(t){return getPrototypeOf(t.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(t,e)=>{arrayTraps[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),arrayTraps.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&die(13),arrayTraps.set.call(this,t,e,void 0)},arrayTraps.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&die(14),objectTraps.set.call(this,t[0],e,n,t[0])};function peek(t,e){const n=t[DRAFT_STATE];return(n?latest(n):t)[e]}function readPropFromProto(t,e,n){var o;const i=getDescriptorFromProto(e,n);return i?"value"in i?i.value:(o=i.get)==null?void 0:o.call(t.draft_):void 0}function getDescriptorFromProto(t,e){if(!(e in t))return;let n=getPrototypeOf(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=getPrototypeOf(n)}}function markChanged(t){t.modified_||(t.modified_=!0,t.parent_&&markChanged(t.parent_))}function prepareCopy(t){t.copy_||(t.copy_=shallowCopy(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,i)=>{if(typeof e=="function"&&typeof n!="function"){const l=n;n=e;const u=this;return function(f=l,...p){return u.produce(f,m=>n.call(this,m,...p))}}typeof n!="function"&&die(6),i!==void 0&&typeof i!="function"&&die(7);let o;if(isDraftable(e)){const l=enterScope(this),u=createProxy(e,void 0);let d=!0;try{o=n(u),d=!1}finally{d?revokeScope(l):leaveScope(l)}return usePatchesInScope(l,i),processResult(o,l)}else if(!e||typeof e!="object"){if(o=n(e),o===void 0&&(o=e),o===NOTHING&&(o=void 0),this.autoFreeze_&&freeze(o,!0),i){const l=[],u=[];getPlugin("Patches").generateReplacementPatches_(e,o,l,u),i(l,u)}return o}else die(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(u,...d)=>this.produceWithPatches(u,f=>e(f,...d));let i,o;return[this.produce(e,n,(u,d)=>{i=u,o=d}),i,o]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){isDraftable(t)||die(8),isDraft(t)&&(t=current(t));const e=enterScope(this),n=createProxy(t,void 0);return n[DRAFT_STATE].isManual_=!0,leaveScope(e),n}finishDraft(t,e){const n=t&&t[DRAFT_STATE];(!n||!n.isManual_)&&die(9);const{scope_:i}=n;return usePatchesInScope(i,e),processResult(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const o=e[n];if(o.path.length===0&&o.op==="replace"){t=o.value;break}}n>-1&&(e=e.slice(n+1));const i=getPlugin("Patches").applyPatches_;return isDraft(t)?i(t,e):this.produce(t,o=>i(o,e))}};function createProxy(t,e){const n=isMap(t)?getPlugin("MapSet").proxyMap_(t,e):isSet(t)?getPlugin("MapSet").proxySet_(t,e):createProxyProxy(t,e);return(e?e.scope_:getCurrentScope()).drafts_.push(n),n}function current(t){return isDraft(t)||die(10,t),currentImpl(t)}function currentImpl(t){if(!isDraftable(t)||isFrozen(t))return t;const e=t[DRAFT_STATE];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=shallowCopy(t,e.scope_.immer_.useStrictShallowCopy_)}else n=shallowCopy(t,!0);return each(n,(i,o)=>{set(n,i,currentImpl(o))}),e&&(e.finalized_=!1),n}function enablePatches(){process.env.NODE_ENV!=="production"&&errors.push('Sets cannot have "replace" patches.',function(b){return"Unsupported patch operation: "+b},function(b){return"Cannot apply patch, path doesn't resolve: "+b},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const e="replace",n="add",i="remove";function o(b,_,C,R){switch(b.type_){case 0:case 2:return u(b,_,C,R);case 1:return l(b,_,C,R);case 3:return d(b,_,C,R)}}function l(b,_,C,R){let{base_:S,assigned_:E}=b,A=b.copy_;A.length<S.length&&([S,A]=[A,S],[C,R]=[R,C]);for(let I=0;I<S.length;I++)if(E[I]&&A[I]!==S[I]){const M=_.concat([I]);C.push({op:e,path:M,value:g(A[I])}),R.push({op:e,path:M,value:g(S[I])})}for(let I=S.length;I<A.length;I++){const M=_.concat([I]);C.push({op:n,path:M,value:g(A[I])})}for(let I=A.length-1;S.length<=I;--I){const M=_.concat([I]);R.push({op:i,path:M})}}function u(b,_,C,R){const{base_:S,copy_:E}=b;each(b.assigned_,(A,I)=>{const M=get(S,A),T=get(E,A),N=I?has(S,A)?e:n:i;if(M===T&&N===e)return;const O=_.concat(A);C.push(N===i?{op:N,path:O}:{op:N,path:O,value:T}),R.push(N===n?{op:i,path:O}:N===i?{op:n,path:O,value:g(M)}:{op:e,path:O,value:g(M)})})}function d(b,_,C,R){let{base_:S,copy_:E}=b,A=0;S.forEach(I=>{if(!E.has(I)){const M=_.concat([A]);C.push({op:i,path:M,value:I}),R.unshift({op:n,path:M,value:I})}A++}),A=0,E.forEach(I=>{if(!S.has(I)){const M=_.concat([A]);C.push({op:n,path:M,value:I}),R.unshift({op:i,path:M,value:I})}A++})}function f(b,_,C,R){C.push({op:e,path:[],value:_===NOTHING?void 0:_}),R.push({op:e,path:[],value:b})}function p(b,_){return _.forEach(C=>{const{path:R,op:S}=C;let E=b;for(let T=0;T<R.length-1;T++){const N=getArchtype(E);let O=R[T];typeof O!="string"&&typeof O!="number"&&(O=""+O),(N===0||N===1)&&(O==="__proto__"||O==="constructor")&&die(19),typeof E=="function"&&O==="prototype"&&die(19),E=get(E,O),typeof E!="object"&&die(18,R.join("/"))}const A=getArchtype(E),I=m(C.value),M=R[R.length-1];switch(S){case e:switch(A){case 2:return E.set(M,I);case 3:die(16);default:return E[M]=I}case n:switch(A){case 1:return M==="-"?E.push(I):E.splice(M,0,I);case 2:return E.set(M,I);case 3:return E.add(I);default:return E[M]=I}case i:switch(A){case 1:return E.splice(M,1);case 2:return E.delete(M);case 3:return E.delete(C.value);default:return delete E[M]}default:die(17,S)}}),b}function m(b){if(!isDraftable(b))return b;if(Array.isArray(b))return b.map(m);if(isMap(b))return new Map(Array.from(b.entries()).map(([C,R])=>[C,m(R)]));if(isSet(b))return new Set(Array.from(b).map(m));const _=Object.create(getPrototypeOf(b));for(const C in b)_[C]=m(b[C]);return has(b,DRAFTABLE)&&(_[DRAFTABLE]=b[DRAFTABLE]),_}function g(b){return isDraft(b)?m(b):b}loadPlugin("Patches",{applyPatches_:p,generatePatches_:o,generateReplacementPatches_:f})}var immer=new Immer2,produce=immer.produce,produceWithPatches=immer.produceWithPatches.bind(immer);immer.setAutoFreeze.bind(immer),immer.setUseStrictShallowCopy.bind(immer);var applyPatches=immer.applyPatches.bind(immer);immer.createDraft.bind(immer),immer.finishDraft.bind(immer);var runIdentityFunctionCheck=(t,e,n)=>{if(e.length===1&&e[0]===n){let i=!1;try{const o={};t(o)===o&&(i=!0)}catch{}if(i){let o;try{throw new Error}catch(l){({stack:o}=l)}console.warn(`The result function returned its own inputs without modification. e.g
|
|
662
|
+
`,p="/",m="*",g="",b="comment",_="declaration";inlineStyleParser=function(R,S){if(typeof R!="string")throw new TypeError("First argument must be a string");if(!R)return[];S=S||{};var E=1,A=1;function I(L){var q=L.match(e);q&&(E+=q.length);var G=L.lastIndexOf(f);A=~G?L.length-G:A+L.length}function M(){var L={line:E,column:A};return function(q){return q.position=new T(L),j(),q}}function T(L){this.start=L,this.end={line:E,column:A},this.source=S.source}T.prototype.content=R;function N(L){var q=new Error(S.source+":"+E+":"+A+": "+L);if(q.reason=L,q.filename=S.source,q.line=E,q.column=A,q.source=R,!S.silent)throw q}function O(L){var q=L.exec(R);if(q){var G=q[0];return I(G),R=R.slice(G.length),q}}function j(){O(n)}function D(L){var q;for(L=L||[];q=B();)q!==!1&&L.push(q);return L}function B(){var L=M();if(!(p!=R.charAt(0)||m!=R.charAt(1))){for(var q=2;g!=R.charAt(q)&&(m!=R.charAt(q)||p!=R.charAt(q+1));)++q;if(q+=2,g===R.charAt(q-1))return N("End of comment missing");var G=R.slice(2,q-2);return A+=2,I(G),R=R.slice(q),A+=2,L({type:b,comment:G})}}function V(){var L=M(),q=O(i);if(q){if(B(),!O(o))return N("property missing ':'");var G=O(l),U=L({type:_,property:C(q[0].replace(t,g)),value:G?C(G[0].replace(t,g)):g});return O(u),U}}function F(){var L=[];D(L);for(var q;q=V();)q!==!1&&(L.push(q),D(L));return L}return j(),F()};function C(R){return R?R.replace(d,g):g}return inlineStyleParser}var hasRequiredCjs$1;function requireCjs$1(){if(hasRequiredCjs$1)return cjs$1;hasRequiredCjs$1=1;var t=cjs$1&&cjs$1.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(cjs$1,"__esModule",{value:!0}),cjs$1.default=n;var e=t(requireInlineStyleParser());function n(i,o){var l=null;if(!i||typeof i!="string")return l;var u=(0,e.default)(i),d=typeof o=="function";return u.forEach(function(f){if(f.type==="declaration"){var p=f.property,m=f.value;d?o(p,m,f):m&&(l=l||{},l[p]=m)}}),l}return cjs$1}var utilities={},hasRequiredUtilities$1;function requireUtilities$1(){if(hasRequiredUtilities$1)return utilities;hasRequiredUtilities$1=1,Object.defineProperty(utilities,"__esModule",{value:!0}),utilities.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,l=function(p){return!p||n.test(p)||t.test(p)},u=function(p,m){return m.toUpperCase()},d=function(p,m){return"".concat(m,"-")},f=function(p,m){return m===void 0&&(m={}),l(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(o,d):p=p.replace(i,d),p.replace(e,u))};return utilities.camelCase=f,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var t=cjs&&cjs.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},e=t(requireCjs$1()),n=requireUtilities$1();function i(o,l){var u={};return!o||typeof o!="string"||(0,e.default)(o,function(d,f){d&&f&&(u[(0,n.camelCase)(d,l)]=f)}),u}return i.default=i,cjs=i,cjs}var hasRequiredUtilities;function requireUtilities(){return hasRequiredUtilities||(hasRequiredUtilities=1,function(t){var e=utilities$1&&utilities$1.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(t,"__esModule",{value:!0}),t.returnFirstArg=t.canTextBeChildOfNode=t.ELEMENTS_WITH_NO_TEXT_CHILDREN=t.PRESERVE_CUSTOM_ATTRIBUTES=void 0,t.isCustomComponent=l,t.setStyleProp=d;var n=React,i=e(requireCjs()),o=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function l(m,g){return m.includes("-")?!o.has(m):!!(g&&typeof g.is=="string")}var u={reactCompat:!0};function d(m,g){if(typeof m=="string"){if(!m.trim()){g.style={};return}try{g.style=(0,i.default)(m,u)}catch{g.style={}}}}t.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,t.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var f=function(m){return!t.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(m.name)};t.canTextBeChildOfNode=f;var p=function(m){return m};t.returnFirstArg=p}(utilities$1)),utilities$1}var hasRequiredAttributesToProps;function requireAttributesToProps(){if(hasRequiredAttributesToProps)return attributesToProps;hasRequiredAttributesToProps=1,Object.defineProperty(attributesToProps,"__esModule",{value:!0}),attributesToProps.default=l;var t=requireLib$1(),e=requireUtilities(),n=["checked","value"],i=["input","select","textarea"],o={reset:!0,submit:!0};function l(d,f){d===void 0&&(d={});var p={},m=!!(d.type&&o[d.type]);for(var g in d){var b=d[g];if((0,t.isCustomAttribute)(g)){p[g]=b;continue}var _=g.toLowerCase(),C=u(_);if(C){var R=(0,t.getPropertyInfo)(C);switch(n.includes(C)&&i.includes(f)&&!m&&(C=u("default"+_)),p[C]=b,R&&R.type){case t.BOOLEAN:p[C]=!0;break;case t.OVERLOADED_BOOLEAN:b===""&&(p[C]=!0);break}continue}e.PRESERVE_CUSTOM_ATTRIBUTES&&(p[g]=b)}return(0,e.setStyleProp)(d.style,p),p}function u(d){return t.possibleStandardNames[d]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var t=domToReact&&domToReact.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=l;var e=React,n=t(requireAttributesToProps()),i=requireUtilities(),o={cloneElement:e.cloneElement,createElement:e.createElement,isValidElement:e.isValidElement};function l(d,f){f===void 0&&(f={});for(var p=[],m=typeof f.replace=="function",g=f.transform||i.returnFirstArg,b=f.library||o,_=b.cloneElement,C=b.createElement,R=b.isValidElement,S=d.length,E=0;E<S;E++){var A=d[E];if(m){var I=f.replace(A,E);if(R(I)){S>1&&(I=_(I,{key:I.key||E})),p.push(g(I,A,E));continue}}if(A.type==="text"){var M=!A.data.trim().length;if(M&&A.parent&&!(0,i.canTextBeChildOfNode)(A.parent)||f.trim&&M)continue;p.push(g(A.data,A,E));continue}var T=A,N={};u(T)?((0,i.setStyleProp)(T.attribs.style,T.attribs),N=T.attribs):T.attribs&&(N=(0,n.default)(T.attribs,T.name));var O=void 0;switch(A.type){case"script":case"style":A.children[0]&&(N.dangerouslySetInnerHTML={__html:A.children[0].data});break;case"tag":A.name==="textarea"&&A.children[0]?N.defaultValue=A.children[0].data:A.children&&A.children.length&&(O=l(A.children,f));break;default:continue}S>1&&(N.key=E),p.push(g(C(A.name,N,O),A,E))}return p.length===1?p[0]:p}function u(d){return i.PRESERVE_CUSTOM_ATTRIBUTES&&d.type==="tag"&&(0,i.isCustomComponent)(d.name,d.attribs)}return domToReact}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(t){var e=lib$3&&lib$3.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(t,"__esModule",{value:!0}),t.htmlToDOM=t.domToReact=t.attributesToProps=t.Text=t.ProcessingInstruction=t.Element=t.Comment=void 0,t.default=d;var n=e(requireHtmlToDom());t.htmlToDOM=n.default;var i=e(requireAttributesToProps());t.attributesToProps=i.default;var o=e(requireDomToReact());t.domToReact=o.default;var l=requireLib$2();Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return l.Comment}}),Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return l.Element}}),Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return l.ProcessingInstruction}}),Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return l.Text}});var u={lowerCaseAttributeNames:!1};function d(f,p){if(typeof f!="string")throw new TypeError("First argument must be a string");return f?(0,o.default)((0,n.default)(f,(p==null?void 0:p.htmlparser2)||u),p):[]}}(lib$3)),lib$3}var libExports=requireLib();const HTMLReactParser=getDefaultExportFromCjs(libExports),parser=HTMLReactParser.default||HTMLReactParser;function SkeletonMessage(){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:"Thinking..."})]})})]})]})}function ChatMessages({messages:t,currentUserId:e,loading:n,isAssistantChat:i}){return jsxRuntime.jsxs("div",{children:[t.map(o=>{const l=o.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",l&&"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(o.senderName+o.fromPartnerID)}&flip=${l}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[o.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const u=new Date(o.timestamp);return isToday(u)?u.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(u)?`Yesterday, ${u.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${u.toLocaleDateString([],{month:"short",day:"numeric"})} ${u.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 ",l?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:o.fromPartnerID===ASSISTANT_ID?parser(o.content):o.content})]})]},o.id)}),n&&jsxRuntime.jsx(SkeletonMessage,{}),t.length===0&&!n&&!i&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&!n&&i&&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"!'})})]})]})}function formatProdErrorMessage$1(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var randomString=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString()}`,REPLACE:`@@redux/REPLACE${randomString()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString()}`},actionTypes_default=ActionTypes;function isPlainObject$1(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function miniKindOf(t){if(t===void 0)return"undefined";if(t===null)return"null";const e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(isDate(t))return"date";if(isError(t))return"error";const n=ctorName(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function ctorName(t){return typeof t.constructor=="function"?t.constructor.name:null}function isError(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function isDate(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function kindOf(t){let e=typeof t;return process.env.NODE_ENV!=="production"&&(e=miniKindOf(t)),e}function warning(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function getUnexpectedStateShapeWarningMessage(t,e,n,i){const o=Object.keys(e),l=n&&n.type===actionTypes_default.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(o.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!isPlainObject$1(t))return`The ${l} has unexpected type of "${kindOf(t)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;const u=Object.keys(t).filter(d=>!e.hasOwnProperty(d)&&!i[d]);if(u.forEach(d=>{i[d]=!0}),!(n&&n.type===actionTypes_default.REPLACE)&&u.length>0)return`Unexpected ${u.length>1?"keys":"key"} "${u.join('", "')}" found in ${l}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`}function assertReducerShape(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(12):`The slice reducer for key "${e}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(13):`The slice reducer for key "${e}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function combineReducers(t){const e=Object.keys(t),n={};for(let u=0;u<e.length;u++){const d=e[u];process.env.NODE_ENV!=="production"&&typeof t[d]>"u"&&warning(`No reducer provided for key "${d}"`),typeof t[d]=="function"&&(n[d]=t[d])}const i=Object.keys(n);let o;process.env.NODE_ENV!=="production"&&(o={});let l;try{assertReducerShape(n)}catch(u){l=u}return function(d={},f){if(l)throw l;if(process.env.NODE_ENV!=="production"){const g=getUnexpectedStateShapeWarningMessage(d,n,f,o);g&&warning(g)}let p=!1;const m={};for(let g=0;g<i.length;g++){const b=i[g],_=n[b],C=d[b],R=_(C,f);if(typeof R>"u"){const S=f&&f.type;throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage$1(14):`When called with an action of type ${S?`"${String(S)}"`:"(unknown type)"}, the slice reducer for key "${b}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}m[b]=R,p=p||R!==C}return p=p||i.length!==Object.keys(d).length,p?m:d}}function isAction(t){return isPlainObject$1(t)&&"type"in t&&typeof t.type=="string"}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state"),errors=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function die(t,...e){if(process.env.NODE_ENV!=="production"){const n=errors[t],i=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf=Object.getPrototypeOf;function isDraft(t){return!!t&&!!t[DRAFT_STATE]}function isDraftable(t){var e;return t?isPlainObject(t)||Array.isArray(t)||!!t[DRAFTABLE]||!!((e=t.constructor)!=null&&e[DRAFTABLE])||isMap(t)||isSet(t):!1}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject(t){if(!t||typeof t!="object")return!1;const e=getPrototypeOf(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===objectCtorString}function original(t){return isDraft(t)||die(15,t),t[DRAFT_STATE].base_}function each(t,e){getArchtype(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,i)=>e(i,n,t))}function getArchtype(t){const e=t[DRAFT_STATE];return e?e.type_:Array.isArray(t)?1:isMap(t)?2:isSet(t)?3:0}function has(t,e){return getArchtype(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function get(t,e){return getArchtype(t)===2?t.get(e):t[e]}function set(t,e,n){const i=getArchtype(t);i===2?t.set(e,n):i===3?t.add(n):t[e]=n}function is$1(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function isMap(t){return t instanceof Map}function isSet(t){return t instanceof Set}function latest(t){return t.copy_||t.base_}function shallowCopy(t,e){if(isMap(t))return new Map(t);if(isSet(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=isPlainObject(t);if(e===!0||e==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[DRAFT_STATE];let o=Reflect.ownKeys(i);for(let l=0;l<o.length;l++){const u=o[l],d=i[u];d.writable===!1&&(d.writable=!0,d.configurable=!0),(d.get||d.set)&&(i[u]={configurable:!0,writable:!0,enumerable:d.enumerable,value:t[u]})}return Object.create(getPrototypeOf(t),i)}else{const i=getPrototypeOf(t);if(i!==null&&n)return{...t};const o=Object.create(i);return Object.assign(o,t)}}function freeze(t,e=!1){return isFrozen(t)||isDraft(t)||!isDraftable(t)||(getArchtype(t)>1&&(t.set=t.add=t.clear=t.delete=dontMutateFrozenCollections),Object.freeze(t),e&&Object.entries(t).forEach(([n,i])=>freeze(i,!0))),t}function dontMutateFrozenCollections(){die(2)}function isFrozen(t){return Object.isFrozen(t)}var plugins={};function getPlugin(t){const e=plugins[t];return e||die(0,t),e}function loadPlugin(t,e){plugins[t]||(plugins[t]=e)}var currentScope;function getCurrentScope(){return currentScope}function createScope(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(t,e){e&&(getPlugin("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function revokeScope(t){leaveScope(t),t.drafts_.forEach(revokeDraft),t.drafts_=null}function leaveScope(t){t===currentScope&&(currentScope=t.parent_)}function enterScope(t){return currentScope=createScope(currentScope,t)}function revokeDraft(t){const e=t[DRAFT_STATE];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function processResult(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[DRAFT_STATE].modified_&&(revokeScope(e),die(4)),isDraftable(t)&&(t=finalize(e,t),e.parent_||maybeFreeze(e,t)),e.patches_&&getPlugin("Patches").generateReplacementPatches_(n[DRAFT_STATE].base_,t,e.patches_,e.inversePatches_)):t=finalize(e,n,[]),revokeScope(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==NOTHING?t:void 0}function finalize(t,e,n){if(isFrozen(e))return e;const i=e[DRAFT_STATE];if(!i)return each(e,(o,l)=>finalizeProperty(t,i,e,o,l,n)),e;if(i.scope_!==t)return e;if(!i.modified_)return maybeFreeze(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const o=i.copy_;let l=o,u=!1;i.type_===3&&(l=new Set(o),o.clear(),u=!0),each(l,(d,f)=>finalizeProperty(t,i,o,d,f,n,u)),maybeFreeze(t,o,!1),n&&t.patches_&&getPlugin("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function finalizeProperty(t,e,n,i,o,l,u){if(process.env.NODE_ENV!=="production"&&o===n&&die(5),isDraft(o)){const d=l&&e&&e.type_!==3&&!has(e.assigned_,i)?l.concat(i):void 0,f=finalize(t,o,d);if(set(n,i,f),isDraft(f))t.canAutoFreeze_=!1;else return}else u&&n.add(o);if(isDraftable(o)&&!isFrozen(o)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;finalize(t,o),(!e||!e.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&maybeFreeze(t,o)}}function maybeFreeze(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&freeze(e,n)}function createProxyProxy(t,e){const n=Array.isArray(t),i={type_:n?1:0,scope_:e?e.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=i,l=objectTraps;n&&(o=[i],l=arrayTraps);const{revoke:u,proxy:d}=Proxy.revocable(o,l);return i.draft_=d,i.revoke_=u,d}var objectTraps={get(t,e){if(e===DRAFT_STATE)return t;const n=latest(t);if(!has(n,e))return readPropFromProto(t,n,e);const i=n[e];return t.finalized_||!isDraftable(i)?i:i===peek(t.base_,e)?(prepareCopy(t),t.copy_[e]=createProxy(i,t)):i},has(t,e){return e in latest(t)},ownKeys(t){return Reflect.ownKeys(latest(t))},set(t,e,n){const i=getDescriptorFromProto(latest(t),e);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const o=peek(latest(t),e),l=o==null?void 0:o[DRAFT_STATE];if(l&&l.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(is$1(n,o)&&(n!==void 0||has(t.base_,e)))return!0;prepareCopy(t),markChanged(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return peek(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,prepareCopy(t),markChanged(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=latest(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:i.enumerable,value:n[e]}},defineProperty(){die(11)},getPrototypeOf(t){return getPrototypeOf(t.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(t,e)=>{arrayTraps[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),arrayTraps.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&die(13),arrayTraps.set.call(this,t,e,void 0)},arrayTraps.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&die(14),objectTraps.set.call(this,t[0],e,n,t[0])};function peek(t,e){const n=t[DRAFT_STATE];return(n?latest(n):t)[e]}function readPropFromProto(t,e,n){var o;const i=getDescriptorFromProto(e,n);return i?"value"in i?i.value:(o=i.get)==null?void 0:o.call(t.draft_):void 0}function getDescriptorFromProto(t,e){if(!(e in t))return;let n=getPrototypeOf(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=getPrototypeOf(n)}}function markChanged(t){t.modified_||(t.modified_=!0,t.parent_&&markChanged(t.parent_))}function prepareCopy(t){t.copy_||(t.copy_=shallowCopy(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,i)=>{if(typeof e=="function"&&typeof n!="function"){const l=n;n=e;const u=this;return function(f=l,...p){return u.produce(f,m=>n.call(this,m,...p))}}typeof n!="function"&&die(6),i!==void 0&&typeof i!="function"&&die(7);let o;if(isDraftable(e)){const l=enterScope(this),u=createProxy(e,void 0);let d=!0;try{o=n(u),d=!1}finally{d?revokeScope(l):leaveScope(l)}return usePatchesInScope(l,i),processResult(o,l)}else if(!e||typeof e!="object"){if(o=n(e),o===void 0&&(o=e),o===NOTHING&&(o=void 0),this.autoFreeze_&&freeze(o,!0),i){const l=[],u=[];getPlugin("Patches").generateReplacementPatches_(e,o,l,u),i(l,u)}return o}else die(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(u,...d)=>this.produceWithPatches(u,f=>e(f,...d));let i,o;return[this.produce(e,n,(u,d)=>{i=u,o=d}),i,o]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){isDraftable(t)||die(8),isDraft(t)&&(t=current(t));const e=enterScope(this),n=createProxy(t,void 0);return n[DRAFT_STATE].isManual_=!0,leaveScope(e),n}finishDraft(t,e){const n=t&&t[DRAFT_STATE];(!n||!n.isManual_)&&die(9);const{scope_:i}=n;return usePatchesInScope(i,e),processResult(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const o=e[n];if(o.path.length===0&&o.op==="replace"){t=o.value;break}}n>-1&&(e=e.slice(n+1));const i=getPlugin("Patches").applyPatches_;return isDraft(t)?i(t,e):this.produce(t,o=>i(o,e))}};function createProxy(t,e){const n=isMap(t)?getPlugin("MapSet").proxyMap_(t,e):isSet(t)?getPlugin("MapSet").proxySet_(t,e):createProxyProxy(t,e);return(e?e.scope_:getCurrentScope()).drafts_.push(n),n}function current(t){return isDraft(t)||die(10,t),currentImpl(t)}function currentImpl(t){if(!isDraftable(t)||isFrozen(t))return t;const e=t[DRAFT_STATE];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=shallowCopy(t,e.scope_.immer_.useStrictShallowCopy_)}else n=shallowCopy(t,!0);return each(n,(i,o)=>{set(n,i,currentImpl(o))}),e&&(e.finalized_=!1),n}function enablePatches(){process.env.NODE_ENV!=="production"&&errors.push('Sets cannot have "replace" patches.',function(b){return"Unsupported patch operation: "+b},function(b){return"Cannot apply patch, path doesn't resolve: "+b},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const e="replace",n="add",i="remove";function o(b,_,C,R){switch(b.type_){case 0:case 2:return u(b,_,C,R);case 1:return l(b,_,C,R);case 3:return d(b,_,C,R)}}function l(b,_,C,R){let{base_:S,assigned_:E}=b,A=b.copy_;A.length<S.length&&([S,A]=[A,S],[C,R]=[R,C]);for(let I=0;I<S.length;I++)if(E[I]&&A[I]!==S[I]){const M=_.concat([I]);C.push({op:e,path:M,value:g(A[I])}),R.push({op:e,path:M,value:g(S[I])})}for(let I=S.length;I<A.length;I++){const M=_.concat([I]);C.push({op:n,path:M,value:g(A[I])})}for(let I=A.length-1;S.length<=I;--I){const M=_.concat([I]);R.push({op:i,path:M})}}function u(b,_,C,R){const{base_:S,copy_:E}=b;each(b.assigned_,(A,I)=>{const M=get(S,A),T=get(E,A),N=I?has(S,A)?e:n:i;if(M===T&&N===e)return;const O=_.concat(A);C.push(N===i?{op:N,path:O}:{op:N,path:O,value:T}),R.push(N===n?{op:i,path:O}:N===i?{op:n,path:O,value:g(M)}:{op:e,path:O,value:g(M)})})}function d(b,_,C,R){let{base_:S,copy_:E}=b,A=0;S.forEach(I=>{if(!E.has(I)){const M=_.concat([A]);C.push({op:i,path:M,value:I}),R.unshift({op:n,path:M,value:I})}A++}),A=0,E.forEach(I=>{if(!S.has(I)){const M=_.concat([A]);C.push({op:n,path:M,value:I}),R.unshift({op:i,path:M,value:I})}A++})}function f(b,_,C,R){C.push({op:e,path:[],value:_===NOTHING?void 0:_}),R.push({op:e,path:[],value:b})}function p(b,_){return _.forEach(C=>{const{path:R,op:S}=C;let E=b;for(let T=0;T<R.length-1;T++){const N=getArchtype(E);let O=R[T];typeof O!="string"&&typeof O!="number"&&(O=""+O),(N===0||N===1)&&(O==="__proto__"||O==="constructor")&&die(19),typeof E=="function"&&O==="prototype"&&die(19),E=get(E,O),typeof E!="object"&&die(18,R.join("/"))}const A=getArchtype(E),I=m(C.value),M=R[R.length-1];switch(S){case e:switch(A){case 2:return E.set(M,I);case 3:die(16);default:return E[M]=I}case n:switch(A){case 1:return M==="-"?E.push(I):E.splice(M,0,I);case 2:return E.set(M,I);case 3:return E.add(I);default:return E[M]=I}case i:switch(A){case 1:return E.splice(M,1);case 2:return E.delete(M);case 3:return E.delete(C.value);default:return delete E[M]}default:die(17,S)}}),b}function m(b){if(!isDraftable(b))return b;if(Array.isArray(b))return b.map(m);if(isMap(b))return new Map(Array.from(b.entries()).map(([C,R])=>[C,m(R)]));if(isSet(b))return new Set(Array.from(b).map(m));const _=Object.create(getPrototypeOf(b));for(const C in b)_[C]=m(b[C]);return has(b,DRAFTABLE)&&(_[DRAFTABLE]=b[DRAFTABLE]),_}function g(b){return isDraft(b)?m(b):b}loadPlugin("Patches",{applyPatches_:p,generatePatches_:o,generateReplacementPatches_:f})}var immer=new Immer2,produce=immer.produce,produceWithPatches=immer.produceWithPatches.bind(immer);immer.setAutoFreeze.bind(immer),immer.setUseStrictShallowCopy.bind(immer);var applyPatches=immer.applyPatches.bind(immer);immer.createDraft.bind(immer),immer.finishDraft.bind(immer);var runIdentityFunctionCheck=(t,e,n)=>{if(e.length===1&&e[0]===n){let i=!1;try{const o={};t(o)===o&&(i=!0)}catch{}if(i){let o;try{throw new Error}catch(l){({stack:o}=l)}console.warn(`The result function returned its own inputs without modification. e.g
|
|
663
663
|
\`createSelector([state => state.todos], todos => todos)\`
|
|
664
664
|
This could lead to inefficient memoization and unnecessary re-renders.
|
|
665
665
|
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:o})}}},runInputStabilityCheck=(t,e,n)=>{const{memoize:i,memoizeOptions:o}=e,{inputSelectorResults:l,inputSelectorResultsCopy:u}=t,d=i(()=>({}),...o);if(!(d.apply(null,l)===d.apply(null,u))){let p;try{throw new Error}catch(m){({stack:p}=m)}console.warn(`An input selector returned a different result when passed same arguments.
|
|
@@ -770,7 +770,7 @@ Hook ${d} was either not provided or not a function.`)}return{name:reactHooksMod
|
|
|
770
770
|
* SPDX-License-Identifier: Apache-2.0
|
|
771
771
|
*/const LANGUAGE_LABEL_PREFIX="gl-node/";class GoogleGenAI{constructor(e){var n;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(n=e.vertexai)!==null&&n!==void 0?n:!1,this.apiKey=e.apiKey,this.apiVersion=e.apiVersion;const i=new WebAuth(this.apiKey);this.apiClient=new ApiClient({auth:i,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:LANGUAGE_LABEL_PREFIX+"web",uploader:new BrowserUploader}),this.models=new Models(this.apiClient),this.live=new Live(this.apiClient,i,new BrowserWebSocketFactory),this.chats=new Chats(this.models,this.apiClient),this.caches=new Caches(this.apiClient),this.files=new Files(this.apiClient),this.operations=new Operations(this.apiClient)}}const bodyKey="TheRequestBody";async function fetchApiFunctions(){var t,e;try{const n=await fetch("https://api.randmar.io/swagger/V4/swagger.json");if(!n.ok)throw new Error("Failed to fetch Swagger spec");const i=await n.json(),o=[];for(const[l,u]of Object.entries(i.paths)){const d=["get","post","put","delete"];for(const f of d){const p=u[f];if(!p||p["x-allowed-for-chatbots"]!==!0)continue;const m=l.split("/").filter(Boolean);let g=`${f}_${m.slice(1).join("_")}`;g=g.replace(/[^a-zA-Z0-9_.-]/g,"_"),g.length>60&&(g=g.substring(0,60));const b={},_=[];(t=p.parameters)==null||t.forEach(E=>{b[E.name]={type:E.schema.type,description:E.description||`The ${E.name} parameter`},E.required&&_.push(E.name)});const C=((e=p.parameters)==null?void 0:e.filter(E=>E.in==="path").map(E=>E.name))||[];(f==="post"||f==="put")&&p.requestBody&&(b[bodyKey]={type:Type.STRING,description:p.requestBody.description||"Request body content"},_.push(bodyKey));const R={name:g,description:p.description?`${p.summary}
|
|
772
772
|
|
|
773
|
-
${p.description}`:p.summary||`${f.toUpperCase()} ${m[m.length-1]}`,parameters:{type:Type.OBJECT,properties:b,required:_}},S=async E=>{var A;try{let I=`https://api.randmar.io${l}`;console.log(`[API Function] ${g} called with args:`,E),console.log(`[API Function] Original URL: ${I}`),C.forEach(V=>{const F=`{${V}}`,L=V;I=I.replace(F,E[L])}),console.log(`[API Function] Final URL: ${I}`);const M=localStorage.getItem("access_token"),T={method:f.toUpperCase(),headers:{Authorization:M?`Bearer ${M}`:"","Content-Type":"application/json"}},N=[];if((((A=p.parameters)==null?void 0:A.filter(V=>V.in==="query"))||[]).forEach(V=>{const F=V.name,L=E[F];L&&N.push(`${V.name}=${encodeURIComponent(L)}`)}),N.length>0&&(I+=`?${N.join("&")}`),f==="post"||f==="put"){const F=E[bodyKey];F&&(T.body=F)}console.log(`[API Function] Making request to: ${I}`),console.log("[API Function] Request options:",T);const j=await fetch(I,T);if(console.log(`[API Function] Response status: ${j.status}`),!j.ok){const V=await j.text();throw console.error(`[API Function] Error response: ${V}`),new Error(`Error ${j.status}: ${V}`)}const D=await j.json();console.log("[API Function] Response data:",D);const B=getComponent(l,D);return B?{component:B,summary:JSON.stringify(D,null,2)}:JSON.stringify(D,null,2)}catch(I){return console.error(`Error in ${g}:`,I),`I'm sorry, I couldn't retrieve the requested information. Error: ${I instanceof Error?I.message:"Unknown error"}`}};o.push({declaration:R,handler:S})}}return console.log(o),o}catch(n){return console.error("Error fetching API functions:",n),[]}}const getComponent=(t,e)=>{switch(t){case"/V4/Partner/{routeApplicationId}/Search":return handleSearchResults(e);case"/Product/{productNumber}":return handleProduct(e);case"/V4/Reseller/{routeResellerId}/Documents/GeneralDocuments":return handleGeneralDocuments(e);default:console.log("no component mapping for path",t);break}return null},handleGeneralDocuments=t=>{if(!Array.isArray(t))return null;const e=t;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map(n=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(GeneralDocumentCard,{document:n})}))})},handleProduct=t=>{const e=t;return e.MPN?jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ProductCard,{item:e})}):null},handleSearchResults=t=>{if(!Array.isArray(t))return null;const n=t.filter(i=>i.ContentType==="Product").map(i=>i.Content).filter(i=>i.MPN);return n.length==0?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:n.map(i=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ProductCard,{item:i})}))})};function useAIAssistant({userId:t,apiKey:e}){const[n,i]=React.useState(!1),[o,l]=React.useState(null),[u,d]=React.useState([]),[f,p]=React.useState([]),[m,g]=React.useState([]),[b,_]=React.useState(""),C=new GoogleGenAI({apiKey:e}),[R]=useLazyGetV4PartnerByApplicationIdAccountQuery();React.useEffect(()=>{b&&p(M=>[...M,"System instructions updated."])},[b]),React.useEffect(()=>{o&&p(M=>[...M,"Gemini 2.5 session initialized."])},[o]),React.useEffect(()=>{(async()=>{try{const N=await(await fetch("https://docs.google.com/document/d/e/2PACX-1vT-f5SWSJ2BcRUcyiumzT1aPUeC8kyyV7ryJTTymWJWOcRbDRgV5nX6Wyh7HaSPf8rxTY9w63Q2C8rG/pub")).text(),B=new DOMParser().parseFromString(N,"text/html").querySelector(".doc-content").innerHTML.replace(/__user_id__/g,t);console.log("google doc fetched: ",B),_(B)}catch(T){console.error("Error fetching system instructions:",T),_("You are a helpful assistant, but cannot help the user right now. They should come back another time.")}})()},[]),React.useEffect(()=>{const M=async()=>{try{const T=C.chats.create({model:"gemini-2.5-flash-preview-04-17",config:{systemInstruction:b,maxOutputTokens:4096,tools:m.length>0?[{functionDeclarations:m.map(({declaration:N})=>N)}]:[]
|
|
773
|
+
${p.description}`:p.summary||`${f.toUpperCase()} ${m[m.length-1]}`,parameters:{type:Type.OBJECT,properties:b,required:_}},S=async E=>{var A;try{let I=`https://api.randmar.io${l}`;console.log(`[API Function] ${g} called with args:`,E),console.log(`[API Function] Original URL: ${I}`),C.forEach(V=>{const F=`{${V}}`,L=V;I=I.replace(F,E[L])}),console.log(`[API Function] Final URL: ${I}`);const M=localStorage.getItem("access_token"),T={method:f.toUpperCase(),headers:{Authorization:M?`Bearer ${M}`:"","Content-Type":"application/json"}},N=[];if((((A=p.parameters)==null?void 0:A.filter(V=>V.in==="query"))||[]).forEach(V=>{const F=V.name,L=E[F];L&&N.push(`${V.name}=${encodeURIComponent(L)}`)}),N.length>0&&(I+=`?${N.join("&")}`),f==="post"||f==="put"){const F=E[bodyKey];F&&(T.body=F)}console.log(`[API Function] Making request to: ${I}`),console.log("[API Function] Request options:",T);const j=await fetch(I,T);if(console.log(`[API Function] Response status: ${j.status}`),!j.ok){const V=await j.text();throw console.error(`[API Function] Error response: ${V}`),new Error(`Error ${j.status}: ${V}`)}const D=await j.json();console.log("[API Function] Response data:",D);const B=getComponent(l,D);return B?{component:B,summary:JSON.stringify(D,null,2)}:JSON.stringify(D,null,2)}catch(I){return console.error(`Error in ${g}:`,I),`I'm sorry, I couldn't retrieve the requested information. Error: ${I instanceof Error?I.message:"Unknown error"}`}};o.push({declaration:R,handler:S})}}return console.log(o),o}catch(n){return console.error("Error fetching API functions:",n),[]}}const getComponent=(t,e)=>{switch(t){case"/V4/Partner/{routeApplicationId}/Search":return handleSearchResults(e);case"/Product/{productNumber}":return handleProduct(e);case"/V4/Reseller/{routeResellerId}/Documents/GeneralDocuments":return handleGeneralDocuments(e);default:console.log("no component mapping for path",t);break}return null},handleGeneralDocuments=t=>{if(!Array.isArray(t))return null;const e=t;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map(n=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(GeneralDocumentCard,{document:n})}))})},handleProduct=t=>{const e=t;return e.MPN?jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ProductCard,{item:e})}):null},handleSearchResults=t=>{if(!Array.isArray(t))return null;const n=t.filter(i=>i.ContentType==="Product").map(i=>i.Content).filter(i=>i.MPN);return n.length==0?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:n.map(i=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ProductCard,{item:i})}))})};function useAIAssistant({userId:t,apiKey:e}){const[n,i]=React.useState(!1),[o,l]=React.useState(null),[u,d]=React.useState([]),[f,p]=React.useState([]),[m,g]=React.useState([]),[b,_]=React.useState(""),C=new GoogleGenAI({apiKey:e}),[R]=useLazyGetV4PartnerByApplicationIdAccountQuery();React.useEffect(()=>{b&&p(M=>[...M,"System instructions updated."])},[b]),React.useEffect(()=>{o&&p(M=>[...M,"Gemini 2.5 session initialized."])},[o]),React.useEffect(()=>{(async()=>{try{const N=await(await fetch("https://docs.google.com/document/d/e/2PACX-1vT-f5SWSJ2BcRUcyiumzT1aPUeC8kyyV7ryJTTymWJWOcRbDRgV5nX6Wyh7HaSPf8rxTY9w63Q2C8rG/pub")).text(),B=new DOMParser().parseFromString(N,"text/html").querySelector(".doc-content").innerHTML.replace(/__user_id__/g,t);console.log("google doc fetched: ",B),_(B)}catch(T){console.error("Error fetching system instructions:",T),_("You are a helpful assistant, but cannot help the user right now. They should come back another time.")}})()},[]),React.useEffect(()=>{const M=async()=>{try{const T=C.chats.create({model:"gemini-2.5-flash-preview-04-17",config:{systemInstruction:b,maxOutputTokens:4096,tools:m.length>0?[{functionDeclarations:m.map(({declaration:N})=>N)}]:[]}});l(T)}catch(T){console.error("Error initializing chat:",T)}};o||m.length!==0&&b!==""&&M()},[m,o,b]),React.useEffect(()=>{(async()=>{try{const T=await fetchApiFunctions(),N={declaration:{name:"set_on_behalf_id",description:"Call this function when the user wants to act on behalf of another one. It will return to you important flags such as: is user specified by the user ID a reseller, manufacturer or an agency?",parameters:{type:Type.OBJECT,properties:{user_id:{type:Type.STRING,description:"The user ID to use going forward."}},required:["user_id"]}},handler:async function(O){const D=O["user_id"],B=await R({applicationId:D});return{component:jsxRuntime.jsx(PartnerCard,{account:B.data}),summary:`OK. Using ${D} going forward as the user ID. Full data with important flags: ${JSON.stringify(B.data)}`}}};g([...T,N])}catch(T){console.error("Error loading API functions:",T)}})()},[]);const S=Object.fromEntries(m.map(({declaration:M,handler:T})=>[M.name,T])),E=async M=>{var D;const T=M.name??"";if(!(T in S)){console.error(`Function ${T} not found`);return}const N=S[T],O=M.args||{};if(console.log(`[Function Call] ${T} with args:`,O),!((D=m.find(B=>B.declaration.name===T))==null?void 0:D.declaration)){console.error(`[Function Call] Could not find declaration for ${T}`);return}try{p(J=>[...J,`Calling ${T} with:
|
|
774
774
|
${JSON.stringify(O,null,2)}`]);const B=await N(O);let V,F=null,L=!1;if(typeof B=="string"?V=B:(V=B.summary,F=B.component,L=!0),p(J=>[...J,`${T} returned ${V.length} character(s).`]),console.log(`[Function Response] ${T} returned:`,V),!o)return;const q={functionResponse:{name:T,response:{content:V}}};if(L&&F){const J={role:"assistant",content:F,timestamp:new Date,isComponent:!0};d(H=>[...H,J])}const U={role:"assistant",content:(await o.sendMessage({message:[q]})).text,timestamp:new Date};d(J=>[...J,U])}catch(B){p(F=>[...F,`${T} failed.`]),console.error("Error executing function:",B);const V={role:"assistant",content:"I encountered an error while processing your request. Please try again.",timestamp:new Date};d(F=>[...F,V])}};return{handleSubmitToBot:async M=>{if(M.trim()&&!n&&o){const T={role:"user",content:M,timestamp:new Date};d(N=>[...N,T]),i(!0);try{const N=await o.sendMessage({message:M.trim()}),O=N.functionCalls;if(O&&O.length>0)for(const j of O)await E(j);else{const j={role:"assistant",content:N.text,timestamp:new Date};d(D=>[...D,j])}}catch(N){console.error("Error sending message:",N);const O={role:"assistant",content:"I'm sorry, I encountered an error processing your request. Please try again later.",timestamp:new Date};d(j=>[...j,O])}finally{i(!1)}}},botMessages:u,botReady:!!o,isProcessingSubmission:n,debugMessages:f,reset:()=>{l(null)}}}function _getDefaults(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let _defaults=_getDefaults();function changeDefaults(t){_defaults=t}const noopTest={exec:()=>null};function edit(t,e=""){let n=typeof t=="string"?t:t.source;const i={replace:(o,l)=>{let u=typeof l=="string"?l:l.source;return u=u.replace(other.caret,"$1"),n=n.replace(o,u),i},getRegex:()=>new RegExp(n,e)};return i}const other={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},newline=/^(?:[ \t]*(?:\n|$))+/,blockCode=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fences=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bullet=/(?:[*+-]|\d{1,9}[.)])/,lheadingCore=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lheading=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),lheadingGfm=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),_paragraph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,blockText=/^[^\n]+/,_blockLabel=/(?!\s*\])(?:\\.|[^\[\]\\])+/,def=edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_blockLabel).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),list=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bullet).getRegex(),_tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_comment=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,html=edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",_comment).replace("tag",_tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),paragraph=edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockquote=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",paragraph).getRegex(),blockNormal={blockquote,code:blockCode,def,fences,heading,hr,html,lheading,list,newline,paragraph,table:noopTest,text:blockText},gfmTable=edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockGfm={...blockNormal,lheading:lheadingGfm,table:gfmTable,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gfmTable).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex()},blockPedantic={...blockNormal,html:edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:noopTest,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(_paragraph).replace("hr",hr).replace("heading",` *#{1,6} *[^
|
|
775
775
|
]`).replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape$1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_punctuation=/[\p{P}\p{S}]/u,_punctuationOrSpace=/[\s\p{P}\p{S}]/u,_notPunctuationOrSpace=/[^\s\p{P}\p{S}]/u,punctuation=edit(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_punctuationOrSpace).getRegex(),_punctuationGfmStrongEm=/(?!~)[\p{P}\p{S}]/u,_punctuationOrSpaceGfmStrongEm=/(?!~)[\s\p{P}\p{S}]/u,_notPunctuationOrSpaceGfmStrongEm=/(?:[^\s\p{P}\p{S}]|~)/u,blockSkip=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,emStrongLDelimCore=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,emStrongLDelim=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuation).getRegex(),emStrongLDelimGfm=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimAstCore="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",emStrongRDelimAst=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAstGfm=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g,_punctuationOrSpaceGfmStrongEm).replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\(punct)/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:-->|$)","-->").getRegex(),tag=edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation,autolink,blockSkip,br,code:inlineCode,del:noopTest,emStrongLDelim,emStrongRDelimAst,emStrongRDelimUnd,escape:escape$1,link,nolink,punctuation,reflink,reflinkSearch,tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,emStrongRDelimAst:emStrongRDelimAstGfm,emStrongLDelim:emStrongLDelimGfm,url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},inlineBreaks={...inlineGfm,br:edit(br).replace("{2,}","*").getRegex(),text:edit(inlineGfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},block={normal:blockNormal,gfm:blockGfm,pedantic:blockPedantic},inline={normal:inlineNormal,gfm:inlineGfm,breaks:inlineBreaks,pedantic:inlinePedantic},escapeReplacements={"&":"&","<":"<",">":">",'"':""","'":"'"},getEscapeReplacement=t=>escapeReplacements[t];function escape$2(t,e){if(e){if(other.escapeTest.test(t))return t.replace(other.escapeReplace,getEscapeReplacement)}else if(other.escapeTestNoEncode.test(t))return t.replace(other.escapeReplaceNoEncode,getEscapeReplacement);return t}function cleanUrl(t){try{t=encodeURI(t).replace(other.percentDecode,"%")}catch{return null}return t}function splitCells(t,e){var l;const n=t.replace(other.findPipe,(u,d,f)=>{let p=!1,m=d;for(;--m>=0&&f[m]==="\\";)p=!p;return p?"|":" |"}),i=n.split(other.splitPipe);let o=0;if(i[0].trim()||i.shift(),i.length>0&&!((l=i.at(-1))!=null&&l.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;o<i.length;o++)i[o]=i[o].trim().replace(other.slashPipe,"|");return i}function rtrim(t,e,n){const i=t.length;if(i===0)return"";let o=0;for(;o<i&&t.charAt(i-o-1)===e;)o++;return t.slice(0,i-o)}function findClosingBracket(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])n++;else if(t[i]===e[1]&&(n--,n<0))return i;return-1}function outputLink(t,e,n,i,o){const l=e.href,u=e.title||null,d=t[1].replace(o.other.outputLinkReplace,"$1");if(t[0].charAt(0)!=="!"){i.state.inLink=!0;const f={type:"link",raw:n,href:l,title:u,text:d,tokens:i.inlineTokens(d)};return i.state.inLink=!1,f}return{type:"image",raw:n,href:l,title:u,text:d}}function indentCodeCompensation(t,e,n){const i=t.match(n.other.indentCodeCompensation);if(i===null)return e;const o=i[1];return e.split(`
|
|
776
776
|
`).map(l=>{const u=l.match(n.other.beginningSpace);if(u===null)return l;const[d]=u;return d.length>=o.length?l.slice(o.length):l}).join(`
|
|
@@ -828,4 +828,4 @@ ${e}</tr>
|
|
|
828
828
|
`+this.renderer.text(p);n?i+=this.renderer.paragraph({type:"paragraph",raw:m,text:m,tokens:[{type:"text",raw:m,text:m,escaped:!0}]}):i+=m;continue}default:{const p='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return i}parseInline(e,n=this.renderer){var o,l;let i="";for(let u=0;u<e.length;u++){const d=e[u];if((l=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&l[d.type]){const p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){i+=p||"";continue}}const f=d;switch(f.type){case"escape":{i+=n.text(f);break}case"html":{i+=n.html(f);break}case"link":{i+=n.link(f);break}case"image":{i+=n.image(f);break}case"strong":{i+=n.strong(f);break}case"em":{i+=n.em(f);break}case"codespan":{i+=n.codespan(f);break}case"br":{i+=n.br(f);break}case"del":{i+=n.del(f);break}case"text":{i+=n.text(f);break}default:{const p='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return i}}class _Hooks{constructor(e){be(this,"options");be(this,"block");this.options=e||_defaults}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?_Lexer.lex:_Lexer.lexInline}provideParser(){return this.block?_Parser.parse:_Parser.parseInline}}be(_Hooks,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Marked{constructor(...e){be(this,"defaults",_getDefaults());be(this,"options",this.setOptions);be(this,"parse",this.parseMarkdown(!0));be(this,"parseInline",this.parseMarkdown(!1));be(this,"Parser",_Parser);be(this,"Renderer",_Renderer);be(this,"TextRenderer",_TextRenderer);be(this,"Lexer",_Lexer);be(this,"Tokenizer",_Tokenizer);be(this,"Hooks",_Hooks);this.use(...e)}walkTokens(e,n){var o,l;let i=[];for(const u of e)switch(i=i.concat(n.call(this,u)),u.type){case"table":{const d=u;for(const f of d.header)i=i.concat(this.walkTokens(f.tokens,n));for(const f of d.rows)for(const p of f)i=i.concat(this.walkTokens(p.tokens,n));break}case"list":{const d=u;i=i.concat(this.walkTokens(d.items,n));break}default:{const d=u;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(f=>{const p=d[f].flat(1/0);i=i.concat(this.walkTokens(p,n))}):d.tokens&&(i=i.concat(this.walkTokens(d.tokens,n)))}}return i}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{const o={...i};if(o.async=this.defaults.async||o.async||!1,i.extensions&&(i.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const u=n.renderers[l.name];u?n.renderers[l.name]=function(...d){let f=l.renderer.apply(this,d);return f===!1&&(f=u.apply(this,d)),f}:n.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const u=n[l.level];u?u.unshift(l.tokenizer):n[l.level]=[l.tokenizer],l.start&&(l.level==="block"?n.startBlock?n.startBlock.push(l.start):n.startBlock=[l.start]:l.level==="inline"&&(n.startInline?n.startInline.push(l.start):n.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(n.childTokens[l.name]=l.childTokens)}),o.extensions=n),i.renderer){const l=this.defaults.renderer||new _Renderer(this.defaults);for(const u in i.renderer){if(!(u in l))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;const d=u,f=i.renderer[d],p=l[d];l[d]=(...m)=>{let g=f.apply(l,m);return g===!1&&(g=p.apply(l,m)),g||""}}o.renderer=l}if(i.tokenizer){const l=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const u in i.tokenizer){if(!(u in l))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;const d=u,f=i.tokenizer[d],p=l[d];l[d]=(...m)=>{let g=f.apply(l,m);return g===!1&&(g=p.apply(l,m)),g}}o.tokenizer=l}if(i.hooks){const l=this.defaults.hooks||new _Hooks;for(const u in i.hooks){if(!(u in l))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;const d=u,f=i.hooks[d],p=l[d];_Hooks.passThroughHooks.has(u)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(f.call(l,m)).then(b=>p.call(l,b));const g=f.call(l,m);return p.call(l,g)}:l[d]=(...m)=>{let g=f.apply(l,m);return g===!1&&(g=p.apply(l,m)),g}}o.hooks=l}if(i.walkTokens){const l=this.defaults.walkTokens,u=i.walkTokens;o.walkTokens=function(d){let f=[];return f.push(u.call(this,d)),l&&(f=f.concat(l.call(this,d))),f}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return _Lexer.lex(e,n??this.defaults)}parser(e,n){return _Parser.parse(e,n??this.defaults)}parseMarkdown(e){return(i,o)=>{const l={...o},u={...this.defaults,...l},d=this.onError(!!u.silent,!!u.async);if(this.defaults.async===!0&&l.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof i>"u"||i===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));u.hooks&&(u.hooks.options=u,u.hooks.block=e);const f=u.hooks?u.hooks.provideLexer():e?_Lexer.lex:_Lexer.lexInline,p=u.hooks?u.hooks.provideParser():e?_Parser.parse:_Parser.parseInline;if(u.async)return Promise.resolve(u.hooks?u.hooks.preprocess(i):i).then(m=>f(m,u)).then(m=>u.hooks?u.hooks.processAllTokens(m):m).then(m=>u.walkTokens?Promise.all(this.walkTokens(m,u.walkTokens)).then(()=>m):m).then(m=>p(m,u)).then(m=>u.hooks?u.hooks.postprocess(m):m).catch(d);try{u.hooks&&(i=u.hooks.preprocess(i));let m=f(i,u);u.hooks&&(m=u.hooks.processAllTokens(m)),u.walkTokens&&this.walkTokens(m,u.walkTokens);let g=p(m,u);return u.hooks&&(g=u.hooks.postprocess(g)),g}catch(m){return d(m)}}}onError(e,n){return i=>{if(i.message+=`
|
|
829
829
|
Please report this to https://github.com/markedjs/marked.`,e){const o="<p>An error occurred:</p><pre>"+escape$2(i.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(i);throw i}}}const markedInstance=new Marked;function marked(t,e){return markedInstance.parse(t,e)}marked.options=marked.setOptions=function(t){return markedInstance.setOptions(t),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...t){return markedInstance.use(...t),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(t,e){return markedInstance.walkTokens(t,e)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;const Card=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("rounded-md border bg-card text-card-foreground shadow-sm",t),...e}));Card.displayName="Card";const CardHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("flex flex-col space-y-1.5 p-6",t),...e}));CardHeader.displayName="CardHeader";const CardTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("font-semibold leading-none tracking-tight",t),...e}));CardTitle.displayName="CardTitle";const CardDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));CardDescription.displayName="CardDescription";const CardContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("p-6 pt-0",t),...e}));CardContent.displayName="CardContent";const CardFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{ref:n,className:cn("flex items-center p-6 pt-0",t),...e}));CardFooter.displayName="CardFooter";const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:t,variant:e,size:n,icon:i,children:o,...l},u)=>jsxRuntime.jsxs("div",{ref:u,className:cn(badgeVariants({variant:e,size:n}),t),...l,children:[i&&jsxRuntime.jsx("span",{className:"mr-1",children:i}),o]}));Badge.displayName="Badge";function PartnerCard({account:t,action:e,loading:n=!1,withVoice:i=!0}){const[o,l]=React.useState(null),[u,d]=React.useState(!1),[f,p]=React.useState(!1),[m,g]=React.useState(!1),[b,_]=React.useState(!0),[C,R]=React.useState(null),[S,E]=React.useState(!1),A=React.useMemo(()=>t!=null&&t.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video/Exists`,logoUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Logo?width=64&height=64`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Logo/Exists`}:null,[t==null?void 0:t.ApplicationId]);React.useEffect(()=>{if(!A||n)return;let M=!0;R(null);const T=async()=>{try{const D=await fetch(A.logoExistsUrl);if(D.ok){const V=(await D.text()).toLowerCase()==="true";return M&&p(V),V}return!1}catch(D){return console.error("Failed to check if logo exists:",D),M&&p(!1),!1}},N=async()=>{M&&d(!0);try{const D=await fetch(A.logoUrl);if(D.ok){const B=await D.blob();M&&(o&&URL.revokeObjectURL(o),l(URL.createObjectURL(B)))}else throw new Error(`Failed to load logo: ${D.status}`)}catch(D){console.error("Failed to load logo:",D),M&&R("Failed to load partner logo")}finally{M&&d(!1)}},O=async()=>{try{const D=await fetch(A.videoExistsUrl);if(D.ok){const B=await D.text();M&&g(B.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${D.status}`)}catch(D){console.error("Failed to check if video exists:",D),M&&g(!1)}};return(async()=>{await T()&&N(),O()})(),()=>{M=!1,o&&URL.revokeObjectURL(o)}},[A,n]);const I=()=>{_(!1)};return n||!t?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),i&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:u?jsxRuntime.jsx(Skeleton,{className:"h-10 w-10 rounded-md"}):o&&jsxRuntime.jsx("img",{src:o||"/placeholder.svg",alt:`${t.PublicName}'s logo`,className:"max-h-10 w-auto object-contain"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:t.ApplicationId})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"pb-2",children:[C&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:C}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(t.IsManufacturer||t.IsReseller||t.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),t.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),t.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),i&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2",children:[m&&A?jsxRuntime.jsxs(Dialog,{open:S,onOpenChange:E,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[t.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[b&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:A.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${t.PublicName}`,className:`w-full h-full object-cover ${b?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:I,onError:()=>_(!1)})]})]})]}):jsxRuntime.jsx("div",{}),e||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}const ASSISTANT_ID="RandmarAIChatAssistant",ChatLayout=React.forwardRef(({userId:t,userName:e,apiKey:n,inputRef:i},o)=>{var ae,ce,se;const{data:l}=useGetV4PartnerByApplicationIdBusinessDevelopmentConversationsQuery({applicationId:t}),[u]=useLazyGetV4PartnerByApplicationIdAccountQuery(),[d]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[f]=useLazyGetV4PartnerByApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:p,botMessages:m,botReady:g,debugMessages:b,isProcessingSubmission:_,reset:C}=useAIAssistant({userId:t,apiKey:n});React.useEffect(()=>{if(!l)return;const Q={partner1:[t,ASSISTANT_ID].sort()[0],partner2:[t,ASSISTANT_ID].sort()[1],name:"Randmar Assistant",unread:0,pending:!1,historyFetched:!0,messages:[],conversationID:-1},te=l.map(K=>{var fe;return{partner1:[K.Participant1,K.Participant2].sort()[0],partner2:[K.Participant1,K.Participant2].sort()[1],name:((fe=K.Participant)==null?void 0:fe.PublicName)??"missing public name",unread:0,pending:K.Status!="Approved",historyFetched:!1,messages:[],conversationID:K.ConversationId}});setTimeout(()=>{var K;return(K=z.current)==null?void 0:K.focus()},50),j([Q,...te])},[l]);const[R,S]=React.useState("all"),[E,A]=React.useState([[t,ASSISTANT_ID].sort()[0],[t,ASSISTANT_ID].sort()[1]]),[I,M]=React.useState(""),[T,N]=React.useState(null),[O,j]=React.useState([]),[D,B]=React.useState(""),[V,F]=React.useState(null),[L,q]=React.useState([]),[G,U]=React.useState(0),J=React.useRef(null),H=React.useRef(null),z=i||H,W=O.filter(Q=>{const te=Q.name.toLowerCase().includes(D.toLowerCase());return R==="all"?te:R==="approved"?te&&!Q.pending:R==="pending"?te&&Q.pending:te});React.useEffect(()=>{const Q=m.at(-1);if(!Q||Q.role!="assistant")return;if(Q.isComponent){q(K=>[...K,Q.content]),U(0);return}const te={id:Q.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:Q.timestamp.getTime(),content:Q.content};te.content=marked(te.content,{async:!1}),Z(te)},[m]);function Z(Q){const te=[Q.fromPartnerID,Q.toPartnerID];te.sort(),j(K=>{let fe=!1;const ee=K.map(de=>de.partner1!==te[0]||de.partner2!==te[1]||de.messages.findIndex(pe=>pe.id==Q.id)!==-1?de:(fe=!0,{...de,unread:de.unread+1,messages:[...de.messages,Q]}));return fe&&N([te[0],te[1]]),ee})}React.useEffect(()=>{const Q=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return Q.on("ReceiveMessage",Z),Q.start().catch(te=>console.error("Error connecting to SignalR hub:",te)),F(Q),()=>{Q&&Q.stop()}},[t]),React.useEffect(()=>{(T==null?void 0:T[0])!==(E==null?void 0:E[0])||(T==null?void 0:T[1])!==(E==null?void 0:E[1])||(j(Q=>Q.map(te=>te.partner1===(E==null?void 0:E[0])&&te.partner2===(E==null?void 0:E[1])?{...te,unread:0}:te)),setTimeout(()=>{var Q;return(Q=J.current)==null?void 0:Q.scrollIntoView({behavior:"smooth"})},50))},[T,E]),React.useEffect(()=>{var te;if(!E)return;const Q=getActiveChatObject(O,E);Q&&((te=z.current)==null||te.focus(),U(L.length),u({applicationId:Q.partner1===t?Q.partner2:Q.partner1}).then(K=>{K.data&&(q(fe=>[...fe,jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx(PartnerCard,{account:K.data,action:jsxRuntime.jsx(jsxRuntime.Fragment,{}),withVoice:!1})})]),U(0))}),Q.historyFetched?(j(K=>K.map(fe=>fe.partner1===E[0]&&fe.partner2===E[1]?{...fe,unread:0}:fe)),setTimeout(()=>{var K;return(K=J.current)==null?void 0:K.scrollIntoView({behavior:"smooth"})},50)):f({applicationId:t,conversationId:Q.conversationID}).unwrap().then(K=>{const fe=K.map(ee=>({id:"history"+ee.MessageId,fromPartnerID:ee.SenderId,toPartnerID:ee.SenderId==E[0]?E[1]:E[0],senderName:ee.SenderName??"missing name",timestamp:new Date(ee.SentDate+"Z").getTime(),content:ee.Content??"no content"}));j(ee=>ee.map(de=>de.partner1===E[0]&&de.partner2===E[1]?{...de,messages:fe,historyFetched:!0}:de)),setTimeout(()=>{var ee;return(ee=J.current)==null?void 0:ee.scrollIntoView({behavior:"smooth"})},100)}).catch(K=>{console.error("Error fetching conversation messages:",K)}))},[E,f,t]);const ne=(Q,te,K)=>{const fe={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:te[0]===t?te[1]:te[0],content:Q,timestamp:Date.now()};j(ee=>ee.map(de=>de.partner1===te[0]&&de.partner2===te[1]?{...de,messages:[...de.messages,fe]}:de)),N([te[0],te[1]]),fe.toPartnerID==ASSISTANT_ID?p(fe.content):K.invoke("NewMessage",fe).catch(ee=>console.error("Error sending message:",ee)),M("")},oe=(Q,te)=>{if(!O.length||!V||!g)return!1;const K=O.find(fe=>fe.conversationID===Q);return K?(A([K.partner1,K.partner2]),te&&setTimeout(()=>ne(te,[K.partner1,K.partner2],V),100),!0):!1};if(React.useImperativeHandle(o,()=>({setActiveChatAndSendMessage:oe})),!g)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 le=()=>{!I.trim()||!E||!V||(U(L.length),ne(I,E,V))},ie=()=>{var Q=O.find(K=>K.partner1===ASSISTANT_ID||K.partner2===ASSISTANT_ID);d({applicationId:t,emailAddress:e,body:{messages:Q,debug:b}})},ue=()=>{j(Q=>Q.map(K=>K.partner1!==ASSISTANT_ID&&K.partner2!==ASSISTANT_ID?K:{...K,messages:[]})),C()};return jsxRuntime.jsxs("div",{className:"flex h-[80vh] 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"}),O.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:D,onChange:Q=>B(Q.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:R,onValueChange:S,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-8 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"all",className:"text-xs col-span-2",children:"All"}),jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsx(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:"Pending"})]})})]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:O.length&&jsxRuntime.jsx(ChatList,{userId:t,chats:W.filter(Q=>Q.partner1!=ASSISTANT_ID&&Q.partner2!=ASSISTANT_ID),activeChat:getActiveChatObject(O,E)??null,onSelectChat:A,assistantChat:O.find(Q=>Q.partner1==ASSISTANT_ID||Q.partner2==ASSISTANT_ID)})})]}),jsxRuntime.jsx("div",{className:"flex-1 flex flex-col",children:E?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:E[0]==ASSISTANT_ID||E[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-auto",onClick:()=>ue(),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:()=>ie()},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/${E[0]===t?E[1]:E[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:(ae=getActiveChatObject(O,E))==null?void 0:ae.name})]})}),(ce=getActiveChatObject(O,E))!=null&&ce.pending?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is still awaiting approval — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:((se=getActiveChatObject(O,E))==null?void 0:se.messages)??[],currentUserId:t,isAssistantChat:isAssistantChat(E),loading:_&&isAssistantChat(E)}),jsxRuntime.jsx("div",{ref:J})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t flex",children:[jsxRuntime.jsx(Input,{ref:z,placeholder:"Type a message...",value:I,onChange:Q=>M(Q.target.value),onKeyDown:Q=>Q.key==="Enter"&&le(),className:"flex-1"}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:"ml-1",disabled:_,onClick:le,children:jsxRuntime.jsx(Send,{className:"h-4 w-4"})})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsxs("div",{className:"w-[480px] flex flex-1 flex-col border-l",children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Visuals and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 pl-2 pr-2 bg-slate-50",children:G>=0&&L.length>G&&L[L.length-(1+G)]}),jsxRuntime.jsxs("div",{className:"flex bg-slate-50 border-t pt-1 pb-1 justify-center gap-4",children:[jsxRuntime.jsx(Button,{size:"icon",onClick:()=>U(Q=>Q+1),children:jsxRuntime.jsx(ChevronLeft,{})}),jsxRuntime.jsx(Button,{size:"icon",onClick:()=>U(Q=>Q-1),children:jsxRuntime.jsx(ChevronRight,{})})]}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:b.map(Q=>jsxRuntime.jsx("p",{className:"text-slate-600",children:Q}))})})]})]})});function getActiveChatObject(t,e){return t.find(n=>n.partner1==(e==null?void 0:e[0])&&n.partner2==(e==null?void 0:e[1]))}function isAssistantChat(t){return(t==null?void 0:t[0])==ASSISTANT_ID||(t==null?void 0:t[1])==ASSISTANT_ID}const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:i},o)=>{const[l,u]=React.useState(""),d=reactRouterDom.useLocation(),{toast:f}=useToast();React.useEffect(()=>{const b=new URLSearchParams(d.search).get("q");b&&u(b)},[d.search]);const p=()=>{const g=l.trim();if(!g||g.length<2){f({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(g)},m=g=>{g.key==="Enter"&&p()};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:p,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:i??"Search...",className:"w-full pl-8 bg-white text-black",value:l,onChange:g=>u(g.target.value),onKeyDown:m,ref:o},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";const CountryFlag=({countryCode:t,className:e=""})=>{const[n,i]=React.useState(null),[o,l]=React.useState(!1);return React.useEffect(()=>{if(!t)return;const d=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${t.toUpperCase()}.svg`;fetch(d,{method:"HEAD"}).then(f=>{f.ok?(i(d),l(!1)):l(!0)}).catch(()=>{l(!0)})},[t]),o||!n?jsxRuntime.jsx("span",{className:e,children:t}):jsxRuntime.jsx("img",{src:n,alt:`${t} flag`,className:`inline-block ${e}`,style:{width:"24px",height:"auto"}})},Navbar=React.forwardRef(({routes:t,footer:e,dashboardTitle:n,withRandmarAssistant:i,chatUserName:o,chatApiKey:l},u)=>{const{appID:d}=reactRouterDom.useParams(),f=t.filter(b=>b.showInNav),p=React.useRef(null),m=React.useRef(null),g=React.useRef(null);return React.useImperativeHandle(u,()=>({setActiveChatAndSendMessage:(b,_)=>{var C;return(C=g.current)==null||C.click(),setTimeout(()=>{var R;(R=p.current)==null||R.focus(),m.current&&m.current.setActiveChatAndSendMessage(b,_)},100),!0}})),jsxRuntime.jsxs(Sidebar,{className:"border-r border-sidebar-border",children:[jsxRuntime.jsx(SidebarHeader,{className:"border-b border-sidebar-border px-6 h-16 justify-center bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center",children:jsxRuntime.jsx("img",{src:"https://api.randmar.io/images/RandmarIcon.svg",alt:"Randmar Icon",className:"h-4 w-4 filter brightness-0 saturate-100 invert"})}),jsxRuntime.jsx("span",{className:"font-semibold text-lg",children:n})]})}),jsxRuntime.jsx(SidebarContent,{className:"py-4 bg-sidebar text-sidebar-foreground",children:jsxRuntime.jsx(SidebarMenu,{children:f.map(b=>{const _=b.icon,C=`/${b.path.replace(":appID",d??"")}`;return jsxRuntime.jsx(SidebarMenuItem,{children:jsxRuntime.jsx(SidebarMenuButton,{asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:C,className:"transition-colors hover:bg-muted px-6",children:[_&&jsxRuntime.jsx(_,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:b.label})]})})},b.key)})})}),jsxRuntime.jsxs(SidebarFooter,{className:"border-t border-sidebar-border p-4 bg-sidebar-background text-sidebar-foreground",children:[i===!0&&jsxRuntime.jsxs(Dialog,{children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{ref:g,size:"lg",className:"collapse md:visible",onClick:()=>setTimeout(()=>{var b;return(b=p.current)==null?void 0:b.focus()},50),children:[jsxRuntime.jsx(Bot,{}),"Assistant"]})}),jsxRuntime.jsx(DialogContent,{className:"max-w-[85vw] p-0 data-[state=open]:visible data-[state=closed]:invisible",forceMount:!0,animateExit:!1,children:jsxRuntime.jsx(ChatLayout,{ref:m,inputRef:p,userId:d??"2",userName:o??"Unknown user",apiKey:l??""})})]}),e]})]})}),Layout=React.forwardRef(({children:t,rightMenu:e,routes:n,footer:i,handleValidSearch:o,dashboardTitle:l,onSignOut:u,searchPlaceholder:d,withRandmarAssistant:f,chatUserName:p,chatApiKey:m,chatRef:g},b)=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(SidebarProvider,{children:jsxRuntime.jsxs("div",{className:"flex grow",children:[jsxRuntime.jsx(Navbar,{routes:n,footer:i,dashboardTitle:l,withRandmarAssistant:f,chatUserName:p,chatApiKey:m,ref:g}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[jsxRuntime.jsx(Topbar,{ref:b,onSignOut:u,rightMenu:e,handleValidSearch:o,searchPlaceholder:d}),jsxRuntime.jsx("main",{className:"flex-1 overflow-auto mt-16",children:t}),jsxRuntime.jsx(Toaster,{})]})]})})}));Layout.displayName="Layout";const imgSizeMap={sm:100,md:200,lg:300,xl:400};function ProductImage({randmarSKU:t,size:e="md",alt:n,secondaryContent:i}){const[o,l]=React__namespace.useState(!1),[u,d]=React__namespace.useState(!1),[f,p]=React__namespace.useState(!1),[m,g]=React__namespace.useState(!1),b=`https://api.randmar.io/Product/${t}/Video`;React__namespace.useEffect(()=>{(async()=>{try{const I=await(await fetch(b+"/Exists")).json();d(I)}catch(A){console.error("Error checking for video:",A),d(!1)}})()},[t,b]);async function _(){if(u){g(!0);try{const A=await(await fetch(b)).blob(),I=window.URL.createObjectURL(A),M=document.createElement("a");M.href=I,M.download=`${t||"product"}-video.mp4`,document.body.appendChild(M),M.click(),document.body.removeChild(M),window.URL.revokeObjectURL(I)}catch(E){console.error("Error downloading video:",E)}finally{g(!1)}}}function C(){navigator.clipboard.writeText(b),p(!0),setTimeout(()=>{p(!1)},2e3)}function R(){l(!0)}const S=imgSizeMap[e||"xl"];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dialog,{open:o,onOpenChange:l,children:jsxRuntime.jsx(DialogContent,{className:"max-w-4xl p-0 overflow-hidden",children:i?jsxRuntime.jsxs("div",{className:"flex flex-row",children:[jsxRuntime.jsxs("video",{className:"w-full rounded-l-lg max-h-[720px] object-contain",controls:!0,autoPlay:!0,muted:!0,loop:!0,children:[jsxRuntime.jsx("source",{src:b,type:"video/mp4"}),"Your browser does not support the video tag."]}),jsxRuntime.jsx("div",{className:"flex-grow min-w-[400px] h-[70vh] p-6",children:i})]}):jsxRuntime.jsxs("div",{className:"w-full relative",children:[jsxRuntime.jsxs("video",{className:"w-full max-h-[720px] object-contain",controls:!0,autoPlay:!0,children:[jsxRuntime.jsx("source",{src:b,type:"video/mp4"}),"Your browser does not support the video tag."]}),jsxRuntime.jsxs("div",{className:"absolute top-2 right-12 flex gap-1",children:[jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",onClick:C,children:f?jsxRuntime.jsx(Check,{className:"h-4 w-4"}):jsxRuntime.jsx(Copy,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Copy video link"})})]})}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",onClick:_,disabled:m,children:jsxRuntime.jsx(Download,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Download video"})})]})})]})]})})}),jsxRuntime.jsxs("div",{className:"relative w-max h-max",children:[jsxRuntime.jsx("img",{alt:n||`Product ${t}`,className:`rounded-md ${u?"cursor-pointer":""}`,onClick:u?R:void 0,src:`https://api.randmar.io/Product/${t}/Image?width=${S*1.5}&height=${S*1.5}`,width:S,height:S}),u&&jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"secondary",size:"icon",className:"absolute top-2 right-2",onClick:R,children:jsxRuntime.jsx(Play,{className:"h-4 w-4"})})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"Play video"})})]})})]})]})}function ProductCard({item:t,addToCart:e=!1,syncToShopify:n=!1,customAction:i=jsxRuntime.jsx(jsxRuntime.Fragment,{}),defaultOpportunityNumber:o="",viewProductLink:l,addToCartAction:u,isAddToCartActionLoading:d=!1,syncToShopifyAction:f,isSyncToShopifyActionLoading:p=!1}){var z,W,Z,ne,oe,le,ie,ue,ae,ce,se;const[m,g]=React.useState(1),[b,_]=React.useState(null),[C,R]=React.useState(0),[S,E]=React.useState(!1),A=((z=t==null?void 0:t.Distribution)==null?void 0:z.Cost)||0,I=((W=t==null?void 0:t.Distribution)==null?void 0:W.RegularPrice)||0,M=((Z=t==null?void 0:t.Distribution)==null?void 0:Z.Price)||0;React.useEffect(()=>{g(1),_(null),R(0),E(!1)},[t==null?void 0:t.RandmarSKU]);const[T,N]=React.useState(null),[O,j]=React.useState(!1);React.useEffect(()=>{const Q=async()=>{if(t!=null&&t.ManufacturerId){j(!0);try{const te=await fetch(`https://api.randmar.io/V4/Partner/${t.ManufacturerId}/Account/Logo?width=60&height=40`);if(te.ok){const K=await te.blob();N(URL.createObjectURL(K))}}catch(te){console.error("Failed to load logo:",te)}finally{j(!1)}}};t!=null&&t.ManufacturerId&&Q()},[t==null?void 0:t.ManufacturerId]),React.useEffect(()=>{var Q;if(t&&o){const te=(Q=t.Opportunities)==null?void 0:Q.find(K=>K.BidNumber==o);te&&_(te)}},[t,o]),React.useEffect(()=>{if(!t)return;const Q=b!=null&&b.Price?b.Price:M;R(I>0?Math.round((I-Q)/I*100):0)},[t,b,M,I]),React.useEffect(()=>{d||g(1)},[d]);const D=Q=>{if(Q.Active!==!0)return!1;const te=new Date().toISOString().split("T")[0];return!(Q.EndDate&&Q.EndDate.split("T")[0]<te||Q.StartDate&&Q.StartDate.split("T")[0]>te)};if(!t)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const B=(t==null?void 0:t.Opportunities)||[],V=B.length>0,F=()=>{if(m==null){g(1);return}m>1&&g(m-1)},L=()=>{if(m==null){g(1);return}g(m+1)},q=Q=>{const te=parseInt(Q.target.value,10);if(!isNaN(te)&&te>0){g(te);return}g(void 0)},G=()=>{(m==null||m<1)&&g(1)},U=((oe=(ne=t.Distribution)==null?void 0:ne.Inventory)==null?void 0:oe.reduce((Q,te)=>Q+(te.AvailableQuantity||0),0))||0,J=Q=>{try{return new Date(Q).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(te){return console.error(te),Q.split("T")[0]||"N/A"}},H=()=>{u&&u({quantity:m??1,bidNumber:(b==null?void 0:b.BidNumber)??null})};return jsxRuntime.jsx(Card,{className:"hover:shadow-lg transition-shadow",children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:t.Title||t.RandmarTitle}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:O?jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}):T&&jsxRuntime.jsx("img",{src:T,alt:t.ManufacturerName??"",className:"max-h-10 max-w-24 object-contain"})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[t.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",t.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",t.SerialNumber?"Serialized":"Unserialized"]}),t.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),t.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",t.AvailableToBuy?"Available":"Unavailable"]}),t.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${(le=t.ManufacturerCategory)!=null&&le.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",(ie=t.ManufacturerCategory)!=null&&ie.QualificationRequired?"Qualified Only":"Available to all"]}),t.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",t.AutoUpdate?`Automatic Reorder (${t.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${t.BodyHTML&&t.Title&&t.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",t.BodyHTML&&t.Title&&t.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.UnitWeight?`${t.UnitWeight} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MAP"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.MAP?"$"+t.MAP.toFixed(2):"N/A"})]}),t.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex items-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:t.CountryCodeOfOrigin,className:"mr-2"}),t.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx(ProductImage,{randmarSKU:t.RandmarSKU||"",alt:t.RandmarTitle||""})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:V&&t.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex items-center",children:"You have "+B.length+(B.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:B.map((Q,te)=>{var K;return jsxRuntime.jsxs("div",{className:`flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
|
|
830
830
|
${Q.BidNumber==(b==null?void 0:b.BidNumber)?"cursor-pointer border-2 border-purple-900":D(Q)?"hover:bg-purple-200 cursor-pointer":"!bg-neutral-50"}
|
|
831
|
-
`,onClick:()=>{D(Q)&&_(Q.BidNumber!=(b==null?void 0:b.BidNumber)?Q:null)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Q.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[Q.BidNumber," ",!D(Q)&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-semibold",children:["$",(K=Q.Price)==null?void 0:K.toFixed(2)]}),Q.Rebate&&Q.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: $",Q.Rebate.toFixed(2)]}),Q.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",J(Q.EndDate)]})]})]},te)})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[l&&jsxRuntime.jsx(reactRouterDom.Link,{to:l,children:jsxRuntime.jsxs(Button,{variant:"secondary",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})}),((ue=t.Distribution)==null?void 0:ue.Inventory)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsxs(Dialog,{open:S,onOpenChange:E,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:`flex items-center text-sm ${U>0?"text-green-700":"text-red-700"}`,children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),U>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[U," in stock"]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Out of stock"})]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex items-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:t.Distribution.Inventory})]})]})})]})]}),t.Distribution&&jsxRuntime.jsxs("div",{className:"flex justify-between items-end mt-4",children:[jsxRuntime.jsx("div",{className:"flex-shrink-1 flex flex-col items-start gap-1",children:A>0?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:[jsxRuntime.jsx("span",{children:"Cost: $"}),A.toFixed(2),jsxRuntime.jsx("span",{children:" CAD"})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap",children:[jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:[jsxRuntime.jsx("span",{children:"$"}),b?(ce=(ae=t.Opportunities)==null?void 0:ae.find(Q=>Q.BidNumber==b.BidNumber))==null?void 0:ce.Price:M.toFixed(2),jsxRuntime.jsx("span",{children:" CAD"})]}),C>0&&jsxRuntime.jsxs("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:["$",I.toFixed(2)]})]}),C>0&&jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[C,"% OFF"]}),((se=t.InstantRebate)==null?void 0:se.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",t.InstantRebate.EndDate.split("T")[0]]}),(b==null?void 0:b.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",b.EndDate.split("T")[0]]})]})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-shrink-0 gap-2 ml-4",children:[typeof e<"u"&&e&&jsxRuntime.jsxs("div",{className:"flex items-center border rounded-md",children:[jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:F,disabled:typeof m<"u"&&(m<=1||!t.AvailableToBuy||d||!u),children:"-"}),jsxRuntime.jsx("input",{value:m,onChange:q,onBlur:G,onClick:Q=>Q.currentTarget.select(),className:`w-12 text-center border-0 focus:ring-0 focus:outline-none ${!t.AvailableToBuy||d||!u?"text-gray-400":""}`,disabled:!t.AvailableToBuy||d||!u}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:L,disabled:!t.AvailableToBuy||d||!u,children:"+"})]}),typeof e<"u"&&e&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap",onClick:H,disabled:!t.AvailableToBuy||d||!u,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})}),n&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:f,disabled:p||!f,children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),i]})]})]})})}function ManufacturerCard({manufacturer:t,link:e,actions:n,loading:i=!1}){var p;if(i||!t)return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const o=t.ManufacturerId||"N/A",l=t.PublicName||"N/A",u=[t.City,t.Province,t.Country].filter(Boolean),d=u.length>0?u.join(", "):"Location not provided",f=((p=t.Tags)==null?void 0:p.split(",").map(m=>m.trim()).filter(Boolean))||[];return jsxRuntime.jsxs(Card,{className:"manufacturer-theme",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${o}/Account/Logo?width=64&height=64`,alt:`${l}'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:o})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:d})]})]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[(!!t.OpenToWork||f.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[!!t.OpenToWork&&jsxRuntime.jsx(Badge,{variant:"success",children:"Open To Work"}),f.map((m,g)=>jsxRuntime.jsx(Badge,{children:m},g))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]})}),(n||e)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 ${n?"justify-between":"justify-end"}`,children:[n&&n,e&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:e,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Manufacturer"]})})]})]})}function ResellerCard({reseller:t,link:e,actions:n,loading:i=!1}){if(i||!t)return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsx("div",{className:"flex flex-col space-y-2",children:jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const o=t.ResellerId||"N/A",l=t.PublicName||"N/A",u=[t.City,t.Province,t.Country].filter(Boolean),d=u.length>0?u.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${o}/Account/Logo?width=64&height=64`,alt:`${l}'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:o})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:d})]})]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsx("div",{className:"flex flex-col space-y-2",children:jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})})}),(n||e)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 ${n?"justify-between":"justify-end"}`,children:[n&&n,e&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:e,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}function usePrevious(t){const e=React__namespace.useRef({value:t,previous:t});return React__namespace.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection,useCollection,createCollectionScope]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope,createPopperScope]),usePopperScope=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=t=>{const{__scopeSelect:e,children:n,open:i,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:f,dir:p,name:m,autoComplete:g,disabled:b,required:_,form:C}=t,R=usePopperScope(e),[S,E]=React__namespace.useState(null),[A,I]=React__namespace.useState(null),[M,T]=React__namespace.useState(!1),N=useDirection(p),[O,j]=useControllableState({prop:i,defaultProp:o??!1,onChange:l,caller:SELECT_NAME}),[D,B]=useControllableState({prop:u,defaultProp:d,onChange:f,caller:SELECT_NAME}),V=React__namespace.useRef(null),F=S?C||!!S.closest("form"):!0,[L,q]=React__namespace.useState(new Set),G=Array.from(L).map(U=>U.props.value).join(";");return jsxRuntime.jsx(Root2$4,{...R,children:jsxRuntime.jsxs(SelectProvider,{required:_,scope:e,trigger:S,onTriggerChange:E,valueNode:A,onValueNodeChange:I,valueNodeHasChildren:M,onValueNodeHasChildrenChange:T,contentId:useId(),value:D,onValueChange:B,open:O,onOpenChange:j,dir:N,triggerPointerDownPosRef:V,disabled:b,children:[jsxRuntime.jsx(Collection.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(U=>{q(J=>new Set(J).add(U))},[]),onNativeOptionRemove:React__namespace.useCallback(U=>{q(J=>{const H=new Set(J);return H.delete(U),H})},[]),children:n})}),F?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:_,tabIndex:-1,name:m,autoComplete:g,value:D,onChange:U=>B(U.target.value),disabled:b,form:C,children:[D===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(L)]},G):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:i=!1,...o}=t,l=usePopperScope(n),u=useSelectContext(TRIGGER_NAME,n),d=u.disabled||i,f=useComposedRefs(e,u.onTriggerChange),p=useCollection(n),m=React__namespace.useRef("touch"),[g,b,_]=useTypeaheadSearch(R=>{const S=p().filter(I=>!I.disabled),E=S.find(I=>I.value===u.value),A=findNextItem(S,R,E);A!==void 0&&u.onValueChange(A.value)}),C=R=>{d||(u.onOpenChange(!0),_()),R&&(u.triggerPointerDownPosRef.current={x:Math.round(R.pageX),y:Math.round(R.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...l,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":shouldShowPlaceholder(u.value)?"":void 0,...o,ref:f,onClick:composeEventHandlers(o.onClick,R=>{R.currentTarget.focus(),m.current!=="mouse"&&C(R)}),onPointerDown:composeEventHandlers(o.onPointerDown,R=>{m.current=R.pointerType;const S=R.target;S.hasPointerCapture(R.pointerId)&&S.releasePointerCapture(R.pointerId),R.button===0&&R.ctrlKey===!1&&R.pointerType==="mouse"&&(C(R),R.preventDefault())}),onKeyDown:composeEventHandlers(o.onKeyDown,R=>{const S=g.current!=="";!(R.ctrlKey||R.altKey||R.metaKey)&&R.key.length===1&&b(R.key),!(S&&R.key===" ")&&OPEN_KEYS.includes(R.key)&&(C(),R.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:o,children:l,placeholder:u="",...d}=t,f=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:p}=f,m=l!==void 0,g=useComposedRefs(e,f.onValueNodeChange);return useLayoutEffect2(()=>{p(m)},[p,m]),jsxRuntime.jsx(Primitive.span,{...d,ref:g,style:{pointerEvents:"none"},children:shouldShowPlaceholder(f.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:u}):l})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,children:i,...o}=t;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:e,children:i||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME="SelectPortal",SelectPortal=t=>jsxRuntime.jsx(Portal$4,{asChild:!0,...t});SelectPortal.displayName=PORTAL_NAME;var CONTENT_NAME="SelectContent",SelectContent$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContext(CONTENT_NAME,t.__scopeSelect),[i,o]=React__namespace.useState();if(useLayoutEffect2(()=>{o(new DocumentFragment)},[]),!n.open){const l=i;return l?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:t.__scopeSelect,children:jsxRuntime.jsx(Collection.Slot,{scope:t.__scopeSelect,children:jsxRuntime.jsx("div",{children:t.children})})}),l):null}return jsxRuntime.jsx(SelectContentImpl,{...t,ref:e})});SelectContent$1.displayName=CONTENT_NAME;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME),CONTENT_IMPL_NAME="SelectContentImpl",Slot=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:f,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:b,collisionPadding:_,sticky:C,hideWhenDetached:R,avoidCollisions:S,...E}=t,A=useSelectContext(CONTENT_NAME,n),[I,M]=React__namespace.useState(null),[T,N]=React__namespace.useState(null),O=useComposedRefs(e,ae=>M(ae)),[j,D]=React__namespace.useState(null),[B,V]=React__namespace.useState(null),F=useCollection(n),[L,q]=React__namespace.useState(!1),G=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(I)return hideOthers(I)},[I]),useFocusGuards();const U=React__namespace.useCallback(ae=>{const[ce,...se]=F().map(K=>K.ref.current),[Q]=se.slice(-1),te=document.activeElement;for(const K of ae)if(K===te||(K==null||K.scrollIntoView({block:"nearest"}),K===ce&&T&&(T.scrollTop=0),K===Q&&T&&(T.scrollTop=T.scrollHeight),K==null||K.focus(),document.activeElement!==te))return},[F,T]),J=React__namespace.useCallback(()=>U([j,I]),[U,j,I]);React__namespace.useEffect(()=>{L&&J()},[L,J]);const{onOpenChange:H,triggerPointerDownPosRef:z}=A;React__namespace.useEffect(()=>{if(I){let ae={x:0,y:0};const ce=Q=>{var te,K;ae={x:Math.abs(Math.round(Q.pageX)-(((te=z.current)==null?void 0:te.x)??0)),y:Math.abs(Math.round(Q.pageY)-(((K=z.current)==null?void 0:K.y)??0))}},se=Q=>{ae.x<=10&&ae.y<=10?Q.preventDefault():I.contains(Q.target)||H(!1),document.removeEventListener("pointermove",ce),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",se,{capture:!0})}}},[I,H,z]),React__namespace.useEffect(()=>{const ae=()=>H(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[H]);const[W,Z]=useTypeaheadSearch(ae=>{const ce=F().filter(te=>!te.disabled),se=ce.find(te=>te.ref.current===document.activeElement),Q=findNextItem(ce,ae,se);Q&&setTimeout(()=>Q.ref.current.focus())}),ne=React__namespace.useCallback((ae,ce,se)=>{const Q=!G.current&&!se;(A.value!==void 0&&A.value===ce||Q)&&(D(ae),Q&&(G.current=!0))},[A.value]),oe=React__namespace.useCallback(()=>I==null?void 0:I.focus(),[I]),le=React__namespace.useCallback((ae,ce,se)=>{const Q=!G.current&&!se;(A.value!==void 0&&A.value===ce||Q)&&V(ae)},[A.value]),ie=i==="popper"?SelectPopperPosition:SelectItemAlignedPosition,ue=ie===SelectPopperPosition?{side:d,sideOffset:f,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:b,collisionPadding:_,sticky:C,hideWhenDetached:R,avoidCollisions:S}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:I,viewport:T,onViewportChange:N,itemRefCallback:ne,selectedItem:j,onItemLeave:oe,itemTextRefCallback:le,focusSelectedItem:J,selectedItemText:B,position:i,isPositioned:L,searchRef:W,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:A.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:composeEventHandlers(o,ae=>{var ce;(ce=A.trigger)==null||ce.focus({preventScroll:!0}),ae.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:jsxRuntime.jsx(ie,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:ae=>ae.preventDefault(),...E,...ue,onPlaced:()=>q(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:composeEventHandlers(E.onKeyDown,ae=>{const ce=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!ce&&ae.key.length===1&&Z(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let Q=F().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(Q=Q.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const te=ae.target,K=Q.indexOf(te);Q=Q.slice(K+1)}setTimeout(()=>U(Q)),ae.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:i,...o}=t,l=useSelectContext(CONTENT_NAME,n),u=useSelectContentContext(CONTENT_NAME,n),[d,f]=React__namespace.useState(null),[p,m]=React__namespace.useState(null),g=useComposedRefs(e,O=>m(O)),b=useCollection(n),_=React__namespace.useRef(!1),C=React__namespace.useRef(!0),{viewport:R,selectedItem:S,selectedItemText:E,focusSelectedItem:A}=u,I=React__namespace.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&p&&R&&S&&E){const O=l.trigger.getBoundingClientRect(),j=p.getBoundingClientRect(),D=l.valueNode.getBoundingClientRect(),B=E.getBoundingClientRect();if(l.dir!=="rtl"){const te=B.left-j.left,K=D.left-te,fe=O.left-K,ee=O.width+fe,de=Math.max(ee,j.width),pe=window.innerWidth-CONTENT_MARGIN,me=clamp(K,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,pe-de)]);d.style.minWidth=ee+"px",d.style.left=me+"px"}else{const te=j.right-B.right,K=window.innerWidth-D.right-te,fe=window.innerWidth-O.right-K,ee=O.width+fe,de=Math.max(ee,j.width),pe=window.innerWidth-CONTENT_MARGIN,me=clamp(K,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,pe-de)]);d.style.minWidth=ee+"px",d.style.right=me+"px"}const V=b(),F=window.innerHeight-CONTENT_MARGIN*2,L=R.scrollHeight,q=window.getComputedStyle(p),G=parseInt(q.borderTopWidth,10),U=parseInt(q.paddingTop,10),J=parseInt(q.borderBottomWidth,10),H=parseInt(q.paddingBottom,10),z=G+U+L+H+J,W=Math.min(S.offsetHeight*5,z),Z=window.getComputedStyle(R),ne=parseInt(Z.paddingTop,10),oe=parseInt(Z.paddingBottom,10),le=O.top+O.height/2-CONTENT_MARGIN,ie=F-le,ue=S.offsetHeight/2,ae=S.offsetTop+ue,ce=G+U+ae,se=z-ce;if(ce<=le){const te=V.length>0&&S===V[V.length-1].ref.current;d.style.bottom="0px";const K=p.clientHeight-R.offsetTop-R.offsetHeight,fe=Math.max(ie,ue+(te?oe:0)+K+J),ee=ce+fe;d.style.height=ee+"px"}else{const te=V.length>0&&S===V[0].ref.current;d.style.top="0px";const fe=Math.max(le,G+R.offsetTop+(te?ne:0)+ue)+se;d.style.height=fe+"px",R.scrollTop=ce-le+R.offsetTop}d.style.margin=`${CONTENT_MARGIN}px 0`,d.style.minHeight=W+"px",d.style.maxHeight=F+"px",i==null||i(),requestAnimationFrame(()=>_.current=!0)}},[b,l.trigger,l.valueNode,d,p,R,S,E,l.dir,i]);useLayoutEffect2(()=>I(),[I]);const[M,T]=React__namespace.useState();useLayoutEffect2(()=>{p&&T(window.getComputedStyle(p).zIndex)},[p]);const N=React__namespace.useCallback(O=>{O&&C.current===!0&&(I(),A==null||A(),C.current=!1)},[I,A]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:_,onScrollButtonChange:N,children:jsxRuntime.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:jsxRuntime.jsx(Primitive.div,{...o,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,align:i="start",collisionPadding:o=CONTENT_MARGIN,...l}=t,u=usePopperScope(n);return jsxRuntime.jsx(Content$1,{...u,...l,ref:e,align:i,collisionPadding:o,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});SelectPopperPosition.displayName=POPPER_POSITION_NAME;var[SelectViewportProvider,useSelectViewportContext]=createSelectContext(CONTENT_NAME,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:i,...o}=t,l=useSelectContentContext(VIEWPORT_NAME,n),u=useSelectViewportContext(VIEWPORT_NAME,n),d=useComposedRefs(e,l.onViewportChange),f=React__namespace.useRef(0);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:composeEventHandlers(o.onScroll,p=>{const m=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=u;if(b!=null&&b.current&&g){const _=Math.abs(f.current-m.scrollTop);if(_>0){const C=window.innerHeight-CONTENT_MARGIN*2,R=parseFloat(g.style.minHeight),S=parseFloat(g.style.height),E=Math.max(R,S);if(E<C){const A=E+_,I=Math.min(C,A),M=A-I;g.style.height=I+"px",g.style.bottom==="0px"&&(m.scrollTop=M>0?M:0,g.style.justifyContent="flex-end")}}}f.current=m.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,o=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:o,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":o,...i,ref:e})})});SelectGroup.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,o=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:o.id,...i,ref:e})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME),SelectItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,value:i,disabled:o=!1,textValue:l,...u}=t,d=useSelectContext(ITEM_NAME,n),f=useSelectContentContext(ITEM_NAME,n),p=d.value===i,[m,g]=React__namespace.useState(l??""),[b,_]=React__namespace.useState(!1),C=useComposedRefs(e,A=>{var I;return(I=f.itemRefCallback)==null?void 0:I.call(f,A,i,o)}),R=useId(),S=React__namespace.useRef("touch"),E=()=>{o||(d.onValueChange(i),d.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return jsxRuntime.jsx(SelectItemContextProvider,{scope:n,value:i,disabled:o,textId:R,isSelected:p,onItemTextChange:React__namespace.useCallback(A=>{g(I=>I||((A==null?void 0:A.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection.ItemSlot,{scope:n,value:i,disabled:o,textValue:m,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":R,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:C,onFocus:composeEventHandlers(u.onFocus,()=>_(!0)),onBlur:composeEventHandlers(u.onBlur,()=>_(!1)),onClick:composeEventHandlers(u.onClick,()=>{S.current!=="mouse"&&E()}),onPointerUp:composeEventHandlers(u.onPointerUp,()=>{S.current==="mouse"&&E()}),onPointerDown:composeEventHandlers(u.onPointerDown,A=>{S.current=A.pointerType}),onPointerMove:composeEventHandlers(u.onPointerMove,A=>{var I;S.current=A.pointerType,o?(I=f.onItemLeave)==null||I.call(f):S.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(u.onPointerLeave,A=>{var I;A.currentTarget===document.activeElement&&((I=f.onItemLeave)==null||I.call(f))}),onKeyDown:composeEventHandlers(u.onKeyDown,A=>{var M;((M=f.searchRef)==null?void 0:M.current)!==""&&A.key===" "||(SELECTION_KEYS.includes(A.key)&&E(),A.key===" "&&A.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:o,...l}=t,u=useSelectContext(ITEM_TEXT_NAME,n),d=useSelectContentContext(ITEM_TEXT_NAME,n),f=useSelectItemContext(ITEM_TEXT_NAME,n),p=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[m,g]=React__namespace.useState(null),b=useComposedRefs(e,E=>g(E),f.onItemTextChange,E=>{var A;return(A=d.itemTextRefCallback)==null?void 0:A.call(d,E,f.value,f.disabled)}),_=m==null?void 0:m.textContent,C=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:f.value,disabled:f.disabled,children:_},f.value),[f.disabled,f.value,_]),{onNativeOptionAdd:R,onNativeOptionRemove:S}=p;return useLayoutEffect2(()=>(R(C),()=>S(C)),[R,S,C]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:f.textId,...l,ref:b}),f.isSelected&&u.valueNode&&!u.valueNodeHasChildren?ReactDOM__namespace.createPortal(l.children,u.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...i,ref:e}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),i=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),[o,l]=React__namespace.useState(!1),u=useComposedRefs(e,i.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=f.scrollTop>0;l(p)};const f=n.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),o?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=n;d&&f&&(d.scrollTop=d.scrollTop-f.offsetHeight)}}):null});SelectScrollUpButton$1.displayName=SCROLL_UP_BUTTON_NAME;var SCROLL_DOWN_BUTTON_NAME="SelectScrollDownButton",SelectScrollDownButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),i=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),[o,l]=React__namespace.useState(!1),u=useComposedRefs(e,i.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=f.scrollHeight-f.clientHeight,m=Math.ceil(f.scrollTop)<p;l(m)};const f=n.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),o?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=n;d&&f&&(d.scrollTop=d.scrollTop+f.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:i,...o}=t,l=useSelectContentContext("SelectScrollButton",n),u=React__namespace.useRef(null),d=useCollection(n),f=React__namespace.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return React__namespace.useEffect(()=>()=>f(),[f]),useLayoutEffect2(()=>{var m;const p=d().find(g=>g.ref.current===document.activeElement);(m=p==null?void 0:p.ref.current)==null||m.scrollIntoView({block:"nearest"})},[d]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:composeEventHandlers(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:composeEventHandlers(o.onPointerMove,()=>{var p;(p=l.onItemLeave)==null||p.call(l),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:composeEventHandlers(o.onPointerLeave,()=>{f()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...i,ref:e})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME="SelectArrow",SelectArrow=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,o=usePopperScope(n),l=useSelectContext(ARROW_NAME,n),u=useSelectContentContext(ARROW_NAME,n);return l.open&&u.position==="popper"?jsxRuntime.jsx(Arrow,{...o,...i,ref:e}):null});SelectArrow.displayName=ARROW_NAME;var BUBBLE_INPUT_NAME$1="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:t,value:e,...n},i)=>{const o=React__namespace.useRef(null),l=useComposedRefs(i,o),u=usePrevious(e);return React__namespace.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(f,"value").set;if(u!==e&&m){const g=new Event("change",{bubbles:!0});m.call(d,e),d.dispatchEvent(g)}},[u,e]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:l,defaultValue:e})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function shouldShowPlaceholder(t){return t===""||t===void 0}function useTypeaheadSearch(t){const e=useCallbackRef$1(t),n=React__namespace.useRef(""),i=React__namespace.useRef(0),o=React__namespace.useCallback(u=>{const d=n.current+u;e(d),function f(p){n.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>f(""),1e3))}(d)},[e]),l=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,o,l]}function findNextItem(t,e,n){const o=e.length>1&&Array.from(e).every(p=>p===e[0])?e[0]:e,l=n?t.indexOf(n):-1;let u=wrapArray(t,Math.max(l,0));o.length===1&&(u=u.filter(p=>p!==n));const f=u.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return f!==n?f:void 0}function wrapArray(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var Root2=Select$1,Trigger=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal=SelectPortal,Content2=SelectContent$1,Viewport=SelectViewport,Label=SelectLabel$1,Item=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:t,children:e,...n},i)=>jsxRuntime.jsxs(Trigger,{ref:i,className:cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:t,children:e,position:n="popper",...i},o)=>jsxRuntime.jsx(Portal,{children:jsxRuntime.jsxs(Content2,{ref:o,className:cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:[jsxRuntime.jsx(SelectScrollUpButton,{}),jsxRuntime.jsx(Viewport,{className:cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2.displayName;const SelectLabel=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",t),...e}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:t,children:e,...n},i)=>jsxRuntime.jsxs(Item,{ref:i,className:cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),jsxRuntime.jsx(ItemText,{children:e})]}));SelectItem.displayName=Item.displayName;const SelectSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));SelectSeparator.displayName=Separator.displayName;var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:i,checked:o,defaultChecked:l,required:u,disabled:d,value:f="on",onCheckedChange:p,form:m,...g}=t,[b,_]=React__namespace.useState(null),C=useComposedRefs(e,I=>_(I)),R=React__namespace.useRef(!1),S=b?m||!!b.closest("form"):!0,[E,A]=useControllableState({prop:o,defaultProp:l??!1,onChange:p,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:E,disabled:d,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":E,"aria-required":u,"data-state":getState(E),"data-disabled":d?"":void 0,disabled:d,value:f,...g,ref:C,onClick:composeEventHandlers(t.onClick,I=>{A(M=>!M),S&&(R.current=I.isPropagationStopped(),R.current||I.stopPropagation())})}),S&&jsxRuntime.jsx(SwitchBubbleInput,{control:b,bubbles:!R.current,name:i,value:f,checked:E,required:u,disabled:d,form:m,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...i}=t,o=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:i=!0,...o},l)=>{const u=React__namespace.useRef(null),d=useComposedRefs(u,l),f=usePrevious(n),p=useSize(e);return React__namespace.useEffect(()=>{const m=u.current;if(!m)return;const g=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(g,"checked").set;if(f!==n&&_){const C=new Event("click",{bubbles:i});_.call(m,n),m.dispatchEvent(C)}},[f,n,i]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:d,style:{...o.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME;function getState(t){return t?"checked":"unchecked"}var Root=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},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",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root.displayName;const DAYS_OF_WEEK=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ManufacturerReorderingCard({manufacturer:t,onSave:e,loading:n=!1,saving:i=!1}){const[o,l]=React.useState({...t}),u=(b,_)=>{l(C=>({...C,[b]:_}))},d=(b,_)=>{l(C=>({...C,[b]:_}))},f=(b,_)=>{l(C=>({...C,[b]:_}))},p=()=>{i||e(o)},m=b=>b===-1?"ASAP":b===void 0||b<0||b>6?"Sunday":DAYS_OF_WEEK[b],g=b=>b==="ASAP"?-1:DAYS_OF_WEEK.indexOf(b);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[n?jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}):jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Reordering"}),n?jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}):jsxRuntime.jsx(CardDescription,{className:"text-sm",children:"Adjust your reordering settings to control lead times, stocking weeks, minimum orders, and reorder dates, enhancing efficiency in restocking processes."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"automatic-reordering",checked:o.AutoUpdate,onCheckedChange:b=>u("AutoUpdate",b),disabled:i}),jsxRuntime.jsx(Label$2,{htmlFor:"automatic-reordering",children:"Automatic Reordering"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"reorder-date",children:"Automatic Reorder Date"}),jsxRuntime.jsxs(Select,{value:m(o.AutoReorderDate),onValueChange:b=>d("AutoReorderDate",g(b)),disabled:i,children:[jsxRuntime.jsx(SelectTrigger,{id:"reorder-date",children:jsxRuntime.jsx(SelectValue,{placeholder:"Select day"})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"ASAP",children:"ASAP"}),DAYS_OF_WEEK.map(b=>jsxRuntime.jsx(SelectItem,{value:b,children:b},b))]})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"weeks-stocking",children:"Default Weeks of Stocking"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"weeks-stocking",type:"number",value:o.DefaultWeeksOfStocking||"",onChange:b=>d("DefaultWeeksOfStocking",Number(b.target.value)),disabled:i}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"weeks"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"minimum-order",children:"Default Minimum Order"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"minimum-order",type:"number",className:"pl-6",value:o.DefaultMinimumOrder||"",onChange:b=>d("DefaultMinimumOrder",Number(b.target.value)),disabled:i})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"lead-time",children:"Default Lead Time"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"lead-time",type:"number",value:o.DefaultLeadTime||"",onChange:b=>d("DefaultLeadTime",Number(b.target.value)),disabled:i}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"days"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"maximum-inventory-value",children:"Default Maximum Inventory Value"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"maximum-inventory-value",type:"number",className:"pl-6",value:o.DefaultMaxInventoryValue||"",onChange:b=>d("DefaultMaxInventoryValue",Number(b.target.value)),disabled:i})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"order-confirmations",children:"Send Order Confirmations To"}),jsxRuntime.jsx(Input,{id:"order-confirmations",type:"email",value:o.POEmail||"",onChange:b=>f("POEmail",b.target.value),placeholder:"email@example.com",disabled:i})]})]})]})}),jsxRuntime.jsx(CardFooter,{className:"flex justify-end",children:n?jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"}):jsxRuntime.jsxs(Button,{onClick:p,disabled:i,children:[i&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}function ActiveOrdersCard({orders:t,loading:e=!1}){const n=l=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(l),i=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(E=>E.DocumentType==="Order"),u=t.filter(E=>E.DocumentType==="Shipment"),d=l.filter(E=>E.WarehouseCode!=="3PLE"),f=d.reduce((E,A)=>E+(A.Quantity||0),0),p=d.reduce((E,A)=>E+(A.ExtendedPrice||0),0),m=l.filter(E=>E.WarehouseCode==="3PLE"),g=m.reduce((E,A)=>E+(A.Quantity||0),0),b=m.reduce((E,A)=>E+(A.ExtendedPrice||0),0),_=u.length,C=u.reduce((E,A)=>E+(A.ExtendedPrice||0),0),R=f+g+_,S=p+b+C;return{all:{orders:R,amount:S},processing:{orders:f,amount:p},shipped:{orders:_,amount:C},delayed:{orders:g,amount:b}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:i.all.orders,amount:i.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:i.processing.orders,amount:i.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:i.shipped.orders,amount:i.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:i.delayed.orders,amount:i.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:n(l.amount)})]})]})]})]},l.name))})]})}function SalesOverviewCard({salesData:t,salesStatistics:e=[],loading:n=!1}){return n||!t?jsxRuntime.jsx(SalesOverviewSkeleton,{}):jsxRuntime.jsx(SalesOverviewData,{salesData:t,salesStatistics:e})}function SalesOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array(3).fill(0).map((t,e)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},e))}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-[250px] w-full rounded-lg"})]})})]})]})}function SalesOverviewData({salesData:t,salesStatistics:e=[]}){const n=l=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(l),i=[{title:"Last 30 days",amount:t.SalesLast30Days||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"},{title:"Last 3 months",amount:t.SalesLast3Months||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-amber-500"},{title:"Year to date",amount:t.SalesYearToDay||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-emerald-500"}],o=e.sort((l,u)=>(l.Day||0)-(u.Day||0)).map(l=>{var m;const u=((m=l.Day)==null?void 0:m.toString())||"",d=u.substring(4,6),f=u.substring(6,8);return{date:`${d}/${f}`,amount:l.ExtendedPrice||0,quantity:l.Quantity||0}});return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:"Sales Overview"})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map((l,u)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:l.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${l.color}`,children:l.icon})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(l.amount)})]})]},u))}),jsxRuntime.jsx("div",{className:"mt-6",children:e&&e.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h3",{className:"text-sm font-medium mb-4",children:"Sales Trend"}),jsxRuntime.jsx("div",{className:"space-y-6",children:jsxRuntime.jsx(AreaChart,{data:o,units:"$",unitsPosition:"left",height:200})})]})})]})]})}function ResellerQualificationsCard({qualifications:t=[],loading:e=!1}){return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:Array.from({length:10}).map((n,i)=>jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]},i))})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:t.map((n,i)=>jsxRuntime.jsx(ManufacturerLogo,{manufacturerId:n.ManufacturerId,opportunityNumber:n.DefaultOpportunityNumber},`${n.ManufacturerId}-${i}`))})})]})}function ManufacturerLogo({manufacturerId:t,opportunityNumber:e}){const[n,i]=React.useState(null),[o,l]=React.useState(!0),[u,d]=React.useState(!1),[f,p]=React.useState(null),m=React.useMemo(()=>t?{logoUrl:`https://api.randmar.io/V4/Partner/${t}/Account/Logo?width=96&height=48`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${t}/Account/Logo/Exists`}:null,[t]);return React.useEffect(()=>{if(!m)return;let g=!0;p(null);const b=async()=>{try{const R=await fetch(m.logoExistsUrl);if(R.ok){const E=(await R.text()).toLowerCase()==="true";return g&&d(E),E}return!1}catch(R){return console.error("Failed to check if logo exists:",R),g&&d(!1),!1}},_=async()=>{g&&l(!0);try{const R=await fetch(m.logoUrl);if(R.ok){const S=await R.blob();g&&(n&&URL.revokeObjectURL(n),i(URL.createObjectURL(S)))}else throw new Error(`Failed to load logo: ${R.status}`)}catch(R){console.error("Failed to load logo:",R),g&&p("Failed to load manufacturer logo")}finally{g&&l(!1)}};return(async()=>{await b()?_():l(!1)})(),()=>{g=!1,n&&URL.revokeObjectURL(n)}},[m]),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"h-12 flex items-center justify-center mb-2",children:o?jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md"}):u&&n?jsxRuntime.jsx("img",{src:n,alt:"Manufacturer logo",className:"max-h-12 max-w-24 object-contain",onError:()=>p("Failed to load logo")}):jsxRuntime.jsx("div",{className:"h-12 w-24 flex items-center justify-center bg-slate-100 rounded-md text-xs text-slate-500",children:t?t.substring(0,8):"No ID"})}),e&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs",children:e}),f&&jsxRuntime.jsx("div",{className:"text-red-500 text-xs mt-1",role:"alert",children:f})]})}function GeneralDocumentCard({document:t,loading:e=!1}){return e?jsxRuntime.jsx("div",{children:"loading..."}):jsxRuntime.jsxs("div",{children:[t==null?void 0:t.OrderNumber," for P.O. ",t==null?void 0:t.PONumber]})}exports.ActiveOrdersCard=ActiveOrdersCard,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.CountryFlag=CountryFlag,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.Navbar=Navbar,exports.PartnerCard=PartnerCard,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ResellerCard=ResellerCard,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
831
|
+
`,onClick:()=>{D(Q)&&_(Q.BidNumber!=(b==null?void 0:b.BidNumber)?Q:null)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Q.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[Q.BidNumber," ",!D(Q)&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-semibold",children:["$",(K=Q.Price)==null?void 0:K.toFixed(2)]}),Q.Rebate&&Q.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: $",Q.Rebate.toFixed(2)]}),Q.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",J(Q.EndDate)]})]})]},te)})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[l&&jsxRuntime.jsx(reactRouterDom.Link,{to:l,children:jsxRuntime.jsxs(Button,{variant:"secondary",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})}),((ue=t.Distribution)==null?void 0:ue.Inventory)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsxs(Dialog,{open:S,onOpenChange:E,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:`flex items-center text-sm ${U>0?"text-green-700":"text-red-700"}`,children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),U>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[U," in stock"]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Out of stock"})]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex items-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:t.Distribution.Inventory})]})]})})]})]}),t.Distribution&&jsxRuntime.jsxs("div",{className:"flex justify-between items-end mt-4",children:[jsxRuntime.jsx("div",{className:"flex-shrink-1 flex flex-col items-start gap-1",children:A>0?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:[jsxRuntime.jsx("span",{children:"Cost: $"}),A.toFixed(2),jsxRuntime.jsx("span",{children:" CAD"})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap",children:[jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:[jsxRuntime.jsx("span",{children:"$"}),b?(ce=(ae=t.Opportunities)==null?void 0:ae.find(Q=>Q.BidNumber==b.BidNumber))==null?void 0:ce.Price:M.toFixed(2),jsxRuntime.jsx("span",{children:" CAD"})]}),C>0&&jsxRuntime.jsxs("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:["$",I.toFixed(2)]})]}),C>0&&jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[C,"% OFF"]}),((se=t.InstantRebate)==null?void 0:se.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",t.InstantRebate.EndDate.split("T")[0]]}),(b==null?void 0:b.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",b.EndDate.split("T")[0]]})]})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-shrink-0 gap-2 ml-4",children:[typeof e<"u"&&e&&jsxRuntime.jsxs("div",{className:"flex items-center border rounded-md",children:[jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:F,disabled:typeof m<"u"&&(m<=1||!t.AvailableToBuy||d||!u),children:"-"}),jsxRuntime.jsx("input",{value:m,onChange:q,onBlur:G,onClick:Q=>Q.currentTarget.select(),className:`w-12 text-center border-0 focus:ring-0 focus:outline-none ${!t.AvailableToBuy||d||!u?"text-gray-400":""}`,disabled:!t.AvailableToBuy||d||!u}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:L,disabled:!t.AvailableToBuy||d||!u,children:"+"})]}),typeof e<"u"&&e&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap",onClick:H,disabled:!t.AvailableToBuy||d||!u,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})}),n&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:f,disabled:p||!f,children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),i]})]})]})})}function ManufacturerCard({manufacturer:t,link:e,actions:n,loading:i=!1}){var p;if(i||!t)return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const o=t.ManufacturerId||"N/A",l=t.PublicName||"N/A",u=[t.City,t.Province,t.Country].filter(Boolean),d=u.length>0?u.join(", "):"Location not provided",f=((p=t.Tags)==null?void 0:p.split(",").map(m=>m.trim()).filter(Boolean))||[];return jsxRuntime.jsxs(Card,{className:"manufacturer-theme",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${o}/Account/Logo?width=64&height=64`,alt:`${l}'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:o})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:d})]})]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-2",children:[(!!t.OpenToWork||f.length>0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[!!t.OpenToWork&&jsxRuntime.jsx(Badge,{variant:"success",children:"Open To Work"}),f.map((m,g)=>jsxRuntime.jsx(Badge,{children:m},g))]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]})}),(n||e)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 ${n?"justify-between":"justify-end"}`,children:[n&&n,e&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:e,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Manufacturer"]})})]})]})}function ResellerCard({reseller:t,link:e,actions:n,loading:i=!1}){if(i||!t)return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsx("div",{className:"flex flex-col space-y-2",children:jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const o=t.ResellerId||"N/A",l=t.PublicName||"N/A",u=[t.City,t.Province,t.Country].filter(Boolean),d=u.length>0?u.join(", "):"Location not provided";return jsxRuntime.jsxs(Card,{className:"reseller-theme",children:[jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx("img",{src:`https://api.randmar.io/V4/Partner/${o}/Account/Logo?width=64&height=64`,alt:`${l}'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:o})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:d})]})]}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsx(CardContent,{className:"pb-2",children:jsxRuntime.jsx("div",{className:"flex flex-col space-y-2",children:jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})})}),(n||e)&&jsxRuntime.jsxs(CardFooter,{className:`flex pt-2 gap-2 ${n?"justify-between":"justify-end"}`,children:[n&&n,e&&jsxRuntime.jsx(Button,{className:"flex items-center gap-1",asChild:!0,children:jsxRuntime.jsxs(reactRouterDom.Link,{to:e,target:"_blank",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Reseller"]})})]})]})}function usePrevious(t){const e=React__namespace.useRef({value:t,previous:t});return React__namespace.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var OPEN_KEYS=[" ","Enter","ArrowUp","ArrowDown"],SELECTION_KEYS=[" ","Enter"],SELECT_NAME="Select",[Collection,useCollection,createCollectionScope]=createCollection(SELECT_NAME),[createSelectContext,createSelectScope]=createContextScope(SELECT_NAME,[createCollectionScope,createPopperScope]),usePopperScope=createPopperScope(),[SelectProvider,useSelectContext]=createSelectContext(SELECT_NAME),[SelectNativeOptionsProvider,useSelectNativeOptionsContext]=createSelectContext(SELECT_NAME),Select$1=t=>{const{__scopeSelect:e,children:n,open:i,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:f,dir:p,name:m,autoComplete:g,disabled:b,required:_,form:C}=t,R=usePopperScope(e),[S,E]=React__namespace.useState(null),[A,I]=React__namespace.useState(null),[M,T]=React__namespace.useState(!1),N=useDirection(p),[O,j]=useControllableState({prop:i,defaultProp:o??!1,onChange:l,caller:SELECT_NAME}),[D,B]=useControllableState({prop:u,defaultProp:d,onChange:f,caller:SELECT_NAME}),V=React__namespace.useRef(null),F=S?C||!!S.closest("form"):!0,[L,q]=React__namespace.useState(new Set),G=Array.from(L).map(U=>U.props.value).join(";");return jsxRuntime.jsx(Root2$4,{...R,children:jsxRuntime.jsxs(SelectProvider,{required:_,scope:e,trigger:S,onTriggerChange:E,valueNode:A,onValueNodeChange:I,valueNodeHasChildren:M,onValueNodeHasChildrenChange:T,contentId:useId(),value:D,onValueChange:B,open:O,onOpenChange:j,dir:N,triggerPointerDownPosRef:V,disabled:b,children:[jsxRuntime.jsx(Collection.Provider,{scope:e,children:jsxRuntime.jsx(SelectNativeOptionsProvider,{scope:t.__scopeSelect,onNativeOptionAdd:React__namespace.useCallback(U=>{q(J=>new Set(J).add(U))},[]),onNativeOptionRemove:React__namespace.useCallback(U=>{q(J=>{const H=new Set(J);return H.delete(U),H})},[]),children:n})}),F?jsxRuntime.jsxs(SelectBubbleInput,{"aria-hidden":!0,required:_,tabIndex:-1,name:m,autoComplete:g,value:D,onChange:U=>B(U.target.value),disabled:b,form:C,children:[D===void 0?jsxRuntime.jsx("option",{value:""}):null,Array.from(L)]},G):null]})})};Select$1.displayName=SELECT_NAME;var TRIGGER_NAME="SelectTrigger",SelectTrigger$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:i=!1,...o}=t,l=usePopperScope(n),u=useSelectContext(TRIGGER_NAME,n),d=u.disabled||i,f=useComposedRefs(e,u.onTriggerChange),p=useCollection(n),m=React__namespace.useRef("touch"),[g,b,_]=useTypeaheadSearch(R=>{const S=p().filter(I=>!I.disabled),E=S.find(I=>I.value===u.value),A=findNextItem(S,R,E);A!==void 0&&u.onValueChange(A.value)}),C=R=>{d||(u.onOpenChange(!0),_()),R&&(u.triggerPointerDownPosRef.current={x:Math.round(R.pageX),y:Math.round(R.pageY)})};return jsxRuntime.jsx(Anchor,{asChild:!0,...l,children:jsxRuntime.jsx(Primitive.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":shouldShowPlaceholder(u.value)?"":void 0,...o,ref:f,onClick:composeEventHandlers(o.onClick,R=>{R.currentTarget.focus(),m.current!=="mouse"&&C(R)}),onPointerDown:composeEventHandlers(o.onPointerDown,R=>{m.current=R.pointerType;const S=R.target;S.hasPointerCapture(R.pointerId)&&S.releasePointerCapture(R.pointerId),R.button===0&&R.ctrlKey===!1&&R.pointerType==="mouse"&&(C(R),R.preventDefault())}),onKeyDown:composeEventHandlers(o.onKeyDown,R=>{const S=g.current!=="";!(R.ctrlKey||R.altKey||R.metaKey)&&R.key.length===1&&b(R.key),!(S&&R.key===" ")&&OPEN_KEYS.includes(R.key)&&(C(),R.preventDefault())})})})});SelectTrigger$1.displayName=TRIGGER_NAME;var VALUE_NAME="SelectValue",SelectValue$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:o,children:l,placeholder:u="",...d}=t,f=useSelectContext(VALUE_NAME,n),{onValueNodeHasChildrenChange:p}=f,m=l!==void 0,g=useComposedRefs(e,f.onValueNodeChange);return useLayoutEffect2(()=>{p(m)},[p,m]),jsxRuntime.jsx(Primitive.span,{...d,ref:g,style:{pointerEvents:"none"},children:shouldShowPlaceholder(f.value)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:u}):l})});SelectValue$1.displayName=VALUE_NAME;var ICON_NAME="SelectIcon",SelectIcon=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,children:i,...o}=t;return jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...o,ref:e,children:i||"▼"})});SelectIcon.displayName=ICON_NAME;var PORTAL_NAME="SelectPortal",SelectPortal=t=>jsxRuntime.jsx(Portal$4,{asChild:!0,...t});SelectPortal.displayName=PORTAL_NAME;var CONTENT_NAME="SelectContent",SelectContent$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContext(CONTENT_NAME,t.__scopeSelect),[i,o]=React__namespace.useState();if(useLayoutEffect2(()=>{o(new DocumentFragment)},[]),!n.open){const l=i;return l?ReactDOM__namespace.createPortal(jsxRuntime.jsx(SelectContentProvider,{scope:t.__scopeSelect,children:jsxRuntime.jsx(Collection.Slot,{scope:t.__scopeSelect,children:jsxRuntime.jsx("div",{children:t.children})})}),l):null}return jsxRuntime.jsx(SelectContentImpl,{...t,ref:e})});SelectContent$1.displayName=CONTENT_NAME;var CONTENT_MARGIN=10,[SelectContentProvider,useSelectContentContext]=createSelectContext(CONTENT_NAME),CONTENT_IMPL_NAME="SelectContentImpl",Slot=createSlot("SelectContent.RemoveScroll"),SelectContentImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:f,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:b,collisionPadding:_,sticky:C,hideWhenDetached:R,avoidCollisions:S,...E}=t,A=useSelectContext(CONTENT_NAME,n),[I,M]=React__namespace.useState(null),[T,N]=React__namespace.useState(null),O=useComposedRefs(e,ae=>M(ae)),[j,D]=React__namespace.useState(null),[B,V]=React__namespace.useState(null),F=useCollection(n),[L,q]=React__namespace.useState(!1),G=React__namespace.useRef(!1);React__namespace.useEffect(()=>{if(I)return hideOthers(I)},[I]),useFocusGuards();const U=React__namespace.useCallback(ae=>{const[ce,...se]=F().map(K=>K.ref.current),[Q]=se.slice(-1),te=document.activeElement;for(const K of ae)if(K===te||(K==null||K.scrollIntoView({block:"nearest"}),K===ce&&T&&(T.scrollTop=0),K===Q&&T&&(T.scrollTop=T.scrollHeight),K==null||K.focus(),document.activeElement!==te))return},[F,T]),J=React__namespace.useCallback(()=>U([j,I]),[U,j,I]);React__namespace.useEffect(()=>{L&&J()},[L,J]);const{onOpenChange:H,triggerPointerDownPosRef:z}=A;React__namespace.useEffect(()=>{if(I){let ae={x:0,y:0};const ce=Q=>{var te,K;ae={x:Math.abs(Math.round(Q.pageX)-(((te=z.current)==null?void 0:te.x)??0)),y:Math.abs(Math.round(Q.pageY)-(((K=z.current)==null?void 0:K.y)??0))}},se=Q=>{ae.x<=10&&ae.y<=10?Q.preventDefault():I.contains(Q.target)||H(!1),document.removeEventListener("pointermove",ce),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",se,{capture:!0})}}},[I,H,z]),React__namespace.useEffect(()=>{const ae=()=>H(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[H]);const[W,Z]=useTypeaheadSearch(ae=>{const ce=F().filter(te=>!te.disabled),se=ce.find(te=>te.ref.current===document.activeElement),Q=findNextItem(ce,ae,se);Q&&setTimeout(()=>Q.ref.current.focus())}),ne=React__namespace.useCallback((ae,ce,se)=>{const Q=!G.current&&!se;(A.value!==void 0&&A.value===ce||Q)&&(D(ae),Q&&(G.current=!0))},[A.value]),oe=React__namespace.useCallback(()=>I==null?void 0:I.focus(),[I]),le=React__namespace.useCallback((ae,ce,se)=>{const Q=!G.current&&!se;(A.value!==void 0&&A.value===ce||Q)&&V(ae)},[A.value]),ie=i==="popper"?SelectPopperPosition:SelectItemAlignedPosition,ue=ie===SelectPopperPosition?{side:d,sideOffset:f,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:b,collisionPadding:_,sticky:C,hideWhenDetached:R,avoidCollisions:S}:{};return jsxRuntime.jsx(SelectContentProvider,{scope:n,content:I,viewport:T,onViewportChange:N,itemRefCallback:ne,selectedItem:j,onItemLeave:oe,itemTextRefCallback:le,focusSelectedItem:J,selectedItemText:B,position:i,isPositioned:L,searchRef:W,children:jsxRuntime.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,children:jsxRuntime.jsx(FocusScope,{asChild:!0,trapped:A.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:composeEventHandlers(o,ae=>{var ce;(ce=A.trigger)==null||ce.focus({preventScroll:!0}),ae.preventDefault()}),children:jsxRuntime.jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:jsxRuntime.jsx(ie,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:ae=>ae.preventDefault(),...E,...ue,onPlaced:()=>q(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:composeEventHandlers(E.onKeyDown,ae=>{const ce=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!ce&&ae.key.length===1&&Z(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let Q=F().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(Q=Q.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const te=ae.target,K=Q.indexOf(te);Q=Q.slice(K+1)}setTimeout(()=>U(Q)),ae.preventDefault()}})})})})})})});SelectContentImpl.displayName=CONTENT_IMPL_NAME;var ITEM_ALIGNED_POSITION_NAME="SelectItemAlignedPosition",SelectItemAlignedPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:i,...o}=t,l=useSelectContext(CONTENT_NAME,n),u=useSelectContentContext(CONTENT_NAME,n),[d,f]=React__namespace.useState(null),[p,m]=React__namespace.useState(null),g=useComposedRefs(e,O=>m(O)),b=useCollection(n),_=React__namespace.useRef(!1),C=React__namespace.useRef(!0),{viewport:R,selectedItem:S,selectedItemText:E,focusSelectedItem:A}=u,I=React__namespace.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&p&&R&&S&&E){const O=l.trigger.getBoundingClientRect(),j=p.getBoundingClientRect(),D=l.valueNode.getBoundingClientRect(),B=E.getBoundingClientRect();if(l.dir!=="rtl"){const te=B.left-j.left,K=D.left-te,fe=O.left-K,ee=O.width+fe,de=Math.max(ee,j.width),pe=window.innerWidth-CONTENT_MARGIN,me=clamp(K,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,pe-de)]);d.style.minWidth=ee+"px",d.style.left=me+"px"}else{const te=j.right-B.right,K=window.innerWidth-D.right-te,fe=window.innerWidth-O.right-K,ee=O.width+fe,de=Math.max(ee,j.width),pe=window.innerWidth-CONTENT_MARGIN,me=clamp(K,[CONTENT_MARGIN,Math.max(CONTENT_MARGIN,pe-de)]);d.style.minWidth=ee+"px",d.style.right=me+"px"}const V=b(),F=window.innerHeight-CONTENT_MARGIN*2,L=R.scrollHeight,q=window.getComputedStyle(p),G=parseInt(q.borderTopWidth,10),U=parseInt(q.paddingTop,10),J=parseInt(q.borderBottomWidth,10),H=parseInt(q.paddingBottom,10),z=G+U+L+H+J,W=Math.min(S.offsetHeight*5,z),Z=window.getComputedStyle(R),ne=parseInt(Z.paddingTop,10),oe=parseInt(Z.paddingBottom,10),le=O.top+O.height/2-CONTENT_MARGIN,ie=F-le,ue=S.offsetHeight/2,ae=S.offsetTop+ue,ce=G+U+ae,se=z-ce;if(ce<=le){const te=V.length>0&&S===V[V.length-1].ref.current;d.style.bottom="0px";const K=p.clientHeight-R.offsetTop-R.offsetHeight,fe=Math.max(ie,ue+(te?oe:0)+K+J),ee=ce+fe;d.style.height=ee+"px"}else{const te=V.length>0&&S===V[0].ref.current;d.style.top="0px";const fe=Math.max(le,G+R.offsetTop+(te?ne:0)+ue)+se;d.style.height=fe+"px",R.scrollTop=ce-le+R.offsetTop}d.style.margin=`${CONTENT_MARGIN}px 0`,d.style.minHeight=W+"px",d.style.maxHeight=F+"px",i==null||i(),requestAnimationFrame(()=>_.current=!0)}},[b,l.trigger,l.valueNode,d,p,R,S,E,l.dir,i]);useLayoutEffect2(()=>I(),[I]);const[M,T]=React__namespace.useState();useLayoutEffect2(()=>{p&&T(window.getComputedStyle(p).zIndex)},[p]);const N=React__namespace.useCallback(O=>{O&&C.current===!0&&(I(),A==null||A(),C.current=!1)},[I,A]);return jsxRuntime.jsx(SelectViewportProvider,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:_,onScrollButtonChange:N,children:jsxRuntime.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:jsxRuntime.jsx(Primitive.div,{...o,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});SelectItemAlignedPosition.displayName=ITEM_ALIGNED_POSITION_NAME;var POPPER_POSITION_NAME="SelectPopperPosition",SelectPopperPosition=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,align:i="start",collisionPadding:o=CONTENT_MARGIN,...l}=t,u=usePopperScope(n);return jsxRuntime.jsx(Content$1,{...u,...l,ref:e,align:i,collisionPadding:o,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});SelectPopperPosition.displayName=POPPER_POSITION_NAME;var[SelectViewportProvider,useSelectViewportContext]=createSelectContext(CONTENT_NAME,{}),VIEWPORT_NAME="SelectViewport",SelectViewport=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:i,...o}=t,l=useSelectContentContext(VIEWPORT_NAME,n),u=useSelectViewportContext(VIEWPORT_NAME,n),d=useComposedRefs(e,l.onViewportChange),f=React__namespace.useRef(0);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),jsxRuntime.jsx(Collection.Slot,{scope:n,children:jsxRuntime.jsx(Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:composeEventHandlers(o.onScroll,p=>{const m=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=u;if(b!=null&&b.current&&g){const _=Math.abs(f.current-m.scrollTop);if(_>0){const C=window.innerHeight-CONTENT_MARGIN*2,R=parseFloat(g.style.minHeight),S=parseFloat(g.style.height),E=Math.max(R,S);if(E<C){const A=E+_,I=Math.min(C,A),M=A-I;g.style.height=I+"px",g.style.bottom==="0px"&&(m.scrollTop=M>0?M:0,g.style.justifyContent="flex-end")}}}f.current=m.scrollTop})})})]})});SelectViewport.displayName=VIEWPORT_NAME;var GROUP_NAME="SelectGroup",[SelectGroupContextProvider,useSelectGroupContext]=createSelectContext(GROUP_NAME),SelectGroup=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,o=useId();return jsxRuntime.jsx(SelectGroupContextProvider,{scope:n,id:o,children:jsxRuntime.jsx(Primitive.div,{role:"group","aria-labelledby":o,...i,ref:e})})});SelectGroup.displayName=GROUP_NAME;var LABEL_NAME="SelectLabel",SelectLabel$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,o=useSelectGroupContext(LABEL_NAME,n);return jsxRuntime.jsx(Primitive.div,{id:o.id,...i,ref:e})});SelectLabel$1.displayName=LABEL_NAME;var ITEM_NAME="SelectItem",[SelectItemContextProvider,useSelectItemContext]=createSelectContext(ITEM_NAME),SelectItem$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,value:i,disabled:o=!1,textValue:l,...u}=t,d=useSelectContext(ITEM_NAME,n),f=useSelectContentContext(ITEM_NAME,n),p=d.value===i,[m,g]=React__namespace.useState(l??""),[b,_]=React__namespace.useState(!1),C=useComposedRefs(e,A=>{var I;return(I=f.itemRefCallback)==null?void 0:I.call(f,A,i,o)}),R=useId(),S=React__namespace.useRef("touch"),E=()=>{o||(d.onValueChange(i),d.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return jsxRuntime.jsx(SelectItemContextProvider,{scope:n,value:i,disabled:o,textId:R,isSelected:p,onItemTextChange:React__namespace.useCallback(A=>{g(I=>I||((A==null?void 0:A.textContent)??"").trim())},[]),children:jsxRuntime.jsx(Collection.ItemSlot,{scope:n,value:i,disabled:o,textValue:m,children:jsxRuntime.jsx(Primitive.div,{role:"option","aria-labelledby":R,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:C,onFocus:composeEventHandlers(u.onFocus,()=>_(!0)),onBlur:composeEventHandlers(u.onBlur,()=>_(!1)),onClick:composeEventHandlers(u.onClick,()=>{S.current!=="mouse"&&E()}),onPointerUp:composeEventHandlers(u.onPointerUp,()=>{S.current==="mouse"&&E()}),onPointerDown:composeEventHandlers(u.onPointerDown,A=>{S.current=A.pointerType}),onPointerMove:composeEventHandlers(u.onPointerMove,A=>{var I;S.current=A.pointerType,o?(I=f.onItemLeave)==null||I.call(f):S.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:composeEventHandlers(u.onPointerLeave,A=>{var I;A.currentTarget===document.activeElement&&((I=f.onItemLeave)==null||I.call(f))}),onKeyDown:composeEventHandlers(u.onKeyDown,A=>{var M;((M=f.searchRef)==null?void 0:M.current)!==""&&A.key===" "||(SELECTION_KEYS.includes(A.key)&&E(),A.key===" "&&A.preventDefault())})})})})});SelectItem$1.displayName=ITEM_NAME;var ITEM_TEXT_NAME="SelectItemText",SelectItemText=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:o,...l}=t,u=useSelectContext(ITEM_TEXT_NAME,n),d=useSelectContentContext(ITEM_TEXT_NAME,n),f=useSelectItemContext(ITEM_TEXT_NAME,n),p=useSelectNativeOptionsContext(ITEM_TEXT_NAME,n),[m,g]=React__namespace.useState(null),b=useComposedRefs(e,E=>g(E),f.onItemTextChange,E=>{var A;return(A=d.itemTextRefCallback)==null?void 0:A.call(d,E,f.value,f.disabled)}),_=m==null?void 0:m.textContent,C=React__namespace.useMemo(()=>jsxRuntime.jsx("option",{value:f.value,disabled:f.disabled,children:_},f.value),[f.disabled,f.value,_]),{onNativeOptionAdd:R,onNativeOptionRemove:S}=p;return useLayoutEffect2(()=>(R(C),()=>S(C)),[R,S,C]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Primitive.span,{id:f.textId,...l,ref:b}),f.isSelected&&u.valueNode&&!u.valueNodeHasChildren?ReactDOM__namespace.createPortal(l.children,u.valueNode):null]})});SelectItemText.displayName=ITEM_TEXT_NAME;var ITEM_INDICATOR_NAME="SelectItemIndicator",SelectItemIndicator=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return useSelectItemContext(ITEM_INDICATOR_NAME,n).isSelected?jsxRuntime.jsx(Primitive.span,{"aria-hidden":!0,...i,ref:e}):null});SelectItemIndicator.displayName=ITEM_INDICATOR_NAME;var SCROLL_UP_BUTTON_NAME="SelectScrollUpButton",SelectScrollUpButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),i=useSelectViewportContext(SCROLL_UP_BUTTON_NAME,t.__scopeSelect),[o,l]=React__namespace.useState(!1),u=useComposedRefs(e,i.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=f.scrollTop>0;l(p)};const f=n.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),o?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=n;d&&f&&(d.scrollTop=d.scrollTop-f.offsetHeight)}}):null});SelectScrollUpButton$1.displayName=SCROLL_UP_BUTTON_NAME;var SCROLL_DOWN_BUTTON_NAME="SelectScrollDownButton",SelectScrollDownButton$1=React__namespace.forwardRef((t,e)=>{const n=useSelectContentContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),i=useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME,t.__scopeSelect),[o,l]=React__namespace.useState(!1),u=useComposedRefs(e,i.onScrollButtonChange);return useLayoutEffect2(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=f.scrollHeight-f.clientHeight,m=Math.ceil(f.scrollTop)<p;l(m)};const f=n.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),o?jsxRuntime.jsx(SelectScrollButtonImpl,{...t,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=n;d&&f&&(d.scrollTop=d.scrollTop+f.offsetHeight)}}):null});SelectScrollDownButton$1.displayName=SCROLL_DOWN_BUTTON_NAME;var SelectScrollButtonImpl=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:i,...o}=t,l=useSelectContentContext("SelectScrollButton",n),u=React__namespace.useRef(null),d=useCollection(n),f=React__namespace.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return React__namespace.useEffect(()=>()=>f(),[f]),useLayoutEffect2(()=>{var m;const p=d().find(g=>g.ref.current===document.activeElement);(m=p==null?void 0:p.ref.current)==null||m.scrollIntoView({block:"nearest"})},[d]),jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:composeEventHandlers(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:composeEventHandlers(o.onPointerMove,()=>{var p;(p=l.onItemLeave)==null||p.call(l),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:composeEventHandlers(o.onPointerLeave,()=>{f()})})}),SEPARATOR_NAME="SelectSeparator",SelectSeparator$1=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return jsxRuntime.jsx(Primitive.div,{"aria-hidden":!0,...i,ref:e})});SelectSeparator$1.displayName=SEPARATOR_NAME;var ARROW_NAME="SelectArrow",SelectArrow=React__namespace.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,o=usePopperScope(n),l=useSelectContext(ARROW_NAME,n),u=useSelectContentContext(ARROW_NAME,n);return l.open&&u.position==="popper"?jsxRuntime.jsx(Arrow,{...o,...i,ref:e}):null});SelectArrow.displayName=ARROW_NAME;var BUBBLE_INPUT_NAME$1="SelectBubbleInput",SelectBubbleInput=React__namespace.forwardRef(({__scopeSelect:t,value:e,...n},i)=>{const o=React__namespace.useRef(null),l=useComposedRefs(i,o),u=usePrevious(e);return React__namespace.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(f,"value").set;if(u!==e&&m){const g=new Event("change",{bubbles:!0});m.call(d,e),d.dispatchEvent(g)}},[u,e]),jsxRuntime.jsx(Primitive.select,{...n,style:{...VISUALLY_HIDDEN_STYLES,...n.style},ref:l,defaultValue:e})});SelectBubbleInput.displayName=BUBBLE_INPUT_NAME$1;function shouldShowPlaceholder(t){return t===""||t===void 0}function useTypeaheadSearch(t){const e=useCallbackRef$1(t),n=React__namespace.useRef(""),i=React__namespace.useRef(0),o=React__namespace.useCallback(u=>{const d=n.current+u;e(d),function f(p){n.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>f(""),1e3))}(d)},[e]),l=React__namespace.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return React__namespace.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,o,l]}function findNextItem(t,e,n){const o=e.length>1&&Array.from(e).every(p=>p===e[0])?e[0]:e,l=n?t.indexOf(n):-1;let u=wrapArray(t,Math.max(l,0));o.length===1&&(u=u.filter(p=>p!==n));const f=u.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return f!==n?f:void 0}function wrapArray(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var Root2=Select$1,Trigger=SelectTrigger$1,Value=SelectValue$1,Icon=SelectIcon,Portal=SelectPortal,Content2=SelectContent$1,Viewport=SelectViewport,Label=SelectLabel$1,Item=SelectItem$1,ItemText=SelectItemText,ItemIndicator=SelectItemIndicator,ScrollUpButton=SelectScrollUpButton$1,ScrollDownButton=SelectScrollDownButton$1,Separator=SelectSeparator$1;const Select=Root2,SelectValue=Value,SelectTrigger=React__namespace.forwardRef(({className:t,children:e,...n},i)=>jsxRuntime.jsxs(Trigger,{ref:i,className:cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,jsxRuntime.jsx(Icon,{asChild:!0,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));SelectTrigger.displayName=Trigger.displayName;const SelectScrollUpButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollUpButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronUp,{className:"h-4 w-4"})}));SelectScrollUpButton.displayName=ScrollUpButton.displayName;const SelectScrollDownButton=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(ScrollDownButton,{ref:n,className:cn("flex cursor-default items-center justify-center py-1",t),...e,children:jsxRuntime.jsx(ChevronDown,{className:"h-4 w-4"})}));SelectScrollDownButton.displayName=ScrollDownButton.displayName;const SelectContent=React__namespace.forwardRef(({className:t,children:e,position:n="popper",...i},o)=>jsxRuntime.jsx(Portal,{children:jsxRuntime.jsxs(Content2,{ref:o,className:cn("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:[jsxRuntime.jsx(SelectScrollUpButton,{}),jsxRuntime.jsx(Viewport,{className:cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),jsxRuntime.jsx(SelectScrollDownButton,{})]})}));SelectContent.displayName=Content2.displayName;const SelectLabel=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Label,{ref:n,className:cn("px-2 py-1.5 text-sm font-semibold",t),...e}));SelectLabel.displayName=Label.displayName;const SelectItem=React__namespace.forwardRef(({className:t,children:e,...n},i)=>jsxRuntime.jsxs(Item,{ref:i,className:cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ItemIndicator,{children:jsxRuntime.jsx(Check,{className:"h-4 w-4"})})}),jsxRuntime.jsx(ItemText,{children:e})]}));SelectItem.displayName=Item.displayName;const SelectSeparator=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Separator,{ref:n,className:cn("-mx-1 my-1 h-px bg-muted",t),...e}));SelectSeparator.displayName=Separator.displayName;var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:i,checked:o,defaultChecked:l,required:u,disabled:d,value:f="on",onCheckedChange:p,form:m,...g}=t,[b,_]=React__namespace.useState(null),C=useComposedRefs(e,I=>_(I)),R=React__namespace.useRef(!1),S=b?m||!!b.closest("form"):!0,[E,A]=useControllableState({prop:o,defaultProp:l??!1,onChange:p,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:E,disabled:d,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":E,"aria-required":u,"data-state":getState(E),"data-disabled":d?"":void 0,disabled:d,value:f,...g,ref:C,onClick:composeEventHandlers(t.onClick,I=>{A(M=>!M),S&&(R.current=I.isPropagationStopped(),R.current||I.stopPropagation())})}),S&&jsxRuntime.jsx(SwitchBubbleInput,{control:b,bubbles:!R.current,name:i,value:f,checked:E,required:u,disabled:d,form:m,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...i}=t,o=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:i=!0,...o},l)=>{const u=React__namespace.useRef(null),d=useComposedRefs(u,l),f=usePrevious(n),p=useSize(e);return React__namespace.useEffect(()=>{const m=u.current;if(!m)return;const g=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(g,"checked").set;if(f!==n&&_){const C=new Event("click",{bubbles:i});_.call(m,n),m.dispatchEvent(C)}},[f,n,i]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:d,style:{...o.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME;function getState(t){return t?"checked":"unchecked"}var Root=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},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",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root.displayName;const DAYS_OF_WEEK=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ManufacturerReorderingCard({manufacturer:t,onSave:e,loading:n=!1,saving:i=!1}){const[o,l]=React.useState({...t}),u=(b,_)=>{l(C=>({...C,[b]:_}))},d=(b,_)=>{l(C=>({...C,[b]:_}))},f=(b,_)=>{l(C=>({...C,[b]:_}))},p=()=>{i||e(o)},m=b=>b===-1?"ASAP":b===void 0||b<0||b>6?"Sunday":DAYS_OF_WEEK[b],g=b=>b==="ASAP"?-1:DAYS_OF_WEEK.indexOf(b);return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[n?jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}):jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Reordering"}),n?jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}):jsxRuntime.jsx(CardDescription,{className:"text-sm",children:"Adjust your reordering settings to control lead times, stocking weeks, minimum orders, and reorder dates, enhancing efficiency in restocking processes."})]}),jsxRuntime.jsx(CardContent,{className:"space-y-6",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"}),jsxRuntime.jsx("div",{className:"ml-2 w-12"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-40"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full"})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Switch,{id:"automatic-reordering",checked:o.AutoUpdate,onCheckedChange:b=>u("AutoUpdate",b),disabled:i}),jsxRuntime.jsx(Label$2,{htmlFor:"automatic-reordering",children:"Automatic Reordering"})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"reorder-date",children:"Automatic Reorder Date"}),jsxRuntime.jsxs(Select,{value:m(o.AutoReorderDate),onValueChange:b=>d("AutoReorderDate",g(b)),disabled:i,children:[jsxRuntime.jsx(SelectTrigger,{id:"reorder-date",children:jsxRuntime.jsx(SelectValue,{placeholder:"Select day"})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"ASAP",children:"ASAP"}),DAYS_OF_WEEK.map(b=>jsxRuntime.jsx(SelectItem,{value:b,children:b},b))]})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"weeks-stocking",children:"Default Weeks of Stocking"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"weeks-stocking",type:"number",value:o.DefaultWeeksOfStocking||"",onChange:b=>d("DefaultWeeksOfStocking",Number(b.target.value)),disabled:i}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"weeks"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"minimum-order",children:"Default Minimum Order"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"minimum-order",type:"number",className:"pl-6",value:o.DefaultMinimumOrder||"",onChange:b=>d("DefaultMinimumOrder",Number(b.target.value)),disabled:i})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"lead-time",children:"Default Lead Time"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Input,{id:"lead-time",type:"number",value:o.DefaultLeadTime||"",onChange:b=>d("DefaultLeadTime",Number(b.target.value)),disabled:i}),jsxRuntime.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"days"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"maximum-inventory-value",children:"Default Maximum Inventory Value"}),jsxRuntime.jsxs("div",{className:"flex items-center relative",children:[jsxRuntime.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),jsxRuntime.jsx(Input,{id:"maximum-inventory-value",type:"number",className:"pl-6",value:o.DefaultMaxInventoryValue||"",onChange:b=>d("DefaultMaxInventoryValue",Number(b.target.value)),disabled:i})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(Label$2,{htmlFor:"order-confirmations",children:"Send Order Confirmations To"}),jsxRuntime.jsx(Input,{id:"order-confirmations",type:"email",value:o.POEmail||"",onChange:b=>f("POEmail",b.target.value),placeholder:"email@example.com",disabled:i})]})]})]})}),jsxRuntime.jsx(CardFooter,{className:"flex justify-end",children:n?jsxRuntime.jsx(Skeleton,{className:"h-10 w-20"}):jsxRuntime.jsxs(Button,{onClick:p,disabled:i,children:[i&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}function ActiveOrdersCard({orders:t,loading:e=!1}){const n=l=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(l),i=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(E=>E.DocumentType==="Order"),u=t.filter(E=>E.DocumentType==="Shipment"),d=l.filter(E=>E.WarehouseCode!=="3PLE"),f=d.reduce((E,A)=>E+(A.Quantity||0),0),p=d.reduce((E,A)=>E+(A.ExtendedPrice||0),0),m=l.filter(E=>E.WarehouseCode==="3PLE"),g=m.reduce((E,A)=>E+(A.Quantity||0),0),b=m.reduce((E,A)=>E+(A.ExtendedPrice||0),0),_=u.length,C=u.reduce((E,A)=>E+(A.ExtendedPrice||0),0),R=f+g+_,S=p+b+C;return{all:{orders:R,amount:S},processing:{orders:f,amount:p},shipped:{orders:_,amount:C},delayed:{orders:g,amount:b}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:i.all.orders,amount:i.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:i.processing.orders,amount:i.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:i.shipped.orders,amount:i.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:i.delayed.orders,amount:i.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:n(l.amount)})]})]})]})]},l.name))})]})}function SalesOverviewCard({salesData:t,salesStatistics:e=[],loading:n=!1}){return n||!t?jsxRuntime.jsx(SalesOverviewSkeleton,{}):jsxRuntime.jsx(SalesOverviewData,{salesData:t,salesStatistics:e})}function SalesOverviewSkeleton(){return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-40"})})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array(3).fill(0).map((t,e)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9 rounded-full"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-28"})]})]},e))}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-[250px] w-full rounded-lg"})]})})]})]})}function SalesOverviewData({salesData:t,salesStatistics:e=[]}){const n=l=>new Intl.NumberFormat("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:2}).format(l),i=[{title:"Last 30 days",amount:t.SalesLast30Days||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-blue-500"},{title:"Last 3 months",amount:t.SalesLast3Months||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-amber-500"},{title:"Year to date",amount:t.SalesYearToDay||0,icon:jsxRuntime.jsx(Calendar,{className:"h-5 w-5 text-white"}),color:"bg-emerald-500"}],o=[...e].sort((l,u)=>(l.Day||0)-(u.Day||0)).map(l=>{var m;const u=((m=l.Day)==null?void 0:m.toString())||"",d=u.substring(4,6),f=u.substring(6,8);return{date:`${d}/${f}`,amount:l.ExtendedPrice||0,quantity:l.Quantity||0}});return jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg sm:text-xl",children:"Sales Overview"})}),jsxRuntime.jsxs(CardContent,{className:"pt-4 px-3 sm:px-6",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map((l,u)=>jsxRuntime.jsxs("div",{className:"border rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"text-sm sm:text-base font-medium",children:l.title}),jsxRuntime.jsx("div",{className:`p-2 rounded-full ${l.color}`,children:l.icon})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base sm:text-lg font-bold",children:n(l.amount)})]})]},u))}),jsxRuntime.jsx("div",{className:"mt-6",children:e&&e.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h3",{className:"text-sm font-medium mb-4",children:"Sales Trend"}),jsxRuntime.jsx("div",{className:"space-y-6",children:jsxRuntime.jsx(AreaChart,{data:o,units:"$",unitsPosition:"left",height:200})})]})})]})]})}function ResellerQualificationsCard({qualifications:t=[],loading:e=!1}){return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:Array.from({length:10}).map((n,i)=>jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]},i))})})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Qualifications"})}),jsxRuntime.jsx(CardContent,{className:"p-6",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 gap-y-8",children:t.map((n,i)=>jsxRuntime.jsx(ManufacturerLogo,{manufacturerId:n.ManufacturerId,opportunityNumber:n.DefaultOpportunityNumber},`${n.ManufacturerId}-${i}`))})})]})}function ManufacturerLogo({manufacturerId:t,opportunityNumber:e}){const[n,i]=React.useState(null),[o,l]=React.useState(!0),[u,d]=React.useState(!1),[f,p]=React.useState(null),m=React.useMemo(()=>t?{logoUrl:`https://api.randmar.io/V4/Partner/${t}/Account/Logo?width=96&height=48`,logoExistsUrl:`https://api.randmar.io/V4/Partner/${t}/Account/Logo/Exists`}:null,[t]);return React.useEffect(()=>{if(!m)return;let g=!0;p(null);const b=async()=>{try{const R=await fetch(m.logoExistsUrl);if(R.ok){const E=(await R.text()).toLowerCase()==="true";return g&&d(E),E}return!1}catch(R){return console.error("Failed to check if logo exists:",R),g&&d(!1),!1}},_=async()=>{g&&l(!0);try{const R=await fetch(m.logoUrl);if(R.ok){const S=await R.blob();g&&(n&&URL.revokeObjectURL(n),i(URL.createObjectURL(S)))}else throw new Error(`Failed to load logo: ${R.status}`)}catch(R){console.error("Failed to load logo:",R),g&&p("Failed to load manufacturer logo")}finally{g&&l(!1)}};return(async()=>{await b()?_():l(!1)})(),()=>{g=!1,n&&URL.revokeObjectURL(n)}},[m]),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("div",{className:"h-12 flex items-center justify-center mb-2",children:o?jsxRuntime.jsx(Skeleton,{className:"h-12 w-24 rounded-md"}):u&&n?jsxRuntime.jsx("img",{src:n,alt:"Manufacturer logo",className:"max-h-12 max-w-24 object-contain",onError:()=>p("Failed to load logo")}):jsxRuntime.jsx("div",{className:"h-12 w-24 flex items-center justify-center bg-slate-100 rounded-md text-xs text-slate-500",children:t?t.substring(0,8):"No ID"})}),e&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs",children:e}),f&&jsxRuntime.jsx("div",{className:"text-red-500 text-xs mt-1",role:"alert",children:f})]})}function GeneralDocumentCard({document:t,loading:e=!1}){return e?jsxRuntime.jsx("div",{children:"loading..."}):jsxRuntime.jsxs("div",{children:[t==null?void 0:t.OrderNumber," for P.O. ",t==null?void 0:t.PONumber]})}exports.ActiveOrdersCard=ActiveOrdersCard,exports.AreaChart=AreaChart,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.CountryFlag=CountryFlag,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.Navbar=Navbar,exports.PartnerCard=PartnerCard,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ResellerCard=ResellerCard,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|